switchboard-router 0.6.11 → 0.6.13

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 (383) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +3 -3
  3. package/app/.next-cli-build/build-manifest.json +2 -2
  4. package/app/.next-cli-build/prerender-manifest.json +3 -3
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js.nft.json +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js.nft.json +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +3 -3
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js.nft.json +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page_client-reference-manifest.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page_client-reference-manifest.js +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  78. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  80. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  81. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  82. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  83. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  84. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  85. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  86. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  87. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  88. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  89. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  90. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  92. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  93. package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  94. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  95. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  96. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
  97. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  98. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  99. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  100. package/app/.next-cli-build/server/app/api/agent-library/catalog/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/agent-library/doctor/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/agent-library/export/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/agent-library/mcp/route.js.nft.json +1 -1
  104. package/app/.next-cli-build/server/app/api/agent-library/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/agent-library/skills/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/agent-library/sync/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/agent-library/updates/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js +2 -2
  110. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +4 -4
  112. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  114. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  117. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
  123. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  125. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +2 -2
  127. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  131. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js +3 -3
  133. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js +2 -2
  135. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  137. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +1 -1
  139. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  141. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
  143. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  145. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
  147. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  155. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/strategy/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/mgmt/v1/health/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/mgmt/v1/providers/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/mgmt/v1/routing/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/mgmt/v1/usage/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/mgmt/v1/version/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  175. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  184. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  186. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js +1 -1
  189. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  190. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  192. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  194. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  196. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/batch/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/cache/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/prepare/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/remove-unavailable/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js +1 -1
  204. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js.nft.json +1 -1
  205. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js +1 -1
  206. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js +1 -1
  208. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/routing/feedback/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/routing/insights/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/routing/learn/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/routing/stats/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/routing/versions/promote/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/routing/versions/rollback/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/skills/[id]/route.js.nft.json +1 -1
  230. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/token-saver/vault-stats/route.js.nft.json +1 -1
  232. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  234. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  243. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  250. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  251. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  255. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  257. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  270. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  271. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  276. package/app/.next-cli-build/server/app/callback.html +1 -1
  277. package/app/.next-cli-build/server/app/callback.rsc +3 -3
  278. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  279. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  280. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
  281. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  282. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  283. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  284. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  286. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  287. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
  288. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  289. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  290. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
  291. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  292. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  293. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  294. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  295. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  296. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/index.html +1 -1
  298. package/app/.next-cli-build/server/app/index.rsc +3 -3
  299. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  300. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  301. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  302. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
  303. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  304. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  305. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  306. package/app/.next-cli-build/server/app/landing.html +1 -1
  307. package/app/.next-cli-build/server/app/landing.rsc +3 -3
  308. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
  309. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  310. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
  311. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  312. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  313. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  314. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  315. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  316. package/app/.next-cli-build/server/app/login.html +1 -1
  317. package/app/.next-cli-build/server/app/login.rsc +3 -3
  318. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +3 -3
  319. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  320. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
  321. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  322. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  323. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  324. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  325. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  326. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  327. package/app/.next-cli-build/server/app-paths-manifest.json +3 -3
  328. package/app/.next-cli-build/server/chunks/194.js +1 -1
  329. package/app/.next-cli-build/server/chunks/{1062.js → 3787.js} +2 -2
  330. package/app/.next-cli-build/server/chunks/4126.js +1 -1
  331. package/app/.next-cli-build/server/chunks/4746.js +1 -1
  332. package/app/.next-cli-build/server/chunks/5821.js +1 -1
  333. package/app/.next-cli-build/server/chunks/7155.js +1 -1
  334. package/app/.next-cli-build/server/chunks/869.js +1 -1
  335. package/app/.next-cli-build/server/chunks/8998.js +1 -1
  336. package/app/.next-cli-build/server/chunks/9489.js +2 -2
  337. package/app/.next-cli-build/server/chunks/9696.js +5 -5
  338. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  339. package/app/.next-cli-build/server/pages/404.html +1 -1
  340. package/app/.next-cli-build/server/pages/500.html +1 -1
  341. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  342. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  343. package/app/.next-cli-build/static/chunks/{1321-3452b6d48b71f4a2.js → 1321-f614c7c6e5ab4bcc.js} +1 -1
  344. package/app/.next-cli-build/static/chunks/{5497-d866b97bf9a716ba.js → 5497-3d546c1b7aa357b1.js} +5 -5
  345. package/app/.next-cli-build/static/chunks/594-e392353337efef19.js +64 -0
  346. package/app/.next-cli-build/static/chunks/6430-4c528cfc35666c11.js +1 -0
  347. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/agent-library/{page-d720efb4c9d427e6.js → page-62bea7b75b3f2692.js} +1 -1
  348. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/{page-04509a38b9fd3dcf.js → page-1eb380280857cf20.js} +1 -1
  349. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-fa35870caaeabe20.js → page-9aa986f145130c08.js} +1 -1
  350. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-aa9c65a5e73a3f5d.js → page-a09d7692b3ea9179.js} +1 -1
  351. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/{page-a8d77d24b4c71915.js → page-4bf0abe7c7119ac0.js} +1 -1
  352. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/routing/{page-95f09ae849f539d6.js → page-1fc70bcd434deb73.js} +1 -1
  353. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/{page-6678759c536b4008.js → page-fdc5377da12ec933.js} +1 -1
  354. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-b48bd39cb03c4985.js +3 -0
  355. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-183cf5498e6d3e42.js → page-9e60537a4b8f5a0c.js} +1 -1
  356. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/{page-b67e7e3b9acaf1cc.js → page-95bf830096d019fd.js} +1 -1
  357. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-a4bad553cba810e7.js → page-45ebe6bb46c9f65e.js} +1 -1
  358. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/{page-0568602ac2385103.js → page-7ac82c8930583633.js} +1 -1
  359. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-f6e3507247a819e5.js → page-961013b570bbeac6.js} +1 -1
  360. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-08fe6612a31239da.js → page-8619928e4b74f46b.js} +1 -1
  361. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/{page-a1ab95a02951c91d.js → page-b5b9038ea28e63b6.js} +1 -1
  362. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-e023b0417bbc3b44.js +10 -0
  363. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/{page-608cdc11e7047159.js → page-fe7ccc9c117d7d38.js} +1 -1
  364. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/{page-ad84a479883e6cc3.js → page-d3e35265648406f2.js} +1 -1
  365. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-f312c1076859630e.js → page-5ac3900baf3fe9ca.js} +1 -1
  366. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/[id]/{page-90277b8688f387c1.js → page-bb4af1ac9b13a514.js} +1 -1
  367. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/{page-33e127c15efc66a5.js → page-4382c14f28ddfc7f.js} +1 -1
  368. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/{page-0f74a450b98fa125.js → page-1b2b6b736fe98698.js} +1 -1
  369. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/{page-ad2eda4b48c9319b.js → page-92fe95bd4e6b3d0a.js} +1 -1
  370. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/{page-025d20cc7b091120.js → page-4c47b9660f3066e2.js} +1 -1
  371. package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-d1fa5b81e1c386ab.js +1 -0
  372. package/app/package.json +1 -1
  373. package/cli.js +18 -2
  374. package/package.json +1 -1
  375. package/src/cli/interfaceMenu.js +11 -4
  376. package/app/.next-cli-build/static/chunks/1631-cb80453bf5d4173d.js +0 -1
  377. package/app/.next-cli-build/static/chunks/2176-8ad9ce4b3cb01006.js +0 -1
  378. package/app/.next-cli-build/static/chunks/2280-61262f8359f37a85.js +0 -64
  379. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-59e92d48daea1aed.js +0 -3
  380. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-c6f3cad64d4ef25a.js +0 -10
  381. package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-acc24d6e7d8eb782.js +0 -1
  382. /package/app/.next-cli-build/static/{cirxzk63Mj76HYSOHUdGc → y86nLCzoD011gXPeccvk9}/_buildManifest.js +0 -0
  383. /package/app/.next-cli-build/static/{cirxzk63Mj76HYSOHUdGc → y86nLCzoD011gXPeccvk9}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{17002:(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:()=>O});var a=r(95155),s=r(12115),i=r(57250),l=r(97650);let n="quotaCacheData",o="quotaAutoRefresh",d=[10,20,50,100],c=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],u=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}];function x(e){return e.name?.trim()||e.email?.trim()||e.displayName?.trim()||null}function m(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}function h(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 p(e,t){return await e(t)}function g(){try{let e=window.localStorage.getItem(n);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function f(e,t){try{let r=g();r[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(n,JSON.stringify(r))}catch(e){console.error("Error writing quota cache:",e)}}function y(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function v({quotas:e=[],compact:t=!1,sortMode:r="default",showSortLabel:i=!1}){let[l,n]=(0,s.useState)(1),o=(0,s.useMemo)(()=>e.map((e,t)=>({...e,index:t,remaining:e?.remaining!==void 0?Math.max(0,Math.round(e.remaining)):e?.remainingPercentage!==void 0?Math.round(e.remainingPercentage):y(e?.used,e?.total)})),[e]),d=(0,s.useMemo)(()=>"remaining-asc"===r?[...o].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...o].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):o,[o,r]),c=Math.max(1,Math.ceil(d.length/10));if((0,s.useEffect)(()=>{n(1)},[r,e]),(0,s.useEffect)(()=>{n(e=>Math.min(e,c))},[c]),!e||0===e.length)return null;let u=d.slice((l-1)*10,10*l),x=0===d.length?0:(l-1)*10+1,m=Math.min(10*l,d.length),h=t?"py-1 px-1.5":"py-2 px-3",b=t?"text-[11px]":"text-sm",p=t?"text-[11px]":"text-sm",g=t?"text-[10px] leading-tight":"text-xs";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:[d.length," quota",d.length>1?"s":""]}),i&&(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:"overflow-x-auto",children:(0,a.jsx)("table",{className:"w-full table-fixed text-left",children:(0,a.jsx)("tbody",{children:u.map(e=>{var r;let s=(r=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"},i=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 i=Math.floor(s/60),l=s%60;if(i<24)return`${i}h ${l}m`;let n=Math.floor(i/24);return`${n}d ${i%24}h ${l}m`}catch(e){return"-"}}(e.resetAt),l=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 i="";i=t>=a&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let l=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${i}, ${l}`}catch{return null}}(e.resetAt),n=!1!==e.recurring?`in ${i}`:`expires in ${i}`;return(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:`${h} w-[30%]`,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:s.emoji}),(0,a.jsx)("span",{className:`${b} font-medium text-text-primary truncate`,children:e.name})]})}),(0,a.jsx)("td",{className:`${h} w-[45%]`,children:(0,a.jsxs)("div",{className:t?"space-y-1":"space-y-1.5",children:[(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${s.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 ${s.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsxs)("span",{className:"text-text-muted",children:[e.used.toLocaleString()," / ",e.total>0?e.total.toLocaleString():"∞"]}),(0,a.jsxs)("span",{className:`font-medium ${s.text}`,children:[e.remaining,"%"]})]})]})}),(0,a.jsx)("td",{className:`${h} w-[25%]`,children:"-"!==i||l?t?(0,a.jsx)("div",{className:`${p} text-text-primary font-medium truncate`,title:l||"",children:"-"!==i?n:l}):(0,a.jsxs)("div",{className:"space-y-0.5",children:["-"!==i&&(0,a.jsx)("div",{className:`${p} text-text-primary font-medium`,children:n}),l&&(0,a.jsx)("div",{className:`${g} text-text-muted`,children:l})]}):(0,a.jsx)("div",{className:`${p} text-text-muted italic`,children:"N/A"})})]},`${e.name}-${e.index}`)})})})}),c>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,"-",m," of ",d.length]}),(0,a.jsxs)("span",{children:["Page ",l," / ",c]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>n(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:()=>n(e=>Math.min(c,e+1)),disabled:l===c,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 j=r(98542),k=r(97677),w=r(84588),N=r(35497),C=r(88105),S=r(11059),A=r(78559),$=r(77251);let E={"builder-id":"AWS Builder ID",idc:"IAM Identity Center",google:"Google",github:"GitHub",imported:"Imported Token",api_key:"API Key"},q={claude:"claudeAutoPing",codex:"codexAutoPing"},P={claude:"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",codex:"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota."};function D(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]:"")||""}function M(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 O(){let{copied:e,copy:t}=(0,S.C)(),[r,O]=(0,s.useState)([]),[I,_]=(0,s.useState)({}),[F,z]=(0,s.useState)({}),[L,R]=(0,s.useState)({}),[U,J]=(0,s.useState)(!0),[K,G]=(0,s.useState)({claude:{},codex:{}}),[H,B]=(0,s.useState)(null),[V,W]=(0,s.useState)(!1),[Y,Q]=(0,s.useState)(!1),[X,Z]=(0,s.useState)(60),[ee,et]=(0,s.useState)(!0),[er,ea]=(0,s.useState)(null),[es,ei]=(0,s.useState)(null),[el,en]=(0,s.useState)(null),[eo,ed]=(0,s.useState)(null),[ec,eu]=(0,s.useState)(null),[ex,em]=(0,s.useState)(!1),[eh,eb]=(0,s.useState)(null),[ep,eg]=(0,s.useState)("all"),[ef,ey]=(0,s.useState)([]),[ev,ej]=(0,s.useState)("all"),[ek,ew]=(0,s.useState)("default"),[eN,eC]=(0,s.useState)(!1),[eS,eA]=(0,s.useState)(!1),[e$,eE]=(0,s.useState)(!1),[eq,eP]=(0,s.useState)(1),[eD,eT]=(0,s.useState)(20),[eM,eO]=(0,s.useState)(String(20)),[eI,e_]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eF,ez]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),eL=(0,s.useRef)(null),eR=(0,s.useRef)(null),eU=(0,s.useRef)(0),eJ=(0,s.useCallback)(async(e=eq)=>{try{var t,r;let a=new URLSearchParams({page:String(e),pageSize:String(eD),accountStatus:ev,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 i=await s.json(),l=i.connections||[],n=(t=i.pagination,t||{page:1,pageSize:eD,total:0,totalPages:1}),o=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(i.totals,l.length);return O(l),ey(i.providerOptions||[]),e_(n),ez(o),eP((r=i.pagination,r?.page||e)),l}catch(e){return(0,A.s)("Error fetching connections:",e),O([]),ey([]),e_({page:1,pageSize:eD,total:0,totalPages:1}),ez({eligibleConnections:0,providerFilteredConnections:0}),[]}},[ev,eq,eD,ep]),eK=(0,s.useCallback)(async(e,t)=>{z(t=>({...t,[e]:!0})),R(t=>({...t,[e]:null}));try{let r=await fetch(`/api/usage/${e}`);if(!r.ok){let a=(await r.json().catch(()=>({}))).error||r.statusText;if(404===r.status)return void(0,A.s)(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===r.status){(0,A.s)(`[ProviderLimits] Auth error for ${t}:`,a);let r={quotas:[],message:a};_(t=>({...t,[e]:r})),f(e,r);return}throw Error(`HTTP ${r.status}: ${a}`)}let a=await r.json(),s={quotas:function(e,t){if(!t||"object"!=typeof t)return[];let r=[];try{switch(e.toLowerCase()){case"github":default: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":t.quotas&&Object.entries(t.quotas).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])=>{r.push({name: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":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{("organization"!==e||t&&0!==(Number(t.total)||0))&&r.push({name:"user"===e?"Personal":"organization"===e?"Organization":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||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,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":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})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,l.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(e.get(a)??999)-(e.get(s)??999)})}return r}(t,a),plan:a.plan||null,message:a.message||null,raw:a};_(t=>({...t,[e]:s})),f(e,s)}catch(r){(0,A.s)(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),R(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{z(t=>({...t,[e]:!1}))}},[]),eG=(0,s.useCallback)(async(e,t)=>{await eK(e,t),B(new Date)},[eK]),eH=(0,s.useCallback)(async(e,t)=>{if("codex"===t&&!el){en(e),R(t=>({...t,[e]:null}));try{let r=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 Codex limit");await eK(e,t),B(new Date)}catch(t){R(r=>({...r,[e]:t.message||"Failed to reset Codex limit"}))}finally{en(null)}}},[eK,el]),eB=(0,s.useCallback)(async e=>{eu({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)=>{let r=e.expiresAt?new Date(e.expiresAt).getTime():1/0,a=t.expiresAt?new Date(t.expiresAt).getTime():1/0;return r-a}),eu({connection:e,loading:!1,error:null,data:{...r,credits:a}})}catch(t){eu({connection:e,loading:!1,error:t.message||"Failed to load Codex reset credits",data:null})}},[]),eV=(0,s.useCallback)(async e=>{let t=x(r.find(t=>t.id===e)||{})||e;if(await (0,$.l)({message:`Delete connection “${t}”?`,confirmText:"Continue"})){ea(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){_(t=>{let r={...t};return delete r[e],r}),z(t=>{let r={...t};return delete r[e],r}),R(t=>{let r={...t};return delete r[e],r});try{let t=g();t[e]&&(delete t[e],window.localStorage.setItem(n,JSON.stringify(t)))}catch(e){(0,A.s)("Error deleting cache entry:",e)}await p(eJ,eq)}}catch(e){(0,A.s)("Error deleting connection:",e)}finally{ea(null)}}},[r,eJ,eq]),eW=(0,s.useCallback)(async(e,t)=>{ei(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(_(e=>({...e})),await p(eJ,eq))}catch(e){(0,A.s)("Error updating connection status:",e)}finally{ei(null)}},[eJ,eq]),eY=(0,s.useCallback)(async e=>{if(!eh?.id)return;let t=eh.id,r=eh.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eJ(),em(!1),eb(null),C.wb.includes(r)&&await eK(t,r))}catch(e){(0,A.s)("Error saving connection:",e)}},[eh,eJ,eK]),eQ=(0,s.useCallback)(async(e=!1)=>{if(Y)return;Q(!0),Z(60);let t=eU.current+=1,r=Math.round(3);try{let a=await eJ(eq);z(h(a)),R(e=>b(e,a)),_(e=>b(e,a)),await Promise.all(a.filter(a=>e||"claude"!==a.provider||t%r==0).map(e=>eK(e.id,e.provider))),B(new Date)}catch(e){(0,A.s)("Error refreshing all providers:",e)}finally{Q(!1)}},[Y,eJ,eK,eq]);(0,s.useEffect)(()=>{(async()=>{et(!0);let e=await eJ(eq);et(!1),z(h(e)),R(t=>b(t,e)),_(t=>b(t,e)),await Promise.all(e.map(e=>eK(e.id,e.provider))),B(new Date)})()},[eJ,eK,eq]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(o);J(null===e||"true"===e),W(!0)},[]),(0,s.useEffect)(()=>{V&&window.localStorage.setItem(o,String(U))},[U,V]),(0,s.useEffect)(()=>{fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{}).then(e=>G({claude:e?.claudeAutoPing?.connections||{},codex:e?.codexAutoPing?.connections||{}})).catch(()=>{})},[]);let eX=(0,s.useCallback)(async(e,t,r)=>{let a=q[t];if(!a)return;let s={...K[t]||{},[e]:r};G({...K,[t]:s});try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[a]||{},connections:s};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:t})})}catch{G(K)}},[K]);(0,s.useEffect)(()=>{if(!V||!U){eL.current&&(clearInterval(eL.current),eL.current=null),eR.current&&(clearInterval(eR.current),eR.current=null);return}return eL.current=setInterval(()=>{eQ()},6e4),eR.current=setInterval(()=>{Z(e=>e<=1?60:e-1)},1e3),()=>{eL.current&&clearInterval(eL.current),eR.current&&clearInterval(eR.current)}},[U,eQ,V]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(eL.current&&(clearInterval(eL.current),eL.current=null),eR.current&&(clearInterval(eR.current),eR.current=null)):U&&V&&(eL.current=setInterval(()=>eQ(),6e4),eR.current=setInterval(()=>{Z(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[U,eQ,V]);let eZ=(0,s.useMemo)(()=>(function(e,t,r,a,s){if("codex"===a&&"default"!==s)return[...e].sort((e,r)=>{let a=m(e,t),i=m(r,t),l="remaining-asc"===s?a-i:i-a;return 0!==l?l:(x(e)||"").localeCompare(x(r)||"")});if(!r)return e;let i=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=i(e)-i(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(x(e)||"").localeCompare(x(t)||"")})})(r,I,eN,ep,ek),[r,I,eN,ep,ek]),e0=e=>{let t=I[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=y(e.used,e.total))},e1=(0,s.useCallback)(async(e,t)=>{if(e.length&&!e$){eE(!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 p(eJ,eq)}catch(e){(0,A.s)("Error bulk toggling connections:",e)}finally{eE(!1)}}},[e$,eJ,eq]),e5="all"===ep?"All providers":ep,e2=eF.eligibleConnections>0,e3=eZ.length>0,e8=eF.eligibleConnections?eF.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"===ev?"turned off":"active"===ev?"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."},e4=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}`}(eI),e6=!d.includes(eD);return ee||e2?ee||e3?(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-end",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:()=>eA(e=>!e),className:"flex h-8 items-center justify-between gap-1 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-haspopup":"menu","aria-expanded":eS,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-text-muted",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 capitalize hidden lg:inline",children:e5})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),eS&&(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:()=>eA(!1)}),(0,a.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-2xl border border-black/10 bg-surface/95 p-1.5 shadow-xl shadow-black/10 backdrop-blur dark:border-white/10 dark:bg-surface/95 sm:w-72",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{"all"!==ep&&eP(1),eg("all"),eA(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===ep?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,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-black/10 dark:bg-white/10"}),(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto pr-1",children:ef.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{ep!==e&&eP(1),eg(e),eA(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${ep===e?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,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 capitalize",children:e}),ep===e&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,a.jsx)("select",{value:ev,onChange:e=>{let t=e.target.value;ev!==t&&eP(1),ej(t)},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Filter accounts by status",children:c.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===ep&&(0,a.jsx)("select",{value:ek,onChange:e=>ew(e.target.value),className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Sort Codex quotas by remaining",children:u.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)("button",{type:"button",onClick:()=>eC(e=>!e),"aria-pressed":eN,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${eN?"border-amber-500/40 bg-amber-500/10 text-amber-500":"border-black/10 text-text-primary hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,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:()=>{e1(eZ.filter(e=>(e.isActive??!0)&&e0(e)).map(e=>e.id),!1)},disabled:e$,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-red-500/30 px-2 text-xs text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50",title:"Disable connections with depleted quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"block"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn off Empty"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{e1(eZ.filter(e=>!(e.isActive??!0)&&!e0(e)).map(e=>e.id),!0)},disabled:e$,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-emerald-500/30 px-2 text-xs text-emerald-500 transition-colors hover:bg-emerald-500/10 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]",children:"check_circle"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn on Available"})]}),(0,a.jsxs)("button",{onClick:()=>J(e=>!e),className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5",title:U?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${U?"text-primary":"text-text-muted"}`,children:U?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{className:"hidden text-text-primary sm:inline",children:"Auto-refresh"}),U&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",X,"s)"]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eQ(!0),disabled:Y,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5 disabled:opacity-50",title:"Refresh all",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${Y?"animate-spin":""}`,children:"refresh"})})]})}),eN&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",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:eZ.map(r=>{let s,l,n,o=I[r.id],d=F[r.id],c=L[r.id],u=!1===r.isActive,m="codex"===r.provider,h=Number.isFinite(l="number"==typeof(s=o?.raw?.resetCredits?.availableCount)?s:Number(s))?Math.max(0,l):0,b=el===r.id,p=er===r.id||es===r.id||b;return(0,a.jsxs)(w.default,{padding:"none",className:`min-w-0 ${u?"opacity-60":""}`,children:[(0,a.jsx)("div",{className:"px-3 py-2 border-b border-black/10 dark:border-white/10",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 capitalize truncate",children:r.provider}),x(r)?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:x(r)}):null,D(r)?(0,a.jsx)("p",{className:"text-[11px] text-text-muted/80 truncate",children:D(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-brand-500/10 px-2 py-0.5 text-[10px] font-semibold text-brand-600 dark:text-brand-300",children:(n=r.providerSpecificData?.authMethod)&&E[n]?E[n]:"api_key"===r.authType?"API Key":"OAuth"}),T(r)&&(0,a.jsx)("span",{className:"rounded-full bg-blue-500/10 px-2 py-0.5 text-[10px] font-semibold text-blue-600 dark:text-blue-400",children:T(r)}),(0,a.jsx)("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-semibold ${u?"bg-surface-2 text-text-muted":"active"===r.testStatus||"success"===r.testStatus?"bg-green-500/10 text-green-600 dark:text-green-400":"error"===r.testStatus||"expired"===r.testStatus||"unavailable"===r.testStatus?"bg-red-500/10 text-red-600 dark:text-red-400":"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&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k.default,{text:h>0?`Use one Codex reset credit. Available: ${h}`:"No Codex reset credits available",children:(0,a.jsxs)("button",{type:"button",onClick:()=>ed({connection:r,resetCreditCount:h}),disabled:h<=0||d||p,"aria-label":h>0?`Use one Codex reset credit. ${h} available.`:"No Codex reset credits available",className:`flex h-8 min-w-10 items-center justify-center gap-1 rounded-lg border px-2 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 ${h>0?"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10":"border-black/10 bg-black/[0.02] text-text-muted dark:border-white/10 dark:bg-white/[0.03]"}`,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:h})]})}),(0,a.jsx)(k.default,{text:"View Codex reset credit expiry",children:(0,a.jsx)("button",{type:"button",onClick:()=>eB(r),disabled:d||p,"aria-label":"View Codex reset credit expiry",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-muted transition-colors hover:bg-black/5 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10 dark:hover:bg-white/5",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"schedule"})})})]}),q[r.provider]&&"oauth"===r.authType&&(0,a.jsx)(k.default,{text:P[r.provider],children:(0,a.jsx)("button",{type:"button",onClick:()=>eX(r.id,r.provider,K[r.provider]?.[r.id]!==!0),"aria-label":"Toggle auto-ping",className:`flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${K[r.provider]?.[r.id]===!0?"text-primary":"text-text-muted"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"})})}),(0,a.jsx)(k.default,{text:"Refresh quota",children:(0,a.jsx)("button",{type:"button",onClick:()=>eG(r.id,r.provider),disabled:d||p,"aria-label":"Refresh quota",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors 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)(k.default,{text:"Edit connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>{eb(r),em(!0)},disabled:p,"aria-label":"Edit connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})})}),(0,a.jsx)(k.default,{text:"Delete connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>eV(r.id),disabled:p,"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] ${er===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)(j.default,{size:"sm",checked:r.isActive??!0,disabled:p,onChange:e=>eW(r.id,e)})})]})]})}),(0,a.jsx)("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)(v,{quotas:o?.quotas,compact:!0,sortMode:"default",showSortLabel:"codex"===r.provider&&"default"!==ek})})]},r.id)})}),(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:e4}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:e6?"custom":String(eD),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(eP(1),eT(r),eO(String(r)))},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Accounts per page",children:[d.map(e=>(0,a.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,a.jsx)("option",{value:"custom",children:"Custom"})]}),(0,a.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eM,onChange:e=>eO(e.target.value),onBlur:()=>{let e=Number.parseInt(eM,10);if(!Number.isFinite(e))return void eO(String(eD));let t=Math.min(500,Math.max(1,e));eP(1),eT(t),eO(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eM,10);if(!Number.isFinite(t))return void eO(String(eD));let r=Math.min(500,Math.max(1,t));eP(1),eT(r),eO(String(r))},className:"h-8 w-20 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Page ",eI.page," / ",eI.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eP(1),disabled:eI.page<=1||ee||Y,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs 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:"First Page"}),(0,a.jsx)("button",{type:"button",onClick:()=>eP(e=>Math.max(1,e-1)),disabled:eI.page<=1||ee||Y,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 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","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:()=>eP(e=>Math.min(eI.totalPages,e+1)),disabled:eI.page>=eI.totalPages||ee||Y,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 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","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:()=>eP(eI.totalPages),disabled:eI.page>=eI.totalPages||ee||Y,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs 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:"Last Page"})]})]})}),(0,a.jsx)(N.uo,{isOpen:!!eo,onClose:()=>{el||ed(null)},onConfirm:async()=>{let e=eo?.connection;e&&(await eH(e.id,e.provider),ed(null))},title:"Reset Codex limit?",message:`Use 1 Codex reset credit for ${x(eo?.connection||{})||"this account"}. This cannot be undone. Remaining credits: ${eo?.resetCreditCount??0}.`,confirmText:"Reset limit",cancelText:"Cancel",variant:"danger",loading:!!el}),ec&&(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:"Codex Reset Credit Expiry"}),(0,a.jsx)("p",{className:"mt-0.5 truncate text-xs text-text-muted",children:x(ec.connection)||"Codex account"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eu(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:ec.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..."]}):ec.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:ec.error}):ec.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:[ec.data.credits.length," reset credit",1===ec.data.credits.length?"":"s"]}),(0,a.jsxs)("span",{children:[ec.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:ec.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:M(e.grantedAt)}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-primary",children:M(e.expiresAt)}),(0,a.jsx)("td",{className:"px-3 py-2 font-medium text-text-primary",children:function(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`}(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:"No reset credit details returned for this account."})})]})}),(0,a.jsx)(N.wI,{isOpen:ex,connection:eh,onSave:eY,onClose:()=>{em(!1),eb(null)}})]}):(0,a.jsx)(w.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-text-muted opacity-20",children:e8.icon}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:e8.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:e8.description})]})}):(0,a.jsx)(w.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-text-muted opacity-20",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."})]})})}}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=17002)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{17002:(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:()=>O});var a=r(95155),s=r(12115),i=r(57250),l=r(97650);let n="quotaCacheData",o="quotaAutoRefresh",d=[10,20,50,100],c=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],u=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}];function x(e){return e.name?.trim()||e.email?.trim()||e.displayName?.trim()||null}function m(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}function h(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 p(e,t){return await e(t)}function g(){try{let e=window.localStorage.getItem(n);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function f(e,t){try{let r=g();r[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(n,JSON.stringify(r))}catch(e){console.error("Error writing quota cache:",e)}}function y(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function v({quotas:e=[],compact:t=!1,sortMode:r="default",showSortLabel:i=!1}){let[l,n]=(0,s.useState)(1),o=(0,s.useMemo)(()=>e.map((e,t)=>({...e,index:t,remaining:e?.remaining!==void 0?Math.max(0,Math.round(e.remaining)):e?.remainingPercentage!==void 0?Math.round(e.remainingPercentage):y(e?.used,e?.total)})),[e]),d=(0,s.useMemo)(()=>"remaining-asc"===r?[...o].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...o].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):o,[o,r]),c=Math.max(1,Math.ceil(d.length/10));if((0,s.useEffect)(()=>{n(1)},[r,e]),(0,s.useEffect)(()=>{n(e=>Math.min(e,c))},[c]),!e||0===e.length)return null;let u=d.slice((l-1)*10,10*l),x=0===d.length?0:(l-1)*10+1,m=Math.min(10*l,d.length),h=t?"py-1 px-1.5":"py-2 px-3",b=t?"text-[11px]":"text-sm",p=t?"text-[11px]":"text-sm",g=t?"text-[10px] leading-tight":"text-xs";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:[d.length," quota",d.length>1?"s":""]}),i&&(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:"overflow-x-auto",children:(0,a.jsx)("table",{className:"w-full table-fixed text-left",children:(0,a.jsx)("tbody",{children:u.map(e=>{var r;let s=(r=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"},i=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 i=Math.floor(s/60),l=s%60;if(i<24)return`${i}h ${l}m`;let n=Math.floor(i/24);return`${n}d ${i%24}h ${l}m`}catch(e){return"-"}}(e.resetAt),l=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 i="";i=t>=a&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let l=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${i}, ${l}`}catch{return null}}(e.resetAt),n=!1!==e.recurring?`in ${i}`:`expires in ${i}`;return(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:`${h} w-[30%]`,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:s.emoji}),(0,a.jsx)("span",{className:`${b} font-medium text-text-primary truncate`,children:e.name})]})}),(0,a.jsx)("td",{className:`${h} w-[45%]`,children:(0,a.jsxs)("div",{className:t?"space-y-1":"space-y-1.5",children:[(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${s.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 ${s.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsxs)("span",{className:"text-text-muted",children:[e.used.toLocaleString()," / ",e.total>0?e.total.toLocaleString():"∞"]}),(0,a.jsxs)("span",{className:`font-medium ${s.text}`,children:[e.remaining,"%"]})]})]})}),(0,a.jsx)("td",{className:`${h} w-[25%]`,children:"-"!==i||l?t?(0,a.jsx)("div",{className:`${p} text-text-primary font-medium truncate`,title:l||"",children:"-"!==i?n:l}):(0,a.jsxs)("div",{className:"space-y-0.5",children:["-"!==i&&(0,a.jsx)("div",{className:`${p} text-text-primary font-medium`,children:n}),l&&(0,a.jsx)("div",{className:`${g} text-text-muted`,children:l})]}):(0,a.jsx)("div",{className:`${p} text-text-muted italic`,children:"N/A"})})]},`${e.name}-${e.index}`)})})})}),c>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,"-",m," of ",d.length]}),(0,a.jsxs)("span",{children:["Page ",l," / ",c]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>n(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:()=>n(e=>Math.min(c,e+1)),disabled:l===c,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 j=r(98542),k=r(97677),w=r(84588),N=r(35497),C=r(88105),S=r(11059),A=r(78559),$=r(77251);let E={"builder-id":"AWS Builder ID",idc:"IAM Identity Center",google:"Google",github:"GitHub",imported:"Imported Token",api_key:"API Key"},q={claude:"claudeAutoPing",codex:"codexAutoPing"},P={claude:"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",codex:"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota."};function D(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]:"")||""}function M(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 O(){let{copied:e,copy:t}=(0,S.C)(),[r,O]=(0,s.useState)([]),[I,_]=(0,s.useState)({}),[F,z]=(0,s.useState)({}),[L,R]=(0,s.useState)({}),[U,J]=(0,s.useState)(!0),[K,G]=(0,s.useState)({claude:{},codex:{}}),[H,B]=(0,s.useState)(null),[V,W]=(0,s.useState)(!1),[Y,Q]=(0,s.useState)(!1),[X,Z]=(0,s.useState)(60),[ee,et]=(0,s.useState)(!0),[er,ea]=(0,s.useState)(null),[es,ei]=(0,s.useState)(null),[el,en]=(0,s.useState)(null),[eo,ed]=(0,s.useState)(null),[ec,eu]=(0,s.useState)(null),[ex,em]=(0,s.useState)(!1),[eh,eb]=(0,s.useState)(null),[ep,eg]=(0,s.useState)("all"),[ef,ey]=(0,s.useState)([]),[ev,ej]=(0,s.useState)("all"),[ek,ew]=(0,s.useState)("default"),[eN,eC]=(0,s.useState)(!1),[eS,eA]=(0,s.useState)(!1),[e$,eE]=(0,s.useState)(!1),[eq,eP]=(0,s.useState)(1),[eD,eT]=(0,s.useState)(20),[eM,eO]=(0,s.useState)(String(20)),[eI,e_]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eF,ez]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),eL=(0,s.useRef)(null),eR=(0,s.useRef)(null),eU=(0,s.useRef)(0),eJ=(0,s.useCallback)(async(e=eq)=>{try{var t,r;let a=new URLSearchParams({page:String(e),pageSize:String(eD),accountStatus:ev,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 i=await s.json(),l=i.connections||[],n=(t=i.pagination,t||{page:1,pageSize:eD,total:0,totalPages:1}),o=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(i.totals,l.length);return O(l),ey(i.providerOptions||[]),e_(n),ez(o),eP((r=i.pagination,r?.page||e)),l}catch(e){return(0,A.s)("Error fetching connections:",e),O([]),ey([]),e_({page:1,pageSize:eD,total:0,totalPages:1}),ez({eligibleConnections:0,providerFilteredConnections:0}),[]}},[ev,eq,eD,ep]),eK=(0,s.useCallback)(async(e,t)=>{z(t=>({...t,[e]:!0})),R(t=>({...t,[e]:null}));try{let r=await fetch(`/api/usage/${e}`);if(!r.ok){let a=(await r.json().catch(()=>({}))).error||r.statusText;if(404===r.status)return void(0,A.s)(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===r.status){(0,A.s)(`[ProviderLimits] Auth error for ${t}:`,a);let r={quotas:[],message:a};_(t=>({...t,[e]:r})),f(e,r);return}throw Error(`HTTP ${r.status}: ${a}`)}let a=await r.json(),s={quotas:function(e,t){if(!t||"object"!=typeof t)return[];let r=[];try{switch(e.toLowerCase()){case"github":default: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":t.quotas&&Object.entries(t.quotas).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])=>{r.push({name: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":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{("organization"!==e||t&&0!==(Number(t.total)||0))&&r.push({name:"user"===e?"Personal":"organization"===e?"Organization":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||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,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":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})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,l.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(e.get(a)??999)-(e.get(s)??999)})}return r}(t,a),plan:a.plan||null,message:a.message||null,raw:a};_(t=>({...t,[e]:s})),f(e,s)}catch(r){(0,A.s)(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),R(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{z(t=>({...t,[e]:!1}))}},[]),eG=(0,s.useCallback)(async(e,t)=>{await eK(e,t),B(new Date)},[eK]),eH=(0,s.useCallback)(async(e,t)=>{if("codex"===t&&!el){en(e),R(t=>({...t,[e]:null}));try{let r=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 Codex limit");await eK(e,t),B(new Date)}catch(t){R(r=>({...r,[e]:t.message||"Failed to reset Codex limit"}))}finally{en(null)}}},[eK,el]),eB=(0,s.useCallback)(async e=>{eu({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)=>{let r=e.expiresAt?new Date(e.expiresAt).getTime():1/0,a=t.expiresAt?new Date(t.expiresAt).getTime():1/0;return r-a}),eu({connection:e,loading:!1,error:null,data:{...r,credits:a}})}catch(t){eu({connection:e,loading:!1,error:t.message||"Failed to load Codex reset credits",data:null})}},[]),eV=(0,s.useCallback)(async e=>{let t=x(r.find(t=>t.id===e)||{})||e;if(await (0,$.l)({message:`Delete connection “${t}”?`,confirmText:"Continue"})){ea(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){_(t=>{let r={...t};return delete r[e],r}),z(t=>{let r={...t};return delete r[e],r}),R(t=>{let r={...t};return delete r[e],r});try{let t=g();t[e]&&(delete t[e],window.localStorage.setItem(n,JSON.stringify(t)))}catch(e){(0,A.s)("Error deleting cache entry:",e)}await p(eJ,eq)}}catch(e){(0,A.s)("Error deleting connection:",e)}finally{ea(null)}}},[r,eJ,eq]),eW=(0,s.useCallback)(async(e,t)=>{ei(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(_(e=>({...e})),await p(eJ,eq))}catch(e){(0,A.s)("Error updating connection status:",e)}finally{ei(null)}},[eJ,eq]),eY=(0,s.useCallback)(async e=>{if(!eh?.id)return;let t=eh.id,r=eh.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eJ(),em(!1),eb(null),C.wb.includes(r)&&await eK(t,r))}catch(e){(0,A.s)("Error saving connection:",e)}},[eh,eJ,eK]),eQ=(0,s.useCallback)(async(e=!1)=>{if(Y)return;Q(!0),Z(60);let t=eU.current+=1,r=Math.round(3);try{let a=await eJ(eq);z(h(a)),R(e=>b(e,a)),_(e=>b(e,a)),await Promise.all(a.filter(a=>e||"claude"!==a.provider||t%r==0).map(e=>eK(e.id,e.provider))),B(new Date)}catch(e){(0,A.s)("Error refreshing all providers:",e)}finally{Q(!1)}},[Y,eJ,eK,eq]);(0,s.useEffect)(()=>{(async()=>{et(!0);let e=await eJ(eq);et(!1),z(h(e)),R(t=>b(t,e)),_(t=>b(t,e)),await Promise.all(e.map(e=>eK(e.id,e.provider))),B(new Date)})()},[eJ,eK,eq]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(o);J(null===e||"true"===e),W(!0)},[]),(0,s.useEffect)(()=>{V&&window.localStorage.setItem(o,String(U))},[U,V]),(0,s.useEffect)(()=>{fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{}).then(e=>G({claude:e?.claudeAutoPing?.connections||{},codex:e?.codexAutoPing?.connections||{}})).catch(()=>{})},[]);let eX=(0,s.useCallback)(async(e,t,r)=>{let a=q[t];if(!a)return;let s={...K[t]||{},[e]:r};G({...K,[t]:s});try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[a]||{},connections:s};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:t})})}catch{G(K)}},[K]);(0,s.useEffect)(()=>{if(!V||!U){eL.current&&(clearInterval(eL.current),eL.current=null),eR.current&&(clearInterval(eR.current),eR.current=null);return}return eL.current=setInterval(()=>{eQ()},6e4),eR.current=setInterval(()=>{Z(e=>e<=1?60:e-1)},1e3),()=>{eL.current&&clearInterval(eL.current),eR.current&&clearInterval(eR.current)}},[U,eQ,V]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(eL.current&&(clearInterval(eL.current),eL.current=null),eR.current&&(clearInterval(eR.current),eR.current=null)):U&&V&&(eL.current=setInterval(()=>eQ(),6e4),eR.current=setInterval(()=>{Z(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[U,eQ,V]);let eZ=(0,s.useMemo)(()=>(function(e,t,r,a,s){if("codex"===a&&"default"!==s)return[...e].sort((e,r)=>{let a=m(e,t),i=m(r,t),l="remaining-asc"===s?a-i:i-a;return 0!==l?l:(x(e)||"").localeCompare(x(r)||"")});if(!r)return e;let i=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=i(e)-i(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(x(e)||"").localeCompare(x(t)||"")})})(r,I,eN,ep,ek),[r,I,eN,ep,ek]),e0=e=>{let t=I[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=y(e.used,e.total))},e1=(0,s.useCallback)(async(e,t)=>{if(e.length&&!e$){eE(!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 p(eJ,eq)}catch(e){(0,A.s)("Error bulk toggling connections:",e)}finally{eE(!1)}}},[e$,eJ,eq]),e5="all"===ep?"All providers":ep,e2=eF.eligibleConnections>0,e3=eZ.length>0,e8=eF.eligibleConnections?eF.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"===ev?"turned off":"active"===ev?"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."},e4=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}`}(eI),e6=!d.includes(eD);return ee||e2?ee||e3?(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-end",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:()=>eA(e=>!e),className:"flex h-8 items-center justify-between gap-1 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-haspopup":"menu","aria-expanded":eS,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-text-muted",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 capitalize hidden lg:inline",children:e5})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),eS&&(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:()=>eA(!1)}),(0,a.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-2xl border border-black/10 bg-surface/95 p-1.5 shadow-xl shadow-black/10 backdrop-blur dark:border-white/10 dark:bg-surface/95 sm:w-72",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{"all"!==ep&&eP(1),eg("all"),eA(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===ep?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,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-black/10 dark:bg-white/10"}),(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto pr-1",children:ef.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{ep!==e&&eP(1),eg(e),eA(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${ep===e?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,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 capitalize",children:e}),ep===e&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,a.jsx)("select",{value:ev,onChange:e=>{let t=e.target.value;ev!==t&&eP(1),ej(t)},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Filter accounts by status",children:c.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===ep&&(0,a.jsx)("select",{value:ek,onChange:e=>ew(e.target.value),className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Sort Codex quotas by remaining",children:u.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)("button",{type:"button",onClick:()=>eC(e=>!e),"aria-pressed":eN,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${eN?"border-amber-500/40 bg-amber-500/10 text-amber-500":"border-black/10 text-text-primary hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,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:()=>{e1(eZ.filter(e=>(e.isActive??!0)&&e0(e)).map(e=>e.id),!1)},disabled:e$,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-red-500/30 px-2 text-xs text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50",title:"Disable connections with depleted quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"block"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn off Empty"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{e1(eZ.filter(e=>!(e.isActive??!0)&&!e0(e)).map(e=>e.id),!0)},disabled:e$,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-emerald-500/30 px-2 text-xs text-emerald-500 transition-colors hover:bg-emerald-500/10 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]",children:"check_circle"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn on Available"})]}),(0,a.jsxs)("button",{onClick:()=>J(e=>!e),className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5",title:U?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${U?"text-primary":"text-text-muted"}`,children:U?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{className:"hidden text-text-primary sm:inline",children:"Auto-refresh"}),U&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",X,"s)"]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eQ(!0),disabled:Y,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5 disabled:opacity-50",title:"Refresh all",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${Y?"animate-spin":""}`,children:"refresh"})})]})}),eN&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",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:eZ.map(r=>{let s,l,n,o=I[r.id],d=F[r.id],c=L[r.id],u=!1===r.isActive,m="codex"===r.provider,h=Number.isFinite(l="number"==typeof(s=o?.raw?.resetCredits?.availableCount)?s:Number(s))?Math.max(0,l):0,b=el===r.id,p=er===r.id||es===r.id||b;return(0,a.jsxs)(w.default,{padding:"none",className:`min-w-0 ${u?"opacity-60":""}`,children:[(0,a.jsx)("div",{className:"px-3 py-2 border-b border-black/10 dark:border-white/10",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 capitalize truncate",children:r.provider}),x(r)?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:x(r)}):null,D(r)?(0,a.jsx)("p",{className:"text-[11px] text-text-muted/80 truncate",children:D(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-brand-500/10 px-2 py-0.5 text-[10px] font-semibold text-brand-600 dark:text-brand-300",children:(n=r.providerSpecificData?.authMethod)&&E[n]?E[n]:"api_key"===r.authType?"API Key":"OAuth"}),T(r)&&(0,a.jsx)("span",{className:"rounded-full bg-blue-500/10 px-2 py-0.5 text-[10px] font-semibold text-blue-600 dark:text-blue-400",children:T(r)}),(0,a.jsx)("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-semibold ${u?"bg-surface-2 text-text-muted":"active"===r.testStatus||"success"===r.testStatus?"bg-green-500/10 text-green-600 dark:text-green-400":"error"===r.testStatus||"expired"===r.testStatus||"unavailable"===r.testStatus?"bg-red-500/10 text-red-600 dark:text-red-400":"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&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k.default,{text:h>0?`Use one Codex reset credit. Available: ${h}`:"No Codex reset credits available",children:(0,a.jsxs)("button",{type:"button",onClick:()=>ed({connection:r,resetCreditCount:h}),disabled:h<=0||d||p,"aria-label":h>0?`Use one Codex reset credit. ${h} available.`:"No Codex reset credits available",className:`flex h-8 min-w-10 items-center justify-center gap-1 rounded-lg border px-2 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 ${h>0?"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10":"border-black/10 bg-black/[0.02] text-text-muted dark:border-white/10 dark:bg-white/[0.03]"}`,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:h})]})}),(0,a.jsx)(k.default,{text:"View Codex reset credit expiry",children:(0,a.jsx)("button",{type:"button",onClick:()=>eB(r),disabled:d||p,"aria-label":"View Codex reset credit expiry",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-muted transition-colors hover:bg-black/5 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10 dark:hover:bg-white/5",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"schedule"})})})]}),q[r.provider]&&"oauth"===r.authType&&(0,a.jsx)(k.default,{text:P[r.provider],children:(0,a.jsx)("button",{type:"button",onClick:()=>eX(r.id,r.provider,K[r.provider]?.[r.id]!==!0),"aria-label":"Toggle auto-ping",className:`flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${K[r.provider]?.[r.id]===!0?"text-primary":"text-text-muted"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"})})}),(0,a.jsx)(k.default,{text:"Refresh quota",children:(0,a.jsx)("button",{type:"button",onClick:()=>eG(r.id,r.provider),disabled:d||p,"aria-label":"Refresh quota",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors 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)(k.default,{text:"Edit connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>{eb(r),em(!0)},disabled:p,"aria-label":"Edit connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})})}),(0,a.jsx)(k.default,{text:"Delete connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>eV(r.id),disabled:p,"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] ${er===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)(j.default,{size:"sm",checked:r.isActive??!0,disabled:p,onChange:e=>eW(r.id,e)})})]})]})}),(0,a.jsx)("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)(v,{quotas:o?.quotas,compact:!0,sortMode:"default",showSortLabel:"codex"===r.provider&&"default"!==ek})})]},r.id)})}),(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:e4}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:e6?"custom":String(eD),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(eP(1),eT(r),eO(String(r)))},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Accounts per page",children:[d.map(e=>(0,a.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,a.jsx)("option",{value:"custom",children:"Custom"})]}),(0,a.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eM,onChange:e=>eO(e.target.value),onBlur:()=>{let e=Number.parseInt(eM,10);if(!Number.isFinite(e))return void eO(String(eD));let t=Math.min(500,Math.max(1,e));eP(1),eT(t),eO(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eM,10);if(!Number.isFinite(t))return void eO(String(eD));let r=Math.min(500,Math.max(1,t));eP(1),eT(r),eO(String(r))},className:"h-8 w-20 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Page ",eI.page," / ",eI.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eP(1),disabled:eI.page<=1||ee||Y,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs 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:"First Page"}),(0,a.jsx)("button",{type:"button",onClick:()=>eP(e=>Math.max(1,e-1)),disabled:eI.page<=1||ee||Y,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 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","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:()=>eP(e=>Math.min(eI.totalPages,e+1)),disabled:eI.page>=eI.totalPages||ee||Y,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 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","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:()=>eP(eI.totalPages),disabled:eI.page>=eI.totalPages||ee||Y,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs 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:"Last Page"})]})]})}),(0,a.jsx)(N.uo,{isOpen:!!eo,onClose:()=>{el||ed(null)},onConfirm:async()=>{let e=eo?.connection;e&&(await eH(e.id,e.provider),ed(null))},title:"Reset Codex limit?",message:`Use 1 Codex reset credit for ${x(eo?.connection||{})||"this account"}. This cannot be undone. Remaining credits: ${eo?.resetCreditCount??0}.`,confirmText:"Reset limit",cancelText:"Cancel",variant:"danger",loading:!!el}),ec&&(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:"Codex Reset Credit Expiry"}),(0,a.jsx)("p",{className:"mt-0.5 truncate text-xs text-text-muted",children:x(ec.connection)||"Codex account"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eu(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:ec.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..."]}):ec.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:ec.error}):ec.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:[ec.data.credits.length," reset credit",1===ec.data.credits.length?"":"s"]}),(0,a.jsxs)("span",{children:[ec.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:ec.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:M(e.grantedAt)}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-primary",children:M(e.expiresAt)}),(0,a.jsx)("td",{className:"px-3 py-2 font-medium text-text-primary",children:function(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`}(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:"No reset credit details returned for this account."})})]})}),(0,a.jsx)(N.wI,{isOpen:ex,connection:eh,onSave:eY,onClose:()=>{em(!1),eb(null)}})]}):(0,a.jsx)(w.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-text-muted opacity-20",children:e8.icon}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:e8.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:e8.description})]})}):(0,a.jsx)(w.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-text-muted opacity-20",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."})]})})}}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=17002)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2838],{23262:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var a=s(95155),i=s(12115),n=s(98500),r=s.n(n),l=s(73321),o=s(35497),d=s(11059),c=s(46453),m=s(23241);function x(){let e=(0,l.useParams)(),t="string"==typeof e?.id?e.id:"",s=c.J3.find(e=>e.id===t),[n,x]=(0,i.useState)(""),[p,h]=(0,i.useState)({}),[u,f]=(0,i.useState)(""),[b,j]=(0,i.useState)(!0),[y,N]=(0,i.useState)(""),{copied:g,copy:k}=(0,d.C)(2e3),w=(0,c.Rz)(t);(0,i.useEffect)(()=>{N(`${window.location.origin}${w}`)},[w]),(0,i.useEffect)(()=>{if(!t)return;let e=!1;return j(!0),f(""),x(""),fetch(w).then(async e=>{if(!e.ok)throw Error((await e.json().catch(()=>({}))).error||`HTTP ${e.status}`);return e.text()}).then(t=>{if(e)return;let{html:s,meta:a}=(0,m.L6)(t);h(a),x(s)}).catch(t=>{e||f(t.message||"Failed to load skill")}).finally(()=>{e||j(!1)}),()=>{e=!0}},[t,w]);let v=s?.name||p.name||t,_=s?.description||p.description||"";return(0,a.jsxs)("div",{className:"max-w-3xl mx-auto space-y-4 pb-10",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)(r(),{href:"/dashboard/skills",className:"text-xs text-text-muted hover:text-primary inline-flex items-center gap-1 mb-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"arrow_back"}),"All skills"]}),(0,a.jsx)("h1",{className:"text-[20px] font-semibold text-text-main tracking-tight",children:v}),_?(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1 leading-relaxed",children:_}):null]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 shrink-0",children:[(0,a.jsxs)(o.$n,{size:"sm",variant:"secondary",onClick:()=>k(y||w),title:y||w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:g?"check":"content_copy"}),g?"Copied!":"Copy raw URL"]}),(0,a.jsxs)("a",{href:w,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 px-2.5 py-1.5 rounded-md border border-border text-xs text-text-main hover:border-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"open_in_new"}),"Raw markdown"]})]})]}),(y||w)&&!b&&!u?(0,a.jsxs)("div",{className:"rounded-lg border border-border-subtle bg-surface-2 px-3 py-2",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-text-subtle font-semibold mb-0.5",children:"Agent fetch URL"}),(0,a.jsx)("code",{className:"text-[12px] font-mono text-text-main break-all",children:y||w})]}):null,(0,a.jsxs)(o.Zp,{padding:"lg",className:"overflow-hidden",children:[b&&(0,a.jsxs)("p",{className:"text-sm text-text-muted flex items-center gap-2 py-8 justify-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),"Loading skill…"]}),u&&(0,a.jsxs)("div",{className:"text-sm text-red-400 py-4",children:[(0,a.jsx)("p",{className:"font-medium",children:"Could not load skill"}),(0,a.jsx)("p",{className:"text-xs mt-1 opacity-80",children:u}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Expected file: ",(0,a.jsxs)("code",{className:"font-mono",children:["skills/",t,"/SKILL.md"]})]})]}),b||u||!n?null:(0,a.jsx)("article",{className:"skill-md",dangerouslySetInnerHTML:{__html:n}})]})]})}},46453:(e,t,s)=>{"use strict";s.d(t,{EV:()=>n,J3:()=>a,Rz:()=>i});let a=[{id:"switchboard",name:"Switchboard (Entry)",description:"Setup, model discovery, combos & Auto routing. Start here — one /v1 endpoint, multi-provider gateway.",endpoint:"/v1",icon:"hub",isEntry:!0},{id:"switchboard-chat",name:"Chat",description:"Chat / code-gen via OpenAI, Anthropic, or Responses formats — streaming, tools, combo as model.",endpoint:"/v1/chat/completions",icon:"chat"}];function i(e){return`/api/skills/${e}`}function n(e){return`/dashboard/skills/${e}`}},98745:(e,t,s)=>{Promise.resolve().then(s.bind(s,23262))}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=98745)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2838],{23262:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var a=s(95155),i=s(12115),n=s(98500),r=s.n(n),l=s(73321),o=s(35497),d=s(11059),c=s(46453),m=s(23241);function x(){let e=(0,l.useParams)(),t="string"==typeof e?.id?e.id:"",s=c.J3.find(e=>e.id===t),[n,x]=(0,i.useState)(""),[p,h]=(0,i.useState)({}),[u,f]=(0,i.useState)(""),[b,j]=(0,i.useState)(!0),[y,N]=(0,i.useState)(""),{copied:g,copy:k}=(0,d.C)(2e3),w=(0,c.Rz)(t);(0,i.useEffect)(()=>{N(`${window.location.origin}${w}`)},[w]),(0,i.useEffect)(()=>{if(!t)return;let e=!1;return j(!0),f(""),x(""),fetch(w).then(async e=>{if(!e.ok)throw Error((await e.json().catch(()=>({}))).error||`HTTP ${e.status}`);return e.text()}).then(t=>{if(e)return;let{html:s,meta:a}=(0,m.L6)(t);h(a),x(s)}).catch(t=>{e||f(t.message||"Failed to load skill")}).finally(()=>{e||j(!1)}),()=>{e=!0}},[t,w]);let v=s?.name||p.name||t,_=s?.description||p.description||"";return(0,a.jsxs)("div",{className:"max-w-3xl mx-auto space-y-4 pb-10",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)(r(),{href:"/dashboard/skills",className:"text-xs text-text-muted hover:text-primary inline-flex items-center gap-1 mb-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"arrow_back"}),"All skills"]}),(0,a.jsx)("h1",{className:"text-[20px] font-semibold text-text-main tracking-tight",children:v}),_?(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1 leading-relaxed",children:_}):null]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 shrink-0",children:[(0,a.jsxs)(o.$n,{size:"sm",variant:"secondary",onClick:()=>k(y||w),title:y||w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:g?"check":"content_copy"}),g?"Copied!":"Copy raw URL"]}),(0,a.jsxs)("a",{href:w,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 px-2.5 py-1.5 rounded-md border border-border text-xs text-text-main hover:border-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"open_in_new"}),"Raw markdown"]})]})]}),(y||w)&&!b&&!u?(0,a.jsxs)("div",{className:"rounded-lg border border-border-subtle bg-surface-2 px-3 py-2",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-text-subtle font-semibold mb-0.5",children:"Agent fetch URL"}),(0,a.jsx)("code",{className:"text-[12px] font-mono text-text-main break-all",children:y||w})]}):null,(0,a.jsxs)(o.Zp,{padding:"lg",className:"overflow-hidden",children:[b&&(0,a.jsxs)("p",{className:"text-sm text-text-muted flex items-center gap-2 py-8 justify-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),"Loading skill…"]}),u&&(0,a.jsxs)("div",{className:"text-sm text-red-400 py-4",children:[(0,a.jsx)("p",{className:"font-medium",children:"Could not load skill"}),(0,a.jsx)("p",{className:"text-xs mt-1 opacity-80",children:u}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Expected file: ",(0,a.jsxs)("code",{className:"font-mono",children:["skills/",t,"/SKILL.md"]})]})]}),b||u||!n?null:(0,a.jsx)("article",{className:"skill-md",dangerouslySetInnerHTML:{__html:n}})]})]})}},46453:(e,t,s)=>{"use strict";s.d(t,{EV:()=>n,J3:()=>a,Rz:()=>i});let a=[{id:"switchboard",name:"Switchboard (Entry)",description:"Setup, model discovery, combos & Auto routing. Start here — one /v1 endpoint, multi-provider gateway.",endpoint:"/v1",icon:"hub",isEntry:!0},{id:"switchboard-chat",name:"Chat",description:"Chat / code-gen via OpenAI, Anthropic, or Responses formats — streaming, tools, combo as model.",endpoint:"/v1/chat/completions",icon:"chat"}];function i(e){return`/api/skills/${e}`}function n(e){return`/dashboard/skills/${e}`}},98745:(e,t,s)=>{Promise.resolve().then(s.bind(s,23262))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=98745)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9516],{36072:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var n=s(95155),i=s(12115),r=s(35497),a=s(11059),l=s(46453);function o(e,t){return t?/^https?:\/\//i.test(t)?t:`${e||""}${t.startsWith("/")?t:`/${t}`}`:""}function d({value:e,label:t="Copy link"}){let{copied:s,copy:i}=(0,a.C)(2e3);return(0,n.jsxs)("button",{type:"button",onClick:()=>i(e),className:"px-2 py-1 rounded-md bg-primary text-on-primary text-[11px] font-medium hover:bg-primary/90 transition-colors cursor-pointer shrink-0 inline-flex items-center gap-1",title:e,children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:s?"check":"content_copy"}),s?"Copied!":t]})}function c({skill:e,origin:t}){let s=(0,l.Rz)(e.id),i=(0,l.EV)(e.id),a=o(t,s),x=o(t,i);return(0,n.jsxs)("div",{className:`flex items-start gap-3 p-4 rounded-[14px] border shadow-[var(--shadow-soft)] transition-colors ${e.isEntry?"border-brand-500/40 bg-brand-500/5":"border-border-subtle bg-surface hover:bg-surface-2"}`,children:[(0,n.jsx)("div",{className:`size-9 rounded-lg flex items-center justify-center shrink-0 ${e.isEntry?"bg-primary text-on-primary":"bg-primary/10 text-primary"}`,children:(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:e.icon})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,n.jsx)("h3",{className:"font-semibold text-sm text-text-main",children:e.name}),e.isEntry&&(0,n.jsx)(r.Ex,{variant:"primary",size:"sm",children:"START HERE"}),e.endpoint&&(0,n.jsx)(r.Ex,{variant:"default",size:"sm",children:(0,n.jsx)("code",{className:"text-[10px]",children:e.endpoint})})]}),(0,n.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e.description}),(0,n.jsxs)("div",{className:"mt-2 flex flex-col gap-1",children:[(0,n.jsxs)("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] text-primary hover:underline inline-flex items-center gap-1 w-fit",children:["Open skill docs",(0,n.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"open_in_new"})]}),(0,n.jsx)("code",{className:"text-[11px] font-mono text-text-subtle break-all",title:"Paste this URL to an AI agent",children:a||s})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 shrink-0 items-end",children:[(0,n.jsx)(d,{value:a||s,label:"Copy agent URL"}),(0,n.jsxs)("a",{href:x||i,target:"_blank",rel:"noopener noreferrer",className:"px-2 py-1 rounded-md border border-border text-[11px] text-text-main hover:border-primary inline-flex items-center gap-1 transition-colors",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"open_in_new"}),"Open"]})]})]})}function x(){let e=function(){let[e,t]=(0,i.useState)("");return(0,i.useEffect)(()=>{t(window.location.origin)},[]),e}(),t=o(e,(0,l.Rz)("switchboard"));return(0,n.jsxs)("div",{className:"max-w-4xl mx-auto space-y-6",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Skills"}),(0,n.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:"agent skill links \xb7 not Media providers"})]}),(0,n.jsxs)(r.Zp,{padding:"md",children:[(0,n.jsx)("div",{className:"text-xs text-text-muted mb-2",children:"Paste this to your AI:"}),(0,n.jsxs)("div",{className:"px-3 py-2 rounded bg-surface-2 font-mono text-[12px] text-text-main break-all",children:["Read this skill and use it: ",t||(0,l.Rz)("switchboard")]})]}),(0,n.jsx)("div",{className:"space-y-2",children:l.J3.map(t=>(0,n.jsx)(c,{skill:t,origin:e},t.id))}),(0,n.jsx)(r.Zp,{padding:"md",children:(0,n.jsxs)("p",{className:"text-xs text-text-muted leading-relaxed",children:[(0,n.jsx)("strong",{className:"text-text-main",children:"Open"})," opens a readable docs page in a new tab. ",(0,n.jsx)("strong",{className:"text-text-main",children:"Copy agent URL"})," copies"," ",(0,n.jsx)("code",{className:"text-[11px]",children:"/api/skills/<id>"})," for AI agents to fetch the raw markdown."]})})]})}},46453:(e,t,s)=>{"use strict";s.d(t,{EV:()=>r,J3:()=>n,Rz:()=>i});let n=[{id:"switchboard",name:"Switchboard (Entry)",description:"Setup, model discovery, combos & Auto routing. Start here — one /v1 endpoint, multi-provider gateway.",endpoint:"/v1",icon:"hub",isEntry:!0},{id:"switchboard-chat",name:"Chat",description:"Chat / code-gen via OpenAI, Anthropic, or Responses formats — streaming, tools, combo as model.",endpoint:"/v1/chat/completions",icon:"chat"}];function i(e){return`/api/skills/${e}`}function r(e){return`/dashboard/skills/${e}`}},49137:(e,t,s)=>{Promise.resolve().then(s.bind(s,36072))}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=49137)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9516],{36072:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var n=s(95155),i=s(12115),r=s(35497),a=s(11059),l=s(46453);function o(e,t){return t?/^https?:\/\//i.test(t)?t:`${e||""}${t.startsWith("/")?t:`/${t}`}`:""}function d({value:e,label:t="Copy link"}){let{copied:s,copy:i}=(0,a.C)(2e3);return(0,n.jsxs)("button",{type:"button",onClick:()=>i(e),className:"px-2 py-1 rounded-md bg-primary text-on-primary text-[11px] font-medium hover:bg-primary/90 transition-colors cursor-pointer shrink-0 inline-flex items-center gap-1",title:e,children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:s?"check":"content_copy"}),s?"Copied!":t]})}function c({skill:e,origin:t}){let s=(0,l.Rz)(e.id),i=(0,l.EV)(e.id),a=o(t,s),x=o(t,i);return(0,n.jsxs)("div",{className:`flex items-start gap-3 p-4 rounded-[14px] border shadow-[var(--shadow-soft)] transition-colors ${e.isEntry?"border-brand-500/40 bg-brand-500/5":"border-border-subtle bg-surface hover:bg-surface-2"}`,children:[(0,n.jsx)("div",{className:`size-9 rounded-lg flex items-center justify-center shrink-0 ${e.isEntry?"bg-primary text-on-primary":"bg-primary/10 text-primary"}`,children:(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:e.icon})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,n.jsx)("h3",{className:"font-semibold text-sm text-text-main",children:e.name}),e.isEntry&&(0,n.jsx)(r.Ex,{variant:"primary",size:"sm",children:"START HERE"}),e.endpoint&&(0,n.jsx)(r.Ex,{variant:"default",size:"sm",children:(0,n.jsx)("code",{className:"text-[10px]",children:e.endpoint})})]}),(0,n.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e.description}),(0,n.jsxs)("div",{className:"mt-2 flex flex-col gap-1",children:[(0,n.jsxs)("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] text-primary hover:underline inline-flex items-center gap-1 w-fit",children:["Open skill docs",(0,n.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"open_in_new"})]}),(0,n.jsx)("code",{className:"text-[11px] font-mono text-text-subtle break-all",title:"Paste this URL to an AI agent",children:a||s})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 shrink-0 items-end",children:[(0,n.jsx)(d,{value:a||s,label:"Copy agent URL"}),(0,n.jsxs)("a",{href:x||i,target:"_blank",rel:"noopener noreferrer",className:"px-2 py-1 rounded-md border border-border text-[11px] text-text-main hover:border-primary inline-flex items-center gap-1 transition-colors",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"open_in_new"}),"Open"]})]})]})}function x(){let e=function(){let[e,t]=(0,i.useState)("");return(0,i.useEffect)(()=>{t(window.location.origin)},[]),e}(),t=o(e,(0,l.Rz)("switchboard"));return(0,n.jsxs)("div",{className:"max-w-4xl mx-auto space-y-6",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Skills"}),(0,n.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:"agent skill links \xb7 not Media providers"})]}),(0,n.jsxs)(r.Zp,{padding:"md",children:[(0,n.jsx)("div",{className:"text-xs text-text-muted mb-2",children:"Paste this to your AI:"}),(0,n.jsxs)("div",{className:"px-3 py-2 rounded bg-surface-2 font-mono text-[12px] text-text-main break-all",children:["Read this skill and use it: ",t||(0,l.Rz)("switchboard")]})]}),(0,n.jsx)("div",{className:"space-y-2",children:l.J3.map(t=>(0,n.jsx)(c,{skill:t,origin:e},t.id))}),(0,n.jsx)(r.Zp,{padding:"md",children:(0,n.jsxs)("p",{className:"text-xs text-text-muted leading-relaxed",children:[(0,n.jsx)("strong",{className:"text-text-main",children:"Open"})," opens a readable docs page in a new tab. ",(0,n.jsx)("strong",{className:"text-text-main",children:"Copy agent URL"})," copies"," ",(0,n.jsx)("code",{className:"text-[11px]",children:"/api/skills/<id>"})," for AI agents to fetch the raw markdown."]})})]})}},46453:(e,t,s)=>{"use strict";s.d(t,{EV:()=>r,J3:()=>n,Rz:()=>i});let n=[{id:"switchboard",name:"Switchboard (Entry)",description:"Setup, model discovery, combos & Auto routing. Start here — one /v1 endpoint, multi-provider gateway.",endpoint:"/v1",icon:"hub",isEntry:!0},{id:"switchboard-chat",name:"Chat",description:"Chat / code-gen via OpenAI, Anthropic, or Responses formats — streaming, tools, combo as model.",endpoint:"/v1/chat/completions",icon:"chat"}];function i(e){return`/api/skills/${e}`}function r(e){return`/dashboard/skills/${e}`}},49137:(e,t,s)=>{Promise.resolve().then(s.bind(s,36072))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=49137)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9839],{46357:(e,t,a)=>{Promise.resolve().then(a.bind(a,70323))},70323:(e,t,a)=>{"use strict";a.d(t,{default:()=>x});var s=a(95155),r=a(12115),l=a(35497),n=a(11059),i=a(73006);let o=["zh-CN"],d=[{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}],c=[{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"}];var m=a(78559);function x(){let e,[t,a]=(0,r.useState)(!0),[x,h]=(0,r.useState)(!1),[p,u]=(0,r.useState)(8),[f,b]=(0,r.useState)({entries:0,hits:0,bytesSaved:0}),j=(0,r.useRef)({}),[y,v]=(0,r.useState)(!1),[g,N]=(0,r.useState)("http://localhost:8787"),[k,w]=(0,r.useState)({installed:!1,running:!1,python:null,loading:!0}),[C,S]=(0,r.useState)(!1),[E,L]=(0,r.useState)(!1),[B,U]=(0,r.useState)(""),[T,_]=(0,r.useState)(!1),[M,$]=(0,r.useState)("full"),[H,P]=(0,r.useState)(!1),[O,F]=(0,r.useState)("full"),[R,z]=(0,r.useState)("en"),{copied:D,copy:K}=(0,n.C)();(0,r.useEffect)(()=>(z((0,i.kk)()),(0,i.oQ)(()=>z((0,i.kk)()))),[]);let I=o.includes(R),A=I?d:d.filter(e=>!e.wenyan);(0,r.useEffect)(()=>{let e=d.find(e=>e.id===M);e?.wenyan&&!I&&($("ultra"),W({cavemanLevel:"ultra"}))},[I,M]);let W=async e=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(e){(0,m.s)("Error updating setting:",e)}},G=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({rtkEnabled:e})})).ok&&a(e)}catch(e){(0,m.s)("Error updating rtkEnabled:",e)}},J=async()=>{let e=g.trim()||"http://localhost:8787";N(e),await W({headroomUrl:e}),Z()},Y=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/token-saver/vault-stats",{headers:{"Cache-Control":"no-store"}});e.ok&&b(await e.json())}catch{}},[]),Z=(0,r.useCallback)(async()=>{w(e=>({...e,loading:!0}));try{let e=await fetch("/api/headroom/status",{headers:{"Cache-Control":"no-store"}}),t=await e.json();w({...t,loading:!1})}catch{w({installed:!1,running:!1,python:null,loading:!1})}},[]),q=(0,r.useCallback)(async()=>{U(""),L(!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 Z()}catch(e){U(e.message)}finally{L(!1)}},[Z]),Q=(0,r.useCallback)(async()=>{L(!0);try{await fetch("/api/headroom/stop",{method:"POST"}),await Z()}finally{L(!1)}},[Z]);(0,r.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();a(!1!==t.rtkEnabled),j.current=t.tokenSaver&&"object"==typeof t.tokenSaver?t.tokenSaver:{},h(!!t.tokenSaver?.vault),u(t.tokenSaver?.vaultThresholdKB??8),v(!!t.headroomEnabled),N(t.headroomUrl||"http://localhost:8787"),_(!!t.cavemanEnabled),$(t.cavemanLevel||"full"),P(!!t.ponytailEnabled),F(t.ponytailLevel||"full"),Z()}}catch{}})()},[Z]),(0,r.useEffect)(()=>{Y()},[Y]);let V=!!k.running,X=k.loading?"Checking…":V?"Running":!1===k.localUrl||k.installed?!1!==k.localUrl?"Stopped":"External":"Not installed",ee=!1!==k.localUrl,et=!!k.canStart,ea=ee&&!!k.managedPid;return(0,s.jsxs)("div",{className:"space-y-6 p-6",children:[(0,s.jsxs)(l.Zp,{id:"rtk",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-primary",children:"bolt"}),"Token Saver"]})}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-2 pb-4 border-b border-border gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Compress tool output"," ",(0,s.jsx)("a",{href:"https://github.com/rtk-ai/rtk",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(RTK)"})]}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"git/grep/ls/tree/logs → 60-90% fewer input tokens"})]}),(0,s.jsx)(l.lM,{checked:t,onChange:()=>G(!t)})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-4 border-b border-border gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Compress context"," ",(0,s.jsx)("a",{href:"https://github.com/chopratejas/headroom",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Headroom)"})]}),(0,s.jsx)("span",{className:`text-xs px-2 py-0.5 rounded ${V?"bg-success/15 text-success":"bg-warning/15 text-warning"}`,children:X}),(0,s.jsx)("button",{type:"button",onClick:()=>S(!0),className:"text-xs text-primary underline hover:opacity-80",children:V?"Manage":"Setup"})]}),(0,s.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Compress prompts via /v1/compress before routing to the model"})]}),(0,s.jsx)(l.lM,{checked:y&&V,disabled:!V,onChange:()=>{var e;let t;return e=!y,void(N(t=g.trim()||"http://localhost:8787"),v(e),W({headroomEnabled:e,headroomUrl:t}))}})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-4 gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Compress LLM output"," ",(0,s.jsx)("a",{href:"https://github.com/JuliusBrussee/caveman",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Caveman)"})]}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Terse-style system prompt → ~65% fewer output tokens (up to 87%)"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[T&&(0,s.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,s.jsx)("div",{className:"flex items-center gap-1.5",children:A.map(e=>(0,s.jsx)("button",{onClick:()=>{var t;$(t=e.id),W({cavemanLevel:t})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${M===e.id?"bg-primary text-on-primary border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:e.desc,children:e.label},e.id))}),(0,s.jsx)("p",{className:"text-xs text-primary",children:d.find(e=>e.id===M)?.desc})]}),(0,s.jsx)(l.lM,{checked:T,onChange:()=>{var e;_(e=!T),W({cavemanEnabled:e})}})]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-4 mt-4 border-t border-border gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Lazy senior dev"," ",(0,s.jsx)("a",{href:"https://github.com/DietrichGebert/ponytail",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Ponytail)"})]}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Bias the model toward minimal code: YAGNI, reuse stdlib, deletion over addition"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[H&&(0,s.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,s.jsx)("div",{className:"flex items-center gap-1.5",children:c.map(e=>(0,s.jsx)("button",{onClick:()=>{var t;F(t=e.id),W({ponytailLevel:t})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${O===e.id?"bg-primary text-on-primary border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:e.desc,children:e.label},e.id))}),(0,s.jsx)("p",{className:"text-xs text-primary",children:c.find(e=>e.id===O)?.desc})]}),(0,s.jsx)(l.lM,{checked:H,onChange:()=>{var e;P(e=!H),W({ponytailEnabled:e})}})]})]})]}),(0,s.jsxs)(l.Zp,{id:"vault",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-primary",children:"inventory_2"}),"Conversation Vault"]})}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-2 pb-4 border-b border-border gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"font-medium",children:"Externalize large tool results"}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Store full results outside the conversation and search them when needed"})]}),(0,s.jsx)(l.lM,{checked:x,onChange:()=>{var e;let t;return e=!x,t={...j.current,vault:e},void(j.current=t,h(e),W({tokenSaver:t}))}})]}),(0,s.jsx)("div",{className:"py-4 border-b border-border",children:(0,s.jsx)(l.pd,{label:"Externalize tool results larger than (KB)",type:"number",min:7,step:1,value:p,onChange:e=>u(e.target.value),onBlur:()=>{let e=Math.max(7,Number.parseInt(p,10)||8),t={...j.current,vaultThresholdKB:e};j.current=t,u(e),W({tokenSaver:t})},className:"max-w-xs"})}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-4 gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Entries stored"}),(0,s.jsx)("p",{className:"font-mono font-medium",children:f.entries})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Search hits"}),(0,s.jsx)("p",{className:"font-mono font-medium",children:f.hits})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Bytes saved"}),(0,s.jsx)("p",{className:"font-mono font-medium",children:!Number.isFinite(e=Number(f.bytesSaved))||e<=0?"0 B":e<1024?`${Math.round(e)} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`})]})]}),(0,s.jsx)("button",{type:"button",onClick:Y,className:"text-xs text-primary underline hover:opacity-80",children:"Refresh"})]})]}),(0,s.jsx)(l.aF,{isOpen:C,title:V?"Headroom":"Setup Headroom",onClose:()=>S(!1),children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,s.jsx)("span",{children:"Status"}),(0,s.jsx)("span",{className:V?"text-success":"text-warning",children:X})]}),V&&(0,s.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,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Proxy URL"}),(0,s.jsx)(l.pd,{value:g,onChange:e=>N(e.target.value),onBlur:J,placeholder:"http://localhost:8787",className:"font-mono text-sm"}),(0,s.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."})]}),ea?(0,s.jsx)(l.$n,{onClick:Q,variant:"ghost",fullWidth:!0,disabled:E,children:E?"Stopping…":"Stop Headroom"}):V?(0,s.jsx)("p",{className:"text-sm text-success",children:"Headroom proxy is reachable. You can enable the token saver."}):et?(0,s.jsx)(l.$n,{onClick:q,fullWidth:!0,disabled:E,children:E?"Starting…":"Start Headroom"}):ee?k.python?(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Install then click Start:"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.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,s.jsx)(l.$n,{size:"sm",variant:"ghost",onClick:()=>K('pip install "headroom-ai[proxy]"'),children:D?"Copied":"Copy"})]})]}):(0,s.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,s.jsx)("p",{className:"text-sm text-warning",children:"Start Headroom separately at the configured URL, then recheck."}),B&&(0,s.jsx)("p",{className:"text-sm text-warning",children:B}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.$n,{onClick:()=>Z(),variant:"ghost",fullWidth:!0,children:"Recheck"}),(0,s.jsx)(l.$n,{onClick:()=>S(!1),fullWidth:!0,children:"Done"})]})]})})]})}}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=46357)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9839],{46357:(e,t,a)=>{Promise.resolve().then(a.bind(a,70323))},70323:(e,t,a)=>{"use strict";a.d(t,{default:()=>x});var s=a(95155),r=a(12115),l=a(35497),n=a(11059),i=a(73006);let o=["zh-CN"],d=[{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}],c=[{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"}];var m=a(78559);function x(){let e,[t,a]=(0,r.useState)(!0),[x,h]=(0,r.useState)(!1),[p,u]=(0,r.useState)(8),[f,b]=(0,r.useState)({entries:0,hits:0,bytesSaved:0}),j=(0,r.useRef)({}),[y,v]=(0,r.useState)(!1),[g,N]=(0,r.useState)("http://localhost:8787"),[k,w]=(0,r.useState)({installed:!1,running:!1,python:null,loading:!0}),[C,S]=(0,r.useState)(!1),[E,L]=(0,r.useState)(!1),[B,U]=(0,r.useState)(""),[T,_]=(0,r.useState)(!1),[M,$]=(0,r.useState)("full"),[H,P]=(0,r.useState)(!1),[O,F]=(0,r.useState)("full"),[R,z]=(0,r.useState)("en"),{copied:D,copy:K}=(0,n.C)();(0,r.useEffect)(()=>(z((0,i.kk)()),(0,i.oQ)(()=>z((0,i.kk)()))),[]);let I=o.includes(R),A=I?d:d.filter(e=>!e.wenyan);(0,r.useEffect)(()=>{let e=d.find(e=>e.id===M);e?.wenyan&&!I&&($("ultra"),W({cavemanLevel:"ultra"}))},[I,M]);let W=async e=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(e){(0,m.s)("Error updating setting:",e)}},G=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({rtkEnabled:e})})).ok&&a(e)}catch(e){(0,m.s)("Error updating rtkEnabled:",e)}},J=async()=>{let e=g.trim()||"http://localhost:8787";N(e),await W({headroomUrl:e}),Z()},Y=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/token-saver/vault-stats",{headers:{"Cache-Control":"no-store"}});e.ok&&b(await e.json())}catch{}},[]),Z=(0,r.useCallback)(async()=>{w(e=>({...e,loading:!0}));try{let e=await fetch("/api/headroom/status",{headers:{"Cache-Control":"no-store"}}),t=await e.json();w({...t,loading:!1})}catch{w({installed:!1,running:!1,python:null,loading:!1})}},[]),q=(0,r.useCallback)(async()=>{U(""),L(!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 Z()}catch(e){U(e.message)}finally{L(!1)}},[Z]),Q=(0,r.useCallback)(async()=>{L(!0);try{await fetch("/api/headroom/stop",{method:"POST"}),await Z()}finally{L(!1)}},[Z]);(0,r.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();a(!1!==t.rtkEnabled),j.current=t.tokenSaver&&"object"==typeof t.tokenSaver?t.tokenSaver:{},h(!!t.tokenSaver?.vault),u(t.tokenSaver?.vaultThresholdKB??8),v(!!t.headroomEnabled),N(t.headroomUrl||"http://localhost:8787"),_(!!t.cavemanEnabled),$(t.cavemanLevel||"full"),P(!!t.ponytailEnabled),F(t.ponytailLevel||"full"),Z()}}catch{}})()},[Z]),(0,r.useEffect)(()=>{Y()},[Y]);let V=!!k.running,X=k.loading?"Checking…":V?"Running":!1===k.localUrl||k.installed?!1!==k.localUrl?"Stopped":"External":"Not installed",ee=!1!==k.localUrl,et=!!k.canStart,ea=ee&&!!k.managedPid;return(0,s.jsxs)("div",{className:"space-y-6 p-6",children:[(0,s.jsxs)(l.Zp,{id:"rtk",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-primary",children:"bolt"}),"Token Saver"]})}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-2 pb-4 border-b border-border gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Compress tool output"," ",(0,s.jsx)("a",{href:"https://github.com/rtk-ai/rtk",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(RTK)"})]}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"git/grep/ls/tree/logs → 60-90% fewer input tokens"})]}),(0,s.jsx)(l.lM,{checked:t,onChange:()=>G(!t)})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-4 border-b border-border gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Compress context"," ",(0,s.jsx)("a",{href:"https://github.com/chopratejas/headroom",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Headroom)"})]}),(0,s.jsx)("span",{className:`text-xs px-2 py-0.5 rounded ${V?"bg-success/15 text-success":"bg-warning/15 text-warning"}`,children:X}),(0,s.jsx)("button",{type:"button",onClick:()=>S(!0),className:"text-xs text-primary underline hover:opacity-80",children:V?"Manage":"Setup"})]}),(0,s.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Compress prompts via /v1/compress before routing to the model"})]}),(0,s.jsx)(l.lM,{checked:y&&V,disabled:!V,onChange:()=>{var e;let t;return e=!y,void(N(t=g.trim()||"http://localhost:8787"),v(e),W({headroomEnabled:e,headroomUrl:t}))}})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-4 gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Compress LLM output"," ",(0,s.jsx)("a",{href:"https://github.com/JuliusBrussee/caveman",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Caveman)"})]}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Terse-style system prompt → ~65% fewer output tokens (up to 87%)"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[T&&(0,s.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,s.jsx)("div",{className:"flex items-center gap-1.5",children:A.map(e=>(0,s.jsx)("button",{onClick:()=>{var t;$(t=e.id),W({cavemanLevel:t})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${M===e.id?"bg-primary text-on-primary border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:e.desc,children:e.label},e.id))}),(0,s.jsx)("p",{className:"text-xs text-primary",children:d.find(e=>e.id===M)?.desc})]}),(0,s.jsx)(l.lM,{checked:T,onChange:()=>{var e;_(e=!T),W({cavemanEnabled:e})}})]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-4 mt-4 border-t border-border gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("p",{className:"font-medium",children:["Lazy senior dev"," ",(0,s.jsx)("a",{href:"https://github.com/DietrichGebert/ponytail",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Ponytail)"})]}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Bias the model toward minimal code: YAGNI, reuse stdlib, deletion over addition"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[H&&(0,s.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,s.jsx)("div",{className:"flex items-center gap-1.5",children:c.map(e=>(0,s.jsx)("button",{onClick:()=>{var t;F(t=e.id),W({ponytailLevel:t})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${O===e.id?"bg-primary text-on-primary border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:e.desc,children:e.label},e.id))}),(0,s.jsx)("p",{className:"text-xs text-primary",children:c.find(e=>e.id===O)?.desc})]}),(0,s.jsx)(l.lM,{checked:H,onChange:()=>{var e;P(e=!H),W({ponytailEnabled:e})}})]})]})]}),(0,s.jsxs)(l.Zp,{id:"vault",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-primary",children:"inventory_2"}),"Conversation Vault"]})}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-2 pb-4 border-b border-border gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"font-medium",children:"Externalize large tool results"}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Store full results outside the conversation and search them when needed"})]}),(0,s.jsx)(l.lM,{checked:x,onChange:()=>{var e;let t;return e=!x,t={...j.current,vault:e},void(j.current=t,h(e),W({tokenSaver:t}))}})]}),(0,s.jsx)("div",{className:"py-4 border-b border-border",children:(0,s.jsx)(l.pd,{label:"Externalize tool results larger than (KB)",type:"number",min:7,step:1,value:p,onChange:e=>u(e.target.value),onBlur:()=>{let e=Math.max(7,Number.parseInt(p,10)||8),t={...j.current,vaultThresholdKB:e};j.current=t,u(e),W({tokenSaver:t})},className:"max-w-xs"})}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-4 gap-4 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Entries stored"}),(0,s.jsx)("p",{className:"font-mono font-medium",children:f.entries})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Search hits"}),(0,s.jsx)("p",{className:"font-mono font-medium",children:f.hits})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Bytes saved"}),(0,s.jsx)("p",{className:"font-mono font-medium",children:!Number.isFinite(e=Number(f.bytesSaved))||e<=0?"0 B":e<1024?`${Math.round(e)} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`})]})]}),(0,s.jsx)("button",{type:"button",onClick:Y,className:"text-xs text-primary underline hover:opacity-80",children:"Refresh"})]})]}),(0,s.jsx)(l.aF,{isOpen:C,title:V?"Headroom":"Setup Headroom",onClose:()=>S(!1),children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,s.jsx)("span",{children:"Status"}),(0,s.jsx)("span",{className:V?"text-success":"text-warning",children:X})]}),V&&(0,s.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,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Proxy URL"}),(0,s.jsx)(l.pd,{value:g,onChange:e=>N(e.target.value),onBlur:J,placeholder:"http://localhost:8787",className:"font-mono text-sm"}),(0,s.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."})]}),ea?(0,s.jsx)(l.$n,{onClick:Q,variant:"ghost",fullWidth:!0,disabled:E,children:E?"Stopping…":"Stop Headroom"}):V?(0,s.jsx)("p",{className:"text-sm text-success",children:"Headroom proxy is reachable. You can enable the token saver."}):et?(0,s.jsx)(l.$n,{onClick:q,fullWidth:!0,disabled:E,children:E?"Starting…":"Start Headroom"}):ee?k.python?(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Install then click Start:"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.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,s.jsx)(l.$n,{size:"sm",variant:"ghost",onClick:()=>K('pip install "headroom-ai[proxy]"'),children:D?"Copied":"Copy"})]})]}):(0,s.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,s.jsx)("p",{className:"text-sm text-warning",children:"Start Headroom separately at the configured URL, then recheck."}),B&&(0,s.jsx)("p",{className:"text-sm text-warning",children:B}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.$n,{onClick:()=>Z(),variant:"ghost",fullWidth:!0,children:"Recheck"}),(0,s.jsx)(l.$n,{onClick:()=>S(!1),fullWidth:!0,children:"Done"})]})]})})]})}}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=46357)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3528],{5214:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return r.workAsyncStorageInstance}});let r=n(17828)},17828:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return r}});let r=(0,n(64054).createAsyncLocalStorage)()},21957:(e,t,n)=>{"use strict";function r({moduleIds:e}){return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return r}}),n(95155),n(47650),n(5214),n(2451),n(53887)},41112:(e,t,n)=>{"use strict";function r({reason:e,children:t}){return t}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return r}}),n(1980)},51473:(e,t,n)=>{Promise.resolve().then(n.bind(n,69472))},64054:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={bindSnapshot:function(){return i},createAsyncLocalStorage:function(){return l},createSnapshot:function(){return d}};for(var r in n)Object.defineProperty(t,r,{enumerable:!0,get:n[r]});let a=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class s{disable(){throw a}getStore(){}run(){throw a}exit(){throw a}enterWith(){throw a}static bind(e){return e}}let o="u">typeof globalThis&&globalThis.AsyncLocalStorage;function l(){return o?new o:new s}function i(e){return o?o.bind(e):s.bind(e)}function d(){return o?o.snapshot():function(e,...t){return e(...t)}}},68635:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});let r=n(95155),a=n(12115),s=n(41112);function o(e){return{default:e&&"default"in e?e.default:e}}n(21957);let l={loader:()=>Promise.resolve(o(()=>null)),loading:null,ssr:!0},i=function(e){let t={...l,...e},n=(0,a.lazy)(()=>t.loader().then(o)),i=t.loading;function d(e){let o=i?(0,r.jsx)(i,{isLoading:!0,pastDelay:!0,error:null}):null,l=!t.ssr||!!t.loading,d=l?a.Suspense:a.Fragment,c=t.ssr?(0,r.jsxs)(r.Fragment,{children:[null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(s.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(d,{...l?{fallback:o}:{},children:c})}return d.displayName="LoadableComponent",d}},69472:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>f});var r=n(95155),a=n(12115),s=n(35497),o=n(11059),l=n(75707),i=n.n(l),d=n(78559);let c=i()(()=>n.e(8202).then(n.bind(n,28202)),{loadableGenerated:{webpack:()=>[28202]},ssr:!1}),u=[{id:1,label:"Client Request",file:"1_req_client.json",lang:"json",desc:"Raw request from client"},{id:2,label:"Source Body",file:"2_req_source.json",lang:"json",desc:"After initial conversion"},{id:3,label:"OpenAI Intermediate",file:"3_req_openai.json",lang:"json",desc:"source → openai"},{id:4,label:"Target Request",file:"4_req_target.json",lang:"json",desc:"openai → target + URL + headers"},{id:5,label:"Provider Response",file:"5_res_provider.txt",lang:"text",desc:"Raw SSE from provider"},{id:6,label:"OpenAI Response",file:"6_res_openai.txt",lang:"text",desc:"target → openai (response)"},{id:7,label:"Client Response",file:"7_res_client.txt",lang:"text",desc:"Final response to client"}],p={minimap:{enabled:!1},fontSize:12,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0};function f(){let[e,t]=(0,a.useState)({}),[n,l]=(0,a.useState)({1:!0}),[i,f]=(0,a.useState)({}),[x,g]=(0,a.useState)(null),h=(e,t)=>f(n=>({...n,[e]:t})),b=(e,n)=>t(t=>({...t,[e]:n})),y=e=>l(t=>{let n={};return u.forEach(e=>{n[e.id]=!1}),n[e]=!0,n}),j=async e=>{let t=u.find(t=>t.id===e);h(`load-${e}`,!0);try{let n=await fetch(`/api/translator/load?file=${t.file}`),r=await n.json();r.success?(b(e,r.content),1===e&&await _(r.content)):(0,d.s)(r.error||"File not found")}catch(e){(0,d.s)(e.message)}h(`load-${e}`,!1)},_=async e=>{try{let t="string"==typeof e?JSON.parse(e):e,n=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:1,body:t})}),r=await n.json();r.success&&g(r.result)}catch{}},v=(e,t)=>fetch("/api/translator/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,content:t})}).catch(()=>{}),O=async()=>{h("toOpenAI",!0);try{let t=e[1],n=JSON.parse(t);v("1_req_client.json",t),v("2_req_source.json",JSON.stringify({timestamp:new Date().toISOString(),headers:{},body:n.body||n},null,2));let r=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:2,body:n})}),a=await r.json();if(!a.success)return void(0,d.s)(a.error);let s=JSON.stringify(a.result.body,null,2);b(3,s),y(3)}catch(e){(0,d.s)(e.message)}h("toOpenAI",!1)},S=async()=>{h("toTarget",!0);try{let t=e[3],n=JSON.parse(t);v("3_req_openai.json",t);let r=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:3,body:{...n,provider:x?.provider,model:x?.model}})}),a=await r.json();if(!a.success)return void(0,d.s)(a.error);let s={...a.result,provider:x?.provider,model:x?.model};b(4,JSON.stringify(s,null,2)),y(4)}catch(e){(0,d.s)(e.message)}h("toTarget",!1)},w=async()=>{h("send",!0);try{let t=e[4],n=JSON.parse(t);v("4_req_target.json",t);let r=n.provider||x?.provider,a=n.model||x?.model;if(!r||!a)return void(0,d.s)("Missing provider or model. Please run step 1 first to detect them.");let s=await fetch("/api/translator/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,model:a,body:n.body||n})});if(!s.ok){let e=await s.json().catch(()=>({error:s.statusText}));(0,d.s)(e.error||"Send failed");return}let o=s.body.getReader(),l=new TextDecoder,i="";for(;;){let{done:e,value:t}=await o.read();if(e)break;i+=l.decode(t,{stream:!0})}b(5,i),y(5),await fetch("/api/translator/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:"5_res_provider.txt",content:i})})}catch(e){(0,d.s)(e.message)}finally{h("send",!1)}},{copy:N}=(0,o.C)(),P=async t=>{e[t]&&N(e[t],`translator-step-${t}`)};return(0,r.jsxs)("div",{className:"p-8 space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-text-main",children:"Translator Debug"}),(0,r.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Replay request flow — matches log files"})]}),x&&(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap justify-end",children:[(0,r.jsx)(m,{label:"src",value:x.sourceFormat,color:"blue"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,r.jsx)(m,{label:"dst",value:x.targetFormat,color:"orange"}),(0,r.jsx)(m,{label:"provider",value:x.provider,color:"green"}),(0,r.jsx)(m,{label:"model",value:x.model,color:"purple"})]})]}),u.map(t=>{var a;let o=1===(a=t.id)?(0,r.jsx)(s.$n,{size:"sm",icon:"arrow_forward",loading:i.toOpenAI,onClick:O,children:"→ OpenAI"}):3===a?(0,r.jsx)(s.$n,{size:"sm",icon:"arrow_forward",loading:i.toTarget,onClick:S,children:"→ Target"}):4===a?(0,r.jsx)(s.$n,{size:"sm",icon:"send",loading:i.send,onClick:w,children:"Send"}):null,d=!!n[t.id],u=e[t.id]||"";return(0,r.jsx)(s.Zp,{children:(0,r.jsxs)("div",{className:"p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("button",{onClick:()=>{let e;return e=t.id,l(t=>({...t,[e]:!t[e]}))},className:"flex items-center gap-2 flex-1 text-left group",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px] text-text-muted group-hover:text-primary transition-colors",children:d?"expand_more":"chevron_right"}),(0,r.jsx)("span",{className:"text-xs font-mono text-text-muted/60 w-4",children:t.id}),(0,r.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:t.label}),(0,r.jsx)("span",{className:"text-xs text-text-muted/60 font-mono",children:t.file}),u&&(0,r.jsxs)("span",{className:"text-xs text-green-500",children:["(",u.length," chars)"]})]}),!d&&(0,r.jsxs)("div",{className:"flex gap-1 shrink-0",children:[(0,r.jsx)(s.$n,{size:"sm",variant:"ghost",icon:"folder_open",loading:i[`load-${t.id}`],onClick:()=>j(t.id)}),o]})]}),d&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,r.jsx)(c,{height:"400px",defaultLanguage:"text"===t.lang?"plaintext":"json",value:u,onChange:e=>{b(t.id,e||""),1===t.id&&_(e||"")},theme:"vs-dark",options:p})}),(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,r.jsx)(s.$n,{size:"sm",variant:"outline",icon:"folder_open",loading:i[`load-${t.id}`],onClick:()=>j(t.id),children:"Load"}),(0,r.jsx)(s.$n,{size:"sm",variant:"outline",icon:"data_object",onClick:()=>(t=>{try{let n=JSON.parse(e[t]);b(t,JSON.stringify(n,null,2))}catch{}})(t.id),children:"Format"}),(0,r.jsx)(s.$n,{size:"sm",variant:"outline",icon:"content_copy",onClick:()=>P(t.id),children:"Copy"}),o]})]})]})},t.id)})]})}function m({label:e,value:t,color:n}){return(0,r.jsxs)("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-mono ${{blue:"bg-blue-500/10 text-blue-500",orange:"bg-orange-500/10 text-orange-500",green:"bg-green-500/10 text-green-500",purple:"bg-purple-500/10 text-purple-500"}[n]}`,children:[(0,r.jsxs)("span",{className:"text-text-muted/70 font-sans text-[10px]",children:[e,":"]}),t]})}},75707:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let r=n(73623)._(n(68635));function a(e,t){let n={};"function"==typeof e&&(n.loader=e);let a={...n,...t};return(0,r.default)({...a,modules:a.loadableGenerated?.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=51473)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3528],{5214:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return r.workAsyncStorageInstance}});let r=n(17828)},17828:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return r}});let r=(0,n(64054).createAsyncLocalStorage)()},21957:(e,t,n)=>{"use strict";function r({moduleIds:e}){return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return r}}),n(95155),n(47650),n(5214),n(2451),n(53887)},41112:(e,t,n)=>{"use strict";function r({reason:e,children:t}){return t}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return r}}),n(1980)},51473:(e,t,n)=>{Promise.resolve().then(n.bind(n,69472))},64054:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={bindSnapshot:function(){return i},createAsyncLocalStorage:function(){return l},createSnapshot:function(){return d}};for(var r in n)Object.defineProperty(t,r,{enumerable:!0,get:n[r]});let a=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class s{disable(){throw a}getStore(){}run(){throw a}exit(){throw a}enterWith(){throw a}static bind(e){return e}}let o="u">typeof globalThis&&globalThis.AsyncLocalStorage;function l(){return o?new o:new s}function i(e){return o?o.bind(e):s.bind(e)}function d(){return o?o.snapshot():function(e,...t){return e(...t)}}},68635:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});let r=n(95155),a=n(12115),s=n(41112);function o(e){return{default:e&&"default"in e?e.default:e}}n(21957);let l={loader:()=>Promise.resolve(o(()=>null)),loading:null,ssr:!0},i=function(e){let t={...l,...e},n=(0,a.lazy)(()=>t.loader().then(o)),i=t.loading;function d(e){let o=i?(0,r.jsx)(i,{isLoading:!0,pastDelay:!0,error:null}):null,l=!t.ssr||!!t.loading,d=l?a.Suspense:a.Fragment,c=t.ssr?(0,r.jsxs)(r.Fragment,{children:[null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(s.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(d,{...l?{fallback:o}:{},children:c})}return d.displayName="LoadableComponent",d}},69472:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>f});var r=n(95155),a=n(12115),s=n(35497),o=n(11059),l=n(75707),i=n.n(l),d=n(78559);let c=i()(()=>n.e(8202).then(n.bind(n,28202)),{loadableGenerated:{webpack:()=>[28202]},ssr:!1}),u=[{id:1,label:"Client Request",file:"1_req_client.json",lang:"json",desc:"Raw request from client"},{id:2,label:"Source Body",file:"2_req_source.json",lang:"json",desc:"After initial conversion"},{id:3,label:"OpenAI Intermediate",file:"3_req_openai.json",lang:"json",desc:"source → openai"},{id:4,label:"Target Request",file:"4_req_target.json",lang:"json",desc:"openai → target + URL + headers"},{id:5,label:"Provider Response",file:"5_res_provider.txt",lang:"text",desc:"Raw SSE from provider"},{id:6,label:"OpenAI Response",file:"6_res_openai.txt",lang:"text",desc:"target → openai (response)"},{id:7,label:"Client Response",file:"7_res_client.txt",lang:"text",desc:"Final response to client"}],p={minimap:{enabled:!1},fontSize:12,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0};function f(){let[e,t]=(0,a.useState)({}),[n,l]=(0,a.useState)({1:!0}),[i,f]=(0,a.useState)({}),[x,g]=(0,a.useState)(null),h=(e,t)=>f(n=>({...n,[e]:t})),b=(e,n)=>t(t=>({...t,[e]:n})),y=e=>l(t=>{let n={};return u.forEach(e=>{n[e.id]=!1}),n[e]=!0,n}),j=async e=>{let t=u.find(t=>t.id===e);h(`load-${e}`,!0);try{let n=await fetch(`/api/translator/load?file=${t.file}`),r=await n.json();r.success?(b(e,r.content),1===e&&await _(r.content)):(0,d.s)(r.error||"File not found")}catch(e){(0,d.s)(e.message)}h(`load-${e}`,!1)},_=async e=>{try{let t="string"==typeof e?JSON.parse(e):e,n=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:1,body:t})}),r=await n.json();r.success&&g(r.result)}catch{}},v=(e,t)=>fetch("/api/translator/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,content:t})}).catch(()=>{}),O=async()=>{h("toOpenAI",!0);try{let t=e[1],n=JSON.parse(t);v("1_req_client.json",t),v("2_req_source.json",JSON.stringify({timestamp:new Date().toISOString(),headers:{},body:n.body||n},null,2));let r=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:2,body:n})}),a=await r.json();if(!a.success)return void(0,d.s)(a.error);let s=JSON.stringify(a.result.body,null,2);b(3,s),y(3)}catch(e){(0,d.s)(e.message)}h("toOpenAI",!1)},S=async()=>{h("toTarget",!0);try{let t=e[3],n=JSON.parse(t);v("3_req_openai.json",t);let r=await fetch("/api/translator/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step:3,body:{...n,provider:x?.provider,model:x?.model}})}),a=await r.json();if(!a.success)return void(0,d.s)(a.error);let s={...a.result,provider:x?.provider,model:x?.model};b(4,JSON.stringify(s,null,2)),y(4)}catch(e){(0,d.s)(e.message)}h("toTarget",!1)},w=async()=>{h("send",!0);try{let t=e[4],n=JSON.parse(t);v("4_req_target.json",t);let r=n.provider||x?.provider,a=n.model||x?.model;if(!r||!a)return void(0,d.s)("Missing provider or model. Please run step 1 first to detect them.");let s=await fetch("/api/translator/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,model:a,body:n.body||n})});if(!s.ok){let e=await s.json().catch(()=>({error:s.statusText}));(0,d.s)(e.error||"Send failed");return}let o=s.body.getReader(),l=new TextDecoder,i="";for(;;){let{done:e,value:t}=await o.read();if(e)break;i+=l.decode(t,{stream:!0})}b(5,i),y(5),await fetch("/api/translator/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:"5_res_provider.txt",content:i})})}catch(e){(0,d.s)(e.message)}finally{h("send",!1)}},{copy:N}=(0,o.C)(),P=async t=>{e[t]&&N(e[t],`translator-step-${t}`)};return(0,r.jsxs)("div",{className:"p-8 space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-text-main",children:"Translator Debug"}),(0,r.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Replay request flow — matches log files"})]}),x&&(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap justify-end",children:[(0,r.jsx)(m,{label:"src",value:x.sourceFormat,color:"blue"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,r.jsx)(m,{label:"dst",value:x.targetFormat,color:"orange"}),(0,r.jsx)(m,{label:"provider",value:x.provider,color:"green"}),(0,r.jsx)(m,{label:"model",value:x.model,color:"purple"})]})]}),u.map(t=>{var a;let o=1===(a=t.id)?(0,r.jsx)(s.$n,{size:"sm",icon:"arrow_forward",loading:i.toOpenAI,onClick:O,children:"→ OpenAI"}):3===a?(0,r.jsx)(s.$n,{size:"sm",icon:"arrow_forward",loading:i.toTarget,onClick:S,children:"→ Target"}):4===a?(0,r.jsx)(s.$n,{size:"sm",icon:"send",loading:i.send,onClick:w,children:"Send"}):null,d=!!n[t.id],u=e[t.id]||"";return(0,r.jsx)(s.Zp,{children:(0,r.jsxs)("div",{className:"p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("button",{onClick:()=>{let e;return e=t.id,l(t=>({...t,[e]:!t[e]}))},className:"flex items-center gap-2 flex-1 text-left group",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px] text-text-muted group-hover:text-primary transition-colors",children:d?"expand_more":"chevron_right"}),(0,r.jsx)("span",{className:"text-xs font-mono text-text-muted/60 w-4",children:t.id}),(0,r.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:t.label}),(0,r.jsx)("span",{className:"text-xs text-text-muted/60 font-mono",children:t.file}),u&&(0,r.jsxs)("span",{className:"text-xs text-green-500",children:["(",u.length," chars)"]})]}),!d&&(0,r.jsxs)("div",{className:"flex gap-1 shrink-0",children:[(0,r.jsx)(s.$n,{size:"sm",variant:"ghost",icon:"folder_open",loading:i[`load-${t.id}`],onClick:()=>j(t.id)}),o]})]}),d&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,r.jsx)(c,{height:"400px",defaultLanguage:"text"===t.lang?"plaintext":"json",value:u,onChange:e=>{b(t.id,e||""),1===t.id&&_(e||"")},theme:"vs-dark",options:p})}),(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,r.jsx)(s.$n,{size:"sm",variant:"outline",icon:"folder_open",loading:i[`load-${t.id}`],onClick:()=>j(t.id),children:"Load"}),(0,r.jsx)(s.$n,{size:"sm",variant:"outline",icon:"data_object",onClick:()=>(t=>{try{let n=JSON.parse(e[t]);b(t,JSON.stringify(n,null,2))}catch{}})(t.id),children:"Format"}),(0,r.jsx)(s.$n,{size:"sm",variant:"outline",icon:"content_copy",onClick:()=>P(t.id),children:"Copy"}),o]})]})]})},t.id)})]})}function m({label:e,value:t,color:n}){return(0,r.jsxs)("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-mono ${{blue:"bg-blue-500/10 text-blue-500",orange:"bg-orange-500/10 text-orange-500",green:"bg-green-500/10 text-green-500",purple:"bg-purple-500/10 text-purple-500"}[n]}`,children:[(0,r.jsxs)("span",{className:"text-text-muted/70 font-sans text-[10px]",children:[e,":"]}),t]})}},75707:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let r=n(73623)._(n(68635));function a(e,t){let n={};"function"==typeof e&&(n.loader=e);let a={...n,...t};return(0,r.default)({...a,modules:a.loadableGenerated?.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=51473)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2825],{81772:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>y});var a=s(95155),n=s(12115),l=s(73321),r=s(35497),i=s(84588),o=s(92542),d=s(31474);function c({isOpen:e,onClose:t,title:s,children:l,width:r="md",className:i}){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,d.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[r]||o.md,i),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}function x({currentPage:e,pageSize:t,totalItems:s,onPageChange:n,onPageSizeChange:l,className:r}){let i=Math.ceil(s/t),c=s>0?(e-1)*t+1:0,m=Math.min(e*t,s),h=(()=>{let t=[],s=Math.max(1,e-2),a=Math.min(i,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,d.cn)("flex flex-col sm:flex-row items-center justify-between gap-4 py-4 px-2",r),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:c})," to"," ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:m})," 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)("select",{value:t,onChange:e=>l(Number(e.target.value)),className:(0,d.cn)("h-9 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer"),style:{colorScheme:"auto"},children:[10,20,50].map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]}),i>1&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(o.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"})}),h[0]>1&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.default,{variant:"ghost",size:"sm",onClick:()=>n(1),className:"w-9 px-0 hidden sm:inline-flex",children:"1"}),h[0]>2&&(0,a.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."})]}),h.map(t=>(0,a.jsx)(o.default,{variant:e===t?"primary":"ghost",size:"sm",onClick:()=>n(t),className:(0,d.cn)("w-9 px-0",e===t?"inline-flex":"hidden sm:inline-flex"),children:t},t)),h[h.length-1]<i&&(0,a.jsxs)(a.Fragment,{children:[h[h.length-1]<i-1&&(0,a.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."}),(0,a.jsx)(o.default,{variant:"ghost",size:"sm",onClick:()=>n(i),className:"w-9 px-0 hidden sm:inline-flex",children:i})]}),(0,a.jsx)(o.default,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===i,className:"w-9 px-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})]})]})}var m=s(88105),h=s(78559);let p=null,u=null;async function f(){if(p&&u)return{providerNameCache:p,providerNodesCache:u};let e=await fetch("/api/provider-nodes"),t=(await e.json()).nodes||[];for(let e of(u={},t))u[e.id]=e.name;return{providerNameCache:p={...m.Q2,...u},providerNodesCache:u}}function b(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,m.zt)(e)||m.Q2[e];return a?.name||e}function j({title:e,children:t,defaultOpen:s=!1,icon:l=null}){let[r,i]=(0,n.useState)(s);return(0,a.jsxs)("div",{className:"border border-black/5 dark:border-white/5 rounded-lg overflow-hidden",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(!r),className:"w-full flex items-center justify-between p-3 bg-black/[0.02] dark:bg-white/[0.02] hover:bg-black/[0.04] dark:hover:bg-white/[0.04] 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-text-muted",children:l}),(0,a.jsx)("span",{className:"font-semibold text-sm text-text-main",children:e})]}),(0,a.jsx)("span",{className:(0,d.cn)("material-symbols-outlined text-[20px] text-text-muted transition-transform duration-200",r?"rotate-90":""),children:"chevron_right"})]}),r&&(0,a.jsx)("div",{className:"p-4 border-t border-black/5 dark:border-white/5",children:t})]})}function g(e){return e?.cached_tokens||e?.cache_read_input_tokens||0}function v(e){return e?.cache_creation_input_tokens||0}function N(e){let t=e?.prompt_tokens||e?.input_tokens||0,s=g(e);return t<s?s:t}function w(){let[e,t]=(0,n.useState)([]),[s,l]=(0,n.useState)({page:1,pageSize:20,totalItems:0,totalPages:0}),[r,m]=(0,n.useState)(!1),[p,u]=(0,n.useState)(null),[w,k]=(0,n.useState)(!1),[y,S]=(0,n.useState)([]),[C,D]=(0,n.useState)(null),[_,z]=(0,n.useState)({provider:"",startDate:"",endDate:""}),T=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/usage/providers"),t=await e.json();S(t.providers||[]);let s=await f();D(s.providerNameCache)}catch(e){(0,h.s)("Failed to fetch providers:",e)}},[]),L=(0,n.useCallback)(async()=>{m(!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){(0,h.s)("Failed to fetch request details:",e)}finally{m(!1)}},[s.page,s.pageSize,_]);return(0,n.useEffect)(()=>{T()},[T]),(0,n.useEffect)(()=>{L()},[L]),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,a.jsx)(i.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",{htmlFor:"provider-filter",className:"text-sm font-medium text-text-main",children:"Provider"}),(0,a.jsxs)("select",{id:"provider-filter",value:_.provider,onChange:e=>z({..._,provider:e.target.value}),className:(0,d.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","w-full min-w-0 cursor-pointer"),style:{colorScheme:"auto"},children:[(0,a.jsx)("option",{value:"",children:"All Providers"}),y.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(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=>z({..._,startDate:e.target.value}),className:(0,d.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 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=>z({..._,endDate:e.target.value}),className:(0,d.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 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)(o.default,{variant:"ghost",onClick:()=>{z({provider:"",startDate:"",endDate:""})},disabled:!_.provider&&!_.startDate&&!_.endDate,className:"w-full",children:"Clear Filters"})]})]})}),(0,a.jsxs)(i.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-black/5 dark:border-white/5",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:r?(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-black/5 dark:border-white/5 last:border-b-0 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] 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:b(e.provider,C)})}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:N(e.tokens).toLocaleString()}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:g(e.tokens)>0?g(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: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)(o.default,{variant:"outline",size:"sm",onClick:()=>{u(e),k(!0)},children:"Detail"})})]},`${e.id}-${t}`))})]})}),!r&&e.length>0&&(0,a.jsx)("div",{className:"border-t border-black/5 dark:border-white/5",children:(0,a.jsx)(x,{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:w,onClose:()=>k(!1),title:"Request Details",width:"lg",children:p&&(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:p.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(p.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:b(p.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:p.model})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Status:"})," ",(0,a.jsx)("span",{className:(0,d.cn)("font-medium","success"===p.status?"text-green-600":"text-red-600"),children:p.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 ",p.latency?.ttft||0,"ms / Total ",p.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:N(p.tokens).toLocaleString()})]}),g(p.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:g(p.tokens).toLocaleString()})]}),v(p.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:v(p.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:p.tokens?.completion_tokens?.toLocaleString()||0})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(j,{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-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:JSON.stringify(p.request,null,2)})}),p.providerRequest&&(0,a.jsx)(j,{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-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:JSON.stringify(p.providerRequest,null,2)})}),p.providerResponse&&(0,a.jsx)(j,{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-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:"object"==typeof p.providerResponse?JSON.stringify(p.providerResponse,null,2):p.providerResponse})}),(0,a.jsxs)(j,{title:"4. Client Response (Final)",defaultOpen:!0,icon:"output",children:[p.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]",children:"psychology"}),"Thinking Process"]}),(0,a.jsx)("pre",{className:"max-h-[200px] max-w-full overflow-auto rounded-lg border border-amber-200 bg-amber-50 p-3 font-mono text-xs text-amber-900 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-100 sm:p-4",children:p.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-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:p.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"}];function y(){return(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(S,{})})}function S(){let e=(0,l.useSearchParams)(),t=(0,l.useRouter)(),[s,i]=(0,n.useState)("today"),o=e.get("tab"),d=o&&["overview","logs","details"].includes(o)?o:"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 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)(r.Iz,{options:[{value:"overview",label:"Overview"},{value:"details",label:"Details"}],value:d,onChange:s=>{if(s===d)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"===d&&(0,a.jsx)(r.Iz,{options:k,value:s,onChange:i,size:"sm",className:"w-full sm:w-auto"})]}),"overview"===d&&(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(r.jK,{period:s,setPeriod:i,hidePeriodSelector:!0})}),"logs"===d&&(0,a.jsx)(r.gM,{}),"details"===d&&(0,a.jsx)(w,{})]})}},87618:(e,t,s)=>{Promise.resolve().then(s.bind(s,81772))}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=87618)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2825],{81772:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>y});var a=s(95155),n=s(12115),l=s(73321),r=s(35497),i=s(84588),o=s(92542),d=s(31474);function c({isOpen:e,onClose:t,title:s,children:l,width:r="md",className:i}){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,d.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[r]||o.md,i),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}function x({currentPage:e,pageSize:t,totalItems:s,onPageChange:n,onPageSizeChange:l,className:r}){let i=Math.ceil(s/t),c=s>0?(e-1)*t+1:0,m=Math.min(e*t,s),h=(()=>{let t=[],s=Math.max(1,e-2),a=Math.min(i,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,d.cn)("flex flex-col sm:flex-row items-center justify-between gap-4 py-4 px-2",r),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:c})," to"," ",(0,a.jsx)("span",{className:"font-medium text-text-main",children:m})," 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)("select",{value:t,onChange:e=>l(Number(e.target.value)),className:(0,d.cn)("h-9 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer"),style:{colorScheme:"auto"},children:[10,20,50].map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]}),i>1&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(o.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"})}),h[0]>1&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.default,{variant:"ghost",size:"sm",onClick:()=>n(1),className:"w-9 px-0 hidden sm:inline-flex",children:"1"}),h[0]>2&&(0,a.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."})]}),h.map(t=>(0,a.jsx)(o.default,{variant:e===t?"primary":"ghost",size:"sm",onClick:()=>n(t),className:(0,d.cn)("w-9 px-0",e===t?"inline-flex":"hidden sm:inline-flex"),children:t},t)),h[h.length-1]<i&&(0,a.jsxs)(a.Fragment,{children:[h[h.length-1]<i-1&&(0,a.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."}),(0,a.jsx)(o.default,{variant:"ghost",size:"sm",onClick:()=>n(i),className:"w-9 px-0 hidden sm:inline-flex",children:i})]}),(0,a.jsx)(o.default,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===i,className:"w-9 px-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})]})]})}var m=s(88105),h=s(78559);let p=null,u=null;async function f(){if(p&&u)return{providerNameCache:p,providerNodesCache:u};let e=await fetch("/api/provider-nodes"),t=(await e.json()).nodes||[];for(let e of(u={},t))u[e.id]=e.name;return{providerNameCache:p={...m.Q2,...u},providerNodesCache:u}}function b(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,m.zt)(e)||m.Q2[e];return a?.name||e}function j({title:e,children:t,defaultOpen:s=!1,icon:l=null}){let[r,i]=(0,n.useState)(s);return(0,a.jsxs)("div",{className:"border border-black/5 dark:border-white/5 rounded-lg overflow-hidden",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(!r),className:"w-full flex items-center justify-between p-3 bg-black/[0.02] dark:bg-white/[0.02] hover:bg-black/[0.04] dark:hover:bg-white/[0.04] 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-text-muted",children:l}),(0,a.jsx)("span",{className:"font-semibold text-sm text-text-main",children:e})]}),(0,a.jsx)("span",{className:(0,d.cn)("material-symbols-outlined text-[20px] text-text-muted transition-transform duration-200",r?"rotate-90":""),children:"chevron_right"})]}),r&&(0,a.jsx)("div",{className:"p-4 border-t border-black/5 dark:border-white/5",children:t})]})}function g(e){return e?.cached_tokens||e?.cache_read_input_tokens||0}function v(e){return e?.cache_creation_input_tokens||0}function N(e){let t=e?.prompt_tokens||e?.input_tokens||0,s=g(e);return t<s?s:t}function w(){let[e,t]=(0,n.useState)([]),[s,l]=(0,n.useState)({page:1,pageSize:20,totalItems:0,totalPages:0}),[r,m]=(0,n.useState)(!1),[p,u]=(0,n.useState)(null),[w,k]=(0,n.useState)(!1),[y,S]=(0,n.useState)([]),[C,D]=(0,n.useState)(null),[_,z]=(0,n.useState)({provider:"",startDate:"",endDate:""}),T=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/usage/providers"),t=await e.json();S(t.providers||[]);let s=await f();D(s.providerNameCache)}catch(e){(0,h.s)("Failed to fetch providers:",e)}},[]),L=(0,n.useCallback)(async()=>{m(!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){(0,h.s)("Failed to fetch request details:",e)}finally{m(!1)}},[s.page,s.pageSize,_]);return(0,n.useEffect)(()=>{T()},[T]),(0,n.useEffect)(()=>{L()},[L]),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,a.jsx)(i.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",{htmlFor:"provider-filter",className:"text-sm font-medium text-text-main",children:"Provider"}),(0,a.jsxs)("select",{id:"provider-filter",value:_.provider,onChange:e=>z({..._,provider:e.target.value}),className:(0,d.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","w-full min-w-0 cursor-pointer"),style:{colorScheme:"auto"},children:[(0,a.jsx)("option",{value:"",children:"All Providers"}),y.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(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=>z({..._,startDate:e.target.value}),className:(0,d.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 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=>z({..._,endDate:e.target.value}),className:(0,d.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 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)(o.default,{variant:"ghost",onClick:()=>{z({provider:"",startDate:"",endDate:""})},disabled:!_.provider&&!_.startDate&&!_.endDate,className:"w-full",children:"Clear Filters"})]})]})}),(0,a.jsxs)(i.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-black/5 dark:border-white/5",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:r?(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-black/5 dark:border-white/5 last:border-b-0 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] 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:b(e.provider,C)})}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:N(e.tokens).toLocaleString()}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:g(e.tokens)>0?g(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: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)(o.default,{variant:"outline",size:"sm",onClick:()=>{u(e),k(!0)},children:"Detail"})})]},`${e.id}-${t}`))})]})}),!r&&e.length>0&&(0,a.jsx)("div",{className:"border-t border-black/5 dark:border-white/5",children:(0,a.jsx)(x,{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:w,onClose:()=>k(!1),title:"Request Details",width:"lg",children:p&&(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:p.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(p.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:b(p.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:p.model})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Status:"})," ",(0,a.jsx)("span",{className:(0,d.cn)("font-medium","success"===p.status?"text-green-600":"text-red-600"),children:p.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 ",p.latency?.ttft||0,"ms / Total ",p.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:N(p.tokens).toLocaleString()})]}),g(p.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:g(p.tokens).toLocaleString()})]}),v(p.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:v(p.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:p.tokens?.completion_tokens?.toLocaleString()||0})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(j,{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-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:JSON.stringify(p.request,null,2)})}),p.providerRequest&&(0,a.jsx)(j,{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-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:JSON.stringify(p.providerRequest,null,2)})}),p.providerResponse&&(0,a.jsx)(j,{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-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:"object"==typeof p.providerResponse?JSON.stringify(p.providerResponse,null,2):p.providerResponse})}),(0,a.jsxs)(j,{title:"4. Client Response (Final)",defaultOpen:!0,icon:"output",children:[p.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]",children:"psychology"}),"Thinking Process"]}),(0,a.jsx)("pre",{className:"max-h-[200px] max-w-full overflow-auto rounded-lg border border-amber-200 bg-amber-50 p-3 font-mono text-xs text-amber-900 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-100 sm:p-4",children:p.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-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:p.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"}];function y(){return(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(S,{})})}function S(){let e=(0,l.useSearchParams)(),t=(0,l.useRouter)(),[s,i]=(0,n.useState)("today"),o=e.get("tab"),d=o&&["overview","logs","details"].includes(o)?o:"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 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)(r.Iz,{options:[{value:"overview",label:"Overview"},{value:"details",label:"Details"}],value:d,onChange:s=>{if(s===d)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"===d&&(0,a.jsx)(r.Iz,{options:k,value:s,onChange:i,size:"sm",className:"w-full sm:w-auto"})]}),"overview"===d&&(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(r.jK,{period:s,setPeriod:i,hidePeriodSelector:!0})}),"logs"===d&&(0,a.jsx)(r.gM,{}),"details"===d&&(0,a.jsx)(w,{})]})}},87618:(e,t,s)=>{Promise.resolve().then(s.bind(s,81772))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=87618)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9305],{19216:(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,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,44736)),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,76361)),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,72908)),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,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,4809)),Promise.resolve().then(n.bind(n,28469))},28469:(e,s,n)=>{"use strict";n.d(s,{default:()=>l});var r=n(95155),i=n(12115),o=n(26430),t=n(35625);function l({children:e}){let[s]=(0,i.useState)(()=>new o.E({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}}));return(0,r.jsx)(t.Ht,{client:s,children:e})}}},e=>{e.O(0,[2574,3862,782,8500,594,6430,1321,7592,5497,8441,3794,7358],()=>e(e.s=19216)),_N_E=e.O()}]);
package/app/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "switchboard-app",
3
- "version": "0.6.11",
3
+ "version": "0.6.13",
4
4
  "description": "Switchboard — intelligent model routing dashboard",
5
5
  "private": true,
6
6
  "scripts": {