@rsalmn/extremerouter 0.6.3 → 0.6.4

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 (595) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +1 -1
  3. package/app/.next-cli-build/build-manifest.json +2 -2
  4. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/health/page.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/health/page.js.nft.json +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +2 -2
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/swarm/page.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/swarm/page.js.nft.json +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/swarm/page_client-reference-manifest.js +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +2 -2
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  76. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  77. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  78. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  79. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  80. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  81. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  82. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  83. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  84. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  85. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  86. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  87. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  88. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  89. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  90. package/app/.next-cli-build/server/app/_not-found.rsc +5 -5
  91. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +5 -5
  92. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  93. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +5 -5
  94. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  95. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  96. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  97. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  98. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  100. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  104. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +1 -1
  105. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  115. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/health/providers/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/health/stream/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  139. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  143. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  149. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  151. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  153. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  155. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  157. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  160. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  164. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  167. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  170. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  172. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  175. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  176. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  182. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  184. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  186. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  189. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  190. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  192. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  194. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  196. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  205. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/swarm/active/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/swarm/stream/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  211. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
  213. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  217. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  219. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  228. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  230. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/usage/chart/route.js +1 -1
  232. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/usage/history/route.js +1 -1
  234. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/usage/logs/route.js +1 -1
  236. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  238. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/usage/request-details/route.js +1 -1
  240. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js +1 -1
  242. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  243. package/app/.next-cli-build/server/app/api/usage/stats/route.js +1 -1
  244. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/usage/stream/route.js +1 -1
  246. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  248. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  250. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  252. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  254. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  256. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  258. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  260. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  263. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
  265. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  267. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  269. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  270. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  271. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  273. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  275. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  276. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  277. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  278. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  279. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  280. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  281. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  283. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  284. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  285. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  286. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  287. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  288. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  289. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  290. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  291. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  292. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  293. package/app/.next-cli-build/server/app/callback.html +1 -1
  294. package/app/.next-cli-build/server/app/callback.rsc +5 -5
  295. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +5 -5
  296. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  297. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +5 -5
  298. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  299. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  300. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  301. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  302. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +7 -8
  303. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  304. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  305. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  306. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  307. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -8
  308. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  309. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +5 -5
  310. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -3
  311. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  312. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +7 -8
  313. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  314. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  315. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  316. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  317. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +7 -8
  318. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  319. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +5 -5
  320. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -3
  321. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  322. package/app/.next-cli-build/server/app/dashboard/combos.rsc +7 -8
  323. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  324. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  325. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  326. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  327. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +7 -8
  328. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  329. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +5 -5
  330. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -3
  331. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  332. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +7 -8
  333. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  334. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  335. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  336. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  337. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -8
  338. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  339. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +5 -5
  340. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -3
  341. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  342. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +7 -8
  343. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  344. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  345. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  346. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  347. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  348. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +7 -8
  349. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  350. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +5 -5
  351. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -3
  352. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  353. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +7 -8
  354. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  355. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  356. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  357. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  358. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +7 -8
  359. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  360. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +5 -5
  361. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -3
  362. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  363. package/app/.next-cli-build/server/app/dashboard/profile.rsc +7 -8
  364. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  365. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  366. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  367. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  368. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +7 -8
  369. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  370. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +5 -5
  371. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -3
  372. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  373. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +7 -8
  374. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  375. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  376. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  377. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  378. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  379. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -8
  380. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  381. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +5 -5
  382. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -3
  383. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  384. package/app/.next-cli-build/server/app/dashboard/providers.rsc +7 -8
  385. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  386. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  387. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  388. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  389. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +7 -8
  390. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  391. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +5 -5
  392. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -3
  393. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  394. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +7 -8
  395. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  396. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  397. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  398. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  399. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +7 -8
  400. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  401. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +5 -5
  402. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -3
  403. package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  404. package/app/.next-cli-build/server/app/dashboard/quota.rsc +8 -9
  405. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  406. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  407. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  408. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  409. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +8 -9
  410. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  411. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +5 -5
  412. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -3
  413. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  414. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  415. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  416. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  417. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +5 -5
  418. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +5 -5
  419. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  420. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +5 -5
  421. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  422. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  423. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  424. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  425. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  426. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  427. package/app/.next-cli-build/server/app/dashboard/skills.rsc +7 -8
  428. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  429. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  430. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  431. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  432. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +7 -8
  433. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  434. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +5 -5
  435. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -3
  436. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  437. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +7 -8
  438. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
  439. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
  440. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  441. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  442. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +7 -8
  443. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
  444. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +5 -5
  445. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -3
  446. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  447. package/app/.next-cli-build/server/app/dashboard/translator.rsc +7 -8
  448. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  449. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  450. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  451. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  452. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +7 -8
  453. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  454. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +5 -5
  455. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -3
  456. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  457. package/app/.next-cli-build/server/app/dashboard/usage.rsc +7 -7
  458. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +3 -2
  459. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  460. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  461. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  462. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
  463. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  464. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +5 -5
  465. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  466. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  467. package/app/.next-cli-build/server/app/dashboard.rsc +7 -8
  468. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  469. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  470. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
  471. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +7 -8
  472. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  473. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +5 -5
  474. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -3
  475. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  476. package/app/.next-cli-build/server/app/index.html +1 -1
  477. package/app/.next-cli-build/server/app/index.rsc +5 -5
  478. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  479. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +5 -5
  480. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  481. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +5 -5
  482. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  483. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  484. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  485. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  486. package/app/.next-cli-build/server/app/landing.html +1 -1
  487. package/app/.next-cli-build/server/app/landing.rsc +5 -5
  488. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +5 -5
  489. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  490. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +5 -5
  491. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  492. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  493. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  494. package/app/.next-cli-build/server/app/login/page.js +1 -1
  495. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  496. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  497. package/app/.next-cli-build/server/app/login.html +1 -1
  498. package/app/.next-cli-build/server/app/login.rsc +6 -7
  499. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +6 -7
  500. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  501. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +5 -5
  502. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -3
  503. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -3
  504. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  505. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  506. package/app/.next-cli-build/server/app/page.js +1 -1
  507. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  508. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  509. package/app/.next-cli-build/server/app-paths-manifest.json +1 -1
  510. package/app/.next-cli-build/server/chunks/2231.js +1 -1
  511. package/app/.next-cli-build/server/chunks/2701.js +1 -1
  512. package/app/.next-cli-build/server/chunks/318.js +16 -5
  513. package/app/.next-cli-build/server/chunks/3593.js +1 -1
  514. package/app/.next-cli-build/server/chunks/4055.js +1 -1
  515. package/app/.next-cli-build/server/chunks/412.js +2 -2
  516. package/app/.next-cli-build/server/chunks/4739.js +1 -1
  517. package/app/.next-cli-build/server/chunks/4746.js +1 -1
  518. package/app/.next-cli-build/server/chunks/4780.js +1 -1
  519. package/app/.next-cli-build/server/chunks/4827.js +1 -1
  520. package/app/.next-cli-build/server/chunks/4884.js +4 -2
  521. package/app/.next-cli-build/server/chunks/507.js +1 -1
  522. package/app/.next-cli-build/server/chunks/5217.js +1 -1
  523. package/app/.next-cli-build/server/chunks/5258.js +1 -1
  524. package/app/.next-cli-build/server/chunks/5612.js +1 -1
  525. package/app/.next-cli-build/server/chunks/5699.js +1 -1
  526. package/app/.next-cli-build/server/chunks/5961.js +1 -1
  527. package/app/.next-cli-build/server/chunks/6070.js +1 -1
  528. package/app/.next-cli-build/server/chunks/615.js +1 -1
  529. package/app/.next-cli-build/server/chunks/6316.js +1 -1
  530. package/app/.next-cli-build/server/chunks/698.js +1 -1
  531. package/app/.next-cli-build/server/chunks/788.js +1 -0
  532. package/app/.next-cli-build/server/chunks/7965.js +1 -1
  533. package/app/.next-cli-build/server/chunks/8000.js +64 -0
  534. package/app/.next-cli-build/server/chunks/8238.js +1 -1
  535. package/app/.next-cli-build/server/chunks/8271.js +1 -1
  536. package/app/.next-cli-build/server/chunks/8497.js +1 -0
  537. package/app/.next-cli-build/server/chunks/8520.js +1 -1
  538. package/app/.next-cli-build/server/chunks/8895.js +4 -4
  539. package/app/.next-cli-build/server/chunks/9630.js +1 -1
  540. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  541. package/app/.next-cli-build/server/pages/404.html +1 -1
  542. package/app/.next-cli-build/server/pages/500.html +1 -1
  543. package/app/.next-cli-build/static/chunks/1321-063dbf2b0db9ec56.js +1 -0
  544. package/app/.next-cli-build/static/chunks/1636-47ea773ffa2d3a4b.js +1 -0
  545. package/app/.next-cli-build/static/chunks/27-a63677413de6d402.js +64 -0
  546. package/app/.next-cli-build/static/chunks/5497-e8e1e33b585b7c3e.js +7 -0
  547. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/{page-cd844c9e8ab2fc27.js → page-76e413764f752c03.js} +1 -1
  548. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-6a176bdbfba2621c.js → page-4efb04e1eca7f27c.js} +1 -1
  549. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-873634a244c17d3f.js → page-f6cb00bfa1358617.js} +1 -1
  550. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/{page-08645a1d2433efa1.js → page-bb8f74eb19be72b4.js} +1 -1
  551. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/{page-d0e88224a81a3ddc.js → page-18b262b802c95472.js} +1 -1
  552. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-cb5d0aca5faba3b4.js +1 -0
  553. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-67bf9d70a075636b.js → page-6d0b92899909f933.js} +1 -1
  554. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/{page-dc4b71f3a3b382b6.js → page-04df212b392a7049.js} +1 -1
  555. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-78d8c7c0b1e500fc.js → page-6ff0b7ef268b9f96.js} +1 -1
  556. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-444400de4c1d5f76.js → page-a6ff642180bb6c33.js} +1 -1
  557. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-2750e3fcd71856e0.js → page-325de46b5cec5533.js} +1 -1
  558. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/page-3538bc80a52010ff.js +1 -0
  559. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/{page-3963f4a54f708ed7.js → page-1b18b64a9ced4e9f.js} +1 -1
  560. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-fddc095ae22690a0.js → page-81c19a6fe2231d96.js} +1 -1
  561. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/{page-4e64bdba71a84aa7.js → page-f2075be55913fe76.js} +1 -1
  562. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-d70dcc6c9a151a80.js +1 -0
  563. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/{page-5fd1c281eaa9e772.js → page-964ac16d6816983d.js} +1 -1
  564. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-1b66539173748945.js +1 -0
  565. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/{page-dab3abccf166aced.js → page-6c82876d3dc71dfb.js} +1 -1
  566. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/{page-519d79be7c6523e4.js → page-d1f50f77018f738e.js} +1 -1
  567. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/{page-c854e381afc6b069.js → page-422974480d3bd378.js} +1 -1
  568. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-933a4cc7d2dae064.js +1 -0
  569. package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-ac93a6a5df6b898f.js +1 -0
  570. package/app/.next-cli-build/static/chunks/app/login/{page-237285b5f30b330a.js → page-f9cc5c6db5a0cf57.js} +1 -1
  571. package/app/.next-cli-build/static/css/57a0456cd89c95aa.css +1 -0
  572. package/app/cli/.build-home/AppData/Roaming/extremerouter/db/backups/upgrade-0.6.2-to-0.6.3-0.6.3-20260704-134754/data.sqlite +0 -0
  573. package/app/cli/.build-home/AppData/Roaming/extremerouter/db/backups/upgrade-0.6.3-to-0.6.4-0.6.4-20260705-031259/data.sqlite +0 -0
  574. package/app/cli/.build-home/AppData/Roaming/extremerouter/db/data.sqlite-shm +0 -0
  575. package/app/cli/.build-home/AppData/Roaming/extremerouter/db/data.sqlite-wal +0 -0
  576. package/app/package.json +1 -1
  577. package/app/public/providers/cody.svg +17 -0
  578. package/app/public/providers/trae.svg +13 -0
  579. package/app/public/providers/windsurf.svg +18 -0
  580. package/package.json +1 -1
  581. package/app/.next-cli-build/server/chunks/1228.js +0 -1
  582. package/app/.next-cli-build/server/chunks/1315.js +0 -64
  583. package/app/.next-cli-build/server/chunks/4485.js +0 -1
  584. package/app/.next-cli-build/static/chunks/1321-ff2073ad3d1126ca.js +0 -1
  585. package/app/.next-cli-build/static/chunks/3807-1f60b140ccc35641.js +0 -64
  586. package/app/.next-cli-build/static/chunks/5497-470badc121d94683.js +0 -7
  587. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-80672ae92687edc6.js +0 -1
  588. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/page-4c3fed899c4023c4.js +0 -1
  589. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-9b3ba2db1b90f552.js +0 -1
  590. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-beb433ec82a84fb3.js +0 -1
  591. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-2175023d6eabf14c.js +0 -1
  592. package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-1bb0b613c562d507.js +0 -1
  593. package/app/.next-cli-build/static/css/87588eca18fba81a.css +0 -1
  594. /package/app/.next-cli-build/static/{RPDQBYxJJwcxTCmP2fmVI → wmMfolDh46kO-VuBq1X-C}/_buildManifest.js +0 -0
  595. /package/app/.next-cli-build/static/{RPDQBYxJJwcxTCmP2fmVI → wmMfolDh46kO-VuBq1X-C}/_ssgManifest.js +0 -0
