@jheavenknows/bluerouter 1.0.108 → 1.0.109

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 (433) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +6 -6
  3. package/app/.next-cli-build/build-manifest.json +2 -2
  4. package/app/.next-cli-build/server/app/(dashboard)/dashboard/api-keys/page_client-reference-manifest.js +1 -1
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-logs/page.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-logs/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/provider-health/page_client-reference-manifest.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  34. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  35. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  36. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  37. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  38. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  39. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  40. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  41. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  42. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  43. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  44. package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  45. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  46. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  47. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +4 -4
  48. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  49. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  50. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  51. package/app/.next-cli-build/server/app/api/auth/ldap/test/route.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/api/auth/ldap/users/route.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  54. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  57. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  60. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/autostart/route.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/prompt-log-db/route.js.nft.json +1 -1
  63. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/root-ca/route.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  66. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  69. package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/[id]/route.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/options/route.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/route.js.nft.json +1 -1
  72. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  75. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  77. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  78. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  80. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  81. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  82. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  83. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  84. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  85. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  86. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  87. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  88. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  89. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  90. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  92. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/provider-health/route.js.nft.json +1 -1
  98. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  100. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  104. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  107. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  120. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  121. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/tunnel/tailscale-login/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/tunnel/tailscale-start-daemon/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  155. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  157. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  158. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  160. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  162. package/app/.next-cli-build/server/app/callback.html +1 -1
  163. package/app/.next-cli-build/server/app/callback.rsc +4 -4
  164. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  165. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  166. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +4 -4
  167. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  168. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  169. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  170. package/app/.next-cli-build/server/app/dashboard/api-keys.html +1 -1
  171. package/app/.next-cli-build/server/app/dashboard/api-keys.rsc +6 -6
  172. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard/api-keys/__PAGE__.segment.rsc +2 -2
  173. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard/api-keys.segment.rsc +1 -1
  174. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  175. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  176. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_full.segment.rsc +6 -6
  177. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_head.segment.rsc +1 -1
  178. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_index.segment.rsc +4 -4
  179. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_tree.segment.rsc +2 -2
  180. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  181. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +6 -6
  182. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  183. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  184. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  185. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  186. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
  187. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  188. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
  189. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  190. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  191. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
  192. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  193. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  194. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  195. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  196. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  197. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  198. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
  199. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  200. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  201. package/app/.next-cli-build/server/app/dashboard/combos.rsc +6 -6
  202. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  203. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  204. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  205. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  206. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
  207. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  208. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
  209. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  210. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  211. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +7 -7
  212. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +3 -3
  213. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  214. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  215. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  216. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
  217. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  218. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
  219. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  220. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  221. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +6 -6
  222. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  223. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  224. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  225. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  226. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  227. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
  228. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  229. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
  230. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  231. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  232. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
  233. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  234. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  235. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  236. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  237. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  238. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  239. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
  240. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  241. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  242. package/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
  243. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +1 -1
  244. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  245. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  246. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  247. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
  248. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  249. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
  250. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  251. package/app/.next-cli-build/server/app/dashboard/prompt-logs.html +1 -1
  252. package/app/.next-cli-build/server/app/dashboard/prompt-logs.rsc +6 -6
  253. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard/prompt-logs/__PAGE__.segment.rsc +2 -2
  254. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard/prompt-logs.segment.rsc +1 -1
  255. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  256. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  257. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_full.segment.rsc +6 -6
  258. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_head.segment.rsc +1 -1
  259. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_index.segment.rsc +4 -4
  260. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_tree.segment.rsc +2 -2
  261. package/app/.next-cli-build/server/app/dashboard/provider-health.html +1 -1
  262. package/app/.next-cli-build/server/app/dashboard/provider-health.rsc +5 -5
  263. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard/provider-health/__PAGE__.segment.rsc +1 -1
  264. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard/provider-health.segment.rsc +1 -1
  265. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  266. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  267. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_full.segment.rsc +5 -5
  268. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_head.segment.rsc +1 -1
  269. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_index.segment.rsc +4 -4
  270. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_tree.segment.rsc +2 -2
  271. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  272. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +6 -6
  273. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  274. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  275. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  276. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  277. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  278. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
  279. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  280. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
  281. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  282. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  283. package/app/.next-cli-build/server/app/dashboard/providers.rsc +6 -6
  284. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  285. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  286. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  287. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  288. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
  289. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  290. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
  291. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  292. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  293. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +6 -6
  294. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  295. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  296. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  297. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  298. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
  299. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  300. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
  301. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  302. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  303. package/app/.next-cli-build/server/app/dashboard/quota.rsc +7 -7
  304. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  305. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  306. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  307. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  308. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
  309. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  310. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
  311. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  312. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  313. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  314. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  315. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  316. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  317. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  318. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  319. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  320. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  321. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  322. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  323. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  324. package/app/.next-cli-build/server/app/dashboard/skills.rsc +6 -6
  325. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  326. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  327. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  328. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  329. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +6 -6
  330. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  331. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +4 -4
  332. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  333. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  334. package/app/.next-cli-build/server/app/dashboard/translator.rsc +6 -6
  335. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  336. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  337. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  338. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  339. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
  340. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  341. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
  342. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  343. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  344. package/app/.next-cli-build/server/app/dashboard/usage.rsc +6 -6
  345. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  346. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  347. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  348. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  349. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
  350. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  351. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
  352. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  353. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  354. package/app/.next-cli-build/server/app/dashboard.rsc +6 -6
  355. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  356. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  357. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  358. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
  359. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  360. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +4 -4
  361. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  362. package/app/.next-cli-build/server/app/index.html +1 -1
  363. package/app/.next-cli-build/server/app/index.rsc +4 -4
  364. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  365. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
  366. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  367. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +4 -4
  368. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  369. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  370. package/app/.next-cli-build/server/app/landing.html +1 -1
  371. package/app/.next-cli-build/server/app/landing.rsc +4 -4
  372. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  373. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  374. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +4 -4
  375. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  376. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  377. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  378. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  379. package/app/.next-cli-build/server/app/login.html +1 -1
  380. package/app/.next-cli-build/server/app/login.rsc +4 -4
  381. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  382. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  383. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +4 -4
  384. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  385. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  386. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  387. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  388. package/app/.next-cli-build/server/app-paths-manifest.json +6 -6
  389. package/app/.next-cli-build/server/chunks/2496.js +1 -1
  390. package/app/.next-cli-build/server/chunks/3110.js +1 -1
  391. package/app/.next-cli-build/server/chunks/4746.js +1 -1
  392. package/app/.next-cli-build/server/chunks/7130.js +1 -1
  393. package/app/.next-cli-build/server/chunks/7153.js +1 -1
  394. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  395. package/app/.next-cli-build/server/pages/404.html +1 -1
  396. package/app/.next-cli-build/server/pages/500.html +1 -1
  397. package/app/.next-cli-build/static/chunks/1051-eec0f271123ef82f.js +64 -0
  398. package/app/.next-cli-build/static/chunks/{1321-689bd1da27e14b86.js → 1321-acff60998e66f557.js} +1 -1
  399. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/api-keys/{page-7c41ca97da616da7.js → page-bec8eaff7440b8c7.js} +1 -1
  400. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/{page-782bbed51a1d07eb.js → page-1b2283499089d7dc.js} +1 -1
  401. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-a292301b8b48ef83.js → page-1adaf9be4107d227.js} +1 -1
  402. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-8ad96767b17e1927.js → page-85cb2bafe0526c5d.js} +1 -1
  403. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/{page-eb9021fb6f29af9f.js → page-82be3137baaf2025.js} +1 -1
  404. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/{page-f1374ae2a282dad8.js → page-d26b9256cf41fb19.js} +1 -1
  405. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/{page-3dbf8ec9932781b6.js → page-e0b4284d8e973996.js} +1 -1
  406. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-6d9c6db190394765.js → page-4377fb8d824f5bde.js} +1 -1
  407. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/{page-752ab915a6ff4667.js → page-3cf8e9de4ed5bf33.js} +1 -1
  408. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-7a79761f2d99ef4f.js → page-b2b612e7dedabef1.js} +1 -1
  409. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-2bff0a674207059c.js → page-356120709e5a1a94.js} +1 -1
  410. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-f05795e77fee5793.js → page-161edd90803b7184.js} +1 -1
  411. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/{page-22722a6c1a7dd8b1.js → page-5e2bec66810c6089.js} +1 -1
  412. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/prompt-logs/page-6dfa37913d22cf60.js +1 -0
  413. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-2ec08f1b10de2d04.js → page-5e178086cce9f9f0.js} +1 -1
  414. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/{page-055466baadc14356.js → page-009821d1edc5606b.js} +1 -1
  415. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/{page-665d20d11df80056.js → page-0cf8abbb69a8a288.js} +1 -1
  416. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/{page-45282c7ec724a7d4.js → page-0e356884dbb16e9e.js} +1 -1
  417. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-c391079554415d2f.js → page-383255c4b63ebf3b.js} +1 -1
  418. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/{page-506f34296b69aa15.js → page-de03c9c19092784e.js} +1 -1
  419. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/{page-cf56a227a13523f9.js → page-fdac9423efa73ccd.js} +1 -1
  420. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/{page-549cd9fef3803dcb.js → page-a4e4500cdae96c24.js} +1 -1
  421. package/app/.next-cli-build/static/chunks/app/(dashboard)/{layout-de1653c6da534801.js → layout-74847fe2e0e50a38.js} +1 -1
  422. package/app/.next-cli-build/static/css/94dadf2264525082.css +1 -0
  423. package/app/cli/.build-home/AppData/Roaming/bluerouter/db/backups/upgrade-1.0.108-to-1.0.109-1.0.109-20260609-200931/data.sqlite +0 -0
  424. package/app/cli/.build-home/AppData/Roaming/bluerouter/db/data.sqlite-shm +0 -0
  425. package/app/cli/.build-home/AppData/Roaming/bluerouter/db/data.sqlite-wal +0 -0
  426. package/app/package.json +1 -1
  427. package/package.json +1 -1
  428. package/app/.next-cli-build/static/chunks/4288-6abec21269cb069a.js +0 -64
  429. package/app/.next-cli-build/static/chunks/8500-f62a38ff68ab7f42.js +0 -1
  430. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/prompt-logs/page-8ac96eee4d4039bd.js +0 -1
  431. package/app/.next-cli-build/static/css/78a5a097d108e79a.css +0 -1
  432. /package/app/.next-cli-build/static/{jTA0XRD_TnPrWR_NaeYV9 → 1HtTEsSBwymnEA1NFhCD1}/_buildManifest.js +0 -0
  433. /package/app/.next-cli-build/static/{jTA0XRD_TnPrWR_NaeYV9 → 1HtTEsSBwymnEA1NFhCD1}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