@@ -7,4 +7,4 @@ sk-key-only-auto-named`;function A({isOpen:e,provider:t,providerName:s,isCompati
7
7
  "idToken": "eyJhbGc...",
8
8
  "email": "user@example.com"
9
9
  }
10
- ]`;function P({isOpen:e,onClose:t,onSuccess:s}){let[l,r]=(0,i.useState)(""),[o,n]=(0,i.useState)(!1),[c,m]=(0,i.useState)(""),[p,x]=(0,i.useState)(null),h=()=>{o||(r(""),m(""),x(null),t())},f=async()=>{var e;let t;m(""),x(null);let a=l.trim();if(!a)return;try{t=JSON.parse(a)}catch(e){m(`${(0,u.Tl)("Invalid JSON")}: ${e.message}`);return}let i=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!i||0===i.length)return void m((0,u.Tl)("No accounts found in input"));n(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:i})}),t=await e.json();if(!e.ok)return void m(t?.error||`Request failed: ${e.status}`);x(t),t.success>0&&"function"==typeof s&&s()}catch(e){m(e.message||(0,u.Tl)("Request failed"))}finally{n(!1)}},g=p?.results?.filter(e=>!e.ok)||[];return(0,a.jsx)(d.aF,{isOpen:e,title:(0,u.Tl)("Bulk Add Codex Accounts"),onClose:h,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:(0,u.Tl)("Paste an array of codex account JSON objects. Each must include accessToken (and ideally refreshToken, idToken).")}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:O,value:l,onChange:e=>r(e.target.value),disabled:o}),c&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:c}),p&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${p.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",p.success," ",(0,u.Tl)("added"),p.failed>0?`, ✗ ${p.failed} ${(0,u.Tl)("failed")}`:""]}),g.length>0&&(0,a.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:g.map(e=>(0,a.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:f,fullWidth:!0,disabled:o||!l.trim(),children:o?(0,u.Tl)("Importing..."):(0,u.Tl)("Import All")}),(0,a.jsx)(d.$n,{onClick:h,variant:"ghost",fullWidth:!0,disabled:o,children:(0,u.Tl)("Close")})]})]})})}P.propTypes={isOpen:b().bool.isRequired,onClose:b().func.isRequired,onSuccess:b().func};let E={claude:"claudeAutoPing",codex:"codexAutoPing"};function I(){let e,t,s,r=(0,l.useParams)(),h=(0,l.useRouter)(),y=r.id,{getCaps:b}=(0,x.y)(),[j,N]=(0,i.useState)([]),[k,S]=(0,i.useState)(!0),[O,I]=(0,i.useState)(null),[R,D]=(0,i.useState)([]),[U,_]=(0,i.useState)(!1),[z,q]=(0,i.useState)(!1),[M,K]=(0,i.useState)(!1),[L,F]=(0,i.useState)(""),[J,W]=(0,i.useState)(!1),[B,H]=(0,i.useState)(!1),[G,V]=(0,i.useState)(!1),[Q,Z]=(0,i.useState)(!1),[X,Y]=(0,i.useState)(null),[ee,et]=(0,i.useState)({}),[es,ea]=(0,i.useState)([]),[ei,el]=(0,i.useState)(!1),[er,eo]=(0,i.useState)({}),[en,ed]=(0,i.useState)(""),[ec,em]=(0,i.useState)(()=>new Set),[ep,ex]=(0,i.useState)(""),[eu,eh]=(0,i.useState)(!1),[ef,eg]=(0,i.useState)(!1),[ey,eb]=(0,i.useState)([]),[ev,ej]=(0,i.useState)("__none__"),[ew,eN]=(0,i.useState)(!1),[ek,eC]=(0,i.useState)(null),[eS,eA]=(0,i.useState)(""),[e$,eT]=(0,i.useState)("auto"),[eO,eP]=(0,i.useState)({enabled:!1,connections:{}}),[eE,eI]=(0,i.useState)([]),[eR,eD]=(0,i.useState)([]),[eU,e_]=(0,i.useState)([]),[ez,eq]=(0,i.useState)(null),[eM,eK]=(0,i.useState)(!1),[eL,eF]=(0,i.useState)(!1),[eJ,eW]=(0,i.useState)(!1),[eB,eH]=(0,i.useState)(null),[eG,eV]=(0,i.useState)({}),[eQ,eZ]=(0,i.useState)(null),eX=(0,i.useRef)(!1),[eY,e0]=(0,i.useState)(!1),{copied:e1,copy:e2}=(0,p.C)(),e5="ag_risk_confirmed",e3=()=>{_(!0)},e4=()=>{"antigravity"===y&&"true"!==window.localStorage.getItem(e5)?eK(!0):te?e3():(F(""),K(!0))},e7=()=>{F(""),K(!0)},e8=()=>{te?e4():e7()},e6=O?{id:O.id,name:O.name||("anthropic-compatible"===O.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===O.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===O.type?"AC":"OC",apiType:O.apiType,baseUrl:O.baseUrl,type:O.type}:c.zN[y]||c.fg[y]||c.IS[y]||c.nJ[y]||c.br[y],e9=e6?.authModes||[],te=!!c.zN[y]||!!c.IS[y]||e9.includes("oauth"),tt=!!c.fg[y]||e9.includes("apikey"),ts=!!c.IS[y]?.noAuth,ta=(0,m.KC)(y),ti=(0,c.wG)(y),tl=(0,c.mq)(y),tr=(0,c.gb)(y),to=tl||tr,tn=!to&&te&&tt,td="xai"===y?"Grok Build OAuth":"OAuth",tc="xai"===y?"xAI API Key":"API Key";c.Q2[y]?.thinkingConfig||c.s9.extended;let tm=to?y:ti,tp=to?O?.prefix||y:ti,tx=(0,i.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tm)}`,{cache:"no-store"}),t=await e.json();e.ok&&e_(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tm]),tu=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tm,ids:[e]})})).ok&&await tx()}catch(e){console.log("Error disabling model:",e)}},th=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tm)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tx()}catch(e){console.log("Error enabling model:",e)}},tf=async e=>{e.length&&eq({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eq(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tm,ids:e})})).ok&&await tx()}catch(e){console.log("Error disabling all models:",e)}}})},tg=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tm)}`,{method:"DELETE"})).ok&&await tx()}catch(e){console.log("Error enabling all models:",e)}},ty=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&et(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),tb=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ea(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,i.useEffect)(()=>{"kilocode"===y&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&eD(e.models)}).catch(()=>{})},[y]);let tv=(0,i.useCallback)(async()=>{try{let[e,t,s,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),i=await e.json(),l=await t.json(),r=await s.json(),o=a.ok?await a.json():{};if(e.ok){let e=(i.connections||[]).filter(e=>e.provider===y);N(e)}s.ok&&D(r.proxyPools||[]);let n=(o.providerStrategies||{})[y]||{};eC(n.fallbackStrategy||null),eA(null!=n.stickyRoundRobinLimit?String(n.stickyRoundRobinLimit):"1");let d=(o.providerThinking||{})[y]||{};eT(d.mode||"auto");let c=E[y],m=c&&o[c]||{};if(eP({enabled:!0===m.enabled,connections:m.connections||{}}),t.ok){let e=(l.nodes||[]).find(e=>e.id===y)||null;if(!e&&to)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===y)||null))break}I(e)}}catch(e){console.log("Error fetching connections:",e)}finally{S(!1)}},[y,to]),tj=async e=>{try{let t=await fetch(`/api/provider-nodes/${y}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(I(s.node),await tv(),V(!1))}catch(e){console.log("Error updating provider node:",e)}},tw=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},i={};e&&(i.fallbackStrategy=e),"round-robin"===e&&""!==t&&(i.stickyRoundRobinLimit=Number(t)||3);let l={...a};0===Object.keys(i).length?delete l[y]:l[y]=i,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})})}catch(e){console.log("Error saving provider strategy:",e)}},tN=async e=>{let t=E[y];if(t){eP(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:e})})}catch(e){console.log("Error saving auto-ping config:",e)}}};(0,i.useEffect)(()=>{tv(),ty(),tb(),tx()},[tv,ty,tb,tx]),(0,i.useEffect)(()=>{let e=(c.zN[y]||c.fg[y]||c.IS[y]||c.nJ[y])?.modelsFetcher;e&&f(e).then(eI)},[y]);let tk=async(e,t,s=ti)=>{let a=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})});if(e.ok)await ty();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tC=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await ty()}catch(e){console.log("Error deleting alias:",e)}},tS=async(e,t="llm",s=tm)=>{try{let a=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:s,id:e,type:t})});if(a.ok)await tb(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await a.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},tA=async(e,t="llm",s=tm)=>{try{let a=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${a}`,{method:"DELETE"})).ok&&(await tb(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},t$=async()=>{if(eY)return;let e=j.find(e=>!1!==e.isActive);if(!e)return void alert((0,u.Tl)("Please add an active Qoder connection first"));e0(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,u.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,u.Tl)("No models returned"));let i=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,"");es.some(e=>e.providerAlias===tm&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(ee).includes(`${tm}/${s}`)||(await tS(s,"llm",tm),i+=1)}0===i?alert((0,u.Tl)("All models already exist, no new models added")):alert((0,u.Tl)("Successfully added")+` ${i} `+(0,u.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,u.Tl)("Error fetching models")+": "+e.message)}finally{e0(!1)}},tT=async()=>{if(eL||0===j.length)return;let e=Object.fromEntries(j.map(e=>[e.id,{state:"queued",error:null}]));eX.current=!1,eF(!0),eW(!1),eH(null),eV(e),eZ({total:j.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,s=0;try{for(let e=0;e<j.length;e+=1){if(eX.current){eZ({total:j.length,completed:e,passed:t,failed:s,stopped:!0});break}let a=j[e];eH(a.id),eV(e=>({...e,[a.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${a.id}/test`,{method:"POST"}),i=await e.json(),l=!!i.valid;l?t+=1:s+=1,eV(e=>({...e,[a.id]:{state:l?"success":"failed",error:l?null:i.error||null}}))}catch(e){s+=1,eV(t=>({...t,[a.id]:{state:"failed",error:e.message||"Test failed"}}))}eZ({total:j.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<j.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{eH(null),eF(!1),eW(!1),eX.current=!1}},tO=async e=>{eq({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eq(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&N(t=>t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tP=()=>{tv(),_(!1)},tE=async e=>{F("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:y,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tv(),K(!1);return}F(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),F("Failed to save connection")}},tI=async e=>{try{(await fetch(`/api/providers/${X.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tv(),H(!1))}catch(e){console.log("Error updating connection:",e)}},tR=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&N(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},tD=async(e,t)=>{let s=[...j];[s[e],s[t]]=[s[t],s[e]],N(s);try{await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch(e){console.log("Error swapping priority:",e),await tv()}},tU=j.filter(e=>ey.includes(e.id)),t_=j.length>0&&ey.length===j.length;(0,i.useEffect)(()=>{eb(e=>e.filter(e=>j.some(t=>t.id===e)))},[j]),(()=>{if(0===tU.length)return;let e=new Set(tU.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=R.find(e=>e.id===t);return s?.name}})();let tz=()=>{ew||Z(!1)},tq=async e=>{eN(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:a}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:a})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await tv(),Z(!1)}finally{eN(!1)}},tM=e=>tq(j.map(t=>({connectionId:t.id,proxyPoolId:e}))),tK=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-border-subtle",children:j.map((e,t)=>{let s;return(0,a.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,a.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,a.jsx)("input",{type:"checkbox",checked:(s=e.id,ey.includes(s)),onChange:()=>{var t;return t=e.id,void eb(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(C,{connection:e,proxyPools:R,isOAuth:te,isFirst:0===t,isLast:t===j.length-1,onMoveUp:()=>tD(t,t-1),onMoveDown:()=>tD(t,t+1),onToggleActive:t=>tR(e.id,t),autoPing:E[y]&&"oauth"===e.authType?{on:!0===eO.connections[e.id],onToggle:t=>{var s;return s=e.id,void tN({...eO,connections:{...eO.connections,[s]:t}})},provider:y}:null,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&N(s=>s.map(s=>s.id===e.id?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{Y(e),H(!0)},onDelete:()=>tO(e.id),oneByOneStatus:eG[e.id]||null})})]},e.id)})}),tL=R.filter(e=>!0===e.isActive),tF=(0,a.jsx)(d.aF,{isOpen:Q,onClose:tz,title:`Apply Proxy (${j.length} connections)`,children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("button",{onClick:()=>{let e=R.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):tq(j.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:ew||0===tL.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,a.jsxs)("button",{onClick:()=>tM(null),disabled:ew,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),R.map(e=>(0,a.jsxs)("button",{onClick:()=>tM(e.id),disabled:ew||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,a.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),ew&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:tz,variant:"ghost",fullWidth:!0,disabled:ew,children:"Cancel"})]})}),tJ=async e=>{if(!ec.has(e)){em(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tm}/${e}`})}),s=await t.json();eo(t=>({...t,[e]:s.ok?"ok":"error"})),ed(s.ok?"":s.error||"Model not reachable")}catch{eo(t=>({...t,[e]:"error"})),ed("Network error")}finally{em(t=>{let s=new Set(t);return s.delete(e),s})}}},tW=async e=>{eu||0===e.length||(eh(!0),ed(""),await Promise.all(e.map(e=>tJ(e))),eh(!1))};return k?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]}):e6?(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(o(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${e6.color}15`},children:ei?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:e6.color},children:e6.textIcon||e6.id.slice(0,2).toUpperCase()}):(0,a.jsx)(n.default,{src:tl&&e6.apiType?"responses"===e6.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":tr?"/providers/anthropic-m.png":`/providers/${e6.id}.png`,alt:e6.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>el(!0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:e6.name}),(e6.notice?.apiKeyUrl||e6.notice?.signupUrl||e6.website)&&(0,a.jsxs)("a",{href:e6.notice?.apiKeyUrl||e6.notice?.signupUrl||e6.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),e6.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[j.length," connection",1===j.length?"":"s"]})]})]})]}),e6.deprecated&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:e6.deprecationNotice})]}),e6.notice?.text&&!e6.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-info/30 bg-info/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-info shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-info",children:e6.notice.text}),e6.notice.apiKeyUrl&&(0,a.jsx)("a",{href:e6.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),to&&O&&(0,a.jsx)(d.Zp,{children:(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:tr?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[tr?"Messages API":"responses"===O.apiType?"Responses API":"Chat Completions"," \xb7 ",(O.baseUrl||"").replace(/\/$/,""),"/",tr?"messages":"responses"===O.apiType?"responses":"chat/completions"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>{F(""),K(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>V(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eq({title:"Delete Compatible Node",message:`Delete this ${tr?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eq(null);try{(await fetch(`/api/provider-nodes/${y}`,{method:"DELETE"})).ok&&h.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),ts?(0,a.jsx)(d.gw,{providerId:y}):(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[j.length>0&&R.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>Z(!0),children:"Apply Proxy"}),j.length>0&&(0,a.jsxs)(a.Fragment,{children:[ey.length>0&&(0,a.jsxs)(d.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let e=ey.length;0!==e&&eq({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{eq(null);let e=0,t=[...ey];for(let s of t)try{(await fetch(`/api/providers/${s}`,{method:"DELETE"})).ok||(e+=1)}catch(t){console.log("Error deleting connection:",t),e+=1}N(e=>e.filter(e=>!t.includes(e.id))),eb([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:["Delete Selected (",ey.length,")"]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:tT,disabled:eL,children:eL?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eL&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eL&&(eX.current=!0,eW(!0))},disabled:eJ,children:eJ?"Stopping...":"Stop"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(d.lM,{checked:"round-robin"===ek,onChange:e=>{let t=e?"round-robin":null,s=e?eS||"1":eS;e&&!eS&&eA("1"),eC(t),tw(t,s)}}),"round-robin"===ek&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:eS,onChange:e=>{var t;eA(t=e.target.value),tw("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),0===j.length?(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:te?"lock":"key"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tn&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",td," or ",tc,"."]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:tn?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:e4,children:td}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:e7,children:tc})]}):(0,a.jsxs)(a.Fragment,{children:[!to&&"iflow"===y&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>q(!0),children:"Cookie"}),"codex"===y&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>W(!0),children:(0,u.Tl)("Bulk Add")}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e8,children:to?"Add API Key":"iflow"===y?"OAuth":"Add Connection"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[eQ&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-border bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",eQ.total]}),(0,a.jsxs)("span",{children:["Completed: ",eQ.completed]}),(0,a.jsxs)("span",{children:["Passed: ",eQ.passed]}),(0,a.jsxs)("span",{children:["Failed: ",eQ.failed]}),eQ.stopped&&(0,a.jsx)("span",{className:"text-warning",children:"Stopped"}),eL&&eB&&(0,a.jsxs)("span",{children:["Running: ",j.find(e=>e.id===eB)?.name||eB]})]})}),j.length>0&&(0,a.jsx)("div",{className:"mb-3 flex items-center gap-2 border-b border-black/[0.03] pb-2 dark:border-white/[0.03]",children:(0,a.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,a.jsx)("input",{type:"checkbox",checked:t_,onChange:()=>{t_?eb([]):eb(j.map(e=>e.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),tK,!to&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===y&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>q(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===y&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>W(!0),title:(0,u.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,u.Tl)("Bulk Add")}),tn?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:e4,className:"w-full sm:w-auto",children:td}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:e7,className:"w-full sm:w-auto",children:tc})]}):(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e8,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),!to&&(e=[...ta,...eR.filter(e=>!ta.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!eU.includes(e)),t=ep.trim().toLowerCase(),s=e.filter(e=>!t||e.toLowerCase().includes(t)),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[eU.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tg,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>tf(e),children:"Disable All"}),(j.length>0||ts)&&s.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"primary",icon:eu?"progress_activity":"play_arrow",onClick:()=>tW(s),disabled:eu,children:eu?"Testing...":`Test All (${s.length})`})]}))]}),(0,a.jsx)("div",{className:"sm:max-w-xs",children:(0,a.jsx)(d.pd,{type:"search",placeholder:"Search models...",value:ep,onChange:e=>ex(e.target.value),className:"w-full"})})]}),!!en&&(0,a.jsx)("p",{className:"text-xs text-danger mb-3 break-words",children:en}),(()=>{let e,t,s;if(to)return(0,a.jsx)(w,{providerStorageAlias:tm,providerDisplayAlias:tp,modelAliases:ee,customModels:es,copied:e1,onCopy:e2,onSetAlias:tk,onDeleteAlias:tC,onAddCustomModel:e=>tS(e,"llm",tm),onDeleteCustomModel:e=>tA(e,"llm",tm),connections:j,isAnthropic:tr});let i=[...ta,...eR.filter(e=>!ta.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}),l=new Set(eU),r=i.filter(e=>!l.has(e.id)),o=i.filter(e=>l.has(e.id)),n=g({customModels:es,modelAliases:ee,providerAlias:tm,builtInModels:ta,type:"llm"}),d=ep.trim().toLowerCase(),c=(e,t="")=>!d||e.toLowerCase().includes(d)||String(t).toLowerCase().includes(d),p=r.filter(e=>c(e.id,e.name)),x=n.filter(e=>c(e.id,e.name));return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[x.map(e=>(0,a.jsx)(v,{model:{id:e.id,name:e.name},fullModel:`${tp}/${e.id}`,alias:e.alias,copied:e1,onCopy:e2,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?tA(e.id,"llm",tm):tC(e.alias)},testStatus:er[e.id],onTest:j.length>0||ts?()=>tJ(e.id):void 0,isTesting:ec.has(e.id),isCustom:!0,isFree:!1,caps:b(`${y}/${e.id}`)},`${e.source}-${e.fullModel}`)),p.map(e=>{let t=`${tm}/${e.id}`,s=`${y}/${e.id}`,i=Object.entries(ee).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(v,{model:e,fullModel:`${tp}/${e.id}`,alias:i,copied:e1,onCopy:e2,onSetAlias:t=>tk(e.id,t,tm),onDeleteAlias:()=>tC(i),testStatus:er[e.id],onTest:j.length>0||ts?()=>tJ(e.id):void 0,isTesting:ec.has(e.id),isFree:e.isFree,onDisable:()=>tu(e.id),caps:b(`${y}/${e.id}`)},e.id)}),ep.trim()&&0===p.length&&0===x.length&&(0,a.jsxs)("p",{className:"w-full text-center text-sm text-text-muted py-4",children:["No models match “",ep,"”"]}),(0,a.jsxs)("button",{onClick:()=>eg(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"qoder"===y&&j.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:t$,disabled:eY,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-info transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:eY?{animation:"spin 1s linear infinite"}:void 0,children:eY?"progress_activity":"download"}),eY?(0,u.Tl)("Fetching..."):(0,u.Tl)("Fetch Qoder Models")]}),eE.length>0&&(e=new Set([...Object.values(ee),...n.map(e=>e.fullModel)]),t=new Set(ta.map(e=>e.id)),0===(s=eE.filter(s=>!e.has(`${tm}/${s.id}`)&&!t.has(s.id))).length?null:(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,a.jsxs)("button",{onClick:async()=>{await tS(e.id,"llm",tm)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-border text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),o.length>0&&(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",o.length,"):"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,a.jsxs)("button",{onClick:()=>th(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-border text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),tF,"kiro"===y?(0,a.jsx)(d.Mh,{isOpen:U,providerInfo:e6,onSuccess:tP,onClose:()=>_(!1)}):"cursor"===y?(0,a.jsx)(d.G9,{isOpen:U,onSuccess:tP,onClose:()=>_(!1)}):"gitlab"===y?(0,a.jsx)(d.vj,{isOpen:U,providerInfo:e6,onSuccess:tP,onClose:()=>_(!1)}):(0,a.jsx)(d.LF,{isOpen:U,provider:y,providerInfo:e6,onSuccess:tP,onClose:()=>_(!1)}),"iflow"===y&&(0,a.jsx)(d.vE,{isOpen:z,onSuccess:()=>{tv(),q(!1)},onClose:()=>q(!1)}),(0,a.jsx)(A,{isOpen:M,provider:y,providerName:e6.name,isCompatible:to,isAnthropic:tr,authType:e6?.authType,authHint:e6?.authHint,website:e6?.website,proxyPools:R,error:L,onSave:tE,onBulkDone:tv,onClose:()=>{F(""),K(!1)}}),(0,a.jsx)(d.wI,{isOpen:B,connection:X,proxyPools:R,onSave:tI,onClose:()=>H(!1)}),to&&(0,a.jsx)($,{isOpen:G,node:O,onSave:tj,onClose:()=>V(!1),isAnthropic:tr}),!to&&(0,a.jsx)(T,{isOpen:ef,providerAlias:tm,providerDisplayAlias:tp,onSave:async e=>{await tS(e,"llm",tm),eg(!1)},onClose:()=>eg(!1)}),"codex"===y&&(0,a.jsx)(P,{isOpen:J,onClose:()=>W(!1),onSuccess:tv}),(0,a.jsx)(d.uo,{isOpen:eM,onClose:()=>eK(!1),onConfirm:()=>{(window.localStorage.setItem(e5,"true"),eK(!1),te)?e3():e7()},title:"Risk Notice",message:e6?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(d.uo,{isOpen:!!ez,onClose:()=>eq(null),onConfirm:ez?.onConfirm,title:ez?.title||"Confirm",message:ez?.message,variant:"danger"})]}):(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,a.jsx)(o(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}},88845:(e,t,s)=>{Promise.resolve().then(s.bind(s,78907))}},e=>{e.O(0,[2574,3862,3807,5772,1321,705,5497,8441,3794,7358],()=>e(e.s=88845)),_N_E=e.O()}]);
10
+ ]`;function P({isOpen:e,onClose:t,onSuccess:s}){let[l,r]=(0,i.useState)(""),[o,n]=(0,i.useState)(!1),[c,m]=(0,i.useState)(""),[p,x]=(0,i.useState)(null),h=()=>{o||(r(""),m(""),x(null),t())},f=async()=>{var e;let t;m(""),x(null);let a=l.trim();if(!a)return;try{t=JSON.parse(a)}catch(e){m(`${(0,u.Tl)("Invalid JSON")}: ${e.message}`);return}let i=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!i||0===i.length)return void m((0,u.Tl)("No accounts found in input"));n(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:i})}),t=await e.json();if(!e.ok)return void m(t?.error||`Request failed: ${e.status}`);x(t),t.success>0&&"function"==typeof s&&s()}catch(e){m(e.message||(0,u.Tl)("Request failed"))}finally{n(!1)}},g=p?.results?.filter(e=>!e.ok)||[];return(0,a.jsx)(d.aF,{isOpen:e,title:(0,u.Tl)("Bulk Add Codex Accounts"),onClose:h,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:(0,u.Tl)("Paste an array of codex account JSON objects. Each must include accessToken (and ideally refreshToken, idToken).")}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:O,value:l,onChange:e=>r(e.target.value),disabled:o}),c&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:c}),p&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${p.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",p.success," ",(0,u.Tl)("added"),p.failed>0?`, ✗ ${p.failed} ${(0,u.Tl)("failed")}`:""]}),g.length>0&&(0,a.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:g.map(e=>(0,a.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:f,fullWidth:!0,disabled:o||!l.trim(),children:o?(0,u.Tl)("Importing..."):(0,u.Tl)("Import All")}),(0,a.jsx)(d.$n,{onClick:h,variant:"ghost",fullWidth:!0,disabled:o,children:(0,u.Tl)("Close")})]})]})})}P.propTypes={isOpen:b().bool.isRequired,onClose:b().func.isRequired,onSuccess:b().func};let E={claude:"claudeAutoPing",codex:"codexAutoPing"};function I(){let e,t,s,r=(0,l.useParams)(),h=(0,l.useRouter)(),y=r.id,{getCaps:b}=(0,x.y)(),[j,N]=(0,i.useState)([]),[k,S]=(0,i.useState)(!0),[O,I]=(0,i.useState)(null),[R,D]=(0,i.useState)([]),[U,_]=(0,i.useState)(!1),[z,q]=(0,i.useState)(!1),[M,K]=(0,i.useState)(!1),[L,F]=(0,i.useState)(""),[J,W]=(0,i.useState)(!1),[B,H]=(0,i.useState)(!1),[G,V]=(0,i.useState)(!1),[Q,Z]=(0,i.useState)(!1),[X,Y]=(0,i.useState)(null),[ee,et]=(0,i.useState)({}),[es,ea]=(0,i.useState)([]),[ei,el]=(0,i.useState)(!1),[er,eo]=(0,i.useState)({}),[en,ed]=(0,i.useState)(""),[ec,em]=(0,i.useState)(()=>new Set),[ep,ex]=(0,i.useState)(""),[eu,eh]=(0,i.useState)(!1),[ef,eg]=(0,i.useState)(!1),[ey,eb]=(0,i.useState)([]),[ev,ej]=(0,i.useState)("__none__"),[ew,eN]=(0,i.useState)(!1),[ek,eC]=(0,i.useState)(null),[eS,eA]=(0,i.useState)(""),[e$,eT]=(0,i.useState)("auto"),[eO,eP]=(0,i.useState)({enabled:!1,connections:{}}),[eE,eI]=(0,i.useState)([]),[eR,eD]=(0,i.useState)([]),[eU,e_]=(0,i.useState)([]),[ez,eq]=(0,i.useState)(null),[eM,eK]=(0,i.useState)(!1),[eL,eF]=(0,i.useState)(!1),[eJ,eW]=(0,i.useState)(!1),[eB,eH]=(0,i.useState)(null),[eG,eV]=(0,i.useState)({}),[eQ,eZ]=(0,i.useState)(null),eX=(0,i.useRef)(!1),[eY,e0]=(0,i.useState)(!1),{copied:e1,copy:e2}=(0,p.C)(),e5="ag_risk_confirmed",e3=()=>{_(!0)},e4=()=>{"antigravity"===y&&"true"!==window.localStorage.getItem(e5)?eK(!0):te?e3():(F(""),K(!0))},e7=()=>{F(""),K(!0)},e8=()=>{te?e4():e7()},e6=O?{id:O.id,name:O.name||("anthropic-compatible"===O.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===O.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===O.type?"AC":"OC",apiType:O.apiType,baseUrl:O.baseUrl,type:O.type}:c.zN[y]||c.fg[y]||c.IS[y]||c.nJ[y]||c.br[y],e9=e6?.authModes||[],te=!!c.zN[y]||!!c.IS[y]||e9.includes("oauth"),tt=!!c.fg[y]||e9.includes("apikey"),ts=!!c.IS[y]?.noAuth,ta=(0,m.KC)(y),ti=(0,c.wG)(y),tl=(0,c.mq)(y),tr=(0,c.gb)(y),to=tl||tr,tn=!to&&te&&tt,td="xai"===y?"Grok Build OAuth":"OAuth",tc="xai"===y?"xAI API Key":"API Key";c.Q2[y]?.thinkingConfig||c.s9.extended;let tm=to?y:ti,tp=to?O?.prefix||y:ti,tx=(0,i.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tm)}`,{cache:"no-store"}),t=await e.json();e.ok&&e_(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tm]),tu=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tm,ids:[e]})})).ok&&await tx()}catch(e){console.log("Error disabling model:",e)}},th=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tm)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tx()}catch(e){console.log("Error enabling model:",e)}},tf=async e=>{e.length&&eq({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eq(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tm,ids:e})})).ok&&await tx()}catch(e){console.log("Error disabling all models:",e)}}})},tg=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tm)}`,{method:"DELETE"})).ok&&await tx()}catch(e){console.log("Error enabling all models:",e)}},ty=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&et(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),tb=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ea(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,i.useEffect)(()=>{"kilocode"===y&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&eD(e.models)}).catch(()=>{})},[y]);let tv=(0,i.useCallback)(async()=>{try{let[e,t,s,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),i=await e.json(),l=await t.json(),r=await s.json(),o=a.ok?await a.json():{};if(e.ok){let e=(i.connections||[]).filter(e=>e.provider===y);N(e)}s.ok&&D(r.proxyPools||[]);let n=(o.providerStrategies||{})[y]||{};eC(n.fallbackStrategy||null),eA(null!=n.stickyRoundRobinLimit?String(n.stickyRoundRobinLimit):"1");let d=(o.providerThinking||{})[y]||{};eT(d.mode||"auto");let c=E[y],m=c&&o[c]||{};if(eP({enabled:!0===m.enabled,connections:m.connections||{}}),t.ok){let e=(l.nodes||[]).find(e=>e.id===y)||null;if(!e&&to)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===y)||null))break}I(e)}}catch(e){console.log("Error fetching connections:",e)}finally{S(!1)}},[y,to]),tj=async e=>{try{let t=await fetch(`/api/provider-nodes/${y}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(I(s.node),await tv(),V(!1))}catch(e){console.log("Error updating provider node:",e)}},tw=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},i={};e&&(i.fallbackStrategy=e),"round-robin"===e&&""!==t&&(i.stickyRoundRobinLimit=Number(t)||3);let l={...a};0===Object.keys(i).length?delete l[y]:l[y]=i,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})})}catch(e){console.log("Error saving provider strategy:",e)}},tN=async e=>{let t=E[y];if(t){eP(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:e})})}catch(e){console.log("Error saving auto-ping config:",e)}}};(0,i.useEffect)(()=>{tv(),ty(),tb(),tx()},[tv,ty,tb,tx]),(0,i.useEffect)(()=>{let e=(c.zN[y]||c.fg[y]||c.IS[y]||c.nJ[y])?.modelsFetcher;e&&f(e).then(eI)},[y]);let tk=async(e,t,s=ti)=>{let a=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})});if(e.ok)await ty();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tC=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await ty()}catch(e){console.log("Error deleting alias:",e)}},tS=async(e,t="llm",s=tm)=>{try{let a=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:s,id:e,type:t})});if(a.ok)await tb(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await a.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},tA=async(e,t="llm",s=tm)=>{try{let a=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${a}`,{method:"DELETE"})).ok&&(await tb(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},t$=async()=>{if(eY)return;let e=j.find(e=>!1!==e.isActive);if(!e)return void alert((0,u.Tl)("Please add an active Qoder connection first"));e0(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,u.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,u.Tl)("No models returned"));let i=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,"");es.some(e=>e.providerAlias===tm&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(ee).includes(`${tm}/${s}`)||(await tS(s,"llm",tm),i+=1)}0===i?alert((0,u.Tl)("All models already exist, no new models added")):alert((0,u.Tl)("Successfully added")+` ${i} `+(0,u.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,u.Tl)("Error fetching models")+": "+e.message)}finally{e0(!1)}},tT=async()=>{if(eL||0===j.length)return;let e=Object.fromEntries(j.map(e=>[e.id,{state:"queued",error:null}]));eX.current=!1,eF(!0),eW(!1),eH(null),eV(e),eZ({total:j.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,s=0;try{for(let e=0;e<j.length;e+=1){if(eX.current){eZ({total:j.length,completed:e,passed:t,failed:s,stopped:!0});break}let a=j[e];eH(a.id),eV(e=>({...e,[a.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${a.id}/test`,{method:"POST"}),i=await e.json(),l=!!i.valid;l?t+=1:s+=1,eV(e=>({...e,[a.id]:{state:l?"success":"failed",error:l?null:i.error||null}}))}catch(e){s+=1,eV(t=>({...t,[a.id]:{state:"failed",error:e.message||"Test failed"}}))}eZ({total:j.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<j.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{eH(null),eF(!1),eW(!1),eX.current=!1}},tO=async e=>{eq({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eq(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&N(t=>t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tP=()=>{tv(),_(!1)},tE=async e=>{F("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:y,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tv(),K(!1);return}F(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),F("Failed to save connection")}},tI=async e=>{try{(await fetch(`/api/providers/${X.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tv(),H(!1))}catch(e){console.log("Error updating connection:",e)}},tR=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&N(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},tD=async(e,t)=>{let s=[...j];[s[e],s[t]]=[s[t],s[e]],N(s);try{await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch(e){console.log("Error swapping priority:",e),await tv()}},tU=j.filter(e=>ey.includes(e.id)),t_=j.length>0&&ey.length===j.length;(0,i.useEffect)(()=>{eb(e=>e.filter(e=>j.some(t=>t.id===e)))},[j]),(()=>{if(0===tU.length)return;let e=new Set(tU.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=R.find(e=>e.id===t);return s?.name}})();let tz=()=>{ew||Z(!1)},tq=async e=>{eN(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:a}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:a})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await tv(),Z(!1)}finally{eN(!1)}},tM=e=>tq(j.map(t=>({connectionId:t.id,proxyPoolId:e}))),tK=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-border-subtle",children:j.map((e,t)=>{let s;return(0,a.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,a.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,a.jsx)("input",{type:"checkbox",checked:(s=e.id,ey.includes(s)),onChange:()=>{var t;return t=e.id,void eb(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(C,{connection:e,proxyPools:R,isOAuth:te,isFirst:0===t,isLast:t===j.length-1,onMoveUp:()=>tD(t,t-1),onMoveDown:()=>tD(t,t+1),onToggleActive:t=>tR(e.id,t),autoPing:E[y]&&"oauth"===e.authType?{on:!0===eO.connections[e.id],onToggle:t=>{var s;return s=e.id,void tN({...eO,connections:{...eO.connections,[s]:t}})},provider:y}:null,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&N(s=>s.map(s=>s.id===e.id?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{Y(e),H(!0)},onDelete:()=>tO(e.id),oneByOneStatus:eG[e.id]||null})})]},e.id)})}),tL=R.filter(e=>!0===e.isActive),tF=(0,a.jsx)(d.aF,{isOpen:Q,onClose:tz,title:`Apply Proxy (${j.length} connections)`,children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("button",{onClick:()=>{let e=R.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):tq(j.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:ew||0===tL.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,a.jsxs)("button",{onClick:()=>tM(null),disabled:ew,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),R.map(e=>(0,a.jsxs)("button",{onClick:()=>tM(e.id),disabled:ew||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,a.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),ew&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:tz,variant:"ghost",fullWidth:!0,disabled:ew,children:"Cancel"})]})}),tJ=async e=>{if(!ec.has(e)){em(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tm}/${e}`})}),s=await t.json();eo(t=>({...t,[e]:s.ok?"ok":"error"})),ed(s.ok?"":s.error||"Model not reachable")}catch{eo(t=>({...t,[e]:"error"})),ed("Network error")}finally{em(t=>{let s=new Set(t);return s.delete(e),s})}}},tW=async e=>{eu||0===e.length||(eh(!0),ed(""),await Promise.all(e.map(e=>tJ(e))),eh(!1))};return k?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]}):e6?(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(o(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${e6.color}15`},children:ei?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:e6.color},children:e6.textIcon||e6.id.slice(0,2).toUpperCase()}):(0,a.jsx)(n.default,{src:tl&&e6.apiType?"responses"===e6.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":tr?"/providers/anthropic-m.png":`/providers/${e6.id}.png`,alt:e6.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>el(!0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:e6.name}),(e6.notice?.apiKeyUrl||e6.notice?.signupUrl||e6.website)&&(0,a.jsxs)("a",{href:e6.notice?.apiKeyUrl||e6.notice?.signupUrl||e6.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),e6.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[j.length," connection",1===j.length?"":"s"]})]})]})]}),e6.deprecated&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:e6.deprecationNotice})]}),e6.notice?.text&&!e6.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-info/30 bg-info/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-info shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-info",children:e6.notice.text}),e6.notice.apiKeyUrl&&(0,a.jsx)("a",{href:e6.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),to&&O&&(0,a.jsx)(d.Zp,{children:(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:tr?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[tr?"Messages API":"responses"===O.apiType?"Responses API":"Chat Completions"," \xb7 ",(O.baseUrl||"").replace(/\/$/,""),"/",tr?"messages":"responses"===O.apiType?"responses":"chat/completions"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>{F(""),K(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>V(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eq({title:"Delete Compatible Node",message:`Delete this ${tr?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eq(null);try{(await fetch(`/api/provider-nodes/${y}`,{method:"DELETE"})).ok&&h.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),ts?(0,a.jsx)(d.gw,{providerId:y}):(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[j.length>0&&R.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>Z(!0),children:"Apply Proxy"}),j.length>0&&(0,a.jsxs)(a.Fragment,{children:[ey.length>0&&(0,a.jsxs)(d.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let e=ey.length;0!==e&&eq({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{eq(null);let e=0,t=[...ey];for(let s of t)try{(await fetch(`/api/providers/${s}`,{method:"DELETE"})).ok||(e+=1)}catch(t){console.log("Error deleting connection:",t),e+=1}N(e=>e.filter(e=>!t.includes(e.id))),eb([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:["Delete Selected (",ey.length,")"]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:tT,disabled:eL,children:eL?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eL&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eL&&(eX.current=!0,eW(!0))},disabled:eJ,children:eJ?"Stopping...":"Stop"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(d.lM,{checked:"round-robin"===ek,onChange:e=>{let t=e?"round-robin":null,s=e?eS||"1":eS;e&&!eS&&eA("1"),eC(t),tw(t,s)}}),"round-robin"===ek&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:eS,onChange:e=>{var t;eA(t=e.target.value),tw("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),0===j.length?(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:te?"lock":"key"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tn&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",td," or ",tc,"."]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:tn?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:e4,children:td}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:e7,children:tc})]}):(0,a.jsxs)(a.Fragment,{children:[!to&&"iflow"===y&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>q(!0),children:"Cookie"}),"codex"===y&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>W(!0),children:(0,u.Tl)("Bulk Add")}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e8,children:to?"Add API Key":"iflow"===y?"OAuth":"Add Connection"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[eQ&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-border bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",eQ.total]}),(0,a.jsxs)("span",{children:["Completed: ",eQ.completed]}),(0,a.jsxs)("span",{children:["Passed: ",eQ.passed]}),(0,a.jsxs)("span",{children:["Failed: ",eQ.failed]}),eQ.stopped&&(0,a.jsx)("span",{className:"text-warning",children:"Stopped"}),eL&&eB&&(0,a.jsxs)("span",{children:["Running: ",j.find(e=>e.id===eB)?.name||eB]})]})}),j.length>0&&(0,a.jsx)("div",{className:"mb-3 flex items-center gap-2 border-b border-black/[0.03] pb-2 dark:border-white/[0.03]",children:(0,a.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,a.jsx)("input",{type:"checkbox",checked:t_,onChange:()=>{t_?eb([]):eb(j.map(e=>e.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),tK,!to&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===y&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>q(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===y&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>W(!0),title:(0,u.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,u.Tl)("Bulk Add")}),tn?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:e4,className:"w-full sm:w-auto",children:td}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:e7,className:"w-full sm:w-auto",children:tc})]}):(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e8,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),!to&&(e=[...ta,...eR.filter(e=>!ta.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!eU.includes(e)),t=ep.trim().toLowerCase(),s=e.filter(e=>!t||e.toLowerCase().includes(t)),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[eU.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tg,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>tf(e),children:"Disable All"}),(j.length>0||ts)&&s.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"primary",icon:eu?"progress_activity":"play_arrow",onClick:()=>tW(s),disabled:eu,children:eu?"Testing...":`Test All (${s.length})`})]}))]}),(0,a.jsx)("div",{className:"sm:max-w-xs",children:(0,a.jsx)(d.pd,{type:"search",placeholder:"Search models...",value:ep,onChange:e=>ex(e.target.value),className:"w-full"})})]}),!!en&&(0,a.jsx)("p",{className:"text-xs text-danger mb-3 break-words",children:en}),(()=>{let e,t,s;if(to)return(0,a.jsx)(w,{providerStorageAlias:tm,providerDisplayAlias:tp,modelAliases:ee,customModels:es,copied:e1,onCopy:e2,onSetAlias:tk,onDeleteAlias:tC,onAddCustomModel:e=>tS(e,"llm",tm),onDeleteCustomModel:e=>tA(e,"llm",tm),connections:j,isAnthropic:tr});let i=[...ta,...eR.filter(e=>!ta.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}),l=new Set(eU),r=i.filter(e=>!l.has(e.id)),o=i.filter(e=>l.has(e.id)),n=g({customModels:es,modelAliases:ee,providerAlias:tm,builtInModels:ta,type:"llm"}),d=ep.trim().toLowerCase(),c=(e,t="")=>!d||e.toLowerCase().includes(d)||String(t).toLowerCase().includes(d),p=r.filter(e=>c(e.id,e.name)),x=n.filter(e=>c(e.id,e.name));return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[x.map(e=>(0,a.jsx)(v,{model:{id:e.id,name:e.name},fullModel:`${tp}/${e.id}`,alias:e.alias,copied:e1,onCopy:e2,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?tA(e.id,"llm",tm):tC(e.alias)},testStatus:er[e.id],onTest:j.length>0||ts?()=>tJ(e.id):void 0,isTesting:ec.has(e.id),isCustom:!0,isFree:!1,caps:b(`${y}/${e.id}`)},`${e.source}-${e.fullModel}`)),p.map(e=>{let t=`${tm}/${e.id}`,s=`${y}/${e.id}`,i=Object.entries(ee).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(v,{model:e,fullModel:`${tp}/${e.id}`,alias:i,copied:e1,onCopy:e2,onSetAlias:t=>tk(e.id,t,tm),onDeleteAlias:()=>tC(i),testStatus:er[e.id],onTest:j.length>0||ts?()=>tJ(e.id):void 0,isTesting:ec.has(e.id),isFree:e.isFree,onDisable:()=>tu(e.id),caps:b(`${y}/${e.id}`)},e.id)}),ep.trim()&&0===p.length&&0===x.length&&(0,a.jsxs)("p",{className:"w-full text-center text-sm text-text-muted py-4",children:["No models match “",ep,"”"]}),(0,a.jsxs)("button",{onClick:()=>eg(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"qoder"===y&&j.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:t$,disabled:eY,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-info transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:eY?{animation:"spin 1s linear infinite"}:void 0,children:eY?"progress_activity":"download"}),eY?(0,u.Tl)("Fetching..."):(0,u.Tl)("Fetch Qoder Models")]}),eE.length>0&&(e=new Set([...Object.values(ee),...n.map(e=>e.fullModel)]),t=new Set(ta.map(e=>e.id)),0===(s=eE.filter(s=>!e.has(`${tm}/${s.id}`)&&!t.has(s.id))).length?null:(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,a.jsxs)("button",{onClick:async()=>{await tS(e.id,"llm",tm)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-border text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),o.length>0&&(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",o.length,"):"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,a.jsxs)("button",{onClick:()=>th(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-border text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),tF,"kiro"===y?(0,a.jsx)(d.Mh,{isOpen:U,providerInfo:e6,onSuccess:tP,onClose:()=>_(!1)}):"cursor"===y?(0,a.jsx)(d.G9,{isOpen:U,onSuccess:tP,onClose:()=>_(!1)}):"gitlab"===y?(0,a.jsx)(d.vj,{isOpen:U,providerInfo:e6,onSuccess:tP,onClose:()=>_(!1)}):(0,a.jsx)(d.LF,{isOpen:U,provider:y,providerInfo:e6,onSuccess:tP,onClose:()=>_(!1)}),"iflow"===y&&(0,a.jsx)(d.vE,{isOpen:z,onSuccess:()=>{tv(),q(!1)},onClose:()=>q(!1)}),(0,a.jsx)(A,{isOpen:M,provider:y,providerName:e6.name,isCompatible:to,isAnthropic:tr,authType:e6?.authType,authHint:e6?.authHint,website:e6?.website,proxyPools:R,error:L,onSave:tE,onBulkDone:tv,onClose:()=>{F(""),K(!1)}}),(0,a.jsx)(d.wI,{isOpen:B,connection:X,proxyPools:R,onSave:tI,onClose:()=>H(!1)}),to&&(0,a.jsx)($,{isOpen:G,node:O,onSave:tj,onClose:()=>V(!1),isAnthropic:tr}),!to&&(0,a.jsx)(T,{isOpen:ef,providerAlias:tm,providerDisplayAlias:tp,onSave:async e=>{await tS(e,"llm",tm),eg(!1)},onClose:()=>eg(!1)}),"codex"===y&&(0,a.jsx)(P,{isOpen:J,onClose:()=>W(!1),onSuccess:tv}),(0,a.jsx)(d.uo,{isOpen:eM,onClose:()=>eK(!1),onConfirm:()=>{(window.localStorage.setItem(e5,"true"),eK(!1),te)?e3():e7()},title:"Risk Notice",message:e6?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(d.uo,{isOpen:!!ez,onClose:()=>eq(null),onConfirm:ez?.onConfirm,title:ez?.title||"Confirm",message:ez?.message,variant:"danger"})]}):(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,a.jsx)(o(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}},88845:(e,t,s)=>{Promise.resolve().then(s.bind(s,78907))}},e=>{e.O(0,[27,5772,1321,705,5497,8441,3794,7358],()=>e(e.s=88845)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9089],{15615:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>u});var a=t(95155),s=t(12115),i=t(73321),l=t(98500),d=t.n(l),o=t(35497),n=t(90620);let c=Object.values(n.Q2).map(e=>({value:e.id,label:e.name})),p=Object.values(n.MA).map(e=>({value:e.id,label:e.name}));function u(){let e=(0,i.useRouter)(),[r,t]=(0,s.useState)(!1),[l,u]=(0,s.useState)({provider:"",authMethod:"api_key",apiKey:"",displayName:"",isActive:!0}),[h,m]=(0,s.useState)({}),x=(e,r)=>{u(t=>({...t,[e]:r})),h[e]&&m(r=>({...r,[e]:null}))},b=async r=>{let a;if(r.preventDefault(),a={},l.provider||(a.provider="Please select a provider"),"api_key"!==l.authMethod||l.apiKey||(a.apiKey="API Key is required"),m(a),0===Object.keys(a).length){t(!0);try{let r=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(r.ok)e.push("/dashboard/providers");else{let e=await r.json();m({submit:e.error||"Failed to create provider"})}}catch(e){m({submit:"An error occurred. Please try again."})}finally{t(!1)}}},v=n.Q2[l.provider];return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:"Add New Provider"}),(0,a.jsx)("p",{className:"text-text-muted mt-2",children:"Configure a new AI provider to use with your applications."})]}),(0,a.jsx)(o.Zp,{children:(0,a.jsxs)("form",{onSubmit:b,className:"flex flex-col gap-6",children:[(0,a.jsx)(o.l6,{label:"Provider",options:c,value:l.provider,onChange:e=>x("provider",e.target.value),placeholder:"Select a provider",error:h.provider,required:!0}),v&&(0,a.jsxs)(o.Zp.Section,{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center bg-bg border border-border",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:v.color},children:v.icon})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:v.name}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Selected provider"})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("label",{className:"text-sm font-medium",children:["Authentication Method ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("div",{className:"flex gap-3",children:p.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>x("authMethod",e.value),className:`flex-1 flex items-center justify-center gap-2 p-4 rounded-lg border transition-all ${l.authMethod===e.value?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/50"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined",children:"api_key"===e.value?"key":"lock"}),(0,a.jsx)("span",{className:"font-medium",children:e.label})]},e.value))})]}),"api_key"===l.authMethod&&(0,a.jsx)(o.pd,{label:"API Key",type:"password",placeholder:"Enter your API key",value:l.apiKey,onChange:e=>x("apiKey",e.target.value),error:h.apiKey,hint:"Your API key will be encrypted and stored securely.",required:!0}),"oauth2"===l.authMethod&&(0,a.jsxs)(o.Zp.Section,{children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Connect your account using OAuth2 authentication."}),(0,a.jsx)(o.$n,{type:"button",variant:"secondary",icon:"link",children:"Connect with OAuth2"})]}),(0,a.jsx)(o.pd,{label:"Display Name",placeholder:"e.g., Production API, Dev Environment",value:l.displayName,onChange:e=>x("displayName",e.target.value),hint:"Optional. A friendly name to identify this configuration."}),(0,a.jsx)(o.lM,{checked:l.isActive,onChange:e=>x("isActive",e),label:"Active",description:"Enable this provider for use in your applications"}),h.submit&&(0,a.jsx)("div",{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 text-sm",children:h.submit}),(0,a.jsxs)("div",{className:"flex gap-3 pt-4 border-t border-border",children:[(0,a.jsx)(d(),{href:"/dashboard/providers",className:"flex-1",children:(0,a.jsx)(o.$n,{type:"button",variant:"ghost",fullWidth:!0,children:"Cancel"})}),(0,a.jsx)(o.$n,{type:"submit",loading:r,fullWidth:!0,className:"flex-1",children:"Create Provider"})]})]})})]})}},34654:(e,r,t)=>{Promise.resolve().then(t.bind(t,15615))}},e=>{e.O(0,[2574,3862,3807,1321,705,5497,8441,3794,7358],()=>e(e.s=34654)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9089],{15615:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>u});var a=t(95155),s=t(12115),i=t(73321),l=t(98500),d=t.n(l),o=t(35497),n=t(90620);let c=Object.values(n.Q2).map(e=>({value:e.id,label:e.name})),p=Object.values(n.MA).map(e=>({value:e.id,label:e.name}));function u(){let e=(0,i.useRouter)(),[r,t]=(0,s.useState)(!1),[l,u]=(0,s.useState)({provider:"",authMethod:"api_key",apiKey:"",displayName:"",isActive:!0}),[h,m]=(0,s.useState)({}),x=(e,r)=>{u(t=>({...t,[e]:r})),h[e]&&m(r=>({...r,[e]:null}))},b=async r=>{let a;if(r.preventDefault(),a={},l.provider||(a.provider="Please select a provider"),"api_key"!==l.authMethod||l.apiKey||(a.apiKey="API Key is required"),m(a),0===Object.keys(a).length){t(!0);try{let r=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(r.ok)e.push("/dashboard/providers");else{let e=await r.json();m({submit:e.error||"Failed to create provider"})}}catch(e){m({submit:"An error occurred. Please try again."})}finally{t(!1)}}},v=n.Q2[l.provider];return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:"Add New Provider"}),(0,a.jsx)("p",{className:"text-text-muted mt-2",children:"Configure a new AI provider to use with your applications."})]}),(0,a.jsx)(o.Zp,{children:(0,a.jsxs)("form",{onSubmit:b,className:"flex flex-col gap-6",children:[(0,a.jsx)(o.l6,{label:"Provider",options:c,value:l.provider,onChange:e=>x("provider",e.target.value),placeholder:"Select a provider",error:h.provider,required:!0}),v&&(0,a.jsxs)(o.Zp.Section,{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center bg-bg border border-border",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:v.color},children:v.icon})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:v.name}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Selected provider"})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("label",{className:"text-sm font-medium",children:["Authentication Method ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("div",{className:"flex gap-3",children:p.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>x("authMethod",e.value),className:`flex-1 flex items-center justify-center gap-2 p-4 rounded-lg border transition-all ${l.authMethod===e.value?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/50"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined",children:"api_key"===e.value?"key":"lock"}),(0,a.jsx)("span",{className:"font-medium",children:e.label})]},e.value))})]}),"api_key"===l.authMethod&&(0,a.jsx)(o.pd,{label:"API Key",type:"password",placeholder:"Enter your API key",value:l.apiKey,onChange:e=>x("apiKey",e.target.value),error:h.apiKey,hint:"Your API key will be encrypted and stored securely.",required:!0}),"oauth2"===l.authMethod&&(0,a.jsxs)(o.Zp.Section,{children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Connect your account using OAuth2 authentication."}),(0,a.jsx)(o.$n,{type:"button",variant:"secondary",icon:"link",children:"Connect with OAuth2"})]}),(0,a.jsx)(o.pd,{label:"Display Name",placeholder:"e.g., Production API, Dev Environment",value:l.displayName,onChange:e=>x("displayName",e.target.value),hint:"Optional. A friendly name to identify this configuration."}),(0,a.jsx)(o.lM,{checked:l.isActive,onChange:e=>x("isActive",e),label:"Active",description:"Enable this provider for use in your applications"}),h.submit&&(0,a.jsx)("div",{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 text-sm",children:h.submit}),(0,a.jsxs)("div",{className:"flex gap-3 pt-4 border-t border-border",children:[(0,a.jsx)(d(),{href:"/dashboard/providers",className:"flex-1",children:(0,a.jsx)(o.$n,{type:"button",variant:"ghost",fullWidth:!0,children:"Cancel"})}),(0,a.jsx)(o.$n,{type:"submit",loading:r,fullWidth:!0,className:"flex-1",children:"Create Provider"})]})]})})]})}},34654:(e,r,t)=>{Promise.resolve().then(t.bind(t,15615))}},e=>{e.O(0,[27,1321,705,5497,8441,3794,7358],()=>e(e.s=34654)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{86296:(e,t,s)=>{Promise.resolve().then(s.bind(s,97678))},97678:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>N});var r=s(95155),a=s(12115),l=s(14051),i=s.n(l),n=s(35497),o=s(57250),d=s(90620),c=s(88105),m=s(98500),p=s.n(m),x=s(65921),u=s(38003);let h={available:{icon:"check_circle",color:"#22c55e",label:"Available"},cooldown:{icon:"schedule",color:"#f59e0b",label:"Cooldown"},unavailable:{icon:"error",color:"#ef4444",label:"Unavailable"},unknown:{icon:"help",color:"#6b7280",label:"Unknown"}};function f(){let[e,t]=(0,a.useState)(null),[s,l]=(0,a.useState)(!0),[i,o]=(0,a.useState)(!1),[d,c]=(0,a.useState)(null),m=(0,a.useRef)(null),p=(0,x.i)(),u=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/availability");if(e.ok){let s=await e.json();t(s)}}catch{}finally{l(!1)}},[]);(0,a.useEffect)(()=>{u();let e=setInterval(u,3e4);return()=>clearInterval(e)},[u]),(0,a.useEffect)(()=>{let e=e=>{m.current&&!m.current.contains(e.target)&&o(!1)};return i&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let f=async(e,t)=>{c(`${e}:${t}`);try{(await fetch("/api/models/availability",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clearCooldown",provider:e,model:t})})).ok?(p.success(`Cooldown cleared for ${t}`),await u()):p.error("Failed to clear cooldown")}catch{p.error("Failed to clear cooldown")}finally{c(null)}};if(s)return null;let g=e?.models||[],b=0===(e?.unavailableCount||g.filter(e=>"available"!==e.status).length),v={};return g.forEach(e=>{if("available"===e.status)return;let t=e.provider||"unknown";v[t]||(v[t]=[]),v[t].push(e)}),(0,r.jsx)("div",{className:"relative",ref:m,children:i&&(0,r.jsxs)("div",{className:"absolute top-full right-0 mt-2 w-80 bg-surface border border-border rounded-xl shadow-2xl z-50 overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-bg",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:b?"#22c55e":"#f59e0b"},children:b?"verified":"warning"}),(0,r.jsx)("span",{className:"text-sm font-semibold text-text-main",children:"Model Status"})]}),(0,r.jsx)("button",{onClick:u,className:"p-1 rounded-lg hover:bg-surface text-text-muted hover:text-text-main transition-colors",title:"Refresh",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"})})]}),(0,r.jsx)("div",{className:"px-4 py-3 max-h-60 overflow-y-auto",children:b?(0,r.jsx)("p",{className:"text-sm text-text-muted text-center py-2",children:"All models are responding normally."}):(0,r.jsx)("div",{className:"flex flex-col gap-2.5",children:Object.entries(v).map(([e,t])=>(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs font-semibold text-text-main mb-1.5 capitalize",children:e}),(0,r.jsx)("div",{className:"flex flex-col gap-1",children:t.map(e=>{let t=h[e.status]||h.unknown,s=d===`${e.provider}:${e.model}`;return(0,r.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5 rounded-lg bg-surface/30",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] shrink-0",style:{color:t.color},children:t.icon}),(0,r.jsx)("span",{className:"font-mono text-xs text-text-main truncate",children:e.model})]}),"cooldown"===e.status&&(0,r.jsx)(n.$n,{size:"sm",variant:"ghost",onClick:()=>f(e.provider,e.model),disabled:s,className:"text-[10px] px-1.5! py-0.5! ml-2",children:s?"...":"Clear"})]},`${e.provider}-${e.model}`)})})]},e))})})]})})}let g={openai:{title:"Add OpenAI Compatible",type:"openai-compatible",defaultBaseUrl:"https://api.openai.com/v1",namePlaceholder:"OpenAI Compatible (Prod)",prefixPlaceholder:"oc-prod",baseUrlHint:"Use the base URL (ending in /v1) for your OpenAI-compatible API.",modelIdPlaceholder:"e.g. gpt-4, claude-3-opus",errorLabel:"OpenAI Compatible",hasApiType:!0},anthropic:{title:"Add Anthropic Compatible",type:"anthropic-compatible",defaultBaseUrl:"https://api.anthropic.com/v1",namePlaceholder:"Anthropic Compatible (Prod)",prefixPlaceholder:"ac-prod",baseUrlHint:"Use the base URL (ending in /v1) for your Anthropic-compatible API. The system will append /messages.",modelIdPlaceholder:"e.g. claude-3-opus",errorLabel:"Anthropic Compatible",hasApiType:!1}},b=[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}];function v({variant:e,isOpen:t,onClose:s,onCreated:l}){let i=g[e],o=()=>({name:"",prefix:"",...i.hasApiType?{apiType:"chat"}:{},baseUrl:i.defaultBaseUrl}),[d,c]=(0,a.useState)(o),[m,p]=(0,a.useState)(!1),[x,u]=(0,a.useState)(""),[h,f]=(0,a.useState)(""),[y,j]=(0,a.useState)(!1),[N,w]=(0,a.useState)(null);(0,a.useEffect)(()=>{i.hasApiType?c(e=>({...e,baseUrl:i.defaultBaseUrl})):t&&(w(null),u(""),f(""))},[i.hasApiType?d.apiType:t]);let k=async()=>{if(d.name.trim()&&d.prefix.trim()&&d.baseUrl.trim()){p(!0);try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.name,prefix:d.prefix,...i.hasApiType?{apiType:d.apiType}:{},baseUrl:d.baseUrl,type:i.type})}),t=await e.json();e.ok&&(l(t.node),c(o()),u(""),w(null))}catch(e){console.log(`Error creating ${i.errorLabel} node:`,e)}finally{p(!1)}}},C=async()=>{j(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:d.baseUrl,apiKey:x,type:i.type,modelId:h.trim()||void 0})}),t=await e.json();w(t)}catch{w({valid:!1,error:"Network error"})}finally{j(!1)}};return(0,r.jsx)(n.aF,{isOpen:t,title:i.title,onClose:s,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(n.pd,{label:"Name",value:d.name,onChange:e=>c({...d,name:e.target.value}),placeholder:i.namePlaceholder,hint:"Required. A friendly label for this node."}),(0,r.jsx)(n.pd,{label:"Prefix",value:d.prefix,onChange:e=>c({...d,prefix:e.target.value}),placeholder:i.prefixPlaceholder,hint:"Required. Used as the provider prefix for model IDs."}),i.hasApiType&&(0,r.jsx)(n.l6,{label:"API Type",options:b,value:d.apiType,onChange:e=>c({...d,apiType:e.target.value})}),(0,r.jsx)(n.pd,{label:"Base URL",value:d.baseUrl,onChange:e=>c({...d,baseUrl:e.target.value}),placeholder:i.defaultBaseUrl,hint:i.baseUrlHint}),(0,r.jsx)(n.pd,{label:"API Key (for Check)",type:"password",value:x,onChange:e=>u(e.target.value)}),(0,r.jsx)(n.pd,{label:"Model ID (optional)",value:h,onChange:e=>f(e.target.value),placeholder:i.modelIdPlaceholder,hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,r.jsx)(n.$n,{onClick:C,disabled:!x||y||!d.baseUrl.trim(),variant:"secondary",className:"w-full sm:w-auto",children:y?"Checking...":"Check"}),(()=>{if(!N)return null;let{valid:e,error:t,method:s}=N;return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Ex,{variant:"success",children:"Valid"}),"chat"===s&&(0,r.jsx)("span",{className:"text-sm text-text-muted",children:"(via inference test)"})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(n.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,r.jsx)(n.$n,{onClick:k,fullWidth:!0,disabled:!d.name.trim()||!d.prefix.trim()||!d.baseUrl.trim()||m,children:m?"Creating...":"Create"}),(0,r.jsx)(n.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function y(e,t,s){let a=[];if(e>0&&a.push((0,r.jsxs)(n.Ex,{variant:"success",size:"sm",dot:!0,children:[e," Connected"]},"connected")),t>0){let e=s?`${t} Error (${s})`:`${t} Error`;a.push((0,r.jsx)(n.Ex,{variant:"error",size:"sm",dot:!0,children:e},"error"))}return 0===a.length?(0,r.jsx)("span",{className:"text-text-muted",children:"No connections"}):a}v.propTypes={variant:i().oneOf(["openai","anthropic"]).isRequired,isOpen:i().bool.isRequired,onClose:i().func.isRequired,onCreated:i().func.isRequired};let j=new Set(["windsurf","trae","cody"]);function N(){let[e,t]=(0,a.useState)([]),[s,l]=(0,a.useState)([]),[i,o]=(0,a.useState)(!0),[m,p]=(0,a.useState)(!1),[h,g]=(0,a.useState)(!1),[b,y]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!0),[T,A]=(0,a.useState)(!0),[$,I]=(0,a.useState)(!0),[S,E]=(0,a.useState)(!1),[P,O]=(0,a.useState)(!1),[R,_]=(0,a.useState)(null),[U,z]=(0,a.useState)(null),q=(0,x.i)(),D=(0,u.C)(e=>e.query),F=(0,u.C)(e=>e.register),L=(0,u.C)(e=>e.unregister);(0,a.useEffect)(()=>(F("Search providers..."),()=>L()),[F,L]);let M=e=>!D.trim()||e.toLowerCase().includes(D.trim().toLowerCase()),K=(e,t)=>[...e].sort(([e,s],[r,a])=>{let l=s.priority??999,i=a.priority??999;if(l!==i)return l-i;let n=H(e,t),o=H(r,t),d=+(n.connected>0),c=+(o.connected>0);return d!==c?c-d:(s.name||"").localeCompare(a.name||"")});(0,a.useEffect)(()=>{(async()=>{try{let[e,s]=await Promise.all([fetch("/api/providers"),fetch("/api/provider-nodes")]),r=await e.json(),a=await s.json();e.ok&&t(r.connections||[]),s.ok&&l(a.nodes||[])}catch(e){console.log("Error fetching data:",e)}finally{o(!1)}})()},[]);let H=(t,s)=>{let r=Array.isArray(s)?s:[s],a=e.filter(e=>e.provider===t&&r.includes(e.authType)),l=e=>{let t=Object.entries(e).some(([e,t])=>e.startsWith("modelLock_")&&t&&new Date(t).getTime()>Date.now());return"unavailable"!==e.testStatus||t?e.testStatus:"active"},i=a.filter(e=>{let t=l(e);return"active"===t||"success"===t}).length,n=a.filter(e=>{let t=l(e);return"error"===t||"expired"===t||"unavailable"===t}),o=n.length,d=a.length,c=d>0&&a.every(e=>!1===e.isActive),m=n.sort((e,t)=>new Date(t.lastErrorAt||0)-new Date(e.lastErrorAt||0))[0];return{connected:i,error:o,total:d,errorCode:m?function(e){if(!e)return null;let t=e.lastErrorType;if("runtime_error"===t)return"RUNTIME";if("upstream_auth_error"===t||"auth_missing"===t||"token_refresh_failed"===t||"token_expired"===t)return"AUTH";if("upstream_rate_limited"===t)return"429";if("upstream_unavailable"===t)return"5XX";if("network_error"===t)return"NET";let s=Number(e.errorCode);if(Number.isFinite(s)&&s>=400)return String(s);let r=function(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}(e.lastError);if("401"===r||"403"===r)return"AUTH";if(r&&"ERR"!==r)return r;let a=(e.lastError||"").toLowerCase();return a.includes("runtime")||a.includes("not runnable")||a.includes("not installed")?"RUNTIME":a.includes("invalid api key")||a.includes("token invalid")||a.includes("revoked")||a.includes("unauthorized")?"AUTH":"ERR"}(m):null,errorTime:m?.lastErrorAt?function(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let r=Math.floor(s/24);return`${r}d ago`}(m.lastErrorAt):null,allDisabled:c}},J=async(s,r,a)=>{let l=Array.isArray(r)?r:[r],i=e=>e.provider===s&&l.includes(e.authType),n=e.filter(i);t(e=>e.map(e=>i(e)?{...e,isActive:a}:e)),await Promise.allSettled(n.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:a})})))},B=async(e,t=null)=>{if(!R){_("provider"===e?t:e),z(null);try{let s=await fetch("/api/providers/test-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,providerId:t})}),r=await s.json();if(z(r),r.summary){let{passed:e,failed:t,total:s}=r.summary;0===t?q.success(`All ${s} tests passed`):q.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){z({error:"Test request failed"}),q.error("Provider test failed")}finally{_(null)}}},W=s.filter(e=>"openai-compatible"===e.type).map(e=>({id:e.id,name:e.name||"OpenAI Compatible",color:"#10A37F",textIcon:"OC",apiType:e.apiType})).filter(e=>M(e.name)),Q=s.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"})).filter(e=>M(e.name)),X=K(Object.entries(d.zN).filter(([,e])=>!e.hidden&&M(e.name)),"oauth"),Z=Object.entries(c.IS).filter(([,e])=>!e.hidden&&M(e.name)).sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),V=K(Object.entries(c.nJ).filter(([,e])=>!e.hidden&&M(e.name)&&(e.serviceKinds??["llm"]).includes("llm")),"freeTier").sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),Y=Object.entries(d.fg).filter(([,e])=>!e.hidden&&(e.serviceKinds??["llm"]).includes("llm")&&M(e.name)).sort(([e,t],[s,r])=>{let a=H(e,"apikey").total>0?0:1,l=H(s,"apikey").total>0?0:1;return a!==l?a-l:(t.name||"").localeCompare(r.name||"")}),G=!!D.trim(),ee=G||m?Y:Y.slice(0,20),et=Y.length-20,es=Object.entries(c.br).filter(([,e])=>!e.hidden&&M(e.name)).sort(([e,t],[s,r])=>{let a=H(e,"cookie").total>0?0:1,l=H(s,"cookie").total>0?0:1;return a!==l?a-l:(t.name||"").localeCompare(r.name||"")});if(i)return(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(n.Qv,{}),(0,r.jsx)(n.Qv,{})]});let er=es.length>0||X.length>0||Z.length>0||V.length>0||Y.length>0||W.length>0||Q.length>0;return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,r.jsx)(n.zY,{title:"Providers",description:"Provider registry and account health",icon:"dns",actions:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.$n,{size:"sm",variant:"outline",icon:"add",onClick:()=>O(!0),children:"Anthropic"}),(0,r.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>E(!0),children:"OpenAI"})]})}),!er&&(0,r.jsxs)("div",{className:"rounded-panel border border-dashed border-border py-10 text-center",children:[(0,r.jsx)("span",{className:"material-symbols-outlined mb-2 text-[28px] text-text-muted",children:"search_off"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"No providers match your search"})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>g(e=>!e),className:"flex items-center gap-2 text-lg sm:text-xl font-semibold leading-tight text-text-main transition-colors hover:text-primary","aria-expanded":h,children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[20px] transition-transform ${h?"rotate-90":""}`,children:"chevron_right"}),"Custom Providers (OpenAI/Anthropic Compatible)",(0,r.jsxs)("span",{className:"text-xs font-normal text-text-muted",children:["(",W.length+Q.length,")"]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:w-auto",children:[(0,r.jsx)(n.$n,{size:"sm",icon:"add",onClick:()=>O(!0),className:"w-full sm:w-auto",children:"Add Anthropic Compatible"}),(0,r.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"add",onClick:()=>E(!0),className:"w-full sm:w-auto",children:"Add OpenAI Compatible"})]})]}),h&&(0===W.length&&0===Q.length?(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 py-2 border border-dashed border-border rounded-xl text-text-muted text-sm",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"extension"}),(0,r.jsx)("span",{children:"No custom providers — use buttons above to add OpenAI/Anthropic compatible endpoints"})]}):(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:[...W,...Q].map(e=>(0,r.jsx)(k,{providerId:e.id,provider:e,stats:H(e.id,"apikey"),authType:"compatible",onToggle:t=>J(e.id,"apikey",t)},e.id))}))]}),es.length>0&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>y(e=>!e),className:"flex items-center gap-2 text-lg sm:text-xl font-semibold leading-tight text-text-main transition-colors hover:text-primary","aria-expanded":b,children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[20px] transition-transform ${b?"rotate-90":""}`,children:"chevron_right"}),"Cookies Provider",(0,r.jsxs)("span",{className:"text-xs font-normal text-text-muted",children:["(",es.length,")"]})]}),(0,r.jsxs)("button",{onClick:()=>B("cookie"),disabled:!!R,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"cookie"===R?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all Cookie connections","aria-label":"Test all Cookie connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"cookie"===R?" animate-spin":""}`,children:"play_arrow"}),"cookie"===R?"Testing...":"Test All"]})]}),b&&(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:es.map(([e,t])=>(0,r.jsx)(k,{providerId:e,provider:t,stats:H(e,"cookie"),authType:"cookie",onToggle:t=>J(e,"cookie",t)},e))})]}),X.length>0&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>N(e=>!e),className:"flex items-center gap-2 text-lg sm:text-xl font-semibold leading-tight text-text-main transition-colors hover:text-primary","aria-expanded":j,children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[20px] transition-transform ${j?"rotate-90":""}`,children:"chevron_right"}),"OAuth Providers",(0,r.jsxs)("span",{className:"text-xs font-normal text-text-muted",children:["(",X.length,")"]})]}),(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,r.jsx)(f,{}),(0,r.jsxs)("button",{onClick:()=>B("oauth"),disabled:!!R,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"oauth"===R?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all OAuth connections","aria-label":"Test all OAuth connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"oauth"===R?" animate-spin":""}`,children:"play_arrow"}),"oauth"===R?"Testing...":"Test All"]})]})]}),j&&(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:X.map(([e,t])=>(0,r.jsx)(w,{providerId:e,provider:t,stats:H(e,"oauth"),authType:"oauth",onToggle:t=>J(e,"oauth",t)},e))})]}),(Z.length>0||V.length>0)&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>A(e=>!e),className:"flex items-center gap-2 text-lg sm:text-xl font-semibold leading-tight text-text-main transition-colors hover:text-primary","aria-expanded":T,children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[20px] transition-transform ${T?"rotate-90":""}`,children:"chevron_right"}),"Free Tier Providers",(0,r.jsxs)("span",{className:"text-xs font-normal text-text-muted",children:["(",Z.length+V.length,")"]})]}),(0,r.jsxs)("button",{onClick:()=>B("free"),disabled:!!R,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"free"===R?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all Free connections","aria-label":"Test all Free provider connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"free"===R?" animate-spin":""}`,children:"play_arrow"}),"free"===R?"Testing...":"Test All"]})]}),T&&(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:[Z.map(([e,t])=>{let s="kiro"===e?["oauth","apikey","api_key"]:"oauth";return(0,r.jsx)(w,{providerId:e,provider:t,stats:H(e,s),authType:"free",onToggle:t=>J(e,s,t)},e)}),V.map(([e,t])=>(0,r.jsx)(k,{providerId:e,provider:t,stats:H(e,"apikey"),authType:"apikey",onToggle:t=>J(e,"apikey",t)},e))]})]}),Y.length>0&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>I(e=>!e),className:"flex items-center gap-2 text-lg sm:text-xl font-semibold leading-tight text-text-main transition-colors hover:text-primary","aria-expanded":$,children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[20px] transition-transform ${$?"rotate-90":""}`,children:"chevron_right"}),"API Key Providers",(0,r.jsxs)("span",{className:"text-xs font-normal text-text-muted",children:["(",Y.length,")"]})]}),(0,r.jsxs)("button",{onClick:()=>B("apikey"),disabled:!!R,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"apikey"===R?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all API Key connections","aria-label":"Test all API Key connections",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px]${"apikey"===R?" animate-spin":""}`,children:"play_arrow"}),"apikey"===R?"Testing...":"Test All"]})]}),$&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:ee.map(([e,t])=>(0,r.jsx)(k,{providerId:e,provider:t,stats:H(e,"apikey"),authType:"apikey",onToggle:t=>J(e,"apikey",t)},e))}),!G&&!m&&et>0&&(0,r.jsxs)("button",{onClick:()=>p(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2.5 text-sm font-medium text-primary transition-colors hover:border-primary hover:bg-primary/5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"expand_more"}),"Show all ",Y.length," providers"]})]})]}),(0,r.jsx)(v,{variant:"openai",isOpen:S,onClose:()=>E(!1),onCreated:e=>{l(t=>[...t,e]),E(!1)}}),(0,r.jsx)(v,{variant:"anthropic",isOpen:P,onClose:()=>O(!1),onCreated:e=>{l(t=>[...t,e]),O(!1)}}),U&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center px-3 pt-[6vh] sm:pt-[10vh]",onClick:()=>z(null),children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),(0,r.jsxs)("div",{className:"relative bg-surface border border-border rounded-xl w-full max-w-[600px] max-h-[86vh] sm:max-h-[80vh] overflow-y-auto shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center justify-between px-5 py-3 border-b border-border bg-surface/95 backdrop-blur-sm rounded-t-xl",children:[(0,r.jsx)("h3",{className:"font-semibold",children:"Test Results"}),(0,r.jsx)("button",{onClick:()=>z(null),className:"p-1 rounded-lg hover:bg-bg text-text-muted hover:text-text-main transition-colors","aria-label":"Close test results",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]}),(0,r.jsx)("div",{className:"p-5",children:(0,r.jsx)(C,{results:U})})]})]})]})}function w({providerId:e,provider:t,stats:s,authType:a,onToggle:l}){let{connected:i,error:d,errorCode:c,errorTime:m,allDisabled:x}=s,u=!!t.noAuth;return(0,r.jsx)(p(),{href:`/dashboard/providers/${e}`,className:"group min-w-0",children:(0,r.jsx)(n.Zp,{padding:"xs",className:`h-full hover:bg-surface-2 dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${x?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 shrink-0 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,r.jsx)(o.A,{src:`/providers/${t.id}.${j.has(t.id)?"svg":"png"}`,alt:t.name,size:30,className:"object-contain rounded-lg max-w-[32px] max-h-[32px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h3",{className:"truncate font-semibold",children:t.name}),(0,r.jsx)("div",{className:"flex min-w-0 items-center gap-1.5 text-xs flex-wrap",children:x?(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),"Disabled"]})}):u?(0,r.jsx)(n.Ex,{variant:"success",size:"sm",dot:!0,children:"Ready"}):(0,r.jsxs)(r.Fragment,{children:[y(i,d,c),m&&(0,r.jsx)("span",{className:"text-text-muted",children:m})]})})]})]}),(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:s.total>0&&(0,r.jsx)("div",{className:"opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!!x)},children:(0,r.jsx)(n.lM,{size:"sm",checked:!x,onChange:()=>{},title:x?"Enable provider":"Disable provider"})})})]})})})}function k({providerId:e,provider:t,stats:s,authType:a,onToggle:l}){let{connected:i,error:d,errorCode:m,errorTime:x,allDisabled:u}=s,h=e.startsWith(c.JH),f=e.startsWith(c.DI);return(0,r.jsx)(p(),{href:`/dashboard/providers/${e}`,className:"group min-w-0",children:(0,r.jsx)(n.Zp,{padding:"xs",className:`h-full hover:bg-surface-2 dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${u?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 shrink-0 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,r.jsx)(o.A,{src:h?"responses"===t.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":f?"/providers/anthropic-m.png":`/providers/${t.id}.${j.has(t.id)?"svg":"png"}`,alt:t.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h3",{className:"truncate font-semibold",children:t.name}),(0,r.jsx)("div",{className:"flex min-w-0 items-center gap-1.5 text-xs flex-wrap",children:u?(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),"Disabled"]})}):(0,r.jsxs)(r.Fragment,{children:[y(i,d,m),h&&(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:"responses"===t.apiType?"Responses":"Chat"}),f&&(0,r.jsx)(n.Ex,{variant:"default",size:"sm",children:"Messages"}),t.comingSoon&&(0,r.jsx)(n.Ex,{variant:"warning",size:"sm",children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"schedule"}),"Coming Soon"]})}),x&&(0,r.jsx)("span",{className:"text-text-muted",children:x})]})})]})]}),(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:s.total>0&&(0,r.jsx)("div",{className:"opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!!u)},children:(0,r.jsx)(n.lM,{size:"sm",checked:!u,onChange:()=>{},title:u?"Enable provider":"Disable provider"})})})]})})})}function C({results:e}){if(e.error&&!e.results)return(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-danger text-[32px] mb-2 block",children:"error"}),(0,r.jsx)("p",{className:"text-sm text-danger",children:e.error})]});let{summary:t,mode:s}=e,a=e.results||[];return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[t&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs mb-1 sm:gap-3",children:[(0,r.jsxs)("span",{className:"text-text-muted",children:[{oauth:"OAuth",free:"Free",apikey:"API Key",provider:"Provider",all:"All"}[s]||s," Test"]}),(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded bg-success/15 text-success font-medium",children:[t.passed," passed"]}),t.failed>0&&(0,r.jsxs)("span",{className:"px-2 py-0.5 rounded bg-red-500/15 text-danger font-medium",children:[t.failed," failed"]}),(0,r.jsxs)("span",{className:"text-text-muted sm:ml-auto",children:[t.total," tested"]})]}),a.map((e,t)=>(0,r.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-lg bg-black/[0.03] px-3 py-2 text-xs dark:bg-white/[0.03] sm:flex-nowrap",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[16px] ${e.valid?"text-emerald-500":"text-danger"}`,children:e.valid?"check_circle":"error"}),(0,r.jsxs)("div",{className:"min-w-0 flex-[1_1_160px]",children:[(0,r.jsx)("span",{className:"block truncate font-medium sm:inline",children:e.connectionName}),(0,r.jsxs)("span",{className:"block truncate text-text-muted sm:ml-1.5 sm:inline",children:["(",e.provider,")"]})]}),void 0!==e.latencyMs&&(0,r.jsxs)("span",{className:"shrink-0 text-text-muted font-mono tabular-nums",children:[e.latencyMs,"ms"]}),(0,r.jsx)("span",{className:`shrink-0 text-[10px] uppercase font-bold px-1.5 py-0.5 rounded ${e.valid?"bg-success/15 text-success":"bg-red-500/15 text-danger"}`,children:e.valid?"OK":e.diagnosis?.type||"ERROR"})]},e.connectionId||t)),0===a.length&&(0,r.jsx)("div",{className:"text-center py-4 text-text-muted text-sm",children:"No active connections found for this group."})]})}w.propTypes={providerId:i().string.isRequired,provider:i().shape({id:i().string.isRequired,name:i().string.isRequired,color:i().string,textIcon:i().string}).isRequired,stats:i().shape({connected:i().number,error:i().number,errorCode:i().string,errorTime:i().string}).isRequired,authType:i().string,onToggle:i().func},k.propTypes={providerId:i().string.isRequired,provider:i().shape({id:i().string.isRequired,name:i().string.isRequired,color:i().string,textIcon:i().string,apiType:i().string}).isRequired,stats:i().shape({connected:i().number,error:i().number,errorCode:i().string,errorTime:i().string}).isRequired,authType:i().string,onToggle:i().func},C.propTypes={results:i().shape({mode:i().string,results:i().array,summary:i().shape({total:i().number,passed:i().number,failed:i().number}),error:i().string}).isRequired}}},e=>{e.O(0,[27,1321,705,5497,8441,3794,7358],()=>e(e.s=86296)),_N_E=e.O()}]);
@@ -1,4 +1,4 @@
1
1
  (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6812],{57076:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var l=r(95155),s=r(12115),o=r(35497),a=r(65921);function i(e={}){return{name:e.name||"",proxyUrl:e.proxyUrl||"",noProxy:e.noProxy||"",isActive:!1!==e.isActive,strictProxy:!0===e.strictProxy}}function n(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(!0),[d,c]=(0,s.useState)(!1),[x,p]=(0,s.useState)(!1),[m,h]=(0,s.useState)(!1),[u,y]=(0,s.useState)(!1),[f,g]=(0,s.useState)(!1),[j,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"}),[S,T]=(0,s.useState)({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),[A,E]=(0,s.useState)({denoToken:"",orgDomain:"",projectName:""}),[I,U]=(0,s.useState)(!1),[O,z]=(0,s.useState)(!1),[F,W]=(0,s.useState)(!1),[R,_]=(0,s.useState)(null),[L,q]=(0,s.useState)([]),[V,J]=(0,s.useState)(!1),[B,G]=(0,s.useState)({current:0,total:0}),[M,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(),c(!0)},er=()=>{c(!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){U(!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{U(!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([]),ed=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)}}},ec=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),G({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{G({current:s+=1,total:t.length})}}};await Promise.all(Array.from({length:Math.min(10,t.length)},a)),await X(),J(!1),G({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=()=>{F||h(!1)},eh=()=>{F||y(!1)},eu=()=>{F||g(!1)},ey=async()=>{if($.vercelToken.trim()){W(!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{W(!1)}}},ef=async()=>{if(S.accountId.trim()&&S.apiToken.trim()){W(!0);try{let e=await fetch("/api/proxy-pools/cloudflare-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)}),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{W(!1)}}},eg=async()=>{if(A.denoToken.trim()){W(!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{W(!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")}`);z(!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{z(!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 sm:gap-6",children:[(0,l.jsx)(o.zY,{title:"Proxy Pools",description:"Outbound proxy routing and health checks",icon:"lan",actions:(0,l.jsxs)(l.Fragment,{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 right-0 top-full z-50 mt-1 w-48 rounded-panel border border-border-subtle bg-panel p-1 shadow-[var(--shadow-elev)]",children:[(0,l.jsxs)("button",{onClick:()=>{T({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),y(!0),v(!1)},className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm text-text-main transition-colors hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-warning",children:"cloud"}),"Cloudflare Relay"]}),(0,l.jsxs)("button",{onClick:()=>{D({vercelToken:"",projectName:"vercel-relay"}),h(!0),v(!1)},className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm text-text-main transition-colors hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-info",children:"cloud_upload"}),"Vercel Relay"]}),(0,l.jsxs)("button",{onClick:()=>{E({denoToken:"",orgDomain:"",projectName:""}),g(!0),v(!1)},className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm text-text-main transition-colors hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-success",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||M||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:()=>ed(!0),disabled:M||V,children:"Activate"}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"toggle_off",onClick:()=>ed(!1),disabled:M||V,children:"Deactivate"}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:ec,disabled:M||V,children:"Delete"}),(0,l.jsx)(o.$n,{size:"sm",variant:"ghost",onClick:en,disabled:M||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"}),(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:R===e.id,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:R===e.id?{animation:"spin 1s linear infinite"}:void 0,children:R===e.id?"progress_activity":"science"})}),(0,l.jsx)("button",{onClick:()=>{k(e),w(i(e)),c(!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()||F,children:F?"Deploying... (may take ~1 min)":"Deploy"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:em,disabled:F,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:S.accountId,onChange:e=>T(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:S.apiToken,onChange:e=>T(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:S.projectName,onChange:e=>T(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:!S.accountId.trim()||!S.apiToken.trim()||F,children:F?"Deploying...":"Deploy Worker"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:eh,disabled:F,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-black/5 dark:bg-white/5 border border-black/10 dark:border-white/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 relay worker to Deno Deploy's global edge network. All AI provider requests are forwarded through Deno's edge, masking your real IP."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Deno Deploy v2 runs on a high-performance global edge network"}),(0,l.jsx)("li",{children:"Free tier: 1M requests & 100GiB outbound traffic per month"}),(0,l.jsx)("li",{children:"No per-request CPU time limits (unlike Vercel/Cloudflare)"}),(0,l.jsx)("li",{children:"Support up to 20 active apps & 50 custom domains"}),(0,l.jsx)("li",{children:"Deploy multiple relays for maximum IP diversity"})]}),(0,l.jsxs)("div",{className:"mt-2 pt-2 border-t border-black/10 dark:border-white/10 text-xs text-text-muted",children:[(0,l.jsx)("p",{className:"font-medium text-text-main mb-1",children:"How to generate API token:"}),(0,l.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,l.jsxs)("li",{children:["Go to ",(0,l.jsx)("b",{children:"console.deno.com"})]}),(0,l.jsxs)("li",{children:["Select your ",(0,l.jsx)("b",{children:"Organization"})," → ",(0,l.jsx)("b",{children:"Settings"})," → ",(0,l.jsx)("b",{children:"Organization Tokens"})]}),(0,l.jsxs)("li",{children:["Create a ",(0,l.jsx)("b",{children:"Organization Token"})," (prefix ",(0,l.jsx)("b",{children:"ddo_"}),")"]})]})]})]}),(0,l.jsx)(o.pd,{label:"Deno Deploy API Token",value:A.denoToken,onChange:e=>E(t=>({...t,denoToken:e.target.value})),placeholder:"ddo_xxxxxxxxxxxxxxxx",hint:(0,l.jsx)(l.Fragment,{children:"Token is used once for deployment, not stored. Found in Organization Settings."}),type:"password"}),(0,l.jsx)(o.pd,{label:"Organization Domain",value:A.orgDomain,onChange:e=>E(t=>({...t,orgDomain:e.target.value})),placeholder:"your-org.deno.net",hint:"Organization's default domain. Your relay URL will be in the format: https://my-relay.your-org.deno.net"}),(0,l.jsx)(o.pd,{label:"App Name",value:A.projectName,onChange:e=>E(t=>({...t,projectName:e.target.value})),placeholder:"deno-relay",hint:"Unique app name. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:eg,disabled:!A.denoToken.trim()||!A.orgDomain.trim()||F,children:F?"Deploying...":"Deploy Relay"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:eu,disabled:F,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:d,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:I})]}),(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:I})]}),(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()||I,children:I?"Saving...":"Save"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:er,disabled:I,children:"Cancel"})]})]})}),(0,l.jsx)(o.uo,{isOpen:!!Y,onClose:()=>Q(null),onConfirm:Y?.onConfirm,title:Y?.title||"Confirm",message:Y?.message,variant:"danger"})]})}},67212:(e,t,r)=>{Promise.resolve().then(r.bind(r,57076))}},e=>{e.O(0,[2574,3862,3807,1321,705,5497,8441,3794,7358],()=>e(e.s=67212)),_N_E=e.O()}]);
4
+ ${l.join("\n")}`);z(!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{z(!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 sm:gap-6",children:[(0,l.jsx)(o.zY,{title:"Proxy Pools",description:"Outbound proxy routing and health checks",icon:"lan",actions:(0,l.jsxs)(l.Fragment,{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 right-0 top-full z-50 mt-1 w-48 rounded-panel border border-border-subtle bg-panel p-1 shadow-[var(--shadow-elev)]",children:[(0,l.jsxs)("button",{onClick:()=>{T({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),y(!0),v(!1)},className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm text-text-main transition-colors hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-warning",children:"cloud"}),"Cloudflare Relay"]}),(0,l.jsxs)("button",{onClick:()=>{D({vercelToken:"",projectName:"vercel-relay"}),h(!0),v(!1)},className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm text-text-main transition-colors hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-info",children:"cloud_upload"}),"Vercel Relay"]}),(0,l.jsxs)("button",{onClick:()=>{E({denoToken:"",orgDomain:"",projectName:""}),g(!0),v(!1)},className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm text-text-main transition-colors hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-success",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||M||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:()=>ed(!0),disabled:M||V,children:"Activate"}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"toggle_off",onClick:()=>ed(!1),disabled:M||V,children:"Deactivate"}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:ec,disabled:M||V,children:"Delete"}),(0,l.jsx)(o.$n,{size:"sm",variant:"ghost",onClick:en,disabled:M||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"}),(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:R===e.id,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:R===e.id?{animation:"spin 1s linear infinite"}:void 0,children:R===e.id?"progress_activity":"science"})}),(0,l.jsx)("button",{onClick:()=>{k(e),w(i(e)),c(!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()||F,children:F?"Deploying... (may take ~1 min)":"Deploy"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:em,disabled:F,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:S.accountId,onChange:e=>T(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:S.apiToken,onChange:e=>T(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:S.projectName,onChange:e=>T(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:!S.accountId.trim()||!S.apiToken.trim()||F,children:F?"Deploying...":"Deploy Worker"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:eh,disabled:F,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-black/5 dark:bg-white/5 border border-black/10 dark:border-white/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 relay worker to Deno Deploy's global edge network. All AI provider requests are forwarded through Deno's edge, masking your real IP."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Deno Deploy v2 runs on a high-performance global edge network"}),(0,l.jsx)("li",{children:"Free tier: 1M requests & 100GiB outbound traffic per month"}),(0,l.jsx)("li",{children:"No per-request CPU time limits (unlike Vercel/Cloudflare)"}),(0,l.jsx)("li",{children:"Support up to 20 active apps & 50 custom domains"}),(0,l.jsx)("li",{children:"Deploy multiple relays for maximum IP diversity"})]}),(0,l.jsxs)("div",{className:"mt-2 pt-2 border-t border-black/10 dark:border-white/10 text-xs text-text-muted",children:[(0,l.jsx)("p",{className:"font-medium text-text-main mb-1",children:"How to generate API token:"}),(0,l.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,l.jsxs)("li",{children:["Go to ",(0,l.jsx)("b",{children:"console.deno.com"})]}),(0,l.jsxs)("li",{children:["Select your ",(0,l.jsx)("b",{children:"Organization"})," → ",(0,l.jsx)("b",{children:"Settings"})," → ",(0,l.jsx)("b",{children:"Organization Tokens"})]}),(0,l.jsxs)("li",{children:["Create a ",(0,l.jsx)("b",{children:"Organization Token"})," (prefix ",(0,l.jsx)("b",{children:"ddo_"}),")"]})]})]})]}),(0,l.jsx)(o.pd,{label:"Deno Deploy API Token",value:A.denoToken,onChange:e=>E(t=>({...t,denoToken:e.target.value})),placeholder:"ddo_xxxxxxxxxxxxxxxx",hint:(0,l.jsx)(l.Fragment,{children:"Token is used once for deployment, not stored. Found in Organization Settings."}),type:"password"}),(0,l.jsx)(o.pd,{label:"Organization Domain",value:A.orgDomain,onChange:e=>E(t=>({...t,orgDomain:e.target.value})),placeholder:"your-org.deno.net",hint:"Organization's default domain. Your relay URL will be in the format: https://my-relay.your-org.deno.net"}),(0,l.jsx)(o.pd,{label:"App Name",value:A.projectName,onChange:e=>E(t=>({...t,projectName:e.target.value})),placeholder:"deno-relay",hint:"Unique app name. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:eg,disabled:!A.denoToken.trim()||!A.orgDomain.trim()||F,children:F?"Deploying...":"Deploy Relay"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:eu,disabled:F,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:d,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:I})]}),(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:I})]}),(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()||I,children:I?"Saving...":"Save"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:er,disabled:I,children:"Cancel"})]})]})}),(0,l.jsx)(o.uo,{isOpen:!!Y,onClose:()=>Q(null),onConfirm:Y?.onConfirm,title:Y?.title||"Confirm",message:Y?.message,variant:"danger"})]})}},67212:(e,t,r)=>{Promise.resolve().then(r.bind(r,57076))}},e=>{e.O(0,[27,1321,705,5497,8441,3794,7358],()=>e(e.s=67212)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{17566:(e,t,r)=>{"use strict";r.d(t,{default:()=>M});var a=r(95155),s=r(12115),i=r(57250),n=r(70778);let l="quotaCacheData",o="quotaAutoRefresh",d=[10,20,50,100],c=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],u=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}];function x(e){return e.name?.trim()||e.email?.trim()||e.displayName?.trim()||null}function m(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}function h(e){let t={};return e.forEach(e=>{t[e.id]=!0}),t}function p(e,t){let r=new Set(t.map(e=>e.id));return Object.fromEntries(Object.entries(e).filter(([e])=>r.has(e)))}async function b(e,t){return await e(t)}function g(){try{let e=window.localStorage.getItem(l);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function f(e,t){try{let r=g();r[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(l,JSON.stringify(r))}catch(e){console.error("Error writing quota cache:",e)}}function y(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function v({quotas:e=[],compact:t=!1,sortMode:r="default",showSortLabel:i=!1}){let[n,l]=(0,s.useState)(1),o=(0,s.useMemo)(()=>e.map((e,t)=>({...e,index:t,remaining:e?.remaining!==void 0?Math.max(0,Math.round(e.remaining)):e?.remainingPercentage!==void 0?Math.round(e.remainingPercentage):y(e?.used,e?.total)})),[e]),d=(0,s.useMemo)(()=>"remaining-asc"===r?[...o].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...o].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):o,[o,r]),c=Math.max(1,Math.ceil(d.length/10));if((0,s.useEffect)(()=>{l(1)},[r,e]),(0,s.useEffect)(()=>{l(e=>Math.min(e,c))},[c]),!e||0===e.length)return null;let u=d.slice((n-1)*10,10*n),x=0===d.length?0:(n-1)*10+1,m=Math.min(10*n,d.length),h=t?"py-1 px-1.5":"py-2 px-3",p=t?"text-[11px]":"text-sm",b=t?"text-[11px]":"text-sm",g=t?"text-[10px] leading-tight":"text-xs";return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"text-[10px] text-text-muted",children:[d.length," quota",d.length>1?"s":""]}),i&&(0,a.jsx)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1 text-[10px] text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:"Sorted by account remaining"})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsx)("table",{className:"w-full table-fixed text-left",children:(0,a.jsx)("tbody",{children:u.map(e=>{var r;let s=(r=e.remaining)>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:r>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},i=function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,r=new Date,a=t-r;if(a<=0)return"-";let s=Math.ceil(a/6e4);if(s<60)return`${s}m`;let i=Math.floor(s/60),n=s%60;if(i<24)return`${i}h ${n}m`;let l=Math.floor(i/24);return`${l}d ${i%24}h ${n}m`}catch(e){return"-"}}(e.resetAt),n=function(e){if(!e)return null;try{let t=new Date(e),r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),s=new Date(a);s.setDate(s.getDate()+1);let i="";i=t>=a&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let n=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${i}, ${n}`}catch{return null}}(e.resetAt),l=!1!==e.recurring?`in ${i}`:`expires in ${i}`;return(0,a.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,a.jsx)("td",{className:`${h} w-[30%]`,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:s.emoji}),(0,a.jsx)("span",{className:`${p} font-medium text-text-primary truncate`,children:e.name})]})}),(0,a.jsx)("td",{className:`${h} w-[45%]`,children:(0,a.jsxs)("div",{className:t?"space-y-1":"space-y-1.5",children:[(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${s.bgLight} ${0===e.remaining?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,a.jsx)("div",{className:`h-full transition-all duration-300 ${s.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsxs)("span",{className:"text-text-muted",children:[e.used.toLocaleString()," / ",e.total>0?e.total.toLocaleString():"∞"]}),(0,a.jsxs)("span",{className:`font-medium ${s.text}`,children:[e.remaining,"%"]})]})]})}),(0,a.jsx)("td",{className:`${h} w-[25%]`,children:"-"!==i||n?t?(0,a.jsx)("div",{className:`${b} text-text-primary font-medium truncate`,title:n||"",children:"-"!==i?l:n}):(0,a.jsxs)("div",{className:"space-y-0.5",children:["-"!==i&&(0,a.jsx)("div",{className:`${b} text-text-primary font-medium`,children:l}),n&&(0,a.jsx)("div",{className:`${g} text-text-muted`,children:n})]}):(0,a.jsx)("div",{className:`${b} text-text-muted italic`,children:"N/A"})})]},`${e.name}-${e.index}`)})})})}),c>1&&(0,a.jsxs)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1.5 dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 text-[10px] text-text-muted",children:[(0,a.jsxs)("span",{children:["Showing ",x,"-",m," of ",d.length]}),(0,a.jsxs)("span",{children:["Page ",n," / ",c]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>l(e=>Math.max(1,e-1)),disabled:1===n,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:()=>l(e=>Math.min(c,e+1)),disabled:n===c,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Next"})]})]})]})}var j=r(98542),w=r(97677),N=r(54960),k=r(84588),C=r(35497),S=r(88105),A=r(11059);let $={"builder-id":"AWS Builder ID",idc:"IAM Identity Center",google:"Google",github:"GitHub",imported:"Imported Token",api_key:"API Key"},E={claude:"claudeAutoPing",codex:"codexAutoPing"},P={claude:"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",codex:"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota."};function q(e){return e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null}function D(e){let t=e.providerSpecificData?.region;if(t)return t;let r=e.providerSpecificData?.profileArn;return("string"==typeof r?r.split(":")[3]:"")||""}function T(e){if(!e)return"N/A";let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"N/A"}function M(){let{copied:e,copy:t}=(0,A.C)(),[r,M]=(0,s.useState)([]),[O,I]=(0,s.useState)({}),[_,F]=(0,s.useState)({}),[L,z]=(0,s.useState)({}),[R,U]=(0,s.useState)(!0),[J,K]=(0,s.useState)({claude:{},codex:{}}),[G,H]=(0,s.useState)(null),[B,V]=(0,s.useState)(!1),[W,Q]=(0,s.useState)(!1),[Y,X]=(0,s.useState)(60),[Z,ee]=(0,s.useState)(!0),[et,er]=(0,s.useState)(null),[ea,es]=(0,s.useState)(null),[ei,en]=(0,s.useState)(null),[el,eo]=(0,s.useState)(null),[ed,ec]=(0,s.useState)(null),[eu,ex]=(0,s.useState)(!1),[em,eh]=(0,s.useState)(null),[ep,eb]=(0,s.useState)([]),[eg,ef]=(0,s.useState)("all"),[ey,ev]=(0,s.useState)([]),[ej,ew]=(0,s.useState)("all"),[eN,ek]=(0,s.useState)("default"),[eC,eS]=(0,s.useState)(!1),[eA,e$]=(0,s.useState)(!1),[eE,eP]=(0,s.useState)(!1),[eq,eD]=(0,s.useState)(1),[eT,eM]=(0,s.useState)(20),[eO,eI]=(0,s.useState)(String(20)),[e_,eF]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eL,ez]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),eR=(0,s.useRef)(null),eU=(0,s.useRef)(null),eJ=(0,s.useRef)(0),eK=(0,s.useCallback)(async(e=eq)=>{try{var t,r;let a=new URLSearchParams({page:String(e),pageSize:String(eT),accountStatus:ej,sort:"priority"});"all"!==eg&&a.set("provider",eg);let s=await fetch(`/api/providers/client?${a.toString()}`);if(!s.ok)throw Error("Failed to fetch connections");let i=await s.json(),n=i.connections||[],l=(t=i.pagination,t||{page:1,pageSize:eT,total:0,totalPages:1}),o=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(i.totals,n.length);return M(n),ev(i.providerOptions||[]),eF(l),ez(o),eD((r=i.pagination,r?.page||e)),n}catch(e){return console.error("Error fetching connections:",e),M([]),ev([]),eF({page:1,pageSize:eT,total:0,totalPages:1}),ez({eligibleConnections:0,providerFilteredConnections:0}),[]}},[ej,eC,eq,eT,eg]),eG=(0,s.useCallback)(async(e,t)=>{F(t=>({...t,[e]:!0})),z(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};I(t=>({...t,[e]:r})),f(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"qoder":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{("organization"!==e||t&&0!==(Number(t.total)||0))&&r.push({name:"user"===e?"Personal":"organization"===e?"Organization":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null})});break;case"claude":t.message?r.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"vercel-ai-gateway":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codebuddy-cn":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,recurring:!1!==t.recurring})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let a=(0,n.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};I(t=>({...t,[e]:s})),f(e,s)}catch(r){console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),z(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{F(t=>({...t,[e]:!1}))}},[]),eH=(0,s.useCallback)(async(e,t)=>{await eG(e,t),H(new Date)},[eG]),eB=(0,s.useCallback)(async(e,t)=>{if("codex"===t&&!ei){en(e),z(t=>({...t,[e]:null}));try{let r=await fetch(`/api/usage/${e}/codex-reset-credits`,{method:"POST"}),a=await r.json().catch(()=>({}));if(!r.ok)throw Error(a.message||a.error||a.code||"Failed to reset Codex limit");await eG(e,t),H(new Date)}catch(t){z(r=>({...r,[e]:t.message||"Failed to reset Codex limit"}))}finally{en(null)}}},[eG,ei]),eV=(0,s.useCallback)(async e=>{ec({connection:e,loading:!0,error:null,data:null});try{let t=await fetch(`/api/usage/${e.id}/codex-reset-credits`,{cache:"no-store"}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(r.error||r.message||"Failed to load Codex reset credits");let a=Array.isArray(r.credits)?[...r.credits]:[];a.sort((e,t)=>{let r=e.expiresAt?new Date(e.expiresAt).getTime():1/0,a=t.expiresAt?new Date(t.expiresAt).getTime():1/0;return r-a}),ec({connection:e,loading:!1,error:null,data:{...r,credits:a}})}catch(t){ec({connection:e,loading:!1,error:t.message||"Failed to load Codex reset credits",data:null})}},[]),eW=(0,s.useCallback)(async e=>{if(confirm("Delete this connection?")){er(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){I(t=>{let r={...t};return delete r[e],r}),F(t=>{let r={...t};return delete r[e],r}),z(t=>{let r={...t};return delete r[e],r});try{let t=g();t[e]&&(delete t[e],window.localStorage.setItem(l,JSON.stringify(t)))}catch(e){console.error("Error deleting cache entry:",e)}await b(eK,eq)}}catch(e){console.error("Error deleting connection:",e)}finally{er(null)}}},[eK,eq]),eQ=(0,s.useCallback)(async(e,t)=>{es(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(I(e=>({...e})),await b(eK,eq))}catch(e){console.error("Error updating connection status:",e)}finally{es(null)}},[eK,eq]),eY=(0,s.useCallback)(async e=>{if(!em?.id)return;let t=em.id,r=em.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eK(),ex(!1),eh(null),S.wb.includes(r)&&await eG(t,r))}catch(e){console.error("Error saving connection:",e)}},[em,eK,eG]);(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&&eb(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let eX=(0,s.useCallback)(async(e=!1)=>{if(W)return;Q(!0),X(60);let t=eJ.current+=1,r=Math.round(3);try{let a=await eK(eq);F(h(a)),z(e=>p(e,a)),I(e=>p(e,a)),await Promise.all(a.filter(a=>e||"claude"!==a.provider||t%r==0).map(e=>eG(e.id,e.provider))),H(new Date)}catch(e){console.error("Error refreshing all providers:",e)}finally{Q(!1)}},[W,eK,eG,eq]);(0,s.useEffect)(()=>{(async()=>{ee(!0);let e=await eK(eq);ee(!1),F(h(e)),z(t=>p(t,e)),I(t=>p(t,e)),await Promise.all(e.map(e=>eG(e.id,e.provider))),H(new Date)})()},[eK,eG,eq]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(o);U(null===e||"true"===e),V(!0)},[]),(0,s.useEffect)(()=>{B&&window.localStorage.setItem(o,String(R))},[R,B]),(0,s.useEffect)(()=>{fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{}).then(e=>K({claude:e?.claudeAutoPing?.connections||{},codex:e?.codexAutoPing?.connections||{}})).catch(()=>{})},[]);let eZ=(0,s.useCallback)(async(e,t,r)=>{let a=E[t];if(!a)return;let s={...J[t]||{},[e]:r};K({...J,[t]:s});try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[a]||{},connections:s};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:t})})}catch{K(J)}},[J]);(0,s.useEffect)(()=>{if(!B||!R){eR.current&&(clearInterval(eR.current),eR.current=null),eU.current&&(clearInterval(eU.current),eU.current=null);return}return eR.current=setInterval(()=>{eX()},6e4),eU.current=setInterval(()=>{X(e=>e<=1?60:e-1)},1e3),()=>{eR.current&&clearInterval(eR.current),eU.current&&clearInterval(eU.current)}},[R,eX,B]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(eR.current&&(clearInterval(eR.current),eR.current=null),eU.current&&(clearInterval(eU.current),eU.current=null)):R&&B&&(eR.current=setInterval(()=>eX(),6e4),eU.current=setInterval(()=>{X(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[R,eX,B]);let e0=(0,s.useMemo)(()=>(function(e,t,r,a,s){if("codex"===a&&"default"!==s)return[...e].sort((e,r)=>{let a=m(e,t),i=m(r,t),n="remaining-asc"===s?a-i:i-a;return 0!==n?n:(x(e)||"").localeCompare(x(r)||"")});if(!r)return e;let i=e=>{let r=(t[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return r.length>0?Math.min(...r):1/0};return[...e].sort((e,t)=>{let r=i(e)-i(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(x(e)||"").localeCompare(x(t)||"")})})(r,O,eC,eg,eN),[r,O,eC,eg,eN]),e1=e=>{let t=O[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=y(e.used,e.total))},e2=(0,s.useCallback)(async(e,t)=>{if(e.length&&!eE){eP(!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 b(eK,eq)}catch(e){console.error("Error bulk toggling connections:",e)}finally{eP(!1)}}},[eE,eK,eq]),e5="all"===eg?"All providers":eg,e3=eL.eligibleConnections>0,e8=e0.length>0,e4=eL.eligibleConnections?eL.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"===eg?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===ej?"turned off":"active"===ej?"active":"matching"} accounts found for ${eg}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},e6=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}`}(e_),e7=!d.includes(eT);return Z||e3?Z||e8?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)(N.default,{title:"Quota",description:"Capacity, resets, and account availability",icon:"data_usage"}),(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:()=>e$(e=>!e),className:"flex h-8 items-center justify-between gap-1 rounded-lg border border-border bg-black/[0.02] px-2 text-xs text-text-primary transition-colors hover:bg-surface-2 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-haspopup":"menu","aria-expanded":eA,title:"Filter quota providers",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===eg?(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"apps"}):(0,a.jsx)(i.A,{src:`/providers/${eg}.png`,alt:eg,size:18,className:"size-[18px] rounded object-contain",fallbackText:eg.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"truncate capitalize hidden lg:inline",children:e5})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),eA&&(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:()=>e$(!1)}),(0,a.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-2xl border border-border 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"!==eg&&eD(1),ef("all"),e$(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===eg?"bg-primary/10 text-primary":"text-text-primary hover:hover:bg-surface-3"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"apps"}),(0,a.jsx)("span",{className:"font-medium",children:"All providers"}),"all"===eg&&(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:ey.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{eg!==e&&eD(1),ef(e),e$(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${eg===e?"bg-primary/10 text-primary":"text-text-primary hover:hover:bg-surface-3"}`,children:[(0,a.jsx)(i.A,{src:`/providers/${e}.png`,alt:e,size:24,className:"size-6 rounded-md object-contain",fallbackText:e.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"font-medium capitalize",children:e}),eg===e&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,a.jsx)("select",{value:ej,onChange:e=>{let t=e.target.value;ej!==t&&eD(1),ew(t)},className:"h-8 rounded-lg border border-border bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-surface-2 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Filter accounts by status",children:c.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===eg&&(0,a.jsx)("select",{value:eN,onChange:e=>ek(e.target.value),className:"h-8 rounded-lg border border-border bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-surface-2 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Sort Codex quotas by remaining",children:u.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)("button",{type:"button",onClick:()=>eS(e=>!e),"aria-pressed":eC,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${eC?"border-amber-500/40 bg-warning/10 text-warning":"border-border text-text-primary hover:bg-surface-2 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:()=>{e2(e0.filter(e=>(e.isActive??!0)&&e1(e)).map(e=>e.id),!1)},disabled:eE,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-red-500/30 px-2 text-xs text-danger transition-colors hover:bg-danger/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:()=>{e2(e0.filter(e=>!(e.isActive??!0)&&!e1(e)).map(e=>e.id),!0)},disabled:eE,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:()=>U(e=>!e),className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-border px-2 text-xs transition-colors hover:bg-surface-2 dark:border-white/10 dark:hover:bg-white/5",title:R?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${R?"text-primary":"text-text-muted"}`,children:R?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{className:"hidden text-text-primary sm:inline",children:"Auto-refresh"}),R&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",Y,"s)"]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eX(!0),disabled:W,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-border px-2 text-xs text-text-primary transition-colors hover:bg-surface-2 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] ${W?"animate-spin":""}`,children:"refresh"})})]})}),eC&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-warning/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:e0.map(r=>{let s,n,l,o=O[r.id],d=_[r.id],c=L[r.id],u=!1===r.isActive,m="codex"===r.provider,h=Number.isFinite(n="number"==typeof(s=o?.raw?.resetCredits?.availableCount)?s:Number(s))?Math.max(0,n):0,p=ei===r.id,b=et===r.id||ea===r.id||p;return(0,a.jsxs)(k.default,{padding:"none",className:`min-w-0 ${u?"opacity-60":""}`,children:[(0,a.jsx)("div",{className:"px-3 py-2 border-b border-border",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,a.jsx)(i.A,{src:`/providers/${r.provider}.png`,alt:r.provider,size:32,className:"object-contain",fallbackText:r.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-primary capitalize truncate",children:r.provider}),x(r)?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:x(r)}):null,q(r)?(0,a.jsx)("p",{className:"text-[11px] text-text-muted/80 truncate",children:q(r)}):null,"kiro"===r.provider&&(0,a.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[(0,a.jsx)("span",{className:"rounded-full bg-brand-500/10 px-2 py-0.5 text-[10px] font-semibold text-brand-600 dark:text-brand-300",children:(l=r.providerSpecificData?.authMethod)&&$[l]?$[l]:"api_key"===r.authType?"API Key":"OAuth"}),D(r)&&(0,a.jsx)("span",{className:"rounded-full bg-info/10 px-2 py-0.5 text-[10px] font-semibold text-info",children:D(r)}),(0,a.jsx)("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-semibold ${u?"bg-surface-2 text-text-muted":"active"===r.testStatus||"success"===r.testStatus?"bg-green-500/10 text-success":"error"===r.testStatus||"expired"===r.testStatus||"unavailable"===r.testStatus?"bg-red-500/10 text-danger":"bg-surface-2 text-text-muted"}`,children:u?"disabled":r.testStatus||"unknown"}),r.providerSpecificData?.profileArn&&(0,a.jsxs)("button",{type:"button",onClick:()=>t(r.providerSpecificData.profileArn,r.id),title:r.providerSpecificData.profileArn,className:"inline-flex max-w-full items-center gap-1 rounded-full border border-border-subtle px-2 py-0.5 text-[10px] text-text-muted transition-colors hover:text-primary",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:e===r.id?"check":"content_copy"}),(0,a.jsx)("code",{className:"truncate font-mono",children:r.providerSpecificData.profileArn})]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[m&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(w.default,{text:h>0?`Use one Codex reset credit. Available: ${h}`:"No Codex reset credits available",children:(0,a.jsxs)("button",{type:"button",onClick:()=>eo({connection:r,resetCreditCount:h}),disabled:h<=0||d||b,"aria-label":h>0?`Use one Codex reset credit. ${h} available.`:"No Codex reset credits available",className:`flex h-8 min-w-10 items-center justify-center gap-1 rounded-lg border px-2 text-[11px] font-medium tabular-nums transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary/60 disabled:cursor-not-allowed disabled:opacity-60 ${h>0?"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10":"border-border bg-black/[0.02] text-text-muted dark:border-white/10 dark:bg-white/[0.03]"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[15px] ${p?"animate-spin":""}`,children:p?"progress_activity":"restart_alt"}),(0,a.jsx)("span",{children:h})]})}),(0,a.jsx)(w.default,{text:"View Codex reset credit expiry",children:(0,a.jsx)("button",{type:"button",onClick:()=>eV(r),disabled:d||b,"aria-label":"View Codex reset credit expiry",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border text-text-muted transition-colors hover:bg-surface-2 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10 dark:hover:bg-white/5",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"schedule"})})})]}),E[r.provider]&&"oauth"===r.authType&&(0,a.jsx)(w.default,{text:P[r.provider],children:(0,a.jsx)("button",{type:"button",onClick:()=>eZ(r.id,r.provider,J[r.provider]?.[r.id]!==!0),"aria-label":"Toggle auto-ping",className:`flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:hover:bg-surface-3 ${J[r.provider]?.[r.id]===!0?"text-primary":"text-text-muted"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"})})}),(0,a.jsx)(w.default,{text:"Refresh quota",children:(0,a.jsx)("button",{type:"button",onClick:()=>eH(r.id,r.provider),disabled:d||b,"aria-label":"Refresh quota",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:hover:bg-surface-3 transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${d?"animate-spin":""}`,children:"refresh"})})}),(0,a.jsx)(w.default,{text:"Edit connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>{eh(r),ex(!0)},disabled:b,"aria-label":"Edit connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:hover:bg-surface-3 text-text-muted hover:text-primary transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})})}),(0,a.jsx)(w.default,{text:"Delete connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>eW(r.id),disabled:b,"aria-label":"Delete connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-danger/10 text-danger transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${et===r.id?"animate-pulse":""}`,children:"delete"})})}),(0,a.jsx)("div",{className:"inline-flex items-center pl-0.5",title:r.isActive??!0?"Disable connection":"Enable connection",children:(0,a.jsx)(j.default,{size:"sm",checked:r.isActive??!0,disabled:b,onChange:e=>eQ(r.id,e)})})]})]})}),(0,a.jsx)("div",{className:"px-2 py-1.5",children:d?(0,a.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] animate-spin",children:"progress_activity"})}):c?(0,a.jsxs)("div",{className:"text-center py-5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] text-danger",children:"error"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:c})]}):o?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-text-muted",children:o.message})}):(0,a.jsx)(v,{quotas:o?.quotas,compact:!0,sortMode:"default",showSortLabel:"codex"===r.provider&&"default"!==eN})})]},r.id)})}),(0,a.jsx)("div",{className:"rounded-xl border border-border 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:e6}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:e7?"custom":String(eT),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(eD(1),eM(r),eI(String(r)))},className:"h-8 rounded-lg border border-border bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-surface-2 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Accounts per page",children:[d.map(e=>(0,a.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,a.jsx)("option",{value:"custom",children:"Custom"})]}),(0,a.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eO,onChange:e=>eI(e.target.value),onBlur:()=>{let e=Number.parseInt(eO,10);if(!Number.isFinite(e))return void eI(String(eT));let t=Math.min(500,Math.max(1,e));eD(1),eM(t),eI(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eO,10);if(!Number.isFinite(t))return void eI(String(eT));let r=Math.min(500,Math.max(1,t));eD(1),eM(r),eI(String(r))},className:"h-8 w-20 rounded-lg border border-border bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-surface-2 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 ",e_.page," / ",e_.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eD(1),disabled:e_.page<=1||Z||W,className:"flex h-8 items-center rounded-lg border border-border px-3 text-xs text-text-primary transition-colors hover:bg-surface-2 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:()=>eD(e=>Math.max(1,e-1)),disabled:e_.page<=1||Z||W,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border text-text-primary transition-colors hover:bg-surface-2 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:()=>eD(e=>Math.min(e_.totalPages,e+1)),disabled:e_.page>=e_.totalPages||Z||W,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border text-text-primary transition-colors hover:bg-surface-2 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:()=>eD(e_.totalPages),disabled:e_.page>=e_.totalPages||Z||W,className:"flex h-8 items-center rounded-lg border border-border px-3 text-xs text-text-primary transition-colors hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Last Page"})]})]})}),(0,a.jsx)(C.uo,{isOpen:!!el,onClose:()=>{ei||eo(null)},onConfirm:async()=>{let e=el?.connection;e&&(await eB(e.id,e.provider),eo(null))},title:"Reset Codex limit?",message:`Use 1 Codex reset credit for ${x(el?.connection||{})||"this account"}. This cannot be undone. Remaining credits: ${el?.resetCreditCount??0}.`,confirmText:"Reset limit",cancelText:"Cancel",variant:"danger",loading:!!ei}),ed&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"w-full max-w-2xl overflow-hidden rounded-2xl border border-black/15 bg-white shadow-2xl ring-1 ring-black/10 dark:border-white/15 dark:bg-surface dark:ring-white/10",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3 border-b border-border bg-black/[0.03] px-4 py-3 dark:border-white/10 dark:bg-white/[0.04]",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-base font-semibold text-text-primary",children:"Codex Reset Credit Expiry"}),(0,a.jsx)("p",{className:"mt-0.5 truncate text-xs text-text-muted",children:x(ed.connection)||"Codex account"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>ec(null),className:"flex h-8 w-8 items-center justify-center rounded-lg text-text-muted transition-colors hover:bg-surface-2 hover:text-text-primary dark:hover:bg-white/5","aria-label":"Close reset credit expiry modal",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),(0,a.jsx)("div",{className:"max-h-[70vh] overflow-auto bg-white p-4 dark:bg-surface",children:ed.loading?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),"Loading reset credits..."]}):ed.error?(0,a.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-300",children:ed.error}):ed.data?.credits?.length?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-border bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("span",{children:[ed.data.credits.length," reset credit",1===ed.data.credits.length?"":"s"]}),(0,a.jsxs)("span",{children:[ed.data.availableCount??0," available"]})]}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-xl border border-border",children:(0,a.jsxs)("table",{className:"w-full min-w-[560px] text-left text-sm",children:[(0,a.jsx)("thead",{className:"bg-black/[0.03] text-xs uppercase tracking-wide text-text-muted dark:bg-white/[0.04]",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Status"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Granted At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Expires At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Remaining"})]})}),(0,a.jsx)("tbody",{children:ed.data.credits.map((e,t)=>(0,a.jsxs)("tr",{className:"border-t border-border-subtle",children:[(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsx)("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:e.status||"unknown"})}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-muted",children:T(e.grantedAt)}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-primary",children:T(e.expiresAt)}),(0,a.jsx)("td",{className:"px-3 py-2 font-medium text-text-primary",children:function(e){if(!e)return"N/A";let t=new Date(e).getTime()-Date.now();if(!Number.isFinite(t))return"N/A";if(t<=0)return"Expired";let r=Math.ceil(t/36e5),a=Math.floor(r/24),s=r%24;return a>0?`${a}d ${s}h`:`${s}h`}(e.expiresAt)})]},`${e.status}-${e.expiresAt||t}`))})]})})]}):(0,a.jsx)("div",{className:"rounded-xl border border-border bg-black/[0.02] px-3 py-8 text-center text-sm text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:"No reset credit details returned for this account."})})]})}),(0,a.jsx)(C.wI,{isOpen:eu,connection:em,proxyPools:ep,onSave:eY,onClose:()=>{ex(!1),eh(null)}})]}):(0,a.jsx)(k.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:e4.icon}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:e4.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:e4.description})]})}):(0,a.jsx)(k.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."})]})})}},67471:(e,t,r)=>{Promise.resolve().then(r.bind(r,17566)),Promise.resolve().then(r.bind(r,25086))}},e=>{e.O(0,[27,1321,705,5497,8441,3794,7358],()=>e(e.s=67471)),_N_E=e.O()}]);