1
  (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6812],{60:(e,t,r)=>{Promise.resolve().then(r.bind(r,57076))},57076:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var l=r(95155),s=r(12115),o=r(35497),a=r(65921);function i(e={}){return{name:e.name||"",proxyUrl:e.proxyUrl||"",noProxy:e.noProxy||"",isActive:!1!==e.isActive,strictProxy:!0===e.strictProxy}}function n(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(!0),[c,d]=(0,s.useState)(!1),[x,p]=(0,s.useState)(!1),[m,h]=(0,s.useState)(!1),[u,y]=(0,s.useState)(!1),[f,g]=(0,s.useState)(!1),[j,v]=(0,s.useState)(!1),[b,k]=(0,s.useState)(null),[N,w]=(0,s.useState)(i()),[C,P]=(0,s.useState)(""),[$,D]=(0,s.useState)({vercelToken:"",projectName:"vercel-relay"}),[T,S]=(0,s.useState)({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),[A,E]=(0,s.useState)({denoToken:"",orgDomain:"",projectName:""}),[U,I]=(0,s.useState)(!1),[O,R]=(0,s.useState)(!1),[W,z]=(0,s.useState)(!1),[F,_]=(0,s.useState)(null),[L,q]=(0,s.useState)([]),[V,J]=(0,s.useState)(!1),[B,M]=(0,s.useState)({current:0,total:0}),[G,H]=(0,s.useState)(!1),[Y,Q]=(0,s.useState)(null),K=(0,s.useRef)(null),Z=(0,a.i)();(0,s.useEffect)(()=>{let e=e=>{K.current&&!K.current.contains(e.target)&&v(!1)};return j&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[j]);let X=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/proxy-pools?includeUsage=true",{cache:"no-store"}),r=await e.json();e.ok&&t(r.proxyPools||[])}catch(e){console.log("Error fetching proxy pools:",e)}finally{n(!1)}},[]);(0,s.useEffect)(()=>{X()},[X]);let ee=()=>{k(null),w(i())},et=()=>{ee(),d(!0)},er=()=>{d(!1),ee()},el=async()=>{let e={name:N.name.trim(),proxyUrl:N.proxyUrl.trim(),noProxy:N.noProxy.trim(),isActive:!0===N.isActive,strictProxy:!0===N.strictProxy};if(e.name&&e.proxyUrl){I(!0);try{let t=!!b,r=await fetch(t?`/api/proxy-pools/${b.id}`:"/api/proxy-pools",{method:t?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok)await X(),er(),Z.success(b?"Proxy pool updated":"Proxy pool created");else{let e=await r.json();Z.error(e.error||"Failed to save proxy pool")}}catch(e){console.log("Error saving proxy pool:",e)}finally{I(!1)}}},es=async e=>{Q({title:"Delete Proxy Pool",message:`Delete proxy pool "${e.name}"?`,onConfirm:async()=>{Q(null);try{let r=await fetch(`/api/proxy-pools/${e.id}`,{method:"DELETE"});if(r.ok){t(t=>t.filter(t=>t.id!==e.id)),Z.success("Proxy pool deleted");return}let l=await r.json();409===r.status?Z.warning(`Cannot delete: ${l.boundConnectionCount||0} connection(s) are still using this pool.`):Z.error(l.error||"Failed to delete proxy pool")}catch(e){console.log("Error deleting proxy pool:",e),Z.error("Failed to delete proxy pool")}}})},eo=async e=>{_(e);try{let t=await fetch(`/api/proxy-pools/${e}/test`,{method:"POST"}),r=await t.json();if(!t.ok)return void Z.error(r.error||"Failed to test proxy");await X(),Z.success(r.ok?"Proxy test passed":"Proxy test failed")}catch(e){console.log("Error testing proxy pool:",e),Z.error("Failed to test proxy")}finally{_(null)}},ea=async e=>{let r=!e.isActive;t(t=>t.map(t=>t.id===e.id?{...t,isActive:r}:t));try{(await fetch(`/api/proxy-pools/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:r})})).ok||(t(t=>t.map(t=>t.id===e.id?{...t,isActive:e.isActive}:t)),Z.error("Failed to update active state"))}catch(r){console.log("Error toggling active:",r),t(t=>t.map(t=>t.id===e.id?{...t,isActive:e.isActive}:t))}},ei=e.length>0&&L.length===e.length,en=()=>q([]),ec=async t=>{let r=L.length>0?L:e.map(e=>e.id);if(0!==r.length){H(!0);try{let e=0,l=0;for(let s of r)try{(await fetch(`/api/proxy-pools/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok?e+=1:l+=1}catch{l+=1}await X(),Z.success(`${t?"Activated":"Deactivated"} ${e}${l?`, failed ${l}`:""}`)}finally{H(!1)}}},ed=async()=>{0!==L.length&&Q({title:"Delete Proxy Pools",message:`Delete ${L.length} proxy pool(s)?`,onConfirm:async()=>{Q(null),H(!0);try{let e=0,t=0,r=0;for(let l of L)try{let s=await fetch(`/api/proxy-pools/${l}`,{method:"DELETE"});s.ok?e+=1:409===s.status?t+=1:r+=1}catch{r+=1}await X(),en(),Z.success(`Deleted ${e}${t?`, ${t} bound`:""}${r?`, ${r} failed`:""}`)}finally{H(!1)}}})},ex=async()=>{let t=L.length>0?e.filter(e=>L.includes(e.id)):e;if(0===t.length)return;J(!0),M({current:0,total:t.length});let r=0,l=[],s=0,o=[...t],a=async()=>{for(;o.length>0;){let e=o.shift();if(!e)break;try{let t=await fetch(`/api/proxy-pools/${e.id}/test`,{method:"POST"}),s=await t.json();t.ok&&s.ok?r+=1:l.push(e.id)}catch{l.push(e.id)}finally{M({current:s+=1,total:t.length})}}};await Promise.all(Array.from({length:Math.min(10,t.length)},a)),await X(),J(!1),M({current:0,total:0}),l.length>0?Q({title:"Disable Dead Proxies",message:`Alive: ${r}, Dead: ${l.length}.
2
2
 
3
3
  Disable ${l.length} dead proxies?`,onConfirm:async()=>{Q(null),H(!0);try{for(let e of l)try{await fetch(`/api/proxy-pools/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:!1})})}catch{}await X(),Z.success(`Disabled ${l.length} dead proxies`)}finally{H(!1)}}}):Z.success(`Health check done. Alive: ${r}, Dead: ${l.length}`)};(0,s.useEffect)(()=>{q(t=>t.filter(t=>e.some(e=>e.id===t)))},[e]);let ep=()=>{O||p(!1)},em=()=>{W||h(!1)},eh=()=>{W||y(!1)},eu=()=>{W||g(!1)},ey=async()=>{if($.vercelToken.trim()){z(!0);try{let e=await fetch("/api/proxy-pools/vercel-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}),t=await e.json();e.ok?(await X(),em(),Z.success(`Deployed: ${t.deployUrl}`)):Z.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Vercel relay:",e),Z.error("Deploy failed")}finally{z(!1)}}},ef=async()=>{if(T.accountId.trim()&&T.apiToken.trim()){z(!0);try{let e=await fetch("/api/proxy-pools/cloudflare-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)}),t=await e.json();e.ok?(await X(),eh(),Z.success(`Deployed: ${t.deployUrl}`)):Z.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Cloudflare relay:",e),Z.error("Deploy failed")}finally{z(!1)}}},eg=async()=>{if(A.denoToken.trim()&&A.orgDomain.trim()){z(!0);try{let e=await fetch("/api/proxy-pools/deno-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}),t=await e.json();e.ok?(await X(),eu(),Z.success(`Deployed: ${t.deployUrl}`)):Z.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Deno relay:",e),Z.error("Deploy failed")}finally{z(!1)}}},ej=async()=>{let t=C.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);if(0===t.length)return void Z.warning("Please paste at least one proxy line.");let r=[],l=[];if(t.forEach((e,t)=>{try{let l=(e=>{let t=e.trim();if(!t)return null;if(t.includes("://")){let e=new URL(t),r=e.port?`${e.hostname}:${e.port}`:e.hostname;return{proxyUrl:e.toString(),name:`Imported ${r}`}}let r=t.split(":");if(4===r.length){let[e,t,l,s]=r;if(!e||!t||!l||!s)throw Error("Invalid host:port:user:pass format");return{proxyUrl:new URL(`http://${encodeURIComponent(l)}:${encodeURIComponent(s)}@${e}:${t}`).toString(),name:`Imported ${e}:${t}`}}throw Error("Unsupported format")})(e);l&&r.push({...l,lineNumber:t+1})}catch(e){l.push(`Line ${t+1}: ${e.message}`)}}),l.length>0)return void Z.error(`Invalid proxy format:
4
- ${l.join("\n")}`);R(!0);try{let t=new Set(e.map(e=>`${(e.proxyUrl||"").trim()}|||${(e.noProxy||"").trim()}`)),l=0,s=0,o=0;for(let e of r){let r=`${e.proxyUrl}|||`;if(t.has(r)){s+=1;continue}(await fetch("/api/proxy-pools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,proxyUrl:e.proxyUrl,noProxy:"",isActive:!0})})).ok?(l+=1,t.add(r)):o+=1}await X(),p(!1),Z.success(`Batch import completed: Created ${l}, Skipped ${s}, Failed ${o}`)}catch(e){console.log("Error batch importing proxies:",e),Z.error("Batch import failed")}finally{R(!1)}},ev=(0,s.useMemo)(()=>e.filter(e=>!0===e.isActive).length,[e]);return r?(0,l.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:gap-6 sm:px-0",children:[(0,l.jsx)(o.Qv,{}),(0,l.jsx)(o.Qv,{})]}):(0,l.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:gap-6 sm:px-0",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h1",{className:"text-xl font-semibold sm:text-2xl",children:"Proxy Pools"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Manage reusable per-connection proxies and bind them to provider connections."})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)("div",{className:"relative",ref:K,children:[(0,l.jsxs)(o.$n,{size:"sm",variant:"secondary",icon:"rocket_launch",onClick:()=>v(!j),children:["Deploy Relay",(0,l.jsx)("span",{className:"material-symbols-outlined ml-1 text-[18px]",children:j?"expand_less":"expand_more"})]}),j&&(0,l.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1 w-48 rounded-xl border border-black/10 bg-white p-1 shadow-xl dark:border-white/10 dark:bg-zinc-900 sm:left-auto sm:right-0",children:[(0,l.jsxs)("button",{type:"button",onClick:()=>{S({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),y(!0),v(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-black/5 dark:hover:bg-white/5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px] text-orange-500",children:"cloud"}),"Cloudflare Relay"]}),(0,l.jsxs)("button",{type:"button",onClick:()=>{D({vercelToken:"",projectName:"vercel-relay"}),h(!0),v(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-black/5 dark:hover:bg-white/5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px] text-blue-500",children:"cloud_upload"}),"Vercel Relay"]}),(0,l.jsxs)("button",{type:"button",onClick:()=>{E({denoToken:"",orgDomain:"",projectName:"deno-relay"}),g(!0),v(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-black/5 dark:hover:bg-white/5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px] text-green-500",children:"terminal"}),"Deno Relay"]})]})]}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"upload",onClick:()=>{P(""),p(!0)},children:"Batch Import"}),(0,l.jsx)(o.$n,{size:"sm",icon:"add",onClick:et,children:"Add Proxy Pool"})]})]}),(0,l.jsxs)(o.Zp,{children:[(0,l.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[e.length>0&&(0,l.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",checked:ei,onChange:()=>q(ei?[]:e.map(e=>e.id)),className:"size-4 rounded border-black/20 dark:border-white/20"}),ei?"Unselect all":"Select all"]}),(0,l.jsxs)(o.Ex,{variant:"default",children:["Total: ",e.length]}),(0,l.jsxs)(o.Ex,{variant:"success",children:["Active: ",ev]})]}),(L.length>0||V)&&(0,l.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"checklist"}),(0,l.jsx)("span",{className:"text-xs font-medium text-primary",children:L.length>0?`${L.length} selected`:"All pools"}),(0,l.jsxs)("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[(0,l.jsx)(o.$n,{size:"sm",icon:V?"progress_activity":"health_and_safety",onClick:ex,disabled:V||G||0===e.length,children:V?`Checking ${B.current}/${B.total}`:"Health Check"}),L.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"toggle_on",onClick:()=>ec(!0),disabled:G||V,children:"Activate"}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"toggle_off",onClick:()=>ec(!1),disabled:G||V,children:"Deactivate"}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:ed,disabled:G||V,children:"Delete"}),(0,l.jsx)(o.$n,{size:"sm",variant:"ghost",onClick:en,disabled:G||V,children:"Clear"})]})]})]}),0===e.length?(0,l.jsxs)("div",{className:"text-center py-10",children:[(0,l.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No proxy pool entries yet"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create a proxy pool entry, then assign it to connections."}),(0,l.jsx)(o.$n,{icon:"add",onClick:et,children:"Add Proxy Pool"})]}):(0,l.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.04] dark:divide-white/[0.05]",children:e.map(e=>{var t;return(0,l.jsxs)("div",{className:"flex flex-col gap-3 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[(0,l.jsx)("input",{type:"checkbox",checked:L.includes(e.id),onChange:()=>{let t;return t=e.id,q(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"mt-1 size-4 shrink-0 rounded border-black/20 dark:border-white/20"}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,l.jsx)("p",{className:"min-w-0 max-w-full truncate text-sm font-medium sm:max-w-[18rem]",children:e.name}),(0,l.jsx)(o.Ex,{variant:"active"===(t=e.testStatus)?"success":"error"===t?"error":"default",size:"sm",dot:!0,children:e.testStatus||"unknown"}),(0,l.jsx)(o.Ex,{variant:e.isActive?"success":"default",size:"sm",children:e.isActive?"active":"inactive"}),"vercel"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"vercel relay"}),"cloudflare"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"cloudflare relay"}),"deno"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"deno relay"}),(0,l.jsxs)(o.Ex,{variant:"default",size:"sm",children:[e.boundConnectionCount||0," bound"]})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate mt-1",children:e.proxyUrl}),e.noProxy?(0,l.jsxs)("p",{className:"text-xs text-text-muted truncate",children:["No proxy: ",e.noProxy]}):null,(0,l.jsxs)("p",{className:"text-[11px] text-text-muted mt-1",children:["Last tested: ",function(e){if(!e)return"Never";let t=new Date(e);return Number.isNaN(t.getTime())?"Never":t.toLocaleString()}(e.lastTestedAt),e.lastError?` \xb7 ${e.lastError}`:""]})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,l.jsx)(o.lM,{size:"sm",checked:!0===e.isActive,onChange:()=>ea(e),title:e.isActive?"Disable":"Enable"}),(0,l.jsx)("button",{onClick:()=>eo(e.id),className:"p-2 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",title:"Test proxy",disabled:F===e.id,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:F===e.id?{animation:"spin 1s linear infinite"}:void 0,children:F===e.id?"progress_activity":"science"})}),(0,l.jsx)("button",{onClick:()=>{k(e),w(i(e)),d(!0)},className:"p-2 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",title:"Edit",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,l.jsx)("button",{onClick:()=>es(e),className:"p-2 rounded hover:bg-red-500/10 text-red-500",title:"Delete",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]},e.id)})})]}),(0,l.jsx)(o.aF,{isOpen:x,title:"Batch Import Proxies",onClose:ep,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"text-sm font-medium text-text-main mb-1 block",children:"Paste Proxy List (One per line)"}),(0,l.jsx)("textarea",{value:C,onChange:e=>P(e.target.value),placeholder:"http://user:pass@127.0.0.1:7897\n127.0.0.1:7897:user:pass",className:"w-full min-h-[180px] py-2 px-3 text-sm text-text-main bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all"}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Supported formats: protocol://user:pass@host:port, host:port:user:pass"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ej,disabled:!C.trim()||O,children:O?"Importing...":"Import"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:ep,disabled:O,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:m,title:"Deploy Vercel Relay",onClose:em,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg bg-blue-500/5 border border-blue-500/10 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Vercel Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys an edge relay function to Vercel. All AI provider requests will be forwarded through Vercel's edge network, masking your real IP from providers."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Your IP is replaced by Vercel's dynamic edge IPs (hundreds of IPs across 20+ global regions)"}),(0,l.jsx)("li",{children:"Vercel serves millions of apps — providers can't block Vercel IPs without affecting legitimate traffic"}),(0,l.jsx)("li",{children:"Free tier: 100GB bandwidth/month, 500K edge invocations"}),(0,l.jsx)("li",{children:"Deploy multiple relays on different accounts for more IP diversity"})]})]}),(0,l.jsx)(o.pd,{label:"Vercel API Token",value:$.vercelToken,onChange:e=>D(t=>({...t,vercelToken:e.target.value})),placeholder:"your-vercel-api-token",hint:(0,l.jsxs)(l.Fragment,{children:["Token is used once for deployment and not stored. ",(0,l.jsx)("a",{href:"https://vercel.com/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Project Name",value:$.projectName,onChange:e=>D(t=>({...t,projectName:e.target.value})),placeholder:"my-relay",hint:"Unique name for your Vercel project. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ey,disabled:!$.vercelToken.trim()||W,children:W?"Deploying... (may take ~1 min)":"Deploy"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:em,disabled:W,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:u,title:"Deploy Cloudflare Relay",onClose:eh,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg bg-orange-500/5 border border-orange-500/10 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Cloudflare Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys a Cloudflare Worker as a proxy relay. All AI provider requests will be forwarded through Cloudflare's global edge network."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"High performance global routing and IP masking via Cloudflare Workers"}),(0,l.jsx)("li",{children:"Free tier: 100,000 requests per day"}),(0,l.jsx)("li",{children:"Requires Cloudflare Account ID and a Workers API Token (Edit Workers permission)"})]}),(0,l.jsxs)("div",{className:"mt-2 pt-2 border-t border-orange-500/10 text-xs text-text-muted",children:[(0,l.jsx)("p",{className:"font-medium text-text-main mb-1",children:"How to generate your API Token:"}),(0,l.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,l.jsxs)("li",{children:["Go to ",(0,l.jsx)("b",{children:"My Profile"})," → ",(0,l.jsx)("b",{children:"API Tokens"})," → ",(0,l.jsx)("b",{children:"Create Token"})]}),(0,l.jsxs)("li",{children:["Scroll down to ",(0,l.jsx)("b",{children:"Custom Token"})," and click ",(0,l.jsx)("b",{children:"Get started"})]}),(0,l.jsxs)("li",{children:["Under ",(0,l.jsx)("b",{children:"Permissions"}),": Account | Workers Scripts | Edit"]}),(0,l.jsxs)("li",{children:["Under ",(0,l.jsx)("b",{children:"Account Resources"}),": Include | Account | ",(0,l.jsx)("i",{children:"Your Account Name"})]}),(0,l.jsxs)("li",{children:["Click ",(0,l.jsx)("b",{children:"Continue to summary"})," → ",(0,l.jsx)("b",{children:"Create Token"})]})]})]})]}),(0,l.jsx)(o.pd,{label:"Account ID",value:T.accountId,onChange:e=>S(t=>({...t,accountId:e.target.value})),placeholder:"your-cloudflare-account-id",hint:(0,l.jsx)(l.Fragment,{children:"Found on the right side of the Cloudflare dashboard overview page."})}),(0,l.jsx)(o.pd,{label:"API Token",value:T.apiToken,onChange:e=>S(t=>({...t,apiToken:e.target.value})),placeholder:"your-cloudflare-api-token",hint:(0,l.jsxs)(l.Fragment,{children:['Requires "Workers Scripts: Edit" permission. ',(0,l.jsx)("a",{href:"https://dash.cloudflare.com/profile/api-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Worker Name",value:T.projectName,onChange:e=>S(t=>({...t,projectName:e.target.value})),placeholder:"my-relay",hint:"Unique name for your Cloudflare Worker. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ef,disabled:!T.accountId.trim()||!T.apiToken.trim()||W,children:W?"Deploying...":"Deploy Worker"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:eh,disabled:W,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:f,title:"Deploy Deno Relay",onClose:eu,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg bg-green-500/5 border border-green-500/10 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Deno Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys a Deno Deploy v2 app as a proxy relay. Requests are forwarded through Deno's global edge network using relay headers."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Uses Deno Deploy v2 and creates a reusable proxy pool entry automatically"}),(0,l.jsx)("li",{children:"Token is used once for deployment and is not stored by BlueRouter"}),(0,l.jsx)("li",{children:"Use a unique project name if you deploy multiple relays"})]})]}),(0,l.jsx)(o.pd,{label:"Deno Deploy API Token",value:A.denoToken,onChange:e=>E(t=>({...t,denoToken:e.target.value})),placeholder:"your-deno-deploy-api-token",hint:(0,l.jsxs)(l.Fragment,{children:["Requires Deno Deploy API access. ",(0,l.jsx)("a",{href:"https://dash.deno.com/account#access-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Organization Domain",value:A.orgDomain,onChange:e=>E(t=>({...t,orgDomain:e.target.value})),placeholder:"your-org.deno.dev",hint:"Your Deno organization domain. Example: your-org.deno.dev"}),(0,l.jsx)(o.pd,{label:"Project Name",value:A.projectName,onChange:e=>E(t=>({...t,projectName:e.target.value})),placeholder:"deno-relay",hint:"Unique name for your Deno Deploy app. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:eg,disabled:!A.denoToken.trim()||!A.orgDomain.trim()||W,children:W?"Deploying...":"Deploy Deno Relay"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:eu,disabled:W,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:c,title:b?"Edit Proxy Pool":"Add Proxy Pool",onClose:er,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(o.pd,{label:"Name",value:N.name,onChange:e=>w(t=>({...t,name:e.target.value})),placeholder:"Office Proxy"}),(0,l.jsx)(o.pd,{label:"Proxy URL",value:N.proxyUrl,onChange:e=>w(t=>({...t,proxyUrl:e.target.value})),placeholder:"http://127.0.0.1:7897"}),(0,l.jsx)(o.pd,{label:"No Proxy",value:N.noProxy,onChange:e=>w(t=>({...t,noProxy:e.target.value})),placeholder:"localhost,127.0.0.1,.internal",hint:"Comma-separated hosts/domains to bypass proxy"}),(0,l.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-sm",children:"Active"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Inactive pools are ignored by runtime resolution."})]}),(0,l.jsx)(o.lM,{checked:!0===N.isActive,onChange:()=>w(e=>({...e,isActive:!e.isActive})),disabled:U})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-sm",children:"Strict Proxy"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Fail request if proxy is unreachable instead of falling back to direct."})]}),(0,l.jsx)(o.lM,{checked:!0===N.strictProxy,onChange:()=>w(e=>({...e,strictProxy:!e.strictProxy})),disabled:U})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:el,disabled:!N.name.trim()||!N.proxyUrl.trim()||U,children:U?"Saving...":"Save"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:er,disabled:U,children:"Cancel"})]})]})}),(0,l.jsx)(o.uo,{isOpen:!!Y,onClose:()=>Q(null),onConfirm:Y?.onConfirm,title:Y?.title||"Confirm",message:Y?.message,variant:"danger"})]})}}},e=>{e.O(0,[2574,3862,8500,4288,1321,5497,8441,3794,7358],()=>e(e.s=60)),_N_E=e.O()}]);
4
+ ${l.join("\n")}`);R(!0);try{let t=new Set(e.map(e=>`${(e.proxyUrl||"").trim()}|||${(e.noProxy||"").trim()}`)),l=0,s=0,o=0;for(let e of r){let r=`${e.proxyUrl}|||`;if(t.has(r)){s+=1;continue}(await fetch("/api/proxy-pools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,proxyUrl:e.proxyUrl,noProxy:"",isActive:!0})})).ok?(l+=1,t.add(r)):o+=1}await X(),p(!1),Z.success(`Batch import completed: Created ${l}, Skipped ${s}, Failed ${o}`)}catch(e){console.log("Error batch importing proxies:",e),Z.error("Batch import failed")}finally{R(!1)}},ev=(0,s.useMemo)(()=>e.filter(e=>!0===e.isActive).length,[e]);return r?(0,l.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:gap-6 sm:px-0",children:[(0,l.jsx)(o.Qv,{}),(0,l.jsx)(o.Qv,{})]}):(0,l.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:gap-6 sm:px-0",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h1",{className:"text-xl font-semibold sm:text-2xl",children:"Proxy Pools"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Manage reusable per-connection proxies and bind them to provider connections."})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)("div",{className:"relative",ref:K,children:[(0,l.jsxs)(o.$n,{size:"sm",variant:"secondary",icon:"rocket_launch",onClick:()=>v(!j),children:["Deploy Relay",(0,l.jsx)("span",{className:"material-symbols-outlined ml-1 text-[18px]",children:j?"expand_less":"expand_more"})]}),j&&(0,l.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1 w-48 rounded-xl border border-black/10 bg-white p-1 shadow-xl dark:border-white/10 dark:bg-zinc-900 sm:left-auto sm:right-0",children:[(0,l.jsxs)("button",{type:"button",onClick:()=>{S({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),y(!0),v(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-black/5 dark:hover:bg-white/5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px] text-orange-500",children:"cloud"}),"Cloudflare Relay"]}),(0,l.jsxs)("button",{type:"button",onClick:()=>{D({vercelToken:"",projectName:"vercel-relay"}),h(!0),v(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-black/5 dark:hover:bg-white/5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px] text-blue-500",children:"cloud_upload"}),"Vercel Relay"]}),(0,l.jsxs)("button",{type:"button",onClick:()=>{E({denoToken:"",orgDomain:"",projectName:"deno-relay"}),g(!0),v(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-black/5 dark:hover:bg-white/5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[20px] text-green-500",children:"terminal"}),"Deno Relay"]})]})]}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"upload",onClick:()=>{P(""),p(!0)},children:"Batch Import"}),(0,l.jsx)(o.$n,{size:"sm",icon:"add",onClick:et,children:"Add Proxy Pool"})]})]}),(0,l.jsxs)(o.Zp,{children:[(0,l.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[e.length>0&&(0,l.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",checked:ei,onChange:()=>q(ei?[]:e.map(e=>e.id)),className:"size-4 rounded border-black/20 dark:border-white/20"}),ei?"Unselect all":"Select all"]}),(0,l.jsxs)(o.Ex,{variant:"default",children:["Total: ",e.length]}),(0,l.jsxs)(o.Ex,{variant:"success",children:["Active: ",ev]})]}),(L.length>0||V)&&(0,l.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"checklist"}),(0,l.jsx)("span",{className:"text-xs font-medium text-primary",children:L.length>0?`${L.length} selected`:"All pools"}),(0,l.jsxs)("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[(0,l.jsx)(o.$n,{size:"sm",icon:V?"progress_activity":"health_and_safety",onClick:ex,disabled:V||G||0===e.length,children:V?`Checking ${B.current}/${B.total}`:"Health Check"}),L.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"toggle_on",onClick:()=>ec(!0),disabled:G||V,children:"Activate"}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"toggle_off",onClick:()=>ec(!1),disabled:G||V,children:"Deactivate"}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:ed,disabled:G||V,children:"Delete"}),(0,l.jsx)(o.$n,{size:"sm",variant:"ghost",onClick:en,disabled:G||V,children:"Clear"})]})]})]}),0===e.length?(0,l.jsxs)("div",{className:"text-center py-10",children:[(0,l.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No proxy pool entries yet"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create a proxy pool entry, then assign it to connections."}),(0,l.jsx)(o.$n,{icon:"add",onClick:et,children:"Add Proxy Pool"})]}):(0,l.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.04] dark:divide-white/[0.05]",children:e.map(e=>{var t;return(0,l.jsxs)("div",{className:"flex flex-col gap-3 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[(0,l.jsx)("input",{type:"checkbox",checked:L.includes(e.id),onChange:()=>{let t;return t=e.id,q(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"mt-1 size-4 shrink-0 rounded border-black/20 dark:border-white/20"}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,l.jsx)("p",{className:"min-w-0 max-w-full truncate text-sm font-medium sm:max-w-[18rem]",children:e.name}),(0,l.jsx)(o.Ex,{variant:"active"===(t=e.testStatus)?"success":"error"===t?"error":"default",size:"sm",dot:!0,children:e.testStatus||"unknown"}),(0,l.jsx)(o.Ex,{variant:e.isActive?"success":"default",size:"sm",children:e.isActive?"active":"inactive"}),"vercel"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"vercel relay"}),"cloudflare"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"cloudflare relay"}),"deno"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"deno relay"}),(0,l.jsxs)(o.Ex,{variant:"default",size:"sm",children:[e.boundConnectionCount||0," bound"]})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate mt-1",children:e.proxyUrl}),e.noProxy?(0,l.jsxs)("p",{className:"text-xs text-text-muted truncate",children:["No proxy: ",e.noProxy]}):null,(0,l.jsxs)("p",{className:"text-[11px] text-text-muted mt-1",children:["Last tested: ",function(e){if(!e)return"Never";let t=new Date(e);return Number.isNaN(t.getTime())?"Never":t.toLocaleString()}(e.lastTestedAt),e.lastError?` \xb7 ${e.lastError}`:""]})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,l.jsx)(o.lM,{size:"sm",checked:!0===e.isActive,onChange:()=>ea(e),title:e.isActive?"Disable":"Enable"}),(0,l.jsx)("button",{onClick:()=>eo(e.id),className:"p-2 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",title:"Test proxy",disabled:F===e.id,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:F===e.id?{animation:"spin 1s linear infinite"}:void 0,children:F===e.id?"progress_activity":"science"})}),(0,l.jsx)("button",{onClick:()=>{k(e),w(i(e)),d(!0)},className:"p-2 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",title:"Edit",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,l.jsx)("button",{onClick:()=>es(e),className:"p-2 rounded hover:bg-red-500/10 text-red-500",title:"Delete",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]},e.id)})})]}),(0,l.jsx)(o.aF,{isOpen:x,title:"Batch Import Proxies",onClose:ep,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"text-sm font-medium text-text-main mb-1 block",children:"Paste Proxy List (One per line)"}),(0,l.jsx)("textarea",{value:C,onChange:e=>P(e.target.value),placeholder:"http://user:pass@127.0.0.1:7897\n127.0.0.1:7897:user:pass",className:"w-full min-h-[180px] py-2 px-3 text-sm text-text-main bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all"}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Supported formats: protocol://user:pass@host:port, host:port:user:pass"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ej,disabled:!C.trim()||O,children:O?"Importing...":"Import"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:ep,disabled:O,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:m,title:"Deploy Vercel Relay",onClose:em,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg bg-blue-500/5 border border-blue-500/10 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Vercel Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys an edge relay function to Vercel. All AI provider requests will be forwarded through Vercel's edge network, masking your real IP from providers."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Your IP is replaced by Vercel's dynamic edge IPs (hundreds of IPs across 20+ global regions)"}),(0,l.jsx)("li",{children:"Vercel serves millions of apps — providers can't block Vercel IPs without affecting legitimate traffic"}),(0,l.jsx)("li",{children:"Free tier: 100GB bandwidth/month, 500K edge invocations"}),(0,l.jsx)("li",{children:"Deploy multiple relays on different accounts for more IP diversity"})]})]}),(0,l.jsx)(o.pd,{label:"Vercel API Token",value:$.vercelToken,onChange:e=>D(t=>({...t,vercelToken:e.target.value})),placeholder:"your-vercel-api-token",hint:(0,l.jsxs)(l.Fragment,{children:["Token is used once for deployment and not stored. ",(0,l.jsx)("a",{href:"https://vercel.com/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Project Name",value:$.projectName,onChange:e=>D(t=>({...t,projectName:e.target.value})),placeholder:"my-relay",hint:"Unique name for your Vercel project. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ey,disabled:!$.vercelToken.trim()||W,children:W?"Deploying... (may take ~1 min)":"Deploy"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:em,disabled:W,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:u,title:"Deploy Cloudflare Relay",onClose:eh,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg bg-orange-500/5 border border-orange-500/10 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Cloudflare Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys a Cloudflare Worker as a proxy relay. All AI provider requests will be forwarded through Cloudflare's global edge network."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"High performance global routing and IP masking via Cloudflare Workers"}),(0,l.jsx)("li",{children:"Free tier: 100,000 requests per day"}),(0,l.jsx)("li",{children:"Requires Cloudflare Account ID and a Workers API Token (Edit Workers permission)"})]}),(0,l.jsxs)("div",{className:"mt-2 pt-2 border-t border-orange-500/10 text-xs text-text-muted",children:[(0,l.jsx)("p",{className:"font-medium text-text-main mb-1",children:"How to generate your API Token:"}),(0,l.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,l.jsxs)("li",{children:["Go to ",(0,l.jsx)("b",{children:"My Profile"})," → ",(0,l.jsx)("b",{children:"API Tokens"})," → ",(0,l.jsx)("b",{children:"Create Token"})]}),(0,l.jsxs)("li",{children:["Scroll down to ",(0,l.jsx)("b",{children:"Custom Token"})," and click ",(0,l.jsx)("b",{children:"Get started"})]}),(0,l.jsxs)("li",{children:["Under ",(0,l.jsx)("b",{children:"Permissions"}),": Account | Workers Scripts | Edit"]}),(0,l.jsxs)("li",{children:["Under ",(0,l.jsx)("b",{children:"Account Resources"}),": Include | Account | ",(0,l.jsx)("i",{children:"Your Account Name"})]}),(0,l.jsxs)("li",{children:["Click ",(0,l.jsx)("b",{children:"Continue to summary"})," → ",(0,l.jsx)("b",{children:"Create Token"})]})]})]})]}),(0,l.jsx)(o.pd,{label:"Account ID",value:T.accountId,onChange:e=>S(t=>({...t,accountId:e.target.value})),placeholder:"your-cloudflare-account-id",hint:(0,l.jsx)(l.Fragment,{children:"Found on the right side of the Cloudflare dashboard overview page."})}),(0,l.jsx)(o.pd,{label:"API Token",value:T.apiToken,onChange:e=>S(t=>({...t,apiToken:e.target.value})),placeholder:"your-cloudflare-api-token",hint:(0,l.jsxs)(l.Fragment,{children:['Requires "Workers Scripts: Edit" permission. ',(0,l.jsx)("a",{href:"https://dash.cloudflare.com/profile/api-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Worker Name",value:T.projectName,onChange:e=>S(t=>({...t,projectName:e.target.value})),placeholder:"my-relay",hint:"Unique name for your Cloudflare Worker. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ef,disabled:!T.accountId.trim()||!T.apiToken.trim()||W,children:W?"Deploying...":"Deploy Worker"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:eh,disabled:W,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:f,title:"Deploy Deno Relay",onClose:eu,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg bg-green-500/5 border border-green-500/10 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Deno Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys a Deno Deploy v2 app as a proxy relay. Requests are forwarded through Deno's global edge network using relay headers."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Uses Deno Deploy v2 and creates a reusable proxy pool entry automatically"}),(0,l.jsx)("li",{children:"Token is used once for deployment and is not stored by BlueRouter"}),(0,l.jsx)("li",{children:"Use a unique project name if you deploy multiple relays"})]})]}),(0,l.jsx)(o.pd,{label:"Deno Deploy API Token",value:A.denoToken,onChange:e=>E(t=>({...t,denoToken:e.target.value})),placeholder:"your-deno-deploy-api-token",hint:(0,l.jsxs)(l.Fragment,{children:["Requires Deno Deploy API access. ",(0,l.jsx)("a",{href:"https://dash.deno.com/account#access-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Organization Domain",value:A.orgDomain,onChange:e=>E(t=>({...t,orgDomain:e.target.value})),placeholder:"your-org.deno.dev",hint:"Your Deno organization domain. Example: your-org.deno.dev"}),(0,l.jsx)(o.pd,{label:"Project Name",value:A.projectName,onChange:e=>E(t=>({...t,projectName:e.target.value})),placeholder:"deno-relay",hint:"Unique name for your Deno Deploy app. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:eg,disabled:!A.denoToken.trim()||!A.orgDomain.trim()||W,children:W?"Deploying...":"Deploy Deno Relay"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:eu,disabled:W,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:c,title:b?"Edit Proxy Pool":"Add Proxy Pool",onClose:er,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(o.pd,{label:"Name",value:N.name,onChange:e=>w(t=>({...t,name:e.target.value})),placeholder:"Office Proxy"}),(0,l.jsx)(o.pd,{label:"Proxy URL",value:N.proxyUrl,onChange:e=>w(t=>({...t,proxyUrl:e.target.value})),placeholder:"http://127.0.0.1:7897"}),(0,l.jsx)(o.pd,{label:"No Proxy",value:N.noProxy,onChange:e=>w(t=>({...t,noProxy:e.target.value})),placeholder:"localhost,127.0.0.1,.internal",hint:"Comma-separated hosts/domains to bypass proxy"}),(0,l.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-sm",children:"Active"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Inactive pools are ignored by runtime resolution."})]}),(0,l.jsx)(o.lM,{checked:!0===N.isActive,onChange:()=>w(e=>({...e,isActive:!e.isActive})),disabled:U})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-sm",children:"Strict Proxy"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Fail request if proxy is unreachable instead of falling back to direct."})]}),(0,l.jsx)(o.lM,{checked:!0===N.strictProxy,onChange:()=>w(e=>({...e,strictProxy:!e.strictProxy})),disabled:U})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:el,disabled:!N.name.trim()||!N.proxyUrl.trim()||U,children:U?"Saving...":"Save"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:er,disabled:U,children:"Cancel"})]})]})}),(0,l.jsx)(o.uo,{isOpen:!!Y,onClose:()=>Q(null),onConfirm:Y?.onConfirm,title:Y?.title||"Confirm",message:Y?.message,variant:"danger"})]})}}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=60)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{5744:(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:()=>N});var a=r(95155),s=r(12115),l=r(57250),i=r(45564);function n(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function o({quotas:e=[],compact:t=!1,sortMode:r="default",showSortLabel:l=!1}){let[i,c]=(0,s.useState)(1),d=(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):n(e?.used,e?.total)})),[e]),u=(0,s.useMemo)(()=>"remaining-asc"===r?[...d].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...d].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):d,[d,r]),m=Math.max(1,Math.ceil(u.length/10));if((0,s.useEffect)(()=>{c(1)},[r,e]),(0,s.useEffect)(()=>{c(e=>Math.min(e,m))},[m]),!e||0===e.length)return null;let x=u.slice((i-1)*10,10*i),h=0===u.length?0:(i-1)*10+1,b=Math.min(10*i,u.length),p=t?"py-1 px-1.5":"py-2 px-3",g=t?"text-[11px]":"text-sm",f=t?"text-[11px]":"text-sm",v=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:[u.length," quota",u.length>1?"s":""]}),l&&(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:x.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"},l=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 l=Math.floor(s/60),i=s%60;if(l<24)return`${l}h ${i}m`;let n=Math.floor(l/24);return`${n}d ${l%24}h ${i}m`}catch(e){return"-"}}(e.resetAt),i=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 l="";l=t>=a&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let i=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${l}, ${i}`}catch{return null}}(e.resetAt);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:`${p} 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:`${g} font-medium text-text-primary truncate`,children:e.name})]})}),(0,a.jsx)("td",{className:`${p} 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:`${p} w-[25%]`,children:"-"!==l||i?t?(0,a.jsx)("div",{className:`${f} text-text-primary font-medium truncate`,title:i||"",children:"-"!==l?`in ${l}`:i}):(0,a.jsxs)("div",{className:"space-y-0.5",children:["-"!==l&&(0,a.jsxs)("div",{className:`${f} text-text-primary font-medium`,children:["in ",l]}),i&&(0,a.jsx)("div",{className:`${v} text-text-muted`,children:i})]}):(0,a.jsx)("div",{className:`${f} text-text-muted italic`,children:"N/A"})})]},`${e.name}-${e.index}`)})})})}),m>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 ",h,"-",b," of ",u.length]}),(0,a.jsxs)("span",{children:["Page ",i," / ",m]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>c(e=>Math.max(1,e-1)),disabled:1===i,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:()=>c(e=>Math.min(m,e+1)),disabled:i===m,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Next"})]})]})]})}var c=r(98542),d=r(84588),u=r(35497),m=r(52679);function x(e){let t=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);return t(e.email)?e.email:(t(e.name),e.name)}function h(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}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)}let g="quotaCacheData";function f(){try{let e=window.localStorage.getItem(g);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function v(e,t){try{let r=f();r[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(g,JSON.stringify(r))}catch(e){console.error("Error writing quota cache:",e)}}let y="quotaAutoRefresh",k=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],w=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}],j=[10,20,50,100];function N(){let[e,t]=(0,s.useState)([]),[r,N]=(0,s.useState)({}),[S,C]=(0,s.useState)({}),[$,E]=(0,s.useState)({}),[A,q]=(0,s.useState)(!0),[P,M]=(0,s.useState)(null),[D,T]=(0,s.useState)(!1),[I,O]=(0,s.useState)(!1),[L,_]=(0,s.useState)(60),[F,z]=(0,s.useState)(!0),[U,R]=(0,s.useState)(null),[J,K]=(0,s.useState)(null),[B,G]=(0,s.useState)(!1),[H,Y]=(0,s.useState)(null),[Q,V]=(0,s.useState)([]),[W,X]=(0,s.useState)("all"),[Z,ee]=(0,s.useState)([]),[et,er]=(0,s.useState)("all"),[ea,es]=(0,s.useState)("default"),[el,ei]=(0,s.useState)(!1),[en,eo]=(0,s.useState)(!1),[ec,ed]=(0,s.useState)(!1),[eu,em]=(0,s.useState)(1),[ex,eh]=(0,s.useState)(20),[eb,ep]=(0,s.useState)(String(20)),[eg,ef]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[ev,ey]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),ek=(0,s.useRef)(null),ew=(0,s.useRef)(null),ej=(0,s.useCallback)(async(e=eu)=>{try{var r,a;let s=new URLSearchParams({page:String(e),pageSize:String(ex),accountStatus:et,sort:"priority"});"all"!==W&&s.set("provider",W);let l=await fetch(`/api/providers/client?${s.toString()}`);if(!l.ok)throw Error("Failed to fetch connections");let i=await l.json(),n=i.connections||[],o=(r=i.pagination,r||{page:1,pageSize:ex,total:0,totalPages:1}),c=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(i.totals,n.length);return t(n),ee(i.providerOptions||[]),ef(o),ey(c),em((a=i.pagination,a?.page||e)),n}catch(e){return console.error("Error fetching connections:",e),t([]),ee([]),ef({page:1,pageSize:ex,total:0,totalPages:1}),ey({eligibleConnections:0,providerFilteredConnections:0}),[]}},[et,el,eu,ex,W]),eN=(0,s.useCallback)(async(e,t)=>{C(t=>({...t,[e]:!0})),E(t=>({...t,[e]:null}));try{console.log(`[ProviderLimits] Fetching quota for ${t} (${e})`);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 console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===r.status){console.warn(`[ProviderLimits] Auth error for ${t}:`,a);let r={quotas:[],message:a};N(t=>({...t,[e]:r})),v(e,r);return}throw Error(`HTTP ${r.status}: ${a}`)}let a=await r.json();console.log(`[ProviderLimits] Got quota for ${t}:`,a);let 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"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})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,i.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};N(t=>({...t,[e]:s})),v(e,s)}catch(r){console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),E(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{C(t=>({...t,[e]:!1}))}},[]),eS=(0,s.useCallback)(async(e,t)=>{await eN(e,t),M(new Date)},[eN]),eC=(0,s.useCallback)(async e=>{if(confirm("Delete this connection?")){R(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){N(t=>{let r={...t};return delete r[e],r}),C(t=>{let r={...t};return delete r[e],r}),E(t=>{let r={...t};return delete r[e],r});try{let t=f();t[e]&&(delete t[e],window.localStorage.setItem(g,JSON.stringify(t)))}catch(e){console.error("Error deleting cache entry:",e)}await p(ej,eu)}}catch(e){console.error("Error deleting connection:",e)}finally{R(null)}}},[ej,eu]),e$=(0,s.useCallback)(async(e,t)=>{K(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(N(e=>({...e})),await p(ej,eu))}catch(e){console.error("Error updating connection status:",e)}finally{K(null)}},[ej,eu]),eE=(0,s.useCallback)(async e=>{if(!H?.id)return;let t=H.id,r=H.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await ej(),G(!1),Y(null),m.wb.includes(r)&&await eN(t,r))}catch(e){console.error("Error saving connection:",e)}},[H,ej,eN]);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).then(t=>{!e&&t?.proxyPools&&V(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let eA=(0,s.useCallback)(async()=>{if(!I){O(!0),_(60);try{let e,t=await ej(eu);C((e={},t.forEach(t=>{e[t.id]=!0}),e)),E(e=>b(e,t)),N(e=>b(e,t)),await Promise.all(t.map(e=>eN(e.id,e.provider))),M(new Date)}catch(e){console.error("Error refreshing all providers:",e)}finally{O(!1)}}},[I,ej,eN,eu]);(0,s.useEffect)(()=>{(async()=>{z(!0);let e=await ej(eu);z(!1);let t=f(),r={},a={},s=[],l=null;e.forEach(e=>{let i=t[e.id];if(i){if(r[e.id]=!1,a[e.id]={quotas:i.quotas,plan:i.plan,message:i.message,raw:i.raw},i.cachedAt){let e=new Date(i.cachedAt);(!l||e>l)&&(l=e)}}else r[e.id]=!0,s.push(e)}),C(r),E(r=>{let a=b(r,e);return e.forEach(e=>{t[e.id]&&(a[e.id]=null)}),a}),N(t=>({...b(t,e),...a})),l&&M(l),s.length>0&&(await Promise.all(s.map(e=>eN(e.id,e.provider))),M(new Date))})()},[ej,eN,eu]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(y);q(null===e||"true"===e),T(!0)},[]),(0,s.useEffect)(()=>{D&&window.localStorage.setItem(y,String(A))},[A,D]),(0,s.useEffect)(()=>{if(!D||!A){ek.current&&(clearInterval(ek.current),ek.current=null),ew.current&&(clearInterval(ew.current),ew.current=null);return}return ek.current=setInterval(()=>{eA()},6e4),ew.current=setInterval(()=>{_(e=>e<=1?60:e-1)},1e3),()=>{ek.current&&clearInterval(ek.current),ew.current&&clearInterval(ew.current)}},[A,eA,D]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(ek.current&&(clearInterval(ek.current),ek.current=null),ew.current&&(clearInterval(ew.current),ew.current=null)):A&&D&&(ek.current=setInterval(eA,6e4),ew.current=setInterval(()=>{_(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[A,eA,D]);let eq=(0,s.useMemo)(()=>(function(e,t,r,a,s){if("codex"===a&&"default"!==s)return[...e].sort((e,r)=>{let a=h(e,t),l=h(r,t),i="remaining-asc"===s?a-l:l-a;return 0!==i?i:(x(e)||"").localeCompare(x(r)||"")});if(!r)return e;let l=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=l(e)-l(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(x(e)||"").localeCompare(x(t)||"")})})(e,r,el,W,ea),[e,r,el,W,ea]),eP=e=>{let t=r[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=n(e.used,e.total))},eM=(0,s.useCallback)(async(e,t)=>{if(e.length&&!ec){ed(!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,eu)}catch(e){console.error("Error bulk toggling connections:",e)}finally{ed(!1)}}},[ec,ej,eu]),eD="all"===W?"All providers":W,eT=ev.eligibleConnections>0,eI=eq.length>0,eO=ev.eligibleConnections?ev.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"===W?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===et?"turned off":"active"===et?"active":"matching"} accounts found for ${W}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},eL=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}`}(eg),e_=!j.includes(ex);return F||eT?F||eI?(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:()=>eo(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":en,title:"Filter quota providers",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===W?(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"apps"}):(0,a.jsx)(l.A,{src:`/providers/${W}.png`,alt:W,size:18,className:"size-[18px] rounded object-contain",fallbackText:W.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"truncate capitalize hidden lg:inline",children:eD})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),en&&(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:()=>eo(!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"!==W&&em(1),X("all"),eo(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===W?"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"===W&&(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:Z.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{W!==e&&em(1),X(e),eo(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${W===e?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)(l.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}),W===e&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,a.jsx)("select",{value:et,onChange:e=>{let t=e.target.value;et!==t&&em(1),er(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:k.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===W&&(0,a.jsx)("select",{value:ea,onChange:e=>es(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:w.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)("button",{type:"button",onClick:()=>ei(e=>!e),"aria-pressed":el,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${el?"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:()=>{eM(eq.filter(e=>(e.isActive??!0)&&eP(e)).map(e=>e.id),!1)},disabled:ec,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:()=>{eM(eq.filter(e=>!(e.isActive??!0)&&!eP(e)).map(e=>e.id),!0)},disabled:ec,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:()=>q(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:A?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${A?"text-primary":"text-text-muted"}`,children:A?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{className:"hidden text-text-primary sm:inline",children:"Auto-refresh"}),A&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",L,"s)"]})]}),(0,a.jsx)("button",{type:"button",onClick:eA,disabled:I,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] ${I?"animate-spin":""}`,children:"refresh"})})]})}),el&&(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:eq.map(e=>{let t=r[e.id],s=S[e.id],i=$[e.id],n=!1===e.isActive,u=U===e.id||J===e.id;return(0,a.jsxs)(d.default,{padding:"none",className:`min-w-0 ${n?"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)(l.A,{src:`/providers/${e.provider}.png`,alt:e.provider,size:32,className:"object-contain",fallbackText:e.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:e.provider}),x(e)?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:x(e)}):null]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eS(e.id,e.provider),disabled:s||u,"aria-label":"Refresh quota",className:"p-1.5 rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors disabled:opacity-50",title:"Refresh quota",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${s?"animate-spin":""}`,children:"refresh"})}),(0,a.jsx)("button",{type:"button",onClick:()=>{Y(e),G(!0)},disabled:u,"aria-label":"Edit connection",className:"p-1.5 rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors disabled:opacity-50",title:"Edit connection",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eC(e.id),disabled:u,"aria-label":"Delete connection",className:"p-1.5 rounded-lg hover:bg-red-500/10 text-red-500 transition-colors disabled:opacity-50",title:"Delete connection",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${U===e.id?"animate-pulse":""}`,children:"delete"})}),(0,a.jsx)("div",{className:"inline-flex items-center pl-0.5",title:e.isActive??!0?"Disable connection":"Enable connection",children:(0,a.jsx)(c.default,{size:"sm",checked:e.isActive??!0,disabled:u,onChange:t=>e$(e.id,t)})})]})]})}),(0,a.jsx)("div",{className:"px-2 py-1.5",children:s?(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"})}):i?(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:i})]}):t?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-text-muted",children:t.message})}):(0,a.jsx)(o,{quotas:t?.quotas,compact:!0,sortMode:"default",showSortLabel:"codex"===e.provider&&"default"!==ea})})]},e.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:eL}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:e_?"custom":String(ex),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(em(1),eh(r),ep(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:[j.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:eb,onChange:e=>ep(e.target.value),onBlur:()=>{let e=Number.parseInt(eb,10);if(!Number.isFinite(e))return void ep(String(ex));let t=Math.min(500,Math.max(1,e));em(1),eh(t),ep(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eb,10);if(!Number.isFinite(t))return void ep(String(ex));let r=Math.min(500,Math.max(1,t));em(1),eh(r),ep(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 ",eg.page," / ",eg.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>em(1),disabled:eg.page<=1||F||I,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:()=>em(e=>Math.max(1,e-1)),disabled:eg.page<=1||F||I,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:()=>em(e=>Math.min(eg.totalPages,e+1)),disabled:eg.page>=eg.totalPages||F||I,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:()=>em(eg.totalPages),disabled:eg.page>=eg.totalPages||F||I,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)(u.wI,{isOpen:B,connection:H,proxyPools:Q,onSave:eE,onClose:()=>{G(!1),Y(null)}})]}):(0,a.jsx)(d.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:eO.icon}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:eO.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:eO.description})]})}):(0,a.jsx)(d.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,8500,4288,1321,5497,8441,3794,7358],()=>e(e.s=5744)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{5744:(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:()=>N});var a=r(95155),s=r(12115),l=r(57250),i=r(45564);function n(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function o({quotas:e=[],compact:t=!1,sortMode:r="default",showSortLabel:l=!1}){let[i,c]=(0,s.useState)(1),d=(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):n(e?.used,e?.total)})),[e]),u=(0,s.useMemo)(()=>"remaining-asc"===r?[...d].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...d].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):d,[d,r]),m=Math.max(1,Math.ceil(u.length/10));if((0,s.useEffect)(()=>{c(1)},[r,e]),(0,s.useEffect)(()=>{c(e=>Math.min(e,m))},[m]),!e||0===e.length)return null;let x=u.slice((i-1)*10,10*i),h=0===u.length?0:(i-1)*10+1,b=Math.min(10*i,u.length),p=t?"py-1 px-1.5":"py-2 px-3",g=t?"text-[11px]":"text-sm",f=t?"text-[11px]":"text-sm",v=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:[u.length," quota",u.length>1?"s":""]}),l&&(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:x.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"},l=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 l=Math.floor(s/60),i=s%60;if(l<24)return`${l}h ${i}m`;let n=Math.floor(l/24);return`${n}d ${l%24}h ${i}m`}catch(e){return"-"}}(e.resetAt),i=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 l="";l=t>=a&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let i=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${l}, ${i}`}catch{return null}}(e.resetAt);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:`${p} 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:`${g} font-medium text-text-primary truncate`,children:e.name})]})}),(0,a.jsx)("td",{className:`${p} 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:`${p} w-[25%]`,children:"-"!==l||i?t?(0,a.jsx)("div",{className:`${f} text-text-primary font-medium truncate`,title:i||"",children:"-"!==l?`in ${l}`:i}):(0,a.jsxs)("div",{className:"space-y-0.5",children:["-"!==l&&(0,a.jsxs)("div",{className:`${f} text-text-primary font-medium`,children:["in ",l]}),i&&(0,a.jsx)("div",{className:`${v} text-text-muted`,children:i})]}):(0,a.jsx)("div",{className:`${f} text-text-muted italic`,children:"N/A"})})]},`${e.name}-${e.index}`)})})})}),m>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 ",h,"-",b," of ",u.length]}),(0,a.jsxs)("span",{children:["Page ",i," / ",m]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>c(e=>Math.max(1,e-1)),disabled:1===i,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:()=>c(e=>Math.min(m,e+1)),disabled:i===m,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Next"})]})]})]})}var c=r(98542),d=r(84588),u=r(35497),m=r(52679);function x(e){let t=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);return t(e.email)?e.email:(t(e.name),e.name)}function h(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}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)}let g="quotaCacheData";function f(){try{let e=window.localStorage.getItem(g);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function v(e,t){try{let r=f();r[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(g,JSON.stringify(r))}catch(e){console.error("Error writing quota cache:",e)}}let y="quotaAutoRefresh",k=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],w=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}],j=[10,20,50,100];function N(){let[e,t]=(0,s.useState)([]),[r,N]=(0,s.useState)({}),[S,C]=(0,s.useState)({}),[$,E]=(0,s.useState)({}),[A,q]=(0,s.useState)(!0),[P,M]=(0,s.useState)(null),[D,T]=(0,s.useState)(!1),[I,O]=(0,s.useState)(!1),[L,_]=(0,s.useState)(60),[F,z]=(0,s.useState)(!0),[U,R]=(0,s.useState)(null),[J,K]=(0,s.useState)(null),[B,G]=(0,s.useState)(!1),[H,Y]=(0,s.useState)(null),[Q,V]=(0,s.useState)([]),[W,X]=(0,s.useState)("all"),[Z,ee]=(0,s.useState)([]),[et,er]=(0,s.useState)("all"),[ea,es]=(0,s.useState)("default"),[el,ei]=(0,s.useState)(!1),[en,eo]=(0,s.useState)(!1),[ec,ed]=(0,s.useState)(!1),[eu,em]=(0,s.useState)(1),[ex,eh]=(0,s.useState)(20),[eb,ep]=(0,s.useState)(String(20)),[eg,ef]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[ev,ey]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),ek=(0,s.useRef)(null),ew=(0,s.useRef)(null),ej=(0,s.useCallback)(async(e=eu)=>{try{var r,a;let s=new URLSearchParams({page:String(e),pageSize:String(ex),accountStatus:et,sort:"priority"});"all"!==W&&s.set("provider",W);let l=await fetch(`/api/providers/client?${s.toString()}`);if(!l.ok)throw Error("Failed to fetch connections");let i=await l.json(),n=i.connections||[],o=(r=i.pagination,r||{page:1,pageSize:ex,total:0,totalPages:1}),c=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(i.totals,n.length);return t(n),ee(i.providerOptions||[]),ef(o),ey(c),em((a=i.pagination,a?.page||e)),n}catch(e){return console.error("Error fetching connections:",e),t([]),ee([]),ef({page:1,pageSize:ex,total:0,totalPages:1}),ey({eligibleConnections:0,providerFilteredConnections:0}),[]}},[et,el,eu,ex,W]),eN=(0,s.useCallback)(async(e,t)=>{C(t=>({...t,[e]:!0})),E(t=>({...t,[e]:null}));try{console.log(`[ProviderLimits] Fetching quota for ${t} (${e})`);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 console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===r.status){console.warn(`[ProviderLimits] Auth error for ${t}:`,a);let r={quotas:[],message:a};N(t=>({...t,[e]:r})),v(e,r);return}throw Error(`HTTP ${r.status}: ${a}`)}let a=await r.json();console.log(`[ProviderLimits] Got quota for ${t}:`,a);let 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"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})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,i.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};N(t=>({...t,[e]:s})),v(e,s)}catch(r){console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),E(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{C(t=>({...t,[e]:!1}))}},[]),eS=(0,s.useCallback)(async(e,t)=>{await eN(e,t),M(new Date)},[eN]),eC=(0,s.useCallback)(async e=>{if(confirm("Delete this connection?")){R(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){N(t=>{let r={...t};return delete r[e],r}),C(t=>{let r={...t};return delete r[e],r}),E(t=>{let r={...t};return delete r[e],r});try{let t=f();t[e]&&(delete t[e],window.localStorage.setItem(g,JSON.stringify(t)))}catch(e){console.error("Error deleting cache entry:",e)}await p(ej,eu)}}catch(e){console.error("Error deleting connection:",e)}finally{R(null)}}},[ej,eu]),e$=(0,s.useCallback)(async(e,t)=>{K(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(N(e=>({...e})),await p(ej,eu))}catch(e){console.error("Error updating connection status:",e)}finally{K(null)}},[ej,eu]),eE=(0,s.useCallback)(async e=>{if(!H?.id)return;let t=H.id,r=H.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await ej(),G(!1),Y(null),m.wb.includes(r)&&await eN(t,r))}catch(e){console.error("Error saving connection:",e)}},[H,ej,eN]);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).then(t=>{!e&&t?.proxyPools&&V(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let eA=(0,s.useCallback)(async()=>{if(!I){O(!0),_(60);try{let e,t=await ej(eu);C((e={},t.forEach(t=>{e[t.id]=!0}),e)),E(e=>b(e,t)),N(e=>b(e,t)),await Promise.all(t.map(e=>eN(e.id,e.provider))),M(new Date)}catch(e){console.error("Error refreshing all providers:",e)}finally{O(!1)}}},[I,ej,eN,eu]);(0,s.useEffect)(()=>{(async()=>{z(!0);let e=await ej(eu);z(!1);let t=f(),r={},a={},s=[],l=null;e.forEach(e=>{let i=t[e.id];if(i){if(r[e.id]=!1,a[e.id]={quotas:i.quotas,plan:i.plan,message:i.message,raw:i.raw},i.cachedAt){let e=new Date(i.cachedAt);(!l||e>l)&&(l=e)}}else r[e.id]=!0,s.push(e)}),C(r),E(r=>{let a=b(r,e);return e.forEach(e=>{t[e.id]&&(a[e.id]=null)}),a}),N(t=>({...b(t,e),...a})),l&&M(l),s.length>0&&(await Promise.all(s.map(e=>eN(e.id,e.provider))),M(new Date))})()},[ej,eN,eu]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(y);q(null===e||"true"===e),T(!0)},[]),(0,s.useEffect)(()=>{D&&window.localStorage.setItem(y,String(A))},[A,D]),(0,s.useEffect)(()=>{if(!D||!A){ek.current&&(clearInterval(ek.current),ek.current=null),ew.current&&(clearInterval(ew.current),ew.current=null);return}return ek.current=setInterval(()=>{eA()},6e4),ew.current=setInterval(()=>{_(e=>e<=1?60:e-1)},1e3),()=>{ek.current&&clearInterval(ek.current),ew.current&&clearInterval(ew.current)}},[A,eA,D]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(ek.current&&(clearInterval(ek.current),ek.current=null),ew.current&&(clearInterval(ew.current),ew.current=null)):A&&D&&(ek.current=setInterval(eA,6e4),ew.current=setInterval(()=>{_(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[A,eA,D]);let eq=(0,s.useMemo)(()=>(function(e,t,r,a,s){if("codex"===a&&"default"!==s)return[...e].sort((e,r)=>{let a=h(e,t),l=h(r,t),i="remaining-asc"===s?a-l:l-a;return 0!==i?i:(x(e)||"").localeCompare(x(r)||"")});if(!r)return e;let l=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=l(e)-l(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(x(e)||"").localeCompare(x(t)||"")})})(e,r,el,W,ea),[e,r,el,W,ea]),eP=e=>{let t=r[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=n(e.used,e.total))},eM=(0,s.useCallback)(async(e,t)=>{if(e.length&&!ec){ed(!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,eu)}catch(e){console.error("Error bulk toggling connections:",e)}finally{ed(!1)}}},[ec,ej,eu]),eD="all"===W?"All providers":W,eT=ev.eligibleConnections>0,eI=eq.length>0,eO=ev.eligibleConnections?ev.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"===W?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===et?"turned off":"active"===et?"active":"matching"} accounts found for ${W}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},eL=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}`}(eg),e_=!j.includes(ex);return F||eT?F||eI?(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:()=>eo(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":en,title:"Filter quota providers",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===W?(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"apps"}):(0,a.jsx)(l.A,{src:`/providers/${W}.png`,alt:W,size:18,className:"size-[18px] rounded object-contain",fallbackText:W.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"truncate capitalize hidden lg:inline",children:eD})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),en&&(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:()=>eo(!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"!==W&&em(1),X("all"),eo(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===W?"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"===W&&(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:Z.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{W!==e&&em(1),X(e),eo(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${W===e?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)(l.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}),W===e&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,a.jsx)("select",{value:et,onChange:e=>{let t=e.target.value;et!==t&&em(1),er(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:k.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===W&&(0,a.jsx)("select",{value:ea,onChange:e=>es(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:w.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)("button",{type:"button",onClick:()=>ei(e=>!e),"aria-pressed":el,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${el?"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:()=>{eM(eq.filter(e=>(e.isActive??!0)&&eP(e)).map(e=>e.id),!1)},disabled:ec,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:()=>{eM(eq.filter(e=>!(e.isActive??!0)&&!eP(e)).map(e=>e.id),!0)},disabled:ec,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:()=>q(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:A?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${A?"text-primary":"text-text-muted"}`,children:A?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{className:"hidden text-text-primary sm:inline",children:"Auto-refresh"}),A&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",L,"s)"]})]}),(0,a.jsx)("button",{type:"button",onClick:eA,disabled:I,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] ${I?"animate-spin":""}`,children:"refresh"})})]})}),el&&(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:eq.map(e=>{let t=r[e.id],s=S[e.id],i=$[e.id],n=!1===e.isActive,u=U===e.id||J===e.id;return(0,a.jsxs)(d.default,{padding:"none",className:`min-w-0 ${n?"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)(l.A,{src:`/providers/${e.provider}.png`,alt:e.provider,size:32,className:"object-contain",fallbackText:e.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:e.provider}),x(e)?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:x(e)}):null]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eS(e.id,e.provider),disabled:s||u,"aria-label":"Refresh quota",className:"p-1.5 rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors disabled:opacity-50",title:"Refresh quota",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${s?"animate-spin":""}`,children:"refresh"})}),(0,a.jsx)("button",{type:"button",onClick:()=>{Y(e),G(!0)},disabled:u,"aria-label":"Edit connection",className:"p-1.5 rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors disabled:opacity-50",title:"Edit connection",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eC(e.id),disabled:u,"aria-label":"Delete connection",className:"p-1.5 rounded-lg hover:bg-red-500/10 text-red-500 transition-colors disabled:opacity-50",title:"Delete connection",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${U===e.id?"animate-pulse":""}`,children:"delete"})}),(0,a.jsx)("div",{className:"inline-flex items-center pl-0.5",title:e.isActive??!0?"Disable connection":"Enable connection",children:(0,a.jsx)(c.default,{size:"sm",checked:e.isActive??!0,disabled:u,onChange:t=>e$(e.id,t)})})]})]})}),(0,a.jsx)("div",{className:"px-2 py-1.5",children:s?(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"})}):i?(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:i})]}):t?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-text-muted",children:t.message})}):(0,a.jsx)(o,{quotas:t?.quotas,compact:!0,sortMode:"default",showSortLabel:"codex"===e.provider&&"default"!==ea})})]},e.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:eL}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:e_?"custom":String(ex),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(em(1),eh(r),ep(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:[j.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:eb,onChange:e=>ep(e.target.value),onBlur:()=>{let e=Number.parseInt(eb,10);if(!Number.isFinite(e))return void ep(String(ex));let t=Math.min(500,Math.max(1,e));em(1),eh(t),ep(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eb,10);if(!Number.isFinite(t))return void ep(String(ex));let r=Math.min(500,Math.max(1,t));em(1),eh(r),ep(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 ",eg.page," / ",eg.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>em(1),disabled:eg.page<=1||F||I,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:()=>em(e=>Math.max(1,e-1)),disabled:eg.page<=1||F||I,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:()=>em(e=>Math.min(eg.totalPages,e+1)),disabled:eg.page>=eg.totalPages||F||I,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:()=>em(eg.totalPages),disabled:eg.page>=eg.totalPages||F||I,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)(u.wI,{isOpen:B,connection:H,proxyPools:Q,onSave:eE,onClose:()=>{G(!1),Y(null)}})]}):(0,a.jsx)(d.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:eO.icon}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:eO.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:eO.description})]})}):(0,a.jsx)(d.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,1051,1321,5497,8441,3794,7358],()=>e(e.s=5744)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9516],{43466:(e,t,i)=>{Promise.resolve().then(i.bind(i,64082))},64082:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>b});var s=i(95155),r=i(35497),n=i(11059);let a="decolua/bluerouter",o="master",l="skills",c=`https://github.com/${a}`,d=`https://raw.githubusercontent.com/${a}/refs/heads/${o}/${l}`,m=`https://github.com/${a}/blob/${o}/${l}`,x=[{id:"bluerouter",name:"Bluerouter (Entry)",description:"Setup + index of all capabilities. Start here — covers base URL, auth, model discovery, and links to every capability skill.",endpoint:null,icon:"hub",isEntry:!0},{id:"bluerouter-chat",name:"Chat",description:"Chat / code-gen via OpenAI or Anthropic format with streaming.",endpoint:"/v1/chat/completions",icon:"chat"},{id:"bluerouter-image",name:"Image Generation",description:"Text-to-image via DALL-E, Imagen, FLUX, MiniMax, SDWebUI…",endpoint:"/v1/images/generations",icon:"image"},{id:"bluerouter-tts",name:"Text-to-Speech",description:"OpenAI / ElevenLabs / Edge / Google / Deepgram voices.",endpoint:"/v1/audio/speech",icon:"record_voice_over"},{id:"bluerouter-stt",name:"Speech-to-Text",description:"Transcribe audio via OpenAI Whisper, Groq, Gemini, Deepgram, AssemblyAI…",endpoint:"/v1/audio/transcriptions",icon:"mic"},{id:"bluerouter-embeddings",name:"Embeddings",description:"Vectors for RAG / semantic search via OpenAI, Gemini, Mistral…",endpoint:"/v1/embeddings",icon:"scatter_plot"},{id:"bluerouter-web-search",name:"Web Search",description:"Tavily / Exa / Brave / Serper / SearXNG / Google PSE / You.com.",endpoint:"/v1/search",icon:"search"},{id:"bluerouter-web-fetch",name:"Web Fetch",description:"URL → markdown / text / HTML via Firecrawl, Jina, Tavily, Exa.",endpoint:"/v1/web/fetch",icon:"language"}];function p(e){return`${d}/${e}/SKILL.md`}function u({value:e,label:t="Copy link"}){let{copied:i,copy:r}=(0,n.C)(2e3);return(0,s.jsxs)("button",{onClick:()=>r(e),className:"px-2 py-1 rounded-md bg-primary text-white text-[11px] font-medium hover:bg-primary/90 transition-colors cursor-pointer shrink-0 inline-flex items-center gap-1",title:e,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:i?"check":"content_copy"}),i?"Copied!":t]})}function h({skill:e}){var t;let i=p(e.id);return(0,s.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,s.jsx)("div",{className:`size-9 rounded-lg flex items-center justify-center shrink-0 ${e.isEntry?"bg-primary text-white":"bg-primary/10 text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:e.icon})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,s.jsx)("h3",{className:"font-semibold text-sm text-text-main",children:e.name}),e.isEntry&&(0,s.jsx)(r.Ex,{variant:"primary",size:"sm",children:"START HERE"}),e.endpoint&&(0,s.jsx)(r.Ex,{variant:"default",size:"sm",children:(0,s.jsx)("code",{className:"text-[10px]",children:e.endpoint})})]}),(0,s.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e.description}),(0,s.jsxs)("a",{href:(t=e.id,`${m}/${t}/SKILL.md`),target:"_blank",rel:"noreferrer",className:"text-[11px] text-text-muted hover:text-primary mt-1 inline-flex items-center gap-1 break-all",children:[i,(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"open_in_new"})]})]}),(0,s.jsx)(u,{value:i})]})}function b(){return(0,s.jsxs)("div",{className:"max-w-4xl mx-auto space-y-6",children:[(0,s.jsxs)(r.Zp,{padding:"md",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted mb-2",children:"Paste this to your AI:"}),(0,s.jsxs)("div",{className:"px-3 py-2 rounded bg-surface-2 font-mono text-[12px] text-text-main",children:["Read this skill and use it: ",p("bluerouter")]})]}),(0,s.jsx)("div",{className:"space-y-2",children:x.map(e=>(0,s.jsx)(h,{skill:e},e.id))}),(0,s.jsx)(r.Zp,{padding:"md",children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:"More on GitHub"}),(0,s.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:"Browse source, README, and examples."})]}),(0,s.jsxs)("a",{href:`${c}/tree/master/skills`,target:"_blank",rel:"noreferrer",className:"text-sm text-primary hover:underline inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"open_in_new"}),"View on GitHub"]})]})})]})}}},e=>{e.O(0,[2574,3862,8500,4288,1321,5497,8441,3794,7358],()=>e(e.s=43466)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9516],{43466:(e,t,i)=>{Promise.resolve().then(i.bind(i,64082))},64082:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>b});var s=i(95155),r=i(35497),n=i(11059);let a="decolua/bluerouter",o="master",l="skills",c=`https://github.com/${a}`,d=`https://raw.githubusercontent.com/${a}/refs/heads/${o}/${l}`,m=`https://github.com/${a}/blob/${o}/${l}`,x=[{id:"bluerouter",name:"Bluerouter (Entry)",description:"Setup + index of all capabilities. Start here — covers base URL, auth, model discovery, and links to every capability skill.",endpoint:null,icon:"hub",isEntry:!0},{id:"bluerouter-chat",name:"Chat",description:"Chat / code-gen via OpenAI or Anthropic format with streaming.",endpoint:"/v1/chat/completions",icon:"chat"},{id:"bluerouter-image",name:"Image Generation",description:"Text-to-image via DALL-E, Imagen, FLUX, MiniMax, SDWebUI…",endpoint:"/v1/images/generations",icon:"image"},{id:"bluerouter-tts",name:"Text-to-Speech",description:"OpenAI / ElevenLabs / Edge / Google / Deepgram voices.",endpoint:"/v1/audio/speech",icon:"record_voice_over"},{id:"bluerouter-stt",name:"Speech-to-Text",description:"Transcribe audio via OpenAI Whisper, Groq, Gemini, Deepgram, AssemblyAI…",endpoint:"/v1/audio/transcriptions",icon:"mic"},{id:"bluerouter-embeddings",name:"Embeddings",description:"Vectors for RAG / semantic search via OpenAI, Gemini, Mistral…",endpoint:"/v1/embeddings",icon:"scatter_plot"},{id:"bluerouter-web-search",name:"Web Search",description:"Tavily / Exa / Brave / Serper / SearXNG / Google PSE / You.com.",endpoint:"/v1/search",icon:"search"},{id:"bluerouter-web-fetch",name:"Web Fetch",description:"URL → markdown / text / HTML via Firecrawl, Jina, Tavily, Exa.",endpoint:"/v1/web/fetch",icon:"language"}];function p(e){return`${d}/${e}/SKILL.md`}function u({value:e,label:t="Copy link"}){let{copied:i,copy:r}=(0,n.C)(2e3);return(0,s.jsxs)("button",{onClick:()=>r(e),className:"px-2 py-1 rounded-md bg-primary text-white text-[11px] font-medium hover:bg-primary/90 transition-colors cursor-pointer shrink-0 inline-flex items-center gap-1",title:e,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:i?"check":"content_copy"}),i?"Copied!":t]})}function h({skill:e}){var t;let i=p(e.id);return(0,s.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,s.jsx)("div",{className:`size-9 rounded-lg flex items-center justify-center shrink-0 ${e.isEntry?"bg-primary text-white":"bg-primary/10 text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:e.icon})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,s.jsx)("h3",{className:"font-semibold text-sm text-text-main",children:e.name}),e.isEntry&&(0,s.jsx)(r.Ex,{variant:"primary",size:"sm",children:"START HERE"}),e.endpoint&&(0,s.jsx)(r.Ex,{variant:"default",size:"sm",children:(0,s.jsx)("code",{className:"text-[10px]",children:e.endpoint})})]}),(0,s.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e.description}),(0,s.jsxs)("a",{href:(t=e.id,`${m}/${t}/SKILL.md`),target:"_blank",rel:"noreferrer",className:"text-[11px] text-text-muted hover:text-primary mt-1 inline-flex items-center gap-1 break-all",children:[i,(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"open_in_new"})]})]}),(0,s.jsx)(u,{value:i})]})}function b(){return(0,s.jsxs)("div",{className:"max-w-4xl mx-auto space-y-6",children:[(0,s.jsxs)(r.Zp,{padding:"md",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted mb-2",children:"Paste this to your AI:"}),(0,s.jsxs)("div",{className:"px-3 py-2 rounded bg-surface-2 font-mono text-[12px] text-text-main",children:["Read this skill and use it: ",p("bluerouter")]})]}),(0,s.jsx)("div",{className:"space-y-2",children:x.map(e=>(0,s.jsx)(h,{skill:e},e.id))}),(0,s.jsx)(r.Zp,{padding:"md",children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:"More on GitHub"}),(0,s.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:"Browse source, README, and examples."})]}),(0,s.jsxs)("a",{href:`${c}/tree/master/skills`,target:"_blank",rel:"noreferrer",className:"text-sm text-primary hover:underline inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"open_in_new"}),"View on GitHub"]})]})})]})}}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=43466)),_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)},49106:(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 o},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 l="u">typeof globalThis&&globalThis.AsyncLocalStorage;function o(){return l?new l:new s}function i(e){return l?l.bind(e):s.bind(e)}function d(){return l?l.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 l(e){return{default:e&&"default"in e?e.default:e}}n(21957);let o={loader:()=>Promise.resolve(l(()=>null)),loading:null,ssr:!0},i=function(e){let t={...o,...e},n=(0,a.lazy)(()=>t.loader().then(l)),i=t.loading;function d(e){let l=i?(0,r.jsx)(i,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,d=o?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,{...o?{fallback:l}:{},children:c})}return d.displayName="LoadableComponent",d}},69472:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>u});var r=n(95155),a=n(12115),s=n(35497),l=n(11059),o=n(75707);let i=n.n(o)()(()=>n.e(8202).then(n.bind(n,28202)),{loadableGenerated:{webpack:()=>[28202]},ssr:!1}),d=[{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"}],c={minimap:{enabled:!1},fontSize:12,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0};function u(){let[e,t]=(0,a.useState)({}),[n,o]=(0,a.useState)({1:!0}),[u,f]=(0,a.useState)({}),[m,x]=(0,a.useState)(null),g=(e,t)=>f(n=>({...n,[e]:t})),h=(e,n)=>t(t=>({...t,[e]:n})),b=e=>o(t=>{let n={};return d.forEach(e=>{n[e.id]=!1}),n[e]=!0,n}),y=async e=>{let t=d.find(t=>t.id===e);g(`load-${e}`,!0);try{let n=await fetch(`/api/translator/load?file=${t.file}`),r=await n.json();r.success?(h(e,r.content),1===e&&await j(r.content)):alert(r.error||"File not found")}catch(e){alert(e.message)}g(`load-${e}`,!1)},j=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&&x(r.result)}catch{}},_=(e,t)=>fetch("/api/translator/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,content:t})}).catch(()=>{}),v=async()=>{g("toOpenAI",!0);try{let t=e[1],n=JSON.parse(t);_("1_req_client.json",t),_("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 alert(a.error);let s=JSON.stringify(a.result.body,null,2);h(3,s),b(3)}catch(e){alert(e.message)}g("toOpenAI",!1)},O=async()=>{g("toTarget",!0);try{let t=e[3],n=JSON.parse(t);_("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:m?.provider,model:m?.model}})}),a=await r.json();if(!a.success)return void alert(a.error);let s={...a.result,provider:m?.provider,model:m?.model};h(4,JSON.stringify(s,null,2)),b(4)}catch(e){alert(e.message)}g("toTarget",!1)},S=async()=>{g("send",!0);try{let t=e[4],n=JSON.parse(t);_("4_req_target.json",t);let r=n.provider||m?.provider,a=n.model||m?.model;if(!r||!a)return void alert("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}));alert(e.error||"Send failed");return}let l=s.body.getReader(),o=new TextDecoder,i="";for(;;){let{done:e,value:t}=await l.read();if(e)break;i+=o.decode(t,{stream:!0})}h(5,i),b(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){alert(e.message)}finally{g("send",!1)}},{copy:w}=(0,l.C)(),N=async t=>{e[t]&&w(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"})]}),m&&(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap justify-end",children:[(0,r.jsx)(p,{label:"src",value:m.sourceFormat,color:"blue"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,r.jsx)(p,{label:"dst",value:m.targetFormat,color:"orange"}),(0,r.jsx)(p,{label:"provider",value:m.provider,color:"green"}),(0,r.jsx)(p,{label:"model",value:m.model,color:"purple"})]})]}),d.map(t=>{var a;let l=1===(a=t.id)?(0,r.jsx)(s.$n,{size:"sm",icon:"arrow_forward",loading:u.toOpenAI,onClick:v,children:"→ OpenAI"}):3===a?(0,r.jsx)(s.$n,{size:"sm",icon:"arrow_forward",loading:u.toTarget,onClick:O,children:"→ Target"}):4===a?(0,r.jsx)(s.$n,{size:"sm",icon:"send",loading:u.send,onClick:S,children:"Send"}):null,d=!!n[t.id],p=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,o(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}),p&&(0,r.jsxs)("span",{className:"text-xs text-green-500",children:["(",p.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:u[`load-${t.id}`],onClick:()=>y(t.id)}),l]})]}),d&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,r.jsx)(i,{height:"400px",defaultLanguage:"text"===t.lang?"plaintext":"json",value:p,onChange:e=>{h(t.id,e||""),1===t.id&&j(e||"")},theme:"vs-dark",options:c})}),(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,r.jsx)(s.$n,{size:"sm",variant:"outline",icon:"folder_open",loading:u[`load-${t.id}`],onClick:()=>y(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]);h(t,JSON.stringify(n,null,2))}catch{}})(t.id),children:"Format"}),(0,r.jsx)(s.$n,{size:"sm",variant:"outline",icon:"content_copy",onClick:()=>N(t.id),children:"Copy"}),l]})]})]})},t.id)})]})}function p({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,8500,4288,1321,5497,8441,3794,7358],()=>e(e.s=49106)),_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)},49106:(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 o},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 l="u">typeof globalThis&&globalThis.AsyncLocalStorage;function o(){return l?new l:new s}function i(e){return l?l.bind(e):s.bind(e)}function d(){return l?l.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 l(e){return{default:e&&"default"in e?e.default:e}}n(21957);let o={loader:()=>Promise.resolve(l(()=>null)),loading:null,ssr:!0},i=function(e){let t={...o,...e},n=(0,a.lazy)(()=>t.loader().then(l)),i=t.loading;function d(e){let l=i?(0,r.jsx)(i,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,d=o?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,{...o?{fallback:l}:{},children:c})}return d.displayName="LoadableComponent",d}},69472:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>u});var r=n(95155),a=n(12115),s=n(35497),l=n(11059),o=n(75707);let i=n.n(o)()(()=>n.e(8202).then(n.bind(n,28202)),{loadableGenerated:{webpack:()=>[28202]},ssr:!1}),d=[{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"}],c={minimap:{enabled:!1},fontSize:12,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0};function u(){let[e,t]=(0,a.useState)({}),[n,o]=(0,a.useState)({1:!0}),[u,f]=(0,a.useState)({}),[m,x]=(0,a.useState)(null),g=(e,t)=>f(n=>({...n,[e]:t})),h=(e,n)=>t(t=>({...t,[e]:n})),b=e=>o(t=>{let n={};return d.forEach(e=>{n[e.id]=!1}),n[e]=!0,n}),y=async e=>{let t=d.find(t=>t.id===e);g(`load-${e}`,!0);try{let n=await fetch(`/api/translator/load?file=${t.file}`),r=await n.json();r.success?(h(e,r.content),1===e&&await j(r.content)):alert(r.error||"File not found")}catch(e){alert(e.message)}g(`load-${e}`,!1)},j=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&&x(r.result)}catch{}},_=(e,t)=>fetch("/api/translator/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,content:t})}).catch(()=>{}),v=async()=>{g("toOpenAI",!0);try{let t=e[1],n=JSON.parse(t);_("1_req_client.json",t),_("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 alert(a.error);let s=JSON.stringify(a.result.body,null,2);h(3,s),b(3)}catch(e){alert(e.message)}g("toOpenAI",!1)},O=async()=>{g("toTarget",!0);try{let t=e[3],n=JSON.parse(t);_("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:m?.provider,model:m?.model}})}),a=await r.json();if(!a.success)return void alert(a.error);let s={...a.result,provider:m?.provider,model:m?.model};h(4,JSON.stringify(s,null,2)),b(4)}catch(e){alert(e.message)}g("toTarget",!1)},S=async()=>{g("send",!0);try{let t=e[4],n=JSON.parse(t);_("4_req_target.json",t);let r=n.provider||m?.provider,a=n.model||m?.model;if(!r||!a)return void alert("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}));alert(e.error||"Send failed");return}let l=s.body.getReader(),o=new TextDecoder,i="";for(;;){let{done:e,value:t}=await l.read();if(e)break;i+=o.decode(t,{stream:!0})}h(5,i),b(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){alert(e.message)}finally{g("send",!1)}},{copy:w}=(0,l.C)(),N=async t=>{e[t]&&w(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"})]}),m&&(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap justify-end",children:[(0,r.jsx)(p,{label:"src",value:m.sourceFormat,color:"blue"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,r.jsx)(p,{label:"dst",value:m.targetFormat,color:"orange"}),(0,r.jsx)(p,{label:"provider",value:m.provider,color:"green"}),(0,r.jsx)(p,{label:"model",value:m.model,color:"purple"})]})]}),d.map(t=>{var a;let l=1===(a=t.id)?(0,r.jsx)(s.$n,{size:"sm",icon:"arrow_forward",loading:u.toOpenAI,onClick:v,children:"→ OpenAI"}):3===a?(0,r.jsx)(s.$n,{size:"sm",icon:"arrow_forward",loading:u.toTarget,onClick:O,children:"→ Target"}):4===a?(0,r.jsx)(s.$n,{size:"sm",icon:"send",loading:u.send,onClick:S,children:"Send"}):null,d=!!n[t.id],p=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,o(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}),p&&(0,r.jsxs)("span",{className:"text-xs text-green-500",children:["(",p.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:u[`load-${t.id}`],onClick:()=>y(t.id)}),l]})]}),d&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,r.jsx)(i,{height:"400px",defaultLanguage:"text"===t.lang?"plaintext":"json",value:p,onChange:e=>{h(t.id,e||""),1===t.id&&j(e||"")},theme:"vs-dark",options:c})}),(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,r.jsx)(s.$n,{size:"sm",variant:"outline",icon:"folder_open",loading:u[`load-${t.id}`],onClick:()=>y(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]);h(t,JSON.stringify(n,null,2))}catch{}})(t.id),children:"Format"}),(0,r.jsx)(s.$n,{size:"sm",variant:"outline",icon:"content_copy",onClick:()=>N(t.id),children:"Copy"}),l]})]})]})},t.id)})]})}function p({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,1051,1321,5497,8441,3794,7358],()=>e(e.s=49106)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2825],{21007:(e,t,s)=>{Promise.resolve().then(s.bind(s,81772))},81772:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>N});var a=s(95155),l=s(12115),n=s(73321),r=s(35497),i=s(84588),d=s(92542),o=s(31474);function c({isOpen:e,onClose:t,title:s,children:n,width:r="md",className:i}){let d={sm:"w-[400px]",md:"w-[500px]",lg:"w-[600px]",xl:"w-[800px]",full:"w-full"};return((0,l.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,l.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,o.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",d[r]||d.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:n})]})]}):null}function x({currentPage:e,pageSize:t,totalItems:s,onPageChange:l,onPageSizeChange:n,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,o.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:[n&&(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=>n(Number(e.target.value)),className:(0,o.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)(d.default,{variant:"outline",size:"sm",onClick:()=>l(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)(d.default,{variant:"ghost",size:"sm",onClick:()=>l(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)(d.default,{variant:e===t?"primary":"ghost",size:"sm",onClick:()=>l(t),className:(0,o.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)(d.default,{variant:"ghost",size:"sm",onClick:()=>l(i),className:"w-9 px-0 hidden sm:inline-flex",children:i})]}),(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>l(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(52679);let h=null,p=null;async function u(){if(h&&p)return{providerNameCache:h,providerNodesCache:p};let e=await fetch("/api/provider-nodes"),t=(await e.json()).nodes||[];for(let e of(p={},t))p[e.id]=e.name;return{providerNameCache:h={...m.Q2,...p},providerNodesCache:p}}function f(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 b({title:e,children:t,defaultOpen:s=!1,icon:n=null}){let[r,i]=(0,l.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:[n&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:n}),(0,a.jsx)("span",{className:"font-semibold text-sm text-text-main",children:e})]}),(0,a.jsx)("span",{className:(0,o.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 j(e){let t=e?.prompt_tokens||e?.input_tokens||0,s=e?.cached_tokens||e?.cache_read_input_tokens||0;return t<s?s:t}function g(){let[e,t]=(0,l.useState)([]),[s,n]=(0,l.useState)({page:1,pageSize:20,totalItems:0,totalPages:0}),[r,m]=(0,l.useState)(!1),[h,p]=(0,l.useState)(null),[g,v]=(0,l.useState)(!1),[N,w]=(0,l.useState)([]),[k,y]=(0,l.useState)(null),[S,C]=(0,l.useState)({provider:"",startDate:"",endDate:""}),D=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/usage/providers"),t=await e.json();w(t.providers||[]);let s=await u();y(s.providerNameCache)}catch(e){console.error("Failed to fetch providers:",e)}},[]),z=(0,l.useCallback)(async()=>{m(!0);try{let e=new URLSearchParams({page:s.page.toString(),pageSize:s.pageSize.toString()});S.provider&&e.append("provider",S.provider),S.startDate&&e.append("startDate",S.startDate),S.endDate&&e.append("endDate",S.endDate);let a=await fetch(`/api/usage/request-details?${e}`),l=await a.json();t(l.details||[]),n(e=>({...e,...l.pagination}))}catch(e){console.error("Failed to fetch request details:",e)}finally{m(!1)}},[s.page,s.pageSize,S]);return(0,l.useEffect)(()=>{D()},[D]),(0,l.useEffect)(()=>{z()},[z]),(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:S.provider,onChange:e=>C({...S,provider:e.target.value}),className:(0,o.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"}),N.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:S.startDate,onChange:e=>C({...S,startDate:e.target.value}),className:(0,o.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:S.endDate,onChange:e=>C({...S,endDate:e.target.value}),className:(0,o.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)(d.default,{variant:"ghost",onClick:()=>{C({provider:"",startDate:"",endDate:""})},disabled:!S.provider&&!S.startDate&&!S.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:"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:f(e.provider,k)})}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:j(e.tokens).toLocaleString()}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:e.tokens?.completion_tokens?.toLocaleString()||0}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-muted",children:(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,a.jsxs)("div",{children:["TTFT: ",(0,a.jsxs)("span",{className:"font-mono",children:[e.latency?.ttft||0,"ms"]})]}),(0,a.jsxs)("div",{children:["Total: ",(0,a.jsxs)("span",{className:"font-mono",children:[e.latency?.total||0,"ms"]})]})]})}),(0,a.jsx)("td",{className:"p-4 text-center",children:(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>{p(e),v(!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=>{n(t=>({...t,page:e}))},onPageSizeChange:e=>{n(t=>({...t,pageSize:e,page:1}))}})})]}),(0,a.jsx)(c,{isOpen:g,onClose:()=>v(!1),title:"Request Details",width:"lg",children:h&&(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:h.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(h.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:f(h.provider,k)})]}),(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:h.model})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Status:"})," ",(0,a.jsx)("span",{className:(0,o.cn)("font-medium","success"===h.status?"text-green-600":"text-red-600"),children:h.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 ",h.latency?.ttft||0,"ms / Total ",h.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:j(h.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:h.tokens?.completion_tokens?.toLocaleString()||0})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(b,{title:"1. Client Request (Input)",defaultOpen:!0,icon:"input",children:(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-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(h.request,null,2)})}),h.providerRequest&&(0,a.jsx)(b,{title:"2. Provider Request (Translated)",icon:"translate",children:(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-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(h.providerRequest,null,2)})}),h.providerResponse&&(0,a.jsx)(b,{title:"3. Provider Response (Raw)",icon:"data_object",children:(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-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 h.providerResponse?JSON.stringify(h.providerResponse,null,2):h.providerResponse})}),(0,a.jsxs)(b,{title:"4. Client Response (Final)",defaultOpen:!0,icon:"output",children:[h.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:h.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:h.response?.content||"[No content]"})]})]})]})})]})}let v=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function N(){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(w,{})})}function w(){let e=(0,n.useSearchParams)(),t=(0,n.useRouter)(),[s,i]=(0,l.useState)("today"),d=e.get("tab"),o=d&&["overview","logs","details"].includes(d)?d:"overview";return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 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:o,onChange:s=>{if(s===o)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"===o&&(0,a.jsx)(r.Iz,{options:v,value:s,onChange:i,size:"sm",className:"w-full sm:w-auto"})]}),"overview"===o&&(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(r.jK,{period:s,setPeriod:i,hidePeriodSelector:!0})}),"logs"===o&&(0,a.jsx)(r.gM,{}),"details"===o&&(0,a.jsx)(g,{})]})}}},e=>{e.O(0,[2574,3862,8500,4288,1321,5497,8441,3794,7358],()=>e(e.s=21007)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2825],{21007:(e,t,s)=>{Promise.resolve().then(s.bind(s,81772))},81772:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>N});var a=s(95155),l=s(12115),n=s(73321),r=s(35497),i=s(84588),d=s(92542),o=s(31474);function c({isOpen:e,onClose:t,title:s,children:n,width:r="md",className:i}){let d={sm:"w-[400px]",md:"w-[500px]",lg:"w-[600px]",xl:"w-[800px]",full:"w-full"};return((0,l.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,l.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,o.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",d[r]||d.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:n})]})]}):null}function x({currentPage:e,pageSize:t,totalItems:s,onPageChange:l,onPageSizeChange:n,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,o.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:[n&&(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=>n(Number(e.target.value)),className:(0,o.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)(d.default,{variant:"outline",size:"sm",onClick:()=>l(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)(d.default,{variant:"ghost",size:"sm",onClick:()=>l(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)(d.default,{variant:e===t?"primary":"ghost",size:"sm",onClick:()=>l(t),className:(0,o.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)(d.default,{variant:"ghost",size:"sm",onClick:()=>l(i),className:"w-9 px-0 hidden sm:inline-flex",children:i})]}),(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>l(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(52679);let h=null,p=null;async function u(){if(h&&p)return{providerNameCache:h,providerNodesCache:p};let e=await fetch("/api/provider-nodes"),t=(await e.json()).nodes||[];for(let e of(p={},t))p[e.id]=e.name;return{providerNameCache:h={...m.Q2,...p},providerNodesCache:p}}function f(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 b({title:e,children:t,defaultOpen:s=!1,icon:n=null}){let[r,i]=(0,l.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:[n&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:n}),(0,a.jsx)("span",{className:"font-semibold text-sm text-text-main",children:e})]}),(0,a.jsx)("span",{className:(0,o.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 j(e){let t=e?.prompt_tokens||e?.input_tokens||0,s=e?.cached_tokens||e?.cache_read_input_tokens||0;return t<s?s:t}function g(){let[e,t]=(0,l.useState)([]),[s,n]=(0,l.useState)({page:1,pageSize:20,totalItems:0,totalPages:0}),[r,m]=(0,l.useState)(!1),[h,p]=(0,l.useState)(null),[g,v]=(0,l.useState)(!1),[N,w]=(0,l.useState)([]),[k,y]=(0,l.useState)(null),[S,C]=(0,l.useState)({provider:"",startDate:"",endDate:""}),D=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/usage/providers"),t=await e.json();w(t.providers||[]);let s=await u();y(s.providerNameCache)}catch(e){console.error("Failed to fetch providers:",e)}},[]),z=(0,l.useCallback)(async()=>{m(!0);try{let e=new URLSearchParams({page:s.page.toString(),pageSize:s.pageSize.toString()});S.provider&&e.append("provider",S.provider),S.startDate&&e.append("startDate",S.startDate),S.endDate&&e.append("endDate",S.endDate);let a=await fetch(`/api/usage/request-details?${e}`),l=await a.json();t(l.details||[]),n(e=>({...e,...l.pagination}))}catch(e){console.error("Failed to fetch request details:",e)}finally{m(!1)}},[s.page,s.pageSize,S]);return(0,l.useEffect)(()=>{D()},[D]),(0,l.useEffect)(()=>{z()},[z]),(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:S.provider,onChange:e=>C({...S,provider:e.target.value}),className:(0,o.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"}),N.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:S.startDate,onChange:e=>C({...S,startDate:e.target.value}),className:(0,o.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:S.endDate,onChange:e=>C({...S,endDate:e.target.value}),className:(0,o.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)(d.default,{variant:"ghost",onClick:()=>{C({provider:"",startDate:"",endDate:""})},disabled:!S.provider&&!S.startDate&&!S.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:"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:f(e.provider,k)})}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:j(e.tokens).toLocaleString()}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:e.tokens?.completion_tokens?.toLocaleString()||0}),(0,a.jsx)("td",{className:"p-4 text-sm text-text-muted",children:(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,a.jsxs)("div",{children:["TTFT: ",(0,a.jsxs)("span",{className:"font-mono",children:[e.latency?.ttft||0,"ms"]})]}),(0,a.jsxs)("div",{children:["Total: ",(0,a.jsxs)("span",{className:"font-mono",children:[e.latency?.total||0,"ms"]})]})]})}),(0,a.jsx)("td",{className:"p-4 text-center",children:(0,a.jsx)(d.default,{variant:"outline",size:"sm",onClick:()=>{p(e),v(!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=>{n(t=>({...t,page:e}))},onPageSizeChange:e=>{n(t=>({...t,pageSize:e,page:1}))}})})]}),(0,a.jsx)(c,{isOpen:g,onClose:()=>v(!1),title:"Request Details",width:"lg",children:h&&(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:h.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(h.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:f(h.provider,k)})]}),(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:h.model})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Status:"})," ",(0,a.jsx)("span",{className:(0,o.cn)("font-medium","success"===h.status?"text-green-600":"text-red-600"),children:h.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 ",h.latency?.ttft||0,"ms / Total ",h.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:j(h.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:h.tokens?.completion_tokens?.toLocaleString()||0})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(b,{title:"1. Client Request (Input)",defaultOpen:!0,icon:"input",children:(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-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(h.request,null,2)})}),h.providerRequest&&(0,a.jsx)(b,{title:"2. Provider Request (Translated)",icon:"translate",children:(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-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(h.providerRequest,null,2)})}),h.providerResponse&&(0,a.jsx)(b,{title:"3. Provider Response (Raw)",icon:"data_object",children:(0,a.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-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 h.providerResponse?JSON.stringify(h.providerResponse,null,2):h.providerResponse})}),(0,a.jsxs)(b,{title:"4. Client Response (Final)",defaultOpen:!0,icon:"output",children:[h.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:h.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:h.response?.content||"[No content]"})]})]})]})})]})}let v=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function N(){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(w,{})})}function w(){let e=(0,n.useSearchParams)(),t=(0,n.useRouter)(),[s,i]=(0,l.useState)("today"),d=e.get("tab"),o=d&&["overview","logs","details"].includes(d)?d:"overview";return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 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:o,onChange:s=>{if(s===o)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"===o&&(0,a.jsx)(r.Iz,{options:v,value:s,onChange:i,size:"sm",className:"w-full sm:w-auto"})]}),"overview"===o&&(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(r.Qv,{}),children:(0,a.jsx)(r.jK,{period:s,setPeriod:i,hidePeriodSelector:!0})}),"logs"===o&&(0,a.jsx)(r.gM,{}),"details"===o&&(0,a.jsx)(g,{})]})}}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=21007)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9305],{19953:(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,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,74891)),Promise.resolve().then(n.bind(n,80752)),Promise.resolve().then(n.bind(n,23936)),Promise.resolve().then(n.bind(n,11910)),Promise.resolve().then(n.bind(n,61500)),Promise.resolve().then(n.bind(n,62899)),Promise.resolve().then(n.bind(n,94230)),Promise.resolve().then(n.bind(n,21931)),Promise.resolve().then(n.bind(n,91450)),Promise.resolve().then(n.bind(n,86671)),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,36548)),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))}},e=>{e.O(0,[2574,3862,8500,4288,1321,5497,8441,3794,7358],()=>e(e.s=19953)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9305],{19953:(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,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,74891)),Promise.resolve().then(n.bind(n,80752)),Promise.resolve().then(n.bind(n,23936)),Promise.resolve().then(n.bind(n,11910)),Promise.resolve().then(n.bind(n,61500)),Promise.resolve().then(n.bind(n,62899)),Promise.resolve().then(n.bind(n,94230)),Promise.resolve().then(n.bind(n,21931)),Promise.resolve().then(n.bind(n,91450)),Promise.resolve().then(n.bind(n,86671)),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,36548)),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))}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=19953)),_N_E=e.O()}]);