zevairouter 1.1.55 → 1.1.56

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 (733) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/cli/app/.next-cli-build/BUILD_ID +1 -1
  3. package/cli/app/.next-cli-build/app-path-routes-manifest.json +20 -20
  4. package/cli/app/.next-cli-build/build-manifest.json +2 -2
  5. package/cli/app/.next-cli-build/prerender-manifest.json +5 -5
  6. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page.js +1 -1
  7. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page.js.nft.json +1 -1
  8. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
  9. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  10. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  11. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  12. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  13. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  14. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  15. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  16. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  17. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  18. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  19. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  20. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  21. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  22. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  23. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  24. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page.js +1 -1
  25. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page.js.nft.json +1 -1
  26. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
  27. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  28. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  29. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  30. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +8 -8
  31. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  32. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  33. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  34. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  35. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  36. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +2 -2
  37. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  38. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  39. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  40. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  41. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  42. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  43. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  44. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  45. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  46. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  47. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  48. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page.js +1 -1
  49. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page.js.nft.json +1 -1
  50. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
  51. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  52. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  53. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  54. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  55. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  56. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  57. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  58. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  59. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  60. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  61. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  62. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  63. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  64. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  65. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  66. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  67. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  68. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  69. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  70. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  71. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  72. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page.js +1 -1
  73. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
  74. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  75. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  76. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  77. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  78. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page.js +1 -1
  79. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page.js.nft.json +1 -1
  80. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
  81. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  82. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  83. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  84. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  85. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  86. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  87. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  88. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  89. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  90. package/cli/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  91. package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  92. package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
  93. package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  94. package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  95. package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  96. package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  97. package/cli/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  98. package/cli/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  99. package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  100. package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
  101. package/cli/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  102. package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  103. package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
  104. package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  105. package/cli/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  106. package/cli/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  107. package/cli/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  108. package/cli/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  109. package/cli/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  110. package/cli/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  111. package/cli/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
  112. package/cli/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
  113. package/cli/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
  114. package/cli/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
  115. package/cli/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  116. package/cli/app/.next-cli-build/server/app/api/cache/stats/route.js.nft.json +1 -1
  117. package/cli/app/.next-cli-build/server/app/api/changelog/route.js.nft.json +1 -1
  118. package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
  119. package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  120. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  121. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  122. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  123. package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  124. package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  125. package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
  126. package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  127. package/cli/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +2 -2
  128. package/cli/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
  129. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-gateway/accounts/route.js +1 -1
  130. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-gateway/accounts/route.js.nft.json +1 -1
  131. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
  132. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  133. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  134. package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  135. package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  136. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
  137. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  138. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  139. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  140. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  141. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  142. package/cli/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
  143. package/cli/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
  144. package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
  145. package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  146. package/cli/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +2 -2
  147. package/cli/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
  148. package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
  149. package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  150. package/cli/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +1 -1
  151. package/cli/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
  152. package/cli/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +2 -2
  153. package/cli/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  154. package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js.nft.json +1 -1
  155. package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  156. package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  157. package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  158. package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  159. package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  160. package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  161. package/cli/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +2 -2
  162. package/cli/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
  163. package/cli/app/.next-cli-build/server/app/api/cli-tools/openbot-settings/route.js +2 -2
  164. package/cli/app/.next-cli-build/server/app/api/cli-tools/openbot-settings/route.js.nft.json +1 -1
  165. package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  166. package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  167. package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  168. package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  169. package/cli/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
  170. package/cli/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  171. package/cli/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +3 -3
  172. package/cli/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
  173. package/cli/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
  174. package/cli/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  175. package/cli/app/.next-cli-build/server/app/api/combos/presets/route.js +1 -1
  176. package/cli/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
  177. package/cli/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  178. package/cli/app/.next-cli-build/server/app/api/context/[id]/route.js.nft.json +1 -1
  179. package/cli/app/.next-cli-build/server/app/api/context/bulk/route.js.nft.json +1 -1
  180. package/cli/app/.next-cli-build/server/app/api/context/route.js.nft.json +1 -1
  181. package/cli/app/.next-cli-build/server/app/api/context/test/route.js +1 -1
  182. package/cli/app/.next-cli-build/server/app/api/context/test/route.js.nft.json +1 -1
  183. package/cli/app/.next-cli-build/server/app/api/dashboard/chat/completions/route.js +1 -1
  184. package/cli/app/.next-cli-build/server/app/api/dashboard/chat/completions/route.js.nft.json +1 -1
  185. package/cli/app/.next-cli-build/server/app/api/dashboard/cli-tools/keys/route.js.nft.json +1 -1
  186. package/cli/app/.next-cli-build/server/app/api/dashboard/media/[operation]/route.js +2 -2
  187. package/cli/app/.next-cli-build/server/app/api/dashboard/media/[operation]/route.js.nft.json +1 -1
  188. package/cli/app/.next-cli-build/server/app/api/dashboard/media/videos/[id]/route.js +1 -1
  189. package/cli/app/.next-cli-build/server/app/api/dashboard/media/videos/[id]/route.js.nft.json +1 -1
  190. package/cli/app/.next-cli-build/server/app/api/headroom/enable/route.js.nft.json +1 -1
  191. package/cli/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  192. package/cli/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  193. package/cli/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  194. package/cli/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  195. package/cli/app/.next-cli-build/server/app/api/headroom/status/route.js +1 -1
  196. package/cli/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  197. package/cli/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  198. package/cli/app/.next-cli-build/server/app/api/health/ready/route.js.nft.json +1 -1
  199. package/cli/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  200. package/cli/app/.next-cli-build/server/app/api/init/route.js +1 -1
  201. package/cli/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  202. package/cli/app/.next-cli-build/server/app/api/keys/[id]/rotate/route.js.nft.json +1 -1
  203. package/cli/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  204. package/cli/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  205. package/cli/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  206. package/cli/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  207. package/cli/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  208. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  209. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  210. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  211. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  212. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  213. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  214. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  215. package/cli/app/.next-cli-build/server/app/api/metrics/route.js.nft.json +1 -1
  216. package/cli/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  217. package/cli/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  218. package/cli/app/.next-cli-build/server/app/api/models/catalog-sync/route.js +1 -1
  219. package/cli/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
  220. package/cli/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  221. package/cli/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  222. package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
  223. package/cli/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  224. package/cli/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  225. package/cli/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  226. package/cli/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  227. package/cli/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  228. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/cancel/route.js +1 -1
  229. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  230. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/manual/[workerId]/route.js +1 -1
  231. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  232. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/route.js +1 -1
  233. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/route.js.nft.json +1 -1
  234. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/latest/route.js +1 -1
  235. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/latest/route.js.nft.json +1 -1
  236. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/route.js +1 -1
  237. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/route.js.nft.json +1 -1
  238. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  239. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  240. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/route.js.nft.json +1 -1
  241. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/latest/route.js.nft.json +1 -1
  242. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/route.js.nft.json +1 -1
  243. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  244. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  245. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/route.js.nft.json +1 -1
  246. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/latest/route.js.nft.json +1 -1
  247. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/route.js.nft.json +1 -1
  248. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-token/route.js.nft.json +1 -1
  249. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/quota-cookie/route.js.nft.json +1 -1
  250. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  251. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  252. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/route.js.nft.json +1 -1
  253. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/latest/route.js.nft.json +1 -1
  254. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/route.js.nft.json +1 -1
  255. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-token/route.js.nft.json +1 -1
  256. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/quota-cookie/route.js.nft.json +1 -1
  257. package/cli/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  258. package/cli/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  259. package/cli/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  260. package/cli/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  261. package/cli/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  262. package/cli/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  263. package/cli/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  264. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  265. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  266. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/route.js.nft.json +1 -1
  267. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/latest/route.js.nft.json +1 -1
  268. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
  269. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-token/route.js.nft.json +1 -1
  270. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/json-import/route.js.nft.json +1 -1
  271. package/cli/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  272. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  273. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  274. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  275. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  276. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/route.js.nft.json +1 -1
  277. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/latest/route.js.nft.json +1 -1
  278. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/route.js.nft.json +1 -1
  279. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  280. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  281. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  282. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  283. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  284. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  285. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/route.js.nft.json +1 -1
  286. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/latest/route.js.nft.json +1 -1
  287. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/route.js.nft.json +1 -1
  288. package/cli/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
  289. package/cli/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
  290. package/cli/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
  291. package/cli/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
  292. package/cli/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
  293. package/cli/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
  294. package/cli/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  295. package/cli/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  296. package/cli/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  297. package/cli/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  298. package/cli/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  299. package/cli/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  300. package/cli/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  301. package/cli/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js +1 -1
  302. package/cli/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
  303. package/cli/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  304. package/cli/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  305. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  306. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  307. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  308. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  309. package/cli/app/.next-cli-build/server/app/api/providers/bulk-delete/route.js +1 -1
  310. package/cli/app/.next-cli-build/server/app/api/providers/bulk-delete/route.js.nft.json +1 -1
  311. package/cli/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  312. package/cli/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  313. package/cli/app/.next-cli-build/server/app/api/providers/cloudflare-ai/discover-models/route.js +1 -1
  314. package/cli/app/.next-cli-build/server/app/api/providers/cloudflare-ai/discover-models/route.js.nft.json +1 -1
  315. package/cli/app/.next-cli-build/server/app/api/providers/codebuddy/discover-models/route.js +1 -1
  316. package/cli/app/.next-cli-build/server/app/api/providers/codebuddy/discover-models/route.js.nft.json +1 -1
  317. package/cli/app/.next-cli-build/server/app/api/providers/flow/import/route.js.nft.json +1 -1
  318. package/cli/app/.next-cli-build/server/app/api/providers/flow/login/[jobId]/route.js.nft.json +1 -1
  319. package/cli/app/.next-cli-build/server/app/api/providers/flow/login/route.js.nft.json +1 -1
  320. package/cli/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  321. package/cli/app/.next-cli-build/server/app/api/providers/kiro/discover-models/route.js +1 -1
  322. package/cli/app/.next-cli-build/server/app/api/providers/kiro/discover-models/route.js.nft.json +1 -1
  323. package/cli/app/.next-cli-build/server/app/api/providers/kiro/models/route.js +1 -1
  324. package/cli/app/.next-cli-build/server/app/api/providers/kiro/models/route.js.nft.json +1 -1
  325. package/cli/app/.next-cli-build/server/app/api/providers/opencode/discover-models/route.js +1 -1
  326. package/cli/app/.next-cli-build/server/app/api/providers/opencode/discover-models/route.js.nft.json +1 -1
  327. package/cli/app/.next-cli-build/server/app/api/providers/route.js +2 -2
  328. package/cli/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  329. package/cli/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  330. package/cli/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  331. package/cli/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  332. package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  333. package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  334. package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  335. package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  336. package/cli/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  337. package/cli/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  338. package/cli/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  339. package/cli/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  340. package/cli/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  341. package/cli/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  342. package/cli/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  343. package/cli/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  344. package/cli/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  345. package/cli/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  346. package/cli/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  347. package/cli/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  348. package/cli/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  349. package/cli/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  350. package/cli/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  351. package/cli/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  352. package/cli/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  353. package/cli/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  354. package/cli/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  355. package/cli/app/.next-cli-build/server/app/api/terminal/auth/setup/route.js.nft.json +1 -1
  356. package/cli/app/.next-cli-build/server/app/api/terminal/auth/status/route.js.nft.json +1 -1
  357. package/cli/app/.next-cli-build/server/app/api/terminal/auth/unlock/route.js.nft.json +1 -1
  358. package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/input/route.js.nft.json +1 -1
  359. package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/resize/route.js.nft.json +1 -1
  360. package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/route.js.nft.json +1 -1
  361. package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/stream/route.js.nft.json +1 -1
  362. package/cli/app/.next-cli-build/server/app/api/terminal/session/route.js.nft.json +1 -1
  363. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  364. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  365. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
  366. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  367. package/cli/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  368. package/cli/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  369. package/cli/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  370. package/cli/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  371. package/cli/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  372. package/cli/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  373. package/cli/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  374. package/cli/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  375. package/cli/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  376. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  377. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  378. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  379. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +1 -1
  380. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  381. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  382. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
  383. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  384. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  385. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  386. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  387. package/cli/app/.next-cli-build/server/app/api/usage/aggregate/route.js +1 -1
  388. package/cli/app/.next-cli-build/server/app/api/usage/aggregate/route.js.nft.json +1 -1
  389. package/cli/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  390. package/cli/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  391. package/cli/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  392. package/cli/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  393. package/cli/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  394. package/cli/app/.next-cli-build/server/app/api/usage/quota-stream/route.js +1 -1
  395. package/cli/app/.next-cli-build/server/app/api/usage/quota-stream/route.js.nft.json +1 -1
  396. package/cli/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  397. package/cli/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  398. package/cli/app/.next-cli-build/server/app/api/usage/routing-stream/route.js.nft.json +1 -1
  399. package/cli/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  400. package/cli/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  401. package/cli/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  402. package/cli/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  403. package/cli/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  404. package/cli/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  405. package/cli/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +2 -2
  406. package/cli/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  407. package/cli/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  408. package/cli/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  409. package/cli/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  410. package/cli/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  411. package/cli/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  412. package/cli/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  413. package/cli/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  414. package/cli/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  415. package/cli/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  416. package/cli/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  417. package/cli/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  418. package/cli/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js +1 -1
  419. package/cli/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
  420. package/cli/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  421. package/cli/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  422. package/cli/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  423. package/cli/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  424. package/cli/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  425. package/cli/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  426. package/cli/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  427. package/cli/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  428. package/cli/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  429. package/cli/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  430. package/cli/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  431. package/cli/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  432. package/cli/app/.next-cli-build/server/app/api/v1/systemone/route.js +1 -1
  433. package/cli/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
  434. package/cli/app/.next-cli-build/server/app/api/v1/videos/[id]/content/route.js.nft.json +1 -1
  435. package/cli/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  436. package/cli/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  437. package/cli/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  438. package/cli/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  439. package/cli/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  440. package/cli/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  441. package/cli/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  442. package/cli/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  443. package/cli/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  444. package/cli/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  445. package/cli/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  446. package/cli/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  447. package/cli/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  448. package/cli/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  449. package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
  450. package/cli/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  451. package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  452. package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  453. package/cli/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  454. package/cli/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  455. package/cli/app/.next-cli-build/server/app/callback/page.js +1 -1
  456. package/cli/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  457. package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  458. package/cli/app/.next-cli-build/server/app/callback.html +1 -1
  459. package/cli/app/.next-cli-build/server/app/callback.rsc +4 -4
  460. package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  461. package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  462. package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +4 -4
  463. package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
  464. package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +5 -5
  465. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +5 -5
  466. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +5 -5
  467. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +2 -2
  468. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  469. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
  470. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +5 -5
  471. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
  472. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  473. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  474. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +5 -5
  475. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +5 -5
  476. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
  477. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  478. package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  479. package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
  480. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +5 -5
  481. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
  482. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  483. package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
  484. package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +4 -4
  485. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +4 -4
  486. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +4 -4
  487. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +2 -2
  488. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  489. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
  490. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +5 -5
  491. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
  492. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  493. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  494. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +5 -5
  495. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +5 -5
  496. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +5 -5
  497. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  498. package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  499. package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
  500. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +6 -6
  501. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  502. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  503. package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
  504. package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +5 -5
  505. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +5 -5
  506. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +5 -5
  507. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +2 -2
  508. package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  509. package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +4 -4
  510. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +4 -4
  511. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +4 -4
  512. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  513. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  514. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +4 -4
  515. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +4 -4
  516. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +4 -4
  517. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  518. package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  519. package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
  520. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +5 -5
  521. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
  522. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  523. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  524. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +4 -4
  525. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +4 -4
  526. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +4 -4
  527. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  528. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  529. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +4 -4
  530. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +4 -4
  531. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +4 -4
  532. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
  533. package/cli/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  534. package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +5 -5
  535. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +5 -5
  536. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +5 -5
  537. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  538. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  539. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  540. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +4 -4
  541. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  542. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  543. package/cli/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  544. package/cli/app/.next-cli-build/server/app/dashboard/skills.rsc +4 -4
  545. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +4 -4
  546. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +4 -4
  547. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  548. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  549. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +4 -4
  550. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +4 -4
  551. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +4 -4
  552. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
  553. package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  554. package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +4 -4
  555. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +4 -4
  556. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +4 -4
  557. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  558. package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  559. package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
  560. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +5 -5
  561. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
  562. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  563. package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
  564. package/cli/app/.next-cli-build/server/app/dashboard.rsc +5 -5
  565. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +5 -5
  566. package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
  567. package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  568. package/cli/app/.next-cli-build/server/app/index.html +1 -1
  569. package/cli/app/.next-cli-build/server/app/index.rsc +4 -4
  570. package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  571. package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
  572. package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  573. package/cli/app/.next-cli-build/server/app/landing/page.js +1 -1
  574. package/cli/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  575. package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  576. package/cli/app/.next-cli-build/server/app/landing.html +1 -1
  577. package/cli/app/.next-cli-build/server/app/landing.rsc +4 -4
  578. package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  579. package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  580. package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +4 -4
  581. package/cli/app/.next-cli-build/server/app/login/page.js +1 -1
  582. package/cli/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  583. package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  584. package/cli/app/.next-cli-build/server/app/login.html +1 -1
  585. package/cli/app/.next-cli-build/server/app/login.rsc +4 -4
  586. package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  587. package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  588. package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  589. package/cli/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  590. package/cli/app/.next-cli-build/server/app/page.js +1 -1
  591. package/cli/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  592. package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  593. package/cli/app/.next-cli-build/server/app/provider-icons/[provider]/route.js +2 -2
  594. package/cli/app/.next-cli-build/server/app/provider-icons/[provider]/route.js.nft.json +1 -1
  595. package/cli/app/.next-cli-build/server/app/skills/[skill]/SKILL.md/route.js.nft.json +1 -1
  596. package/cli/app/.next-cli-build/server/app-paths-manifest.json +20 -20
  597. package/cli/app/.next-cli-build/server/chunks/1260.js +1 -1
  598. package/cli/app/.next-cli-build/server/chunks/1350.js +1 -1
  599. package/cli/app/.next-cli-build/server/chunks/1509.js +1 -1
  600. package/cli/app/.next-cli-build/server/chunks/1746.js +1 -0
  601. package/cli/app/.next-cli-build/server/chunks/1757.js +1 -1
  602. package/cli/app/.next-cli-build/server/chunks/2147.js +1 -1
  603. package/cli/app/.next-cli-build/server/chunks/2301.js +1 -1
  604. package/cli/app/.next-cli-build/server/chunks/24.js +1 -1
  605. package/cli/app/.next-cli-build/server/chunks/2731.js +6 -2
  606. package/cli/app/.next-cli-build/server/chunks/3792.js +1 -1
  607. package/cli/app/.next-cli-build/server/chunks/3966.js +6 -2
  608. package/cli/app/.next-cli-build/server/chunks/412.js +1 -1
  609. package/cli/app/.next-cli-build/server/chunks/4404.js +1 -1
  610. package/cli/app/.next-cli-build/server/chunks/4721.js +2 -2
  611. package/cli/app/.next-cli-build/server/chunks/4754.js +1 -1
  612. package/cli/app/.next-cli-build/server/chunks/4780.js +1 -1
  613. package/cli/app/.next-cli-build/server/chunks/4803.js +1 -1
  614. package/cli/app/.next-cli-build/server/chunks/4827.js +1 -1
  615. package/cli/app/.next-cli-build/server/chunks/5024.js +1 -1
  616. package/cli/app/.next-cli-build/server/chunks/5241.js +1 -0
  617. package/cli/app/.next-cli-build/server/chunks/5330.js +2 -2
  618. package/cli/app/.next-cli-build/server/chunks/5434.js +1 -1
  619. package/cli/app/.next-cli-build/server/chunks/5469.js +1 -1
  620. package/cli/app/.next-cli-build/server/chunks/5626.js +1 -1
  621. package/cli/app/.next-cli-build/server/chunks/5999.js +1 -1
  622. package/cli/app/.next-cli-build/server/chunks/6008.js +1 -1
  623. package/cli/app/.next-cli-build/server/chunks/6630.js +1 -1
  624. package/cli/app/.next-cli-build/server/chunks/6846.js +1 -1
  625. package/cli/app/.next-cli-build/server/chunks/7135.js +1 -1
  626. package/cli/app/.next-cli-build/server/chunks/7319.js +14 -14
  627. package/cli/app/.next-cli-build/server/chunks/7401.js +1 -1
  628. package/cli/app/.next-cli-build/server/chunks/7404.js +1 -0
  629. package/cli/app/.next-cli-build/server/chunks/7793.js +1 -1
  630. package/cli/app/.next-cli-build/server/chunks/8028.js +1 -1
  631. package/cli/app/.next-cli-build/server/chunks/8238.js +1 -1
  632. package/cli/app/.next-cli-build/server/chunks/8590.js +1 -1
  633. package/cli/app/.next-cli-build/server/chunks/891.js +1 -1
  634. package/cli/app/.next-cli-build/server/chunks/9152.js +1 -1
  635. package/cli/app/.next-cli-build/server/chunks/9367.js +1 -1
  636. package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  637. package/cli/app/.next-cli-build/server/pages/404.html +1 -1
  638. package/cli/app/.next-cli-build/server/pages/500.html +1 -1
  639. package/cli/app/.next-cli-build/server/preview-props.json +3 -3
  640. package/cli/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  641. package/cli/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  642. package/cli/app/.next-cli-build/static/chunks/523-3899a7f5cde3f3e8.js +3 -0
  643. package/cli/app/.next-cli-build/static/chunks/5497-3c3b07d715a99cab.js +7 -0
  644. package/cli/app/.next-cli-build/static/chunks/620-deb68c62a7d77fc0.js +1 -0
  645. package/cli/app/.next-cli-build/static/chunks/{866-cb5810bc4cfbe501.js → 866-95ac0134c200c9b4.js} +13 -9
  646. package/cli/app/.next-cli-build/static/chunks/9126-704494b6d143e965.js +1 -0
  647. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/automation/page-71a382ed81559482.js +1 -0
  648. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-a2bfbf57ba4e0369.js +1 -0
  649. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-5ea159e81960bde3.js +62 -0
  650. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-83103184cbba481f.js +1 -0
  651. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-cb5b7d41a830d58e.js → page-739bdc9961949f1b.js} +1 -1
  652. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-39062565f11d2c60.js +1 -0
  653. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/page-291c6ac2c795f8c8.js +1 -0
  654. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-656fbf35b150dc4c.js +15 -0
  655. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-3a704c1ae0b33a93.js +1 -0
  656. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-c4b6cea2f44cd5d8.js +1 -0
  657. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-a205615e648f47a1.js +1 -0
  658. package/cli/app/.next-cli-build/static/css/5f8e06639e41002c.css +1 -0
  659. package/cli/app/CHANGELOG.md +8 -0
  660. package/cli/app/package.json +1 -1
  661. package/cli/app/public/providers/agentrouter.png +0 -0
  662. package/cli/app/public/providers/agnes.png +0 -0
  663. package/cli/app/public/providers/api-airforce.png +0 -0
  664. package/cli/app/public/providers/atria.png +0 -0
  665. package/cli/app/public/providers/bai.png +0 -0
  666. package/cli/app/public/providers/bedrock-xai.png +0 -0
  667. package/cli/app/public/providers/bedrock.png +0 -0
  668. package/cli/app/public/providers/bluesminds.png +0 -0
  669. package/cli/app/public/providers/cartesia.png +0 -0
  670. package/cli/app/public/providers/chatgpt-web.png +0 -0
  671. package/cli/app/public/providers/codebuddy-intl.png +0 -0
  672. package/cli/app/public/providers/coqui.png +0 -0
  673. package/cli/app/public/providers/crush.png +0 -0
  674. package/cli/app/public/providers/dahl.png +0 -0
  675. package/cli/app/public/providers/deepseek-web.png +0 -0
  676. package/cli/app/public/providers/devin-cli.png +0 -0
  677. package/cli/app/public/providers/gemini-web.png +0 -0
  678. package/cli/app/public/providers/gitlab.png +0 -0
  679. package/cli/app/public/providers/longcat.png +0 -0
  680. package/cli/app/public/providers/mimo-free.png +0 -0
  681. package/cli/app/public/providers/minimax-code-global.png +0 -0
  682. package/cli/app/public/providers/minimax-code.png +0 -0
  683. package/cli/app/public/providers/mmf.png +0 -0
  684. package/cli/app/public/providers/muse-web.png +0 -0
  685. package/cli/app/public/providers/muse.png +0 -0
  686. package/cli/app/public/providers/nace.png +0 -0
  687. package/cli/app/public/providers/nous.png +0 -0
  688. package/cli/app/public/providers/novita.png +0 -0
  689. package/cli/app/public/providers/opencode-zen.png +0 -0
  690. package/cli/app/public/providers/playht.png +0 -0
  691. package/cli/app/public/providers/qoder-cn.png +0 -0
  692. package/cli/app/public/providers/reka.png +0 -0
  693. package/cli/app/public/providers/runcrate.png +0 -0
  694. package/cli/app/public/providers/sambanova.png +0 -0
  695. package/cli/app/public/providers/selfhosted-embedding.png +0 -0
  696. package/cli/app/public/providers/selfhosted-stt.png +0 -0
  697. package/cli/app/public/providers/selfhosted-tts.png +0 -0
  698. package/cli/app/public/providers/sensenova.png +0 -0
  699. package/cli/app/public/providers/tinyfish.png +0 -0
  700. package/cli/app/public/providers/tokenharbor.png +0 -0
  701. package/cli/app/public/providers/tortoise.png +0 -0
  702. package/cli/app/public/providers/trae.png +0 -0
  703. package/cli/app/public/providers/uc-web.png +0 -0
  704. package/cli/app/public/providers/v1m.png +0 -0
  705. package/cli/app/public/providers/veoaifree-web.png +0 -0
  706. package/cli/app/public/providers/vercel-ai-gateway.png +0 -0
  707. package/cli/app/public/providers/vercel.png +0 -0
  708. package/cli/app/public/providers/windsurf.png +0 -0
  709. package/cli/app/public/providers/workbuddy.png +0 -0
  710. package/cli/app/public/providers/xquik.png +0 -0
  711. package/cli/app/public/providers/zed.png +0 -0
  712. package/cli/package.json +1 -1
  713. package/package.json +1 -1
  714. package/cli/app/.next-cli-build/server/chunks/6316.js +0 -1
  715. package/cli/app/.next-cli-build/server/chunks/6351.js +0 -1
  716. package/cli/app/.next-cli-build/server/chunks/8806.js +0 -1
  717. package/cli/app/.next-cli-build/static/chunks/523-555b1100ea8c36ab.js +0 -3
  718. package/cli/app/.next-cli-build/static/chunks/5497-4e44bebc378726ef.js +0 -7
  719. package/cli/app/.next-cli-build/static/chunks/620-6e8f49e5a0915d95.js +0 -1
  720. package/cli/app/.next-cli-build/static/chunks/9126-8e307fc5cf32a12b.js +0 -1
  721. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/automation/page-c8b39a8d4d46a207.js +0 -1
  722. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-38ef7f5b88262d64.js +0 -1
  723. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-124b1160759061bf.js +0 -62
  724. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-a3aac7af48a78d0a.js +0 -1
  725. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-25329f7e043c45db.js +0 -1
  726. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/page-9e7522af32df1bdb.js +0 -1
  727. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-b7ad641a75eccc63.js +0 -15
  728. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-47b9590e383e3529.js +0 -1
  729. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-17f90cd42bb24199.js +0 -1
  730. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-bbcdfa6960400cb1.js +0 -1
  731. package/cli/app/.next-cli-build/static/css/1ba78f2ef5cfce32.css +0 -1
  732. /package/cli/app/.next-cli-build/static/{hTGU_ZpFVJkIvcdHRwnzH → qbIBaB7VAITknqvX7BY0D}/_buildManifest.js +0 -0
  733. /package/cli/app/.next-cli-build/static/{hTGU_ZpFVJkIvcdHRwnzH → qbIBaB7VAITknqvX7BY0D}/_ssgManifest.js +0 -0
@@ -0,0 +1,15 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{3362:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>ez});var a=s(95155),r=s(12115),n=s(73321),i=s(98500),l=s.n(i),o=s(5772),d=s(35497),c=s(1791);let u=["kiro","codebuddy","codebuddy-cn","qoder","antigravity","cloudflare-ai","grok-cli"];function m(e){return u.includes(String(e||""))}function x(e){let t=String(e||"").trim();return t&&m(t)?`/dashboard/automation?provider=${encodeURIComponent(t)}`:"/dashboard/automation"}var p=s(28777),h=s(11059),f=s(73006);let b=new Map;async function g(e){if(!e?.url||!e?.type)return[];let t=b.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=new URLSearchParams({url:e.url,type:e.type}),s=await fetch(`/api/providers/suggested-models?${t}`);if(!s.ok)return[];let a=(await s.json()).data??[];return b.set(e.url,{data:a,expiresAt:Date.now()+6e5}),a}catch{return[]}}var y=s(12252),v=s(70217),j=s(51716);let k=Object.freeze({oauth:Object.freeze({id:"oauth",label:"OAuth",icon:"lock",description:"Connect through the provider sign-in flow."}),apikey:Object.freeze({id:"apikey",label:"API Key",icon:"key",description:"Connect with an API key or provider credential."}),cookie:Object.freeze({id:"cookie",label:"Browser Cookie",icon:"cookie",description:"Connect with a signed-in browser session cookie."}),"quota-cookie":Object.freeze({id:"quota-cookie",label:"Quota Cookie",icon:"cookie",description:"Attach a web session so Quota Tracker can read credits."})}),w=Object.freeze({codebuddy:Object.freeze(["quota-cookie"]),"codebuddy-cn":Object.freeze(["quota-cookie"]),iflow:Object.freeze(["cookie"])}),N=Object.freeze({qoder:Object.freeze({apikey:Object.freeze({label:"Qoder PAT"})}),xai:Object.freeze({oauth:Object.freeze({label:"Grok Build OAuth"}),apikey:Object.freeze({label:"xAI API Key"})})});function C(e,t){e.includes(t)||e.push(t)}var S=s(65921),$=s(7031),A=s(14051),T=s.n(A);function O({model:e,fullModel:t,alias:s,copied:r,onCopy:n,testStatus:i,isCustom:l,isFree:o,onDeleteAlias:d,onTest:c,isTesting:u,onDisable:m,thinkingSuffix:x}){let p="ok"===i?"#22c55e":"error"===i?"#ef4444":void 0,h=x?`${t}(${x})`:t;return(0,a.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===i?"border-green-500/40":"error"===i?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,a.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:p?{color:p}:void 0,children:"ok"===i?"check_circle":"error"===i?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,a.jsx)("code",{className:"max-w-[72vw] truncate rounded bg-sidebar px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px]",children:h}),e.name&&(0,a.jsx)("span",{className:"truncate pl-1 text-[9px] italic text-text-muted/70",children:e.name})]}),c&&(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:c,disabled:u,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${u?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:u?{animation:"spin 1s linear infinite"}:void 0,children:u?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:u?"Testing...":"Test"})]}),(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:()=>n(h,`model-${e.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:r===`model-${e.id}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:r===`model-${e.id}`?"Copied!":"Copy"})]}),l?(0,a.jsx)("button",{onClick:d,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Remove custom model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):m?(0,a.jsx)("button",{onClick:m,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Disable this model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function P({models:e,modelAliases:t,providerStorageAlias:s,providerDisplayAlias:a}){let r={...t||{}},n=new Set(Object.values(r)),i=[];for(let t of Array.isArray(e)?e:[]){let e=function(e){if(!e)return"";if("string"==typeof e)return e.trim();let t=e.id||e.name||e.model;return"string"==typeof t?t.trim():""}(t);if(!e)continue;let l=`${s}/${e}`;if(n.has(l))continue;let o=function(e,t,s){let a=e.split("/"),r=a[a.length-1];if(!r)return"";if(!t[r])return r;let n=`${s}-${r}`;if(!t[n])return n;let i=2;for(;t[`${n}-${i}`];)i+=1;return`${n}-${i}`}(e,r,a);o&&(i.push({alias:o,model:l,modelId:e}),r[o]=l,n.add(l))}return i}function I({modelId:e,fullModel:t,copied:s,onCopy:r,onDeleteAlias:n,onTest:i,testStatus:l,isTesting:o}){let d="ok"===l?"#22c55e":"error"===l?"#ef4444":void 0;return(0,a.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===l?"border-green-500/40":"error"===l?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:d?{color:d}:void 0,children:"ok"===l?"check_circle":"error"===l?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:()=>r(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:s===`model-${e}`?"Copied!":"Copy"})]}),i&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:i,disabled:o,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:o?{animation:"spin 1s linear infinite"}:void 0,children:o?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:o?"Testing...":"Test"})]})]})]}),(0,a.jsx)("button",{onClick:n,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function E({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,copied:n,onCopy:i,onSetAlias:l,onDeleteAlias:o,onAliasesChanged:c,connections:u,isAnthropic:m}){let[x,p]=(0,r.useState)(""),[h,f]=(0,r.useState)(!1),[b,g]=(0,r.useState)(!1),[y,v]=(0,r.useState)(()=>new Set),[j,k]=(0,r.useState)({}),w=async t=>{let s=`${e}/${t}`;v(e=>new Set(e).add(t));try{let e=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s})}),t=await e.json();k(e=>({...e,[s]:t.ok?"ok":"error"}))}catch{k(e=>({...e,[s]:"error"}))}finally{v(e=>{let s=new Set(e);return s.delete(t),s})}},N=Object.entries(s).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,s])=>({modelId:s.replace(`${e}/`,""),fullModel:s,alias:t})),C=async()=>{if(!x.trim()||h)return;let a=x.trim(),[r]=P({models:[{id:a}],modelAliases:s,providerStorageAlias:e,providerDisplayAlias:t});if(!r)return void alert("This model already exists.");f(!0);try{await l(a,r.alias,e),p("")}catch(e){console.log("Error adding model:",e),alert(e?.message||`Failed to add model "${a}".`)}finally{f(!1)}},S=async()=>{if(b)return;let a=u.find(e=>!1!==e.isActive);if(a){g(!0);try{let r=await fetch(`/api/providers/${a.id}/models`),n=await r.json();if(!r.ok)return void alert(n.error||"Failed to import models");let i=n.models||[];if(0===i.length)return void alert("No models returned from /models.");let l=P({models:i,modelAliases:s,providerStorageAlias:e,providerDisplayAlias:t});if(0===l.length)return void alert("No new models were added.");let o=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({aliases:l.map(({alias:e,model:t})=>({alias:e,model:t}))})}),d=await o.json();if(!o.ok)throw Error(d.error||"Failed to save imported models.");await c(),alert(`Successfully added ${d.count||l.length} models.`)}catch(e){console.log("Error importing models:",e),alert(e?.message||"Failed to import models from /models.")}finally{g(!1)}}},$=u.some(e=>!1!==e.isActive);return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",m?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,a.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,a.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,a.jsx)("input",{id:"new-compatible-model-input",type:"text",value:x,onChange:e=>p(e.target.value),onKeyDown:e=>"Enter"===e.key&&C(),placeholder:m?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:C,disabled:!x.trim()||h,children:h?"Adding...":"Add"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:S,disabled:!$||b,children:b?"Importing...":"Import from /models"})]}),!$&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),N.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-3",children:N.map(({modelId:s,fullModel:r,alias:l})=>(0,a.jsx)(I,{modelId:s,fullModel:`${t}/${s}`,copied:n,onCopy:i,onDeleteAlias:()=>o(l),onTest:u.length>0?()=>w(s):void 0,testStatus:j[`${e}/${s}`],isTesting:y.has(s)},r))})]})}O.propTypes={model:T().shape({id:T().string.isRequired}).isRequired,fullModel:T().string.isRequired,alias:T().string,copied:T().string,onCopy:T().func.isRequired,testStatus:T().oneOf(["ok","error"]),isCustom:T().bool,isFree:T().bool,onDeleteAlias:T().func,onTest:T().func,isTesting:T().bool,onDisable:T().func,thinkingSuffix:T().string},T().string.isRequired,T().string.isRequired,T().string,T().func.isRequired,T().func.isRequired,T().func,T().oneOf(["ok","error"]),T().bool,T().string.isRequired,T().object.isRequired,T().string,T().func.isRequired,T().func.isRequired,T().func.isRequired,E.propTypes={providerStorageAlias:T().string.isRequired,providerDisplayAlias:T().string.isRequired,modelAliases:T().object.isRequired,copied:T().string,onCopy:T().func.isRequired,onSetAlias:T().func.isRequired,onDeleteAlias:T().func.isRequired,onAliasesChanged:T().func.isRequired,connections:T().arrayOf(T().shape({id:T().string,isActive:T().bool})).isRequired,isAnthropic:T().bool};var R=s(47650),z=s(81277);function q({until:e}){let[t,s]=(0,r.useState)("");return((0,r.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime();if(!Number.isFinite(t))return void s("");let a=t-Date.now();if(a<=0)return void s("");let r=Math.floor(a/1e3);if(r<60)s(`${r}s`);else if(r<3600)s(`${Math.floor(r/60)}m ${r%60}s`);else{let e=Math.floor(r/3600),t=Math.floor(r%3600/60);s(`${e}h ${t}m`)}};t();let a=setInterval(t,1e3);return()=>clearInterval(a)},[e]),t)?(0,a.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}q.propTypes={until:T().string.isRequired};var D=s(22942);function M({connection:e,proxyPools:t,isOAuth:s,isFirst:n,isLast:i,onMoveUp:l,onMoveDown:o,onToggleActive:c,onUpdateProxy:u,onEdit:m,onDelete:x,autoPingEnabled:p=!1,onToggleAutoPing:h,autoPingScheduled:f=!1,onOpenAutoPingSchedule:b,oneByOneStatus:g=null}){let[y,j]=(0,r.useState)(!1),[k,w]=(0,r.useState)(null),N=(0,r.useRef)(null),[C,S]=(0,r.useState)(!1),$=(0,r.useRef)(null),A=(0,r.useMemo)(()=>new Map((t||[]).map(e=>[e.id,e])),[t]),T=(0,r.useMemo)(()=>t||[],[t]),O=e.providerSpecificData?.proxyPoolId||null,P=O?A.get(O):null,I=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,E=!!O||I,_=P?`Pool: ${P.name}`:O?`Pool: ${O} (inactive/missing)`:I?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",U="";if(P?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=P?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);U=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{U=t}}let L=P?.noProxy||e.providerSpecificData?.connectionNoProxy||"",K="default";P?.isActive===!0?K="success":(O||I)&&(K="error"),(0,r.useEffect)(()=>{if(!y)return;let e=e=>{$.current?.contains(e.target)||N.current?.contains(e.target)||j(!1)},t=()=>j(!1);return document.addEventListener("mousedown",e),window.addEventListener("resize",t),document.addEventListener("scroll",t,!0),()=>{document.removeEventListener("mousedown",e),window.removeEventListener("resize",t),document.removeEventListener("scroll",t,!0)}},[y]);let F=async e=>{S(!0);try{await u("__none__"===e?null:e)}finally{S(!1),j(!1)}},J=e.authType||(s?"oauth":"apikey"),B="oauth"===J,H="cookie"===J,W=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),G=B?W(e.email)?e.email:W(e.name)?e.name:e.name||e.email||e.displayName||"OAuth Account":e.name||e.email||e.displayName||"API Key",V=(0,z.c)(e),Q=null!==V,Z="unavailable"!==e.testStatus||Q?e.testStatus:"active",X=(0,v.d4)(e),Y=!!e.quarantinedAt,ee={policy_suspended:"Policy suspension",account_validation_required:"Account verification required",credential_rejected:"Credential rejected",reauth_required:"Sign-in required",authentication:"Repeated authentication failure"}[e.failureClass]||e.quarantineReason||"Account quarantined",et=Number.isFinite(Date.parse(e.quarantinedAt))?new Date(e.quarantinedAt).toLocaleString():e.quarantinedAt||null,es=e.modelLockReason?.resetsAt,ea=Number.isFinite(Date.parse(es))?new Date(es).toLocaleString():es||null,er=()=>g?"queued"===g.state?"queued":"testing"===g.state?"testing":"success"===g.state?g.error?`connected: ${g.error}`:"success":"failed"===g.state?g.error?`failed: ${g.error}`:"failed":null:null;return(0,a.jsxs)("div",{className:`group flex min-w-0 flex-col gap-3 rounded-lg p-2 transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between ${!1===e.isActive&&!Y?"opacity-60":""}`,children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,a.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,a.jsx)("button",{onClick:l,disabled:n,className:`p-0.5 rounded ${n?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,a.jsx)("button",{onClick:o,disabled:i,className:`p-0.5 rounded ${i?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:H?"cookie":B?"lock":"key"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:G}),(0,a.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,a.jsx)(d.Ex,{variant:(()=>{if(!1===e.isActive)return"default";let t=(0,v.BU)(X);return"active"!==X.key?t:"active"===Z||"success"===Z?"success":"error"===Z||"expired"===Z||"unavailable"===Z?"error":"default"})(),size:"sm",dot:!0,children:X.label||Z||"unknown"}),(0,a.jsx)(d.Ex,{variant:"default",size:"sm",children:B?"OAuth":H?"Cookie":"API Key"}),Y&&(0,a.jsx)(d.Ex,{variant:"error",size:"sm",children:"Quarantined"}),E&&(0,a.jsx)(d.Ex,{variant:K,size:"sm",children:"Proxy"}),e.autoDisabledAt&&!Y&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["token_expired"===e.autoDisabledReason?"Token expired":"banned"===e.autoDisabledReason?"Banned":"quota_exhausted"===e.autoDisabledReason?"Quota exhausted":"Auto-disabled"," — ",new Date(e.autoDisabledAt).toLocaleDateString()]}),Y&&(0,a.jsxs)("span",{className:"max-w-full truncate text-xs text-red-600 dark:text-red-400 sm:max-w-[420px]",title:`${e.quarantineReason||ee}${et?` - ${et}`:""}`,children:[ee,et?` - ${et}`:""]}),Q&&!1!==e.isActive&&(0,a.jsx)(q,{until:V}),Q&&e.modelLockReason&&!1!==e.isActive&&(0,a.jsxs)("span",{className:"max-w-full truncate text-xs text-amber-600 dark:text-amber-400 sm:max-w-[360px]",title:`${e.modelLockReason.reason}${ea?` — resets ${ea}`:""}`,children:[e.modelLockReason.model,e.modelLockReason.providerErrorCode?` (${e.modelLockReason.providerErrorCode})`:"",ea?` — resets ${ea}`:""]}),e.lastError&&!1!==e.isActive&&(0,a.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:e.lastError,children:e.lastError}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),er()&&(0,a.jsx)(d.Ex,{variant:g?"success"===g.state?"success":"failed"===g.state?"error":"testing"===g.state?"primary":"default":"default",size:"sm",children:er()})]}),E&&(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:_,children:_}),U&&(0,a.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[260px]",children:U}),L&&(0,a.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:L,children:["no_proxy: ",L]})]}),Y&&!1===e.isActive&&(0,a.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-text-muted",children:"Re-enable only permits router requests again; it does not change the account's upstream status."})]})]}),(0,a.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,a.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[T.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{ref:N,type:"button",onClick:()=>{if(y)return void j(!1);let e=N.current?.getBoundingClientRect();e&&w((0,D.x)(e,T.length,{width:window.innerWidth,height:window.innerHeight})),j(!0)},className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${E?"text-primary":"text-text-muted hover:text-primary"}`,disabled:C,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:C?"progress_activity":"lan"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),y&&"u">typeof document&&(0,R.createPortal)((0,a.jsxs)("div",{ref:$,style:k,className:"z-50 max-w-[78vw] min-w-[160px] overflow-y-auto rounded-lg border border-border bg-bg py-1 shadow-lg",children:[(0,a.jsx)("button",{onClick:()=>F("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!O?"text-primary font-medium":"text-text-main"}`,children:"None"}),T.map(e=>(0,a.jsx)("button",{onClick:()=>F(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${O===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]}),document.body)]}),h&&(0,a.jsxs)("button",{onClick:()=>h(!p),className:`flex flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${p?"text-primary":"text-text-muted hover:text-primary"}`,title:p?"Disable quota auto-ping for this account":"Warm the 5-hour quota window after reset with a tiny request",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]}),b&&(0,a.jsxs)("button",{type:"button",onClick:b,className:`flex flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${f?"text-primary":"text-text-muted hover:text-primary"}`,title:"Ping at fixed local times",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"schedule"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Schedule"})]}),(0,a.jsxs)("button",{onClick:m,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,a.jsxs)("button",{onClick:x,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,a.jsx)(d.lM,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable connection":Y?"Re-enable routing only; upstream suspension or credential status is unchanged":"Enable connection"})]})]})}M.propTypes={connection:T().shape({id:T().string,name:T().string,email:T().string,displayName:T().string,modelLockUntil:T().string,testStatus:T().string,isActive:T().bool,lastError:T().string,failureClass:T().string,quarantinedAt:T().string,quarantineReason:T().string,priority:T().number,globalPriority:T().number}).isRequired,proxyPools:T().arrayOf(T().shape({id:T().string,name:T().string,proxyUrl:T().string,noProxy:T().string,isActive:T().bool})),isOAuth:T().bool.isRequired,isFirst:T().bool.isRequired,isLast:T().bool.isRequired,onMoveUp:T().func.isRequired,onMoveDown:T().func.isRequired,onToggleActive:T().func.isRequired,onUpdateProxy:T().func,autoPingEnabled:T().bool,onToggleAutoPing:T().func,autoPingScheduled:T().bool,onOpenAutoPingSchedule:T().func,onEdit:T().func.isRequired,onDelete:T().func.isRequired,oneByOneStatus:T().shape({state:T().string,error:T().string})};var _=s(31474);function U(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}let L={anchor:"09:30",timezone:U(),windowHours:5,slotsPerDay:3};function K(e){let t=/^(\d{1,2}):(\d{2})$/.exec(String(e||"").trim());if(!t)return null;let s=Number(t[1]),a=Number(t[2]);return s>23||a>59?null:{hour:s,minute:a}}function F(e){return Math.max(1,Math.floor(24/e))}function J(e,t,s,a){let r="number"==typeof e?e:Number(e);return Number.isFinite(r)?Math.min(a,Math.max(s,r)):t}let B=[{value:"off",label:"Off",icon:"block"},{value:"reset",label:"On reset",icon:"bolt"},{value:"schedule",label:"Schedule",icon:"schedule"}];function H({isOpen:e,onClose:t,onSave:s,connection:n,reactive:i=!1,schedule:l=null}){let[o,c]=(0,r.useState)(()=>({mode:l?.enabled===!0?"schedule":!0===i?"reset":"off",anchor:l?.anchor||L.anchor,timezone:U(),windowHours:String(l?.windowHours??L.windowHours),slotsPerDay:String(l?.slotsPerDay??L.slotsPerDay)})),u=Number(o.windowHours),m=Number(o.slotsPerDay),x=!!K(o.anchor),p=Number.isFinite(u)&&u>=.5&&u<=24,h=p?F(u):24,f=Number.isInteger(m)&&m>=1&&m<=h,b="schedule"!==o.mode||x&&p&&f,g=x&&p&&f?function(e){let t=function(e){if(!e||!0!==e.enabled)return null;let t=K(e.anchor)||K(L.anchor),s=`${String(t.hour).padStart(2,"0")}:${String(t.minute).padStart(2,"0")}`,a=!function(e){if(!e||"string"!=typeof e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}(e.timezone)?L.timezone:e.timezone,r=J(e.windowHours,L.windowHours,.5,24),n=Math.round(J(e.slotsPerDay,L.slotsPerDay,1,F(r)));return{enabled:!0,anchor:s,timezone:a,windowHours:r,slotsPerDay:n}}(e);if(!t)return[];let{hour:s,minute:a}=K(t.anchor),r=60*s+a;return Array.from({length:t.slotsPerDay},(e,s)=>{let a=Math.round(r+s*t.windowHours*60)%1440;return`${String(Math.floor(a/60)).padStart(2,"0")}:${String(a%60).padStart(2,"0")}`})}({enabled:!0,...o,windowHours:u,slotsPerDay:m}):[],y=g.length?(()=>{let{hour:e,minute:t}=K(o.anchor),s=Math.round(60*e+t+m*u*60)%1440;return`${String(Math.floor(s/60)).padStart(2,"0")}:${String(s%60).padStart(2,"0")}`})():"";return(0,a.jsx)(d.aF,{isOpen:e,onClose:t,title:"Auto-ping settings",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{variant:"secondary",onClick:t,children:"Cancel"}),(0,a.jsx)(d.$n,{onClick:()=>{b&&(s({reactive:"reset"===o.mode,schedule:"schedule"===o.mode?{enabled:!0,anchor:o.anchor,timezone:o.timezone,windowHours:u,slotsPerDay:m}:{enabled:!1}}),t())},disabled:!b,children:"Save"})]}),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Warm the 5-hour window",n?.name?` for ${n.name}`:"",". Pick one mode."]}),(0,a.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-lg bg-black/[0.03] p-1 dark:bg-white/[0.03]",children:B.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>c(t=>({...t,mode:e.value})),className:(0,_.cn)("flex h-9 items-center justify-center gap-1.5 rounded-md text-sm font-medium",o.mode===e.value?"bg-surface text-text-main":"text-text-muted"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px]",children:e.icon}),e.label]},e.value))}),"reset"===o.mode&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Pings once after the window resets."}),"schedule"===o.mode&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[(0,a.jsx)(d.pd,{label:"Anchor time",type:"time",value:o.anchor,onChange:e=>c(t=>({...t,anchor:e.target.value})),error:x?"":"Use HH:MM"}),(0,a.jsx)(d.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:o.windowHours,onChange:e=>c(t=>({...t,windowHours:e.target.value})),error:p?"":"0.5 – 24"}),(0,a.jsx)(d.pd,{label:"Pings per day",type:"number",min:"1",max:String(h),step:"1",value:o.slotsPerDay,onChange:e=>c(t=>({...t,slotsPerDay:e.target.value})),error:f?"":`1 – ${h}`})]}),g.length>0&&(0,a.jsxs)("p",{className:"text-sm text-text-main",children:[g.join(" → ")," (",o.timezone,"). Covers until ",y,"."]})]})]})})}H.propTypes={isOpen:T().bool.isRequired,onClose:T().func.isRequired,onSave:T().func.isRequired,connection:T().object,reactive:T().bool,schedule:T().object};var W=s(28915);let G=`name1|sk-key1
2
+ name2|sk-key2
3
+ sk-key-only-auto-named`;function V({isOpen:e,provider:t,providerName:s,isCompatible:n,isAnthropic:i,authType:l,authHint:o,website:u,proxyPools:m,existingNames:x=[],error:p,onSave:h,onBulkDone:f,onClose:b}){let g="__none__",y="ollama-local"===t,v="flow"===t,j="cookie"===l,k="xai"===t&&!j,w="aws-polly"===t,N="bedrock"===t||"bedrock-xai"===t,C=w||N?"Secret Access Key":v?"Daemon token":j?"Cookie Value":"qoder"===t?"Personal Access Token (PAT)":"API Key",S=j?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":k?"xai-...":"qoder"===t?"pt-...":"",$="azure"===t,A="cloudflare-ai"===t,T=c.Q2?.[t]?.regions||null,O=c.Q2?.[t]?.defaultRegion||T?.[0]?.id||"",[P,I]=(0,r.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:g,ollamaHostUrl:"",flowProfile:"",flowBaseUrl:"http://127.0.0.1:8077/mcp",flowI2vReady:!1}),[E,R]=(0,r.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[z,q]=(0,r.useState)({accountId:""}),[D,M]=(0,r.useState)({accessKeyId:"",region:""}),[_,U]=(0,r.useState)({accessKeyId:"",region:"",sessionToken:""}),[L,K]=(0,r.useState)(O),[F,J]=(0,r.useState)(!1),[B,H]=(0,r.useState)(null),[Q,Z]=(0,r.useState)(!1),[X,Y]=(0,r.useState)("single"),[ee,et]=(0,r.useState)(""),[es,ea]=(0,r.useState)(null),er=(0,r.useRef)(!1);(0,r.useEffect)(()=>{e&&!er.current&&(I({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:g,ollamaHostUrl:"",flowProfile:"",flowBaseUrl:"http://127.0.0.1:8077/mcp",flowI2vReady:!1}),R({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),q({accountId:""}),M({accessKeyId:"",region:""}),U({accessKeyId:"",region:"",sessionToken:""}),K(O),H(null),Y("single"),et(""),ea(null)),er.current=e},[e]);let en=()=>{if(y&&P.ollamaHostUrl.trim())return{baseUrl:P.ollamaHostUrl.trim()};if(v)return{profile:P.flowProfile.trim(),baseUrl:P.flowBaseUrl.trim()||"http://127.0.0.1:8077/mcp",i2vReady:P.flowI2vReady};if($)return{azureEndpoint:E.azureEndpoint,apiVersion:E.apiVersion,deployment:E.deployment,organization:E.organization};if(A)return{accountId:z.accountId};if(w){let e={accessKeyId:D.accessKeyId.trim()};return D.region.trim()&&(e.region=D.region.trim()),e}if(N){let e={accessKeyId:_.accessKeyId.trim()};return _.region.trim()&&(e.region=_.region.trim()),_.sessionToken.trim()&&(e.sessionToken=_.sessionToken.trim()),e}if(T&&L)return{region:L}},ei=async()=>{J(!0);try{let e=await (0,W.x6)("/api/providers/validate",{method:"POST",body:{provider:t,apiKey:P.apiKey,providerSpecificData:en()}});H(e.valid?"success":"failed")}catch{H("unknown")}finally{J(!1)}},el=async()=>{if(t&&(y||P.apiKey)&&(!v||P.flowProfile.trim())&&(y||P.name)&&(!n||P.defaultModel.trim())){Z(!0);try{let e=!1;try{J(!0),H(null),e=!!(await (0,W.x6)("/api/providers/validate",{method:"POST",body:{provider:t,apiKey:P.apiKey,providerSpecificData:en()}})).valid,H(e?"success":"failed")}catch{H("unknown")}finally{J(!1)}let s=Number.parseInt(P.priority,10);await h({name:P.name||(y?"Ollama Local":""),apiKey:P.apiKey,defaultModel:n?P.defaultModel.trim():void 0,priority:Number.isFinite(s)?s:1,proxyPoolId:v||P.proxyPoolId===g?null:P.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:en()})}finally{Z(!1)}}},eo=async()=>{let e=function(e,t,s={}){let a=new Set((Array.isArray(t)?t:[]).filter(e=>"string"==typeof e).map(e=>e.toLowerCase())),r=[];for(let t of Array.isArray(e)?e:[]){let e="string"==typeof t?t.trim():"";if(!e)continue;let n=function(e,{isCloudflareAi:t=!1}={}){let s=e.split("|");if(t&&s.length>=3){let e=s[0].trim(),t=s[s.length-1].trim(),a=s.slice(1,-1).join("|").trim();return a&&t?{baseName:e||"Key",apiKey:a,providerSpecificData:{accountId:t}}:null}if(s.length>=2){let e=s[0].trim(),t=s.slice(1).join("|").trim();return t?{baseName:e||"Key",apiKey:t}:null}let a=s[0].trim();return a?{baseName:"Key",apiKey:a}:null}(e,s);if(!n)continue;let i=1,l=`${n.baseName} ${i}`;for(;a.has(l.toLowerCase());)i+=1,l=`${n.baseName} ${i}`;a.add(l.toLowerCase()),r.push({name:l,apiKey:n.apiKey,...n.providerSpecificData?{providerSpecificData:n.providerSpecificData}:{}})}return r}(ee.split("\n").map(e=>e.trim()).filter(Boolean),x,{isCloudflareAi:A});if(!e.length)return;Z(!0),ea(null);let s=0,a=0,r=[],n=[];for(let i of e)try{await (0,W.x6)("/api/providers",{method:"POST",body:{provider:t,apiKey:i.apiKey,name:i.name,priority:1,testStatus:"unknown",...i.providerSpecificData?{providerSpecificData:i.providerSpecificData}:{}}}),s++}catch(e){a++,r.push({line:i.name,message:e?.message||"Request failed"}),n.push(i.providerSpecificData?`${i.name.replace(/ \d+$/,"")}|${i.apiKey}|${i.providerSpecificData.accountId}`:`${i.name.replace(/ \d+$/,"")}|${i.apiKey}`)}Z(!1),ea({success:s,failed:a,failedRows:r}),et(n.join("\n")),s>0&&f&&f()};return t?(0,a.jsx)(d.aF,{isOpen:e,title:v?"Add Google Flow Account":`Add ${s||t} ${C}`,onClose:b,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[!v&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"single"===X?"primary":"ghost",onClick:()=>{Y("single"),ea(null)},children:"Single"}),(0,a.jsx)(d.$n,{size:"sm",variant:"bulk"===X?"primary":"ghost",onClick:()=>{Y("bulk"),ea(null)},children:"Bulk Add"})]}),"bulk"===X&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["One key per line. Format: ",(0,a.jsx)("code",{children:"name|apiKey"})," or just ",(0,a.jsx)("code",{children:"apiKey"}),". A name that is already used gets the next free number, so an earlier key is not replaced.",A?" Cloudflare also accepts name|apiKey|accountId.":""]}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[140px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:G,value:ee,onChange:e=>et(e.target.value)}),es&&(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${es.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",es.success," added",es.failed>0?`, ✗ ${es.failed} failed`:""]}),es.failedRows?.length>0&&(0,a.jsx)("ul",{className:"text-xs text-red-500 flex flex-col gap-0.5",children:es.failedRows.map((e,t)=>(0,a.jsxs)("li",{className:"break-words",children:[(0,a.jsx)("span",{className:"font-mono",children:e.line.length>40?`${e.line.slice(0,40)}…`:e.line}),` — ${e.message}`]},t))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:eo,fullWidth:!0,disabled:Q||!ee.trim(),children:Q?"Adding...":"Add All Keys"}),(0,a.jsx)(d.$n,{onClick:b,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===X&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.pd,{label:v?"Account name":"Name",value:P.name,onChange:e=>I({...P,name:e.target.value}),placeholder:v?"Google account email":y?"Ollama Local":"Production Key"}),v&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20 flex flex-col gap-3",children:[(0,a.jsx)(d.pd,{label:"gflow profile",value:P.flowProfile,onChange:e=>I({...P,flowProfile:e.target.value}),placeholder:"from: gflow auth list",hint:"One connection maps to one Google Flow browser profile.",required:!0}),(0,a.jsx)(d.pd,{label:"Daemon URL",value:P.flowBaseUrl,onChange:e=>I({...P,flowBaseUrl:e.target.value}),placeholder:"http://127.0.0.1:8077/mcp"}),(0,a.jsxs)("label",{className:"flex items-start gap-2 text-sm text-text-main",children:[(0,a.jsx)("input",{type:"checkbox",checked:P.flowI2vReady,onChange:e=>I({...P,flowI2vReady:e.target.checked}),className:"mt-1"}),(0,a.jsxs)("span",{children:["I2V upload consent confirmed ",(0,a.jsx)("span",{className:"block text-xs text-text-muted",children:"Enable only after uploading an image you own once on flow.google.com and accepting Google's rights dialog. Required for 20–60s videos."})]})]})]}),y&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"Ollama Host URL",value:P.ollamaHostUrl,onChange:e=>I({...P,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:ei,disabled:F||Q,variant:"secondary",children:F?"Checking...":"Check"})})]}),!y&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:C,type:j?"text":"password",value:P.apiKey,onChange:e=>I({...P,apiKey:e.target.value}),placeholder:v?"GFLOW_DAEMON_TOKEN":S,hint:v?"Must match the token used by `gflow serve`.":void 0,className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:ei,disabled:!P.apiKey||v&&!P.flowProfile.trim()||F||Q,variant:"secondary",children:F?"Checking...":"Check"})})]}),k&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Use a direct xAI API key from console.x.ai. This is separate from Grok Build OAuth."}),j&&o&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[o,u&&(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsxs)("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",u.replace(/^https?:\/\//,"")]})]})]}),T&&(0,a.jsx)(d.l6,{label:"Region",value:L,onChange:e=>K(e.target.value),options:T.map(e=>({value:e.id,label:e.label}))}),n&&(0,a.jsx)(d.pd,{label:"Default Model",value:P.defaultModel,onChange:e=>I({...P,defaultModel:e.target.value}),placeholder:i?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),y&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,a.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,a.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),B&&(0,a.jsx)(d.Ex,{variant:"success"===B?"success":"failed"===B?"error":"default",children:"success"===B?"Valid":"failed"===B?"Invalid":"Could not validate"}),p&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:p}),n&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default."}),N&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"AWS Bedrock"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(d.pd,{label:"Access Key ID",value:_.accessKeyId,onChange:e=>U({..._,accessKeyId:e.target.value}),placeholder:"AKIA..."}),(0,a.jsx)(d.pd,{label:"Region",value:_.region,onChange:e=>U({..._,region:e.target.value}),placeholder:"us-east-1"}),(0,a.jsx)(d.pd,{label:"Session Token",value:_.sessionToken,onChange:e=>U({..._,sessionToken:e.target.value}),placeholder:"Only for temporary keys"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-2",children:"Leave region empty to use us-east-1. A profile name is not accepted."})]}),w&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"AWS Polly"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(d.pd,{label:"Access Key ID",value:D.accessKeyId,onChange:e=>M({...D,accessKeyId:e.target.value}),placeholder:"AKIA..."}),(0,a.jsx)(d.pd,{label:"Region",value:D.region,onChange:e=>M({...D,region:e.target.value}),placeholder:"us-east-1"})]}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-2",children:"Leave region empty to use us-east-1. The voice id is chosen on the TTS page."})]}),A&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,a.jsx)(d.pd,{label:"Account ID",value:z.accountId,onChange:e=>q({...z,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,a.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),$&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(d.pd,{label:"Azure Endpoint",value:E.azureEndpoint,onChange:e=>R({...E,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,a.jsx)(d.pd,{label:"Deployment Name",value:E.deployment,onChange:e=>R({...E,deployment:e.target.value}),placeholder:"gpt-4"}),(0,a.jsx)(d.pd,{label:"API Version",value:E.apiVersion,onChange:e=>R({...E,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,a.jsx)(d.pd,{label:"Organization",value:E.organization,onChange:e=>R({...E,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,a.jsx)(d.pd,{label:"Priority",type:"number",value:P.priority,onChange:e=>I({...P,priority:e.target.value}),onBlur:e=>{let t=Number.parseInt(e.target.value,10);I(e=>({...e,priority:Number.isFinite(t)?t:1}))}}),!v&&(0,a.jsx)(d.l6,{label:"Proxy Pool",value:P.proxyPoolId,onChange:e=>I({...P,proxyPoolId:e.target.value}),options:[{value:g,label:"None"},...(m||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),!v&&0===(m||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),!v&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:el,fullWidth:!0,disabled:Q||!y&&(!P.name||!P.apiKey)||v&&!P.flowProfile.trim()||n&&!P.defaultModel.trim()||$&&(!E.azureEndpoint||!E.deployment||!E.organization)||A&&!z.accountId||w&&!D.accessKeyId.trim()||N&&!_.accessKeyId.trim(),children:Q?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:b,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function Q({isOpen:e,node:t,onSave:s,onClose:n,isAnthropic:i}){let[l,o]=(0,r.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,u]=(0,r.useState)(!1),[m,x]=(0,r.useState)(""),[p,h]=(0,r.useState)(""),[f,b]=(0,r.useState)(!1),[g,y]=(0,r.useState)(null);(0,r.useEffect)(()=>{t&&(o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(i?"https://api.anthropic.com/v1":"https://api.openai.com/v1")}),x(""),h(""),y(null))},[t,i]);let v=async()=>{if(l.name.trim()&&l.prefix.trim()&&l.baseUrl.trim()){u(!0);try{let e={name:l.name,prefix:l.prefix,baseUrl:l.baseUrl};i||(e.apiType=l.apiType),await s(e)}finally{u(!1)}}},j=async()=>{b(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:l.baseUrl,apiKey:m,type:i?"anthropic-compatible":"openai-compatible",modelId:p.trim()||void 0})}),t=await e.json();y(t.valid?"success":"failed")}catch{y("failed")}finally{b(!1)}};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Edit ${i?"Anthropic":"OpenAI"} Compatible`,onClose:n,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(d.pd,{label:"Name",value:l.name,onChange:e=>o({...l,name:e.target.value}),placeholder:`${i?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,a.jsx)(d.pd,{label:"Prefix",value:l.prefix,onChange:e=>o({...l,prefix:e.target.value}),placeholder:i?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!i&&(0,a.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:l.apiType,onChange:e=>o({...l,apiType:e.target.value})}),(0,a.jsx)(d.pd,{label:"Base URL",value:l.baseUrl,onChange:e=>o({...l,baseUrl:e.target.value}),placeholder:i?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${i?"Anthropic":"OpenAI"}-compatible API.`}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>x(e.target.value),className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:j,disabled:!m||f||!l.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,a.jsx)(d.pd,{label:"Model ID (optional)",value:p,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),g&&(0,a.jsx)(d.Ex,{variant:"success"===g?"success":"error",children:"success"===g?"Valid":"Invalid"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:v,fullWidth:!0,disabled:!l.name.trim()||!l.prefix.trim()||!l.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:n,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function Z({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:n,onClose:i}){let[l,o]=(0,r.useState)(""),[c,u]=(0,r.useState)(null),[m,x]=(0,r.useState)(""),[p,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{e&&(o(""),u(null),x(""))},[e]);let f=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},b=async()=>{let e=f(l.trim());if(e){u("testing"),x("");try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${e}`})}),a=await s.json();u(a.ok?"ok":"error"),x(a.error||"")}catch(e){u("error"),x(e.message)}}},g=async()=>{let e=f(l.trim());if(e&&!p){h(!0);try{await n(e)}finally{h(!1)}}};return(0,a.jsx)(d.aF,{isOpen:e,onClose:i,title:"Add Custom Model",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:l,onChange:e=>{o(e.target.value),u(null),x("")},onKeyDown:e=>{"Enter"===e.key&&b()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,a.jsx)(d.$n,{variant:"secondary",icon:"science",loading:"testing"===c,onClick:b,disabled:!l.trim()||"testing"===c,children:"testing"===c?"Testing...":"Test"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,a.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:f(l.trim())||"model-id"})]})]}),"ok"===c&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===c&&(0,a.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,a.jsx)("span",{children:m||"Model not reachable"})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(d.$n,{onClick:i,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(d.$n,{onClick:g,fullWidth:!0,size:"sm",disabled:!l.trim()||p,children:p?"Adding...":"Add Model"})]})]})})}V.propTypes={isOpen:T().bool.isRequired,provider:T().string,providerName:T().string,isCompatible:T().bool,isAnthropic:T().bool,authType:T().string,authHint:T().string,website:T().string,proxyPools:T().arrayOf(T().shape({id:T().string,name:T().string})),error:T().string,onSave:T().func.isRequired,onBulkDone:T().func,existingNames:T().arrayOf(T().string),onClose:T().func.isRequired},Q.propTypes={isOpen:T().bool.isRequired,node:T().shape({id:T().string,name:T().string,prefix:T().string,apiType:T().string,baseUrl:T().string}),onSave:T().func.isRequired,onClose:T().func.isRequired,isAnthropic:T().bool},Z.propTypes={isOpen:T().bool.isRequired,providerAlias:T().string.isRequired,providerDisplayAlias:T().string.isRequired,onSave:T().func.isRequired,onClose:T().func.isRequired};let X="/api/providers/codebuddy/discover-models",Y={verified:"Verified",recognized:"Recognized",unavailable:"Unavailable",credential_rejected:"Credential rejected",error:"Inconclusive",skipped:"Skipped"},ee={verified:"border-green-500/30 bg-green-500/[0.08] text-green-700 dark:text-green-300",recognized:"border-sky-500/30 bg-sky-500/[0.08] text-sky-700 dark:text-sky-300",unavailable:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]",credential_rejected:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",error:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",skipped:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]"};function et(e,t){return e?.error||t}function es({isOpen:e,connections:t,onModelsAdded:s,onClose:n}){let i=(0,r.useMemo)(()=>t.filter(e=>"codebuddy"===e.provider&&!1!==e.isActive),[t]),[l,o]=(0,r.useState)(null),[c,u]=(0,r.useState)(!1),[m,x]=(0,r.useState)(""),[p,h]=(0,r.useState)(""),[f,b]=(0,r.useState)(()=>new Set),[g,y]=(0,r.useState)(""),[v,j]=(0,r.useState)(!1),[k,w]=(0,r.useState)(!1),[N,C]=(0,r.useState)([]),[S,$]=(0,r.useState)(()=>new Set),A=(0,r.useCallback)(async()=>{u(!0),x(""),h(""),j(!1),C([]);try{let e=await fetch(X,{cache:"no-store"}),t=await e.json();if(!e.ok)throw Error(et(t,"Could not refresh model candidates"));o(t),b(new Set((t.hidden||[]).map(e=>e.id)))}catch(e){x(e.message)}finally{u(!1)}},[]);(0,r.useEffect)(()=>{e&&(y(e=>i.some(t=>t.id===e)?e:i[0]?.id||""),A())},[i,e,A]);let T=async()=>{if(g&&0!==f.size&&!k){w(!0),x(""),h("");try{let e=await fetch(X,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:g,models:[...f]})}),t=await e.json();if(!e.ok)throw Error(et(t,"Hidden model scan failed"));C(t.results||[]),j(!1)}catch(e){x(e.message)}finally{w(!1)}}},O=(0,r.useMemo)(()=>new Map(N.map(e=>[e.id,e])),[N]),P=(0,r.useMemo)(()=>(l?.hidden||[]).filter(e=>{let t=O.get(e.id)?.status;return e.previouslyVerified||"verified"===t||"recognized"===t}),[l,O]),I=async e=>{let t=e.filter(e=>!S.has(e.id));if(!t.length)return;$(e=>new Set([...e,...t.map(e=>e.id)])),x(""),h("");let a=[];try{for(let e of t){let t=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:"cb",id:e.id,type:"llm",name:e.name})}),s=await t.json();if(!t.ok)throw Error(et(s,`Could not add ${e.id}`));a.push(e)}window.dispatchEvent(new Event("customModelChanged")),await s?.(a),h(`${a.length} model${1===a.length?"":"s"} added to CodeBuddy Global.`)}catch(e){a.length&&(window.dispatchEvent(new Event("customModelChanged")),await s?.(a)),x(e.message)}finally{$(e=>{let s=new Set(e);return t.forEach(e=>s.delete(e.id)),s})}},E=P.filter(e=>f.has(e.id));return(0,a.jsx)(d.aF,{isOpen:e,onClose:n,title:"Discover CodeBuddy Global Models",size:"full",children:(0,a.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,a.jsx)("div",{className:"overflow-hidden rounded-xl border border-cyan-500/20 bg-gradient-to-br from-cyan-500/[0.10] via-transparent to-amber-500/[0.08] p-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Live package candidates"}),(0,a.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:"Refreshing reads Tencent's current CLI manifests and does not call a model or use credits."}),l?.version&&(0,a.jsxs)("p",{className:"mt-2 font-mono text-xs text-cyan-700 dark:text-cyan-300",children:["codebuddy-code@",l.version]})]}),(0,a.jsx)(d.$n,{variant:"secondary",size:"sm",icon:"refresh",loading:c,onClick:A,children:"Refresh Candidates"})]})}),m&&(0,a.jsx)("p",{role:"alert",className:"rounded-lg border border-red-500/25 bg-red-500/[0.08] px-3 py-2 text-sm text-red-600 dark:text-red-300",children:m}),p&&(0,a.jsx)("p",{className:"rounded-lg border border-green-500/25 bg-green-500/[0.08] px-3 py-2 text-sm text-green-700 dark:text-green-300",children:p}),l?.warnings?.map(e=>(0,a.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-300",children:e},e)),l&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:l.official?.length||0}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Official Global"})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:l.hidden?.length||0}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Hidden candidates"})]}),(0,a.jsxs)("div",{className:"col-span-2 rounded-lg border border-border bg-surface-2 px-3 py-2 sm:col-span-1",children:[(0,a.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:l.hidden?.filter(e=>e.previouslyVerified).length||0}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Previously verified"})]})]}),(0,a.jsxs)("section",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Hidden route candidates"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"From alternate official manifests; availability is not guaranteed on Global SaaS."})]}),(0,a.jsx)("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:()=>b(f.size===(l.hidden?.length||0)?new Set:new Set(l.hidden.map(e=>e.id))),children:f.size===(l.hidden?.length||0)?"Clear":"Select all"})]}),(0,a.jsx)("div",{className:"max-h-64 overflow-y-auto rounded-xl border border-border custom-scrollbar",children:(l.hidden||[]).map(e=>{let t=O.get(e.id);return(0,a.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 border-b border-border-subtle px-3 py-2.5 last:border-b-0 hover:bg-surface-2",children:[(0,a.jsx)("input",{type:"checkbox",checked:f.has(e.id),onChange:()=>{var t;return t=e.id,void b(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:"mt-1 accent-primary"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"block truncate text-sm font-medium text-text-main",children:e.name}),(0,a.jsx)("span",{className:"block truncate font-mono text-[11px] text-text-muted",children:e.id}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:e.sources.length?e.sources.join(" + "):"request history"})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[e.previouslyVerified&&(0,a.jsx)("span",{className:"rounded-full bg-green-500/10 px-2 py-0.5 text-[10px] font-medium text-green-700 dark:text-green-300",children:"previous success"}),t&&(0,a.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${ee[t.status]||ee.error}`,children:Y[t.status]||t.status}),(e.previouslyVerified||["verified","recognized"].includes(t?.status))&&(0,a.jsx)("button",{type:"button",onClick:t=>{t.preventDefault(),I([e])},className:"text-xs font-semibold text-primary hover:underline",disabled:S.has(e.id),children:S.has(e.id)?"Adding...":"Add"})]})]},e.id)})})]}),(0,a.jsxs)("section",{className:"rounded-xl border border-amber-500/25 bg-amber-500/[0.07] p-4",children:[(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_auto] sm:items-end",children:[(0,a.jsx)(d.l6,{label:"CodeBuddy Global connection",value:g,onChange:e=>y(e.target.value),options:i.map(e=>({value:e.id,label:e.name||e.email||e.id})),placeholder:"No active Global connection",disabled:!i.length||k,hint:"Every probe is pinned to this connection."}),(0,a.jsxs)(d.$n,{size:"sm",icon:"radar",onClick:()=>j(!0),disabled:!g||0===f.size||k,children:["Scan Hidden Models (",f.size,")"]})]}),!i.length&&(0,a.jsx)("p",{className:"mt-2 text-xs text-red-500",children:"Add and activate a CodeBuddy Global connection before scanning."}),v&&(0,a.jsxs)("div",{className:"mt-4 rounded-lg border border-amber-500/40 bg-surface px-3 py-3",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Confirm credit-using scan"}),(0,a.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:"These are real completion probes and may consume CodeBuddy credits. Scanning uses at most 3 concurrent requests and stops scheduling if the selected credential is rejected."}),(0,a.jsxs)("div",{className:"mt-3 flex justify-end gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:()=>j(!1),disabled:k,children:"Cancel"}),(0,a.jsx)(d.$n,{size:"sm",icon:"science",loading:k,onClick:T,children:"Start Credit Scan"})]})]})]}),N.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[N.filter(e=>"verified"===e.status).length," verified, ",N.filter(e=>"recognized"===e.status).length," recognized, ",N.filter(e=>"unavailable"===e.status).length," unavailable"]}),(0,a.jsxs)(d.$n,{size:"sm",icon:"playlist_add",onClick:()=>I(E),disabled:!E.length||S.size>0,children:["Add Selected Available (",E.length,")"]})]})]})]})})}es.propTypes={isOpen:T().bool.isRequired,connections:T().arrayOf(T().object).isRequired,onModelsAdded:T().func,onClose:T().func.isRequired};let ea="/api/providers/opencode/discover-models",er={verified:"Works",quota_exhausted:"Free quota used up",skipped:"Not tested",overloaded:"Overloaded",unavailable:"Unavailable",deprecated:"Deprecated",unsupported:"Protocol unsupported",error:"Error"},en={verified:"border-green-500/30 bg-green-500/[0.08] text-green-700 dark:text-green-300",quota_exhausted:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",skipped:"border-zinc-500/30 bg-zinc-500/[0.08] text-zinc-600 dark:text-zinc-400",overloaded:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",unavailable:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",deprecated:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",unsupported:"border-purple-500/30 bg-purple-500/[0.08] text-purple-700 dark:text-purple-300",error:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300"},ei=new Set(["unavailable","deprecated","unsupported"]);function el({isOpen:e,onModelsAdded:t,onClose:s}){let[n,i]=(0,r.useState)([]),[l,o]=(0,r.useState)(!1),[c,u]=(0,r.useState)(""),[m,x]=(0,r.useState)(""),[p,h]=(0,r.useState)(()=>new Set),[f,b]=(0,r.useState)(!1),[g,y]=(0,r.useState)([]),[v,j]=(0,r.useState)(()=>new Set),[k,w]=(0,r.useState)(()=>new Set),N=(0,r.useCallback)(async()=>{o(!0),u(""),x(""),y([]);try{let e=await fetch(ea,{cache:"no-store"}),t=await e.json();if(!e.ok)throw Error(t?.error||"Could not fetch OpenCode models");let s=t.candidates||[];i(s),h(new Set(s.filter(e=>!1!==e.inCatalog).map(e=>e.id))),w(new Set(s.filter(e=>e.isConfigured).map(e=>e.id))),!1===t.catalogAvailable&&x("OpenCode's model catalog could not be fetched; showing configured models only.")}catch(e){u(e.message)}finally{o(!1)}},[]);(0,r.useEffect)(()=>{e&&N()},[e,N]);let C=async()=>{if(0!==p.size&&!f){b(!0),u(""),x("");try{let e=await fetch(ea,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({models:[...p]})}),t=await e.json();if(!e.ok)throw Error(t?.error||"Live probe failed");let s=t.results||[];y(s);let a=s.find(e=>"quota_exhausted"===e.status);a&&u(`OpenCode's free quota for this IP is used up (${a.id}). The remaining models were not tested; this says nothing about whether they work. Try again later.`)}catch(e){u(e.message)}finally{b(!1)}}},S=(0,r.useMemo)(()=>new Map(g.map(e=>[e.id,e])),[g]),$=async e=>{let s=e.filter(e=>!v.has(e.id)&&!k.has(e.id));if(!s.length)return;j(e=>new Set([...e,...s.map(e=>e.id)])),u(""),x("");let a=[];try{for(let e of s){let t=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:"oc",id:e.id,type:"llm",name:e.name||e.id})}),s=await t.json();if(!t.ok)throw Error(s?.error||`Could not add ${e.id}`);a.push(e)}window.dispatchEvent(new Event("customModelChanged")),w(e=>new Set([...e,...a.map(e=>e.id)])),await t?.(a),x(`${a.length} model${1===a.length?"":"s"} added to OpenCode Free!`)}catch(e){a.length&&(window.dispatchEvent(new Event("customModelChanged")),w(e=>new Set([...e,...a.map(e=>e.id)])),await t?.(a)),u(e.message)}finally{j(e=>{let t=new Set(e);return s.forEach(e=>t.delete(e.id)),t})}},A=(0,r.useMemo)(()=>n.filter(e=>{let t=S.get(e.id);return t?.ok&&!k.has(e.id)}),[n,S,k]);return(0,a.jsx)(d.aF,{isOpen:e,onClose:s,title:"Live Probe OpenCode Free Models",size:"full",children:(0,a.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,a.jsx)("div",{className:"overflow-hidden rounded-xl border border-orange-500/20 bg-gradient-to-br from-orange-500/[0.10] via-transparent to-amber-500/[0.08] p-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Upstream Catalog Live Probe"}),(0,a.jsxs)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:["Pulls candidates directly from ",(0,a.jsx)("span",{className:"font-mono",children:"opencode.ai/zen/v1/models"})," and tests real-time completions to verify which free models are alive."]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(d.$n,{variant:"secondary",size:"sm",icon:"refresh",loading:l,onClick:N,children:"Refresh Catalog"}),(0,a.jsx)(d.$n,{size:"sm",icon:"radar",loading:f,disabled:0===p.size||f,onClick:C,className:"bg-orange-600 hover:bg-orange-700 text-white",children:f?"Probing Upstream...":`Live Probe (${p.size})`})]})]})}),c&&(0,a.jsx)("p",{role:"alert",className:"rounded-lg border border-red-500/25 bg-red-500/[0.08] px-3 py-2 text-sm text-red-600 dark:text-red-300",children:c}),m&&(0,a.jsx)("p",{className:"rounded-lg border border-green-500/25 bg-green-500/[0.08] px-3 py-2 text-sm text-green-700 dark:text-green-300",children:m}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Total Candidates: ",(0,a.jsx)("strong",{className:"text-text-main",children:n.length})]}),g.length>0&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["• Works: ",(0,a.jsx)("strong",{className:"text-green-600",children:g.filter(e=>e.ok).length})," ","• Dead: ",(0,a.jsx)("strong",{className:"text-red-600",children:g.filter(e=>ei.has(e.status)).length})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[A.length>0&&(0,a.jsxs)("button",{type:"button",onClick:()=>$(A),disabled:v.size>0,className:"text-xs font-semibold text-primary hover:underline",children:["+ Add All Verified (",A.length,")"]}),(0,a.jsx)("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:()=>h(p.size===n.length?new Set:new Set(n.map(e=>e.id))),children:p.size===n.length?"Deselect All":"Select All"})]})]}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto rounded-xl border border-border custom-scrollbar",children:n.map(e=>{let t=S.get(e.id),s=k.has(e.id),r=v.has(e.id);return(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 border-b border-border-subtle px-3 py-2.5 last:border-b-0 hover:bg-surface-2",children:[(0,a.jsxs)("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-3",children:[(0,a.jsx)("input",{type:"checkbox",checked:p.has(e.id),onChange:()=>{var t;return t=e.id,void h(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:"accent-orange-500"}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-text-main truncate",children:e.name}),s&&(0,a.jsx)("span",{className:"rounded-full bg-blue-500/10 px-2 py-0.5 text-[10px] font-medium text-blue-600 dark:text-blue-400",children:"Active in Router"}),!1===e.inCatalog&&(0,a.jsx)("span",{className:"rounded-full bg-red-500/10 px-2 py-0.5 text-[10px] font-medium text-red-600 dark:text-red-400",title:"Not listed in opencode.ai/zen/v1/models anymore",children:"Retired upstream"})]}),(0,a.jsxs)("span",{className:"block font-mono text-[11px] text-text-muted truncate",children:["oc/",e.id]})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-3",children:[t?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`rounded-full border px-2.5 py-0.5 text-[11px] font-medium ${en[t.status]||en.error}`,title:t.error||t.message,children:er[t.status]||t.status}),t.latencyMs>0&&(0,a.jsxs)("span",{className:"text-[11px] text-text-muted font-mono",children:[t.latencyMs,"ms"]})]}):(0,a.jsx)("span",{className:"text-[11px] text-text-muted italic",children:"Ready to probe"}),!s&&!1!==e.inCatalog&&!ei.has(t?.status)&&(0,a.jsx)("button",{type:"button",onClick:()=>$([e]),disabled:r,className:"text-xs font-semibold text-primary hover:underline disabled:opacity-50",children:r?"Adding...":"+ Add"})]})]},e.id)})}),(0,a.jsx)("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:(0,a.jsx)(d.$n,{variant:"secondary",size:"sm",onClick:s,children:"Close"})})]})})}el.propTypes={isOpen:T().bool.isRequired,onModelsAdded:T().func,onClose:T().func.isRequired};let eo="/api/providers/kiro/discover-models",ed={verified:"Verified",recognized:"Recognized (quota)",unavailable:"Unavailable",credential_rejected:"Credential rejected",error:"Inconclusive",skipped:"Skipped"},ec={verified:"border-green-500/30 bg-green-500/[0.08] text-green-700 dark:text-green-300",recognized:"border-sky-500/30 bg-sky-500/[0.08] text-sky-700 dark:text-sky-300",unavailable:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]",credential_rejected:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",error:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",skipped:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]"},eu={live:"live catalog",saved:"saved on account",alias:"your alias"};function em(e){return e?e>=1e6?`${e/1e6}M`:`${Math.round(e/1e3)}K`:null}function ex({isOpen:e,connections:t,onClose:s}){let n=(0,r.useMemo)(()=>t.filter(e=>"kiro"===e.provider&&!1!==e.isActive&&!e.quarantinedAt),[t]),[i,l]=(0,r.useState)(""),[o,c]=(0,r.useState)(null),[u,m]=(0,r.useState)(!1),[x,p]=(0,r.useState)(""),[h,f]=(0,r.useState)(()=>new Set),[b,g]=(0,r.useState)(!1),[y,v]=(0,r.useState)(!1),[j,k]=(0,r.useState)([]),[w,N]=(0,r.useState)(!1),[C,S]=(0,r.useState)(""),$=(0,r.useCallback)(async e=>{if(e){m(!0),p(""),S(""),g(!1),k([]);try{let t=await fetch(`${eo}?connectionId=${encodeURIComponent(e)}`,{cache:"no-store"}),s=await t.json();if(!t.ok)throw Error(s?.error||"Could not refresh Kiro candidates");c(s),f(new Set((s.candidates||[]).filter(e=>!e.inLive).map(e=>e.id)))}catch(e){c(null),p(e.message)}finally{m(!1)}}},[]);(0,r.useEffect)(()=>{!e||n.some(e=>e.id===i)||l(n[0]?.id||"")},[n,i,e]),(0,r.useEffect)(()=>{e&&i&&$(i)},[i,e,$]);let A=async()=>{if(i&&0!==h.size&&!y){v(!0),p("");try{let e=await fetch(eo,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:i,models:[...h]})}),t=await e.json();if(!e.ok)throw Error(t?.error||"Kiro model probe failed");k(t.results||[]),g(!1)}catch(e){p(e.message)}finally{v(!1)}}},T=(0,r.useMemo)(()=>new Map(j.map(e=>[e.id,e])),[j]),O=o?.candidates||[],P=O.filter(e=>e.inLive).length,I=O.length-P,E=j.filter(e=>"verified"===e.status).map(e=>e.id),R=!!o&&!o.hasProfile&&E.length>0,z=async()=>{if(R&&!w){N(!0),p(""),S("");try{let e=await fetch(eo,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:i,models:E})}),t=await e.json();if(!e.ok)throw Error(t?.error||"Saving verified models failed");S(`${t.saved.length} verified model${1===t.saved.length?"":"s"} saved to this connection.`)}catch(e){p(e.message)}finally{N(!1)}}};return(0,a.jsx)(d.aF,{isOpen:e,onClose:s,title:"Live Probe Kiro Models",size:"full",children:(0,a.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,a.jsxs)("div",{className:"overflow-hidden rounded-xl border border-violet-500/20 bg-gradient-to-br from-violet-500/[0.10] via-transparent to-amber-500/[0.08] p-4",children:[(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_auto] sm:items-end",children:[(0,a.jsx)(d.l6,{label:"Kiro connection",value:i,onChange:e=>l(e.target.value),options:n.map(e=>({value:e.id,label:e.name||e.email||e.id})),placeholder:"No active Kiro connection",disabled:!n.length||y,hint:"The catalog and every probe are pinned to this connection."}),(0,a.jsx)(d.$n,{variant:"secondary",size:"sm",icon:"refresh",loading:u,disabled:!i||y,onClick:()=>$(i),children:"Refresh Catalog"})]}),(0,a.jsx)("p",{className:"mt-3 text-xs leading-relaxed text-text-muted",children:"Refreshing calls Kiro's ListAvailableModels for this account and does not use credits."}),!n.length&&(0,a.jsx)("p",{className:"mt-2 text-xs text-red-500",children:"Add and activate a Kiro connection first."})]}),x&&(0,a.jsx)("p",{role:"alert",className:"rounded-lg border border-red-500/25 bg-red-500/[0.08] px-3 py-2 text-sm text-red-600 dark:text-red-300",children:x}),C&&(0,a.jsx)("p",{className:"rounded-lg border border-green-500/25 bg-green-500/[0.08] px-3 py-2 text-sm text-green-700 dark:text-green-300",children:C}),o?.warnings?.map(e=>(0,a.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-300",children:e},e)),o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:P}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"In live catalog"})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsx)("p",{className:"text-2xl font-semibold text-text-main",children:I}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Saved / alias only"})]}),(0,a.jsxs)("div",{className:"col-span-2 rounded-lg border border-border bg-surface-2 px-3 py-2 sm:col-span-1",children:[(0,a.jsx)("p",{className:`text-sm font-semibold ${o.liveCatalog?"text-green-700 dark:text-green-300":"text-amber-700 dark:text-amber-300"}`,children:o.liveCatalog?"Live catalog readable":"Live catalog unavailable"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:o.hasProfile?"Account has a CodeWhisperer profile":"No profile (API-key login)"})]})]}),(0,a.jsxs)("section",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Base models"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"-thinking and -agentic variants share their base model and are not probed separately."})]}),(0,a.jsx)("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:()=>f(h.size===O.length?new Set:new Set(O.map(e=>e.id))),children:h.size===O.length?"Clear":"Select all"})]}),(0,a.jsx)("div",{className:"max-h-80 overflow-y-auto rounded-xl border border-border custom-scrollbar",children:O.map(e=>{let t=T.get(e.id),s=[em(e.contextLength),em(e.maxOutputTokens)].filter(Boolean).join(" / ");return(0,a.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 border-b border-border-subtle px-3 py-2.5 last:border-b-0 hover:bg-surface-2",children:[(0,a.jsx)("input",{type:"checkbox",checked:h.has(e.id),onChange:()=>{var t;return t=e.id,void f(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:"mt-1 accent-primary"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"block truncate text-sm font-medium text-text-main",children:e.name}),(0,a.jsxs)("span",{className:"block truncate font-mono text-[11px] text-text-muted",children:["kr/",e.id]}),(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:[e.sources.map(e=>eu[e]||e).join(" + "),s&&` \xb7 ${s}`,e.rateMultiplier&&1!==e.rateMultiplier&&` \xb7 ${e.rateMultiplier}x credit`]})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[e.inLive&&(0,a.jsx)("span",{className:"rounded-full bg-green-500/10 px-2 py-0.5 text-[10px] font-medium text-green-700 dark:text-green-300",children:"live"}),t&&(0,a.jsxs)("span",{title:t.error||"",className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${ec[t.status]||ec.error}`,children:[ed[t.status]||t.status,"verified"===t.status&&Number.isFinite(t.latencyMs)&&` \xb7 ${t.latencyMs}ms`]})]})]},e.id)})})]}),(0,a.jsxs)("section",{className:"rounded-xl border border-amber-500/25 bg-amber-500/[0.07] p-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:j.length>0?`${j.filter(e=>"verified"===e.status).length} verified, ${j.filter(e=>"unavailable"===e.status).length} unavailable, ${j.filter(e=>!["verified","unavailable"].includes(e.status)).length} other`:"Probe sends one real completion per selected model."}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[R&&(0,a.jsxs)(d.$n,{size:"sm",variant:"secondary",icon:"save",loading:w,onClick:z,children:["Save Verified to Connection (",E.length,")"]}),(0,a.jsxs)(d.$n,{size:"sm",icon:"radar",onClick:()=>g(!0),disabled:!i||0===h.size||y,children:["Probe Selected (",h.size,")"]})]})]}),b&&(0,a.jsxs)("div",{className:"mt-4 rounded-lg border border-amber-500/40 bg-surface px-3 py-3",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Confirm credit-using probe"}),(0,a.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:"These are real completion requests and may consume Kiro credits. Probing uses at most 3 concurrent requests and stops scheduling if the selected credential is rejected."}),(0,a.jsxs)("div",{className:"mt-3 flex justify-end gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:()=>g(!1),disabled:y,children:"Cancel"}),(0,a.jsx)(d.$n,{size:"sm",icon:"science",loading:y,onClick:A,children:"Start Probe"})]})]})]})]})]})})}ex.propTypes={isOpen:T().bool.isRequired,connections:T().arrayOf(T().object).isRequired,onClose:T().func.isRequired};let ep="/api/providers/cloudflare-ai/discover-models",eh={verified:"Works",paid_only:"Paid plan only",no_access:"No access",unavailable:"Unavailable",deprecated:"Deprecated",unsupported:"Not a chat model",agreement_required:"License agreement needed",input_rejected:"Input rejected",quota_exhausted:"Daily quota used up",credential_rejected:"Token rejected",rate_limited:"Rate limited",skipped:"Not tested",error:"Inconclusive"},ef={verified:"border-green-500/30 bg-green-500/[0.08] text-green-700 dark:text-green-300",paid_only:"border-sky-500/30 bg-sky-500/[0.08] text-sky-700 dark:text-sky-300",no_access:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",unavailable:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",input_rejected:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",deprecated:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",unsupported:"border-purple-500/30 bg-purple-500/[0.08] text-purple-700 dark:text-purple-300",agreement_required:"border-sky-500/30 bg-sky-500/[0.08] text-sky-700 dark:text-sky-300",quota_exhausted:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",credential_rejected:"border-red-500/30 bg-red-500/[0.08] text-red-700 dark:text-red-300",rate_limited:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300",skipped:"border-black/10 bg-black/[0.03] text-text-muted dark:border-white/10 dark:bg-white/[0.04]",error:"border-amber-500/30 bg-amber-500/[0.08] text-amber-700 dark:text-amber-300"},eb=new Set(["unavailable","no_access","deprecated","unsupported"]),eg=[{kind:"llm",title:"Chat models",hint:"Probed with one short chat completion."},{kind:"image",title:"Image models",hint:"Probed with one small generation. Image probes use far more neurons than chat."}];function ey({isOpen:e,connections:t,onModelsAdded:s,onClose:n}){let i=(0,r.useMemo)(()=>t.filter(e=>"cloudflare-ai"===e.provider&&!1!==e.isActive&&!e.quarantinedAt),[t]),[l,o]=(0,r.useState)(""),[c,u]=(0,r.useState)(null),[m,x]=(0,r.useState)(!1),[p,h]=(0,r.useState)(""),[f,b]=(0,r.useState)(""),[g,y]=(0,r.useState)(()=>new Set),[v,j]=(0,r.useState)(!1),[k,w]=(0,r.useState)(!1),[N,C]=(0,r.useState)([]),[S,$]=(0,r.useState)(()=>new Set),[A,T]=(0,r.useState)(()=>new Set),O=(0,r.useCallback)(async e=>{if(e){x(!0),h(""),b(""),j(!1),C([]);try{let t=await fetch(`${ep}?connectionId=${encodeURIComponent(e)}`,{cache:"no-store"}),s=await t.json();if(!t.ok)throw Error(s?.error||"Could not read the Cloudflare model catalog");u(s),y(new Set((s.candidates||[]).filter(e=>!e.paidOnly).map(e=>e.id))),T(new Set((s.candidates||[]).filter(e=>e.builtIn||e.aliased).map(e=>e.id))),s.catalogAvailable||b("Cloudflare's model catalog could not be read; showing built-in and saved models only.")}catch(e){u(null),h(e.message)}finally{x(!1)}}},[]);(0,r.useEffect)(()=>{!e||i.some(e=>e.id===l)||o(i[0]?.id||"")},[i,l,e]),(0,r.useEffect)(()=>{e&&l&&O(l)},[l,e,O]);let P=(0,r.useMemo)(()=>c?.candidates||[],[c]),I=(0,r.useMemo)(()=>new Map(N.map(e=>[e.id,e])),[N]),E=P.filter(e=>"image"===e.kind&&g.has(e.id)).length,R=async()=>{if(l&&0!==g.size&&!k){w(!0),h(""),b("");try{let e=P.filter(e=>g.has(e.id)).map(e=>({id:e.id,kind:e.kind})),t=await fetch(ep,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:l,models:e})}),s=await t.json();if(!t.ok)throw Error(s?.error||"Cloudflare model probe failed");let a=s.results||[];C(a),j(!1);let r=a.find(e=>"quota_exhausted"===e.status||"credential_rejected"===e.status);r&&h("quota_exhausted"===r.status?`This account's daily Workers AI allocation is used up (${r.id}). The remaining models were not tested; try again after the daily reset or pick another connection.`:`Cloudflare rejected this connection's API token (${r.id}). The remaining models were not tested.`)}catch(e){h(e.message)}finally{w(!1)}}},z=async e=>{let t=e.filter(e=>!A.has(e.id)&&!S.has(e.id));if(t.length){$(e=>new Set([...e,...t.map(e=>e.id)])),h(""),b("");try{await s?.(t),T(e=>new Set([...e,...t.map(e=>e.id)])),b(`${t.length} model${1===t.length?"":"s"} added to the router.`)}catch(e){h(e.message)}finally{$(e=>{let s=new Set(e);return t.forEach(e=>s.delete(e.id)),s})}}},q=P.filter(e=>"llm"===e.kind&&I.get(e.id)?.status==="verified"&&!A.has(e.id)),D={works:N.filter(e=>"verified"===e.status).length,dead:N.filter(e=>eb.has(e.status)).length,paid:N.filter(e=>"paid_only"===e.status).length,other:N.filter(e=>!["verified","paid_only"].includes(e.status)&&!eb.has(e.status)).length};return(0,a.jsx)(d.aF,{isOpen:e,onClose:n,title:"Live Probe Cloudflare Workers AI Models",size:"full",children:(0,a.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,a.jsxs)("div",{className:"overflow-hidden rounded-xl border border-orange-500/20 bg-gradient-to-br from-orange-500/[0.10] via-transparent to-amber-500/[0.08] p-4",children:[(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_auto] sm:items-end",children:[(0,a.jsx)(d.l6,{label:"Cloudflare connection",value:l,onChange:e=>o(e.target.value),options:i.map(e=>({value:e.id,label:e.name||e.email||e.id})),placeholder:"No active Cloudflare connection",disabled:!i.length||k,hint:"The catalog and every probe use this account."}),(0,a.jsx)(d.$n,{variant:"secondary",size:"sm",icon:"refresh",loading:m,disabled:!l||k,onClick:()=>O(l),children:"Refresh Catalog"})]}),(0,a.jsx)("p",{className:"mt-3 text-xs leading-relaxed text-text-muted",children:"Refreshing reads this account's Workers AI model catalog and does not use neurons. Only chat and text-to-image models are listed."}),!i.length&&(0,a.jsx)("p",{className:"mt-2 text-xs text-red-500",children:"Add and activate a Cloudflare connection first."})]}),p&&(0,a.jsx)("p",{role:"alert",className:"rounded-lg border border-red-500/25 bg-red-500/[0.08] px-3 py-2 text-sm text-red-600 dark:text-red-300",children:p}),f&&(0,a.jsx)("p",{className:"rounded-lg border border-green-500/25 bg-green-500/[0.08] px-3 py-2 text-sm text-green-700 dark:text-green-300",children:f}),c&&eg.map(e=>{let t=P.filter(t=>t.kind===e.kind);if(!t.length)return null;let s=t.every(e=>g.has(e.id));return(0,a.jsxs)("section",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold text-text-main",children:[e.title," (",t.length,")"]}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:e.hint})]}),(0,a.jsx)("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:()=>{var t;let s,a;return t=e.kind,a=(s=P.filter(e=>e.kind===t).map(e=>e.id)).every(e=>g.has(e)),void y(e=>{let t=new Set(e);for(let e of s)a?t.delete(e):t.add(e);return t})},children:s?"Clear":"Select all"})]}),(0,a.jsx)("div",{className:"max-h-80 overflow-y-auto rounded-xl border border-border custom-scrollbar",children:t.map(e=>{var t;let s=I.get(e.id),r=A.has(e.id),n="llm"===e.kind&&!r&&s?.status==="verified",i=[!(t=e.contextLength)?null:t>=1e6?`${Math.round(t/1e5)/10}M ctx`:`${Math.round(t/1e3)}K ctx`,...e.flags].filter(Boolean).join(" \xb7 ");return(0,a.jsxs)("div",{className:"flex items-start gap-3 border-b border-border-subtle px-3 py-2.5 last:border-b-0 hover:bg-surface-2",children:[(0,a.jsxs)("label",{className:"flex min-w-0 flex-1 cursor-pointer items-start gap-3",children:[(0,a.jsx)("input",{type:"checkbox",checked:g.has(e.id),onChange:()=>{var t;return t=e.id,void y(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:"mt-1 accent-orange-500"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[(0,a.jsx)("span",{className:"truncate text-sm font-medium text-text-main",children:e.name}),r&&(0,a.jsx)("span",{className:"rounded-full bg-blue-500/10 px-2 py-0.5 text-[10px] font-medium text-blue-600 dark:text-blue-400",children:"In router"}),e.paidOnly&&(0,a.jsx)("span",{className:"rounded-full bg-sky-500/10 px-2 py-0.5 text-[10px] font-medium text-sky-700 dark:text-sky-300",children:"Workers Paid"}),!1===e.inCatalog&&(0,a.jsx)("span",{className:"rounded-full bg-zinc-500/10 px-2 py-0.5 text-[10px] font-medium text-text-muted",title:"Not listed in this account's Workers AI catalog",children:"Not in catalog"})]}),(0,a.jsxs)("span",{className:"block truncate font-mono text-[11px] text-text-muted",children:["cf/",e.id]}),i&&(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:i})]})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2 pt-0.5",children:[s&&(0,a.jsxs)("span",{title:s.error||"",className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${ef[s.status]||ef.error}`,children:[eh[s.status]||s.status,"verified"===s.status&&Number.isFinite(s.latencyMs)&&` \xb7 ${s.latencyMs}ms`]}),n&&(0,a.jsx)("button",{type:"button",onClick:()=>z([e]),disabled:S.has(e.id),className:"text-xs font-semibold text-primary hover:underline disabled:opacity-50",children:S.has(e.id)?"Adding...":"+ Add"})]})]},e.id)})})]},e.kind)}),c&&(0,a.jsxs)("section",{className:"rounded-xl border border-amber-500/25 bg-amber-500/[0.07] p-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:N.length>0?`${D.works} work, ${D.dead} dead, ${D.paid} need Workers Paid, ${D.other} other`:"Probe sends one real request per selected model."}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[q.length>0&&(0,a.jsxs)(d.$n,{size:"sm",variant:"secondary",icon:"add",loading:S.size>0,onClick:()=>z(q),children:["Add Working Chat Models (",q.length,")"]}),(0,a.jsxs)(d.$n,{size:"sm",icon:"radar",onClick:()=>j(!0),disabled:!l||0===g.size||k,children:["Probe Selected (",g.size,")"]})]})]}),v&&(0,a.jsxs)("div",{className:"mt-4 rounded-lg border border-amber-500/40 bg-surface px-3 py-3",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Confirm neuron-using probe"}),(0,a.jsxs)("p",{className:"mt-1 text-xs leading-relaxed text-text-muted",children:["These are real Workers AI requests on the selected account and count toward its daily free allocation of 10,000 neurons.",E>0&&` ${E} image model${1===E?"":"s"} selected; each image probe costs much more than a chat probe.`," ","At most 3 run at once, and the scan stops if the allocation runs out or the token is rejected."]}),(0,a.jsxs)("div",{className:"mt-3 flex justify-end gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:()=>j(!1),disabled:k,children:"Cancel"}),(0,a.jsx)(d.$n,{size:"sm",icon:"science",loading:k,onClick:R,children:"Start Probe"})]})]})]})]})})}function ev({showAutomation:e,showAddConnection:t,onOpenAutomation:s,onAddConnection:r,extra:n=null}){return e||t||n?(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:flex-wrap sm:justify-end",children:[e?(0,a.jsx)(d.$n,{size:"sm",icon:"automation",variant:"secondary",onClick:s,className:"w-full sm:w-auto",children:"Open Automation"}):null,t?(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:r,className:"w-full sm:w-auto",children:"Add Connection"}):null,n]}):null}ey.propTypes={isOpen:T().bool.isRequired,connections:T().arrayOf(T().object).isRequired,onModelsAdded:T().func,onClose:T().func.isRequired},ev.propTypes={showAutomation:T().bool.isRequired,showAddConnection:T().bool.isRequired,onOpenAutomation:T().func.isRequired,onAddConnection:T().func.isRequired,extra:T().node};let ej=`[
4
+ {
5
+ "accessToken": "eyJhbGc...",
6
+ "refreshToken": "rt_...",
7
+ "email": "user@example.com"
8
+ }
9
+ ]`;function ek({isOpen:e,onClose:t,onSuccess:s}){let[n,i]=(0,r.useState)(""),[l,o]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),m=()=>{l||(u(null),t())},x=async()=>{let e;try{e=JSON.parse(n)}catch{u({error:"Paste a JSON account or an array of accounts"});return}o(!0),u(null);try{let t=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json();u(a.error?{error:a.error}:a),!a.error&&a.success>0&&s?.()}catch(e){u({error:e.message})}finally{o(!1)}},p=c&&!c.error?`Imported ${c.success}. Failed ${c.failed}.`:null;return(0,a.jsxs)(d.aF,{isOpen:e,onClose:m,title:"Import Codex accounts",size:"lg",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{variant:"secondary",onClick:m,disabled:l,children:"Close"}),(0,a.jsx)(d.$n,{onClick:x,disabled:l||!n.trim(),children:l?"Importing...":"Import"})]}),children:[(0,a.jsx)("p",{className:"mb-3 text-xs text-text-muted",children:"Paste one account or an array. An access token is required. A refresh token is stored only when you include it. The response never returns the tokens."}),(0,a.jsx)("textarea",{className:"w-full rounded-lg border border-border bg-background p-3 font-mono text-xs text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none",rows:8,placeholder:ej,value:n,onChange:e=>i(e.target.value),disabled:l}),c?(0,a.jsx)("div",{className:`mt-3 rounded-lg p-3 text-xs ${c.error?"bg-red-500/10 text-red-400":"bg-green-500/10 text-green-400"}`,children:c.error||p}):null]})}ek.propTypes={isOpen:T().bool.isRequired,onClose:T().func.isRequired,onSuccess:T().func};let ew=`[
10
+ {
11
+ "access_token": "eyJhbGc...",
12
+ "refresh_token": "rt_...",
13
+ "email": "user@example.com"
14
+ }
15
+ ]`;function eN({isOpen:e,onClose:t,onSuccess:s}){let[n,i]=(0,r.useState)(""),[l,o]=(0,r.useState)(!1),[c,u]=(0,r.useState)(null),m=()=>{l||(u(null),t())},x=async()=>{let e;try{e=JSON.parse(n)}catch{u({error:"Paste a JSON account or an array of accounts"});return}o(!0),u(null);try{let t=await fetch("/api/oauth/grok-cli/json-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json();u(a.error?{error:a.error}:a),!a.error&&a.success>0&&s?.()}catch(e){u({error:e.message})}finally{o(!1)}},p=c&&!c.error?`Imported ${c.success}. Failed ${c.failed}.`:null;return(0,a.jsxs)(d.aF,{isOpen:e,onClose:m,title:"Import Grok CLI accounts",size:"lg",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{variant:"secondary",onClick:m,disabled:l,children:"Close"}),(0,a.jsx)(d.$n,{onClick:x,disabled:l||!n.trim(),children:l?"Importing...":"Import"})]}),children:[(0,a.jsx)("p",{className:"mb-3 text-xs text-text-muted",children:"Paste one account or an array. Snake_case and camelCase are both accepted. A refresh token is refreshed before it is stored. The response never returns the tokens. Line import stays on the automation page."}),(0,a.jsx)("textarea",{className:"w-full rounded-lg border border-border bg-background p-3 font-mono text-xs text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none",rows:8,placeholder:ew,value:n,onChange:e=>i(e.target.value),disabled:l}),c?(0,a.jsx)("div",{className:`mt-3 rounded-lg p-3 text-xs ${c.error?"bg-red-500/10 text-red-400":"bg-green-500/10 text-green-400"}`,children:c.error||p}):null]})}eN.propTypes={isOpen:T().bool.isRequired,onClose:T().func.isRequired,onSuccess:T().func};let eC=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],eS=/^[A-Za-z0-9-]+$/;function e$({providerId:e}){let t=(0,S.i)(),[s,n]=(0,r.useState)(!1),[i,l]=(0,r.useState)([{name:"",value:""}]),[o,c]=(0,r.useState)({}),[u,m]=(0,r.useState)(!1),[x,p]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let t=!1;return fetch(`/api/providers/${e}/overrides`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{if(t||!e)return;let s=e.builtinHeaders||{},a=Object.entries({...s,...e.headers||{}}).map(([e,t])=>({name:e,value:t}));c(s),l(a.length?a:[{name:"",value:""}]),m(Object.keys(e.headers||{}).length>0)}).catch(()=>{}),()=>{t=!0}},[e]);let h=(e,t,s)=>{l(a=>a.map((a,r)=>r===e?{...a,[t]:s}:a))},f=(0,r.useCallback)(async()=>{let s={};for(let e of i.filter(e=>e.name.trim())){let a=e.name.trim();if(!eS.test(a))return void t.error(`Invalid header name: ${a}`);if(eC.includes(a.toLowerCase()))return void t.error(`Header ${a} cannot be overridden`);if(a in s)return void t.error(`Duplicate header name: ${a}`);e.value!==o[a]&&(s[a]=e.value)}p(!0);try{let a=await fetch(`/api/providers/${e}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:s})});if(!a.ok){let e=await a.json().catch(()=>({}));t.error(e.error||"Failed to save");return}m(Object.keys(s).length>0),t.success("Custom headers saved")}finally{p(!1)}},[i,o,e,t]);return 0!==Object.keys(o).length||u?(0,a.jsxs)(d.Zp,{padding:"xs",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),className:"flex w-full items-center justify-between text-left",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"tune"}),(0,a.jsx)("span",{className:"text-sm font-semibold",children:"Custom Headers"}),u&&(0,a.jsx)(d.Ex,{variant:"success",size:"sm",children:"Active"})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:s?"expand_less":"expand_more"})]}),s&&(0,a.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,a.jsx)("div",{className:"flex flex-col gap-2",children:i.map((e,t)=>{let s=e.name.trim()in o&&e.value!==o[e.name.trim()];return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{value:e.name,onChange:e=>h(t,"name",e.target.value),placeholder:"Header-Name",spellCheck:!1,className:"w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none"}),(0,a.jsx)("input",{value:e.value,onChange:e=>h(t,"value",e.target.value),placeholder:"Value",spellCheck:!1,title:s?"Overridden":e.name.trim()in o?"Registry default":"",className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none ${s?"border-amber-400/60":"border-border"}`}),(0,a.jsx)("button",{type:"button",title:"Remove header",onClick:()=>l(e=>e.length>1?e.filter((e,s)=>s!==t):[{name:"",value:""}]),className:"shrink-0 text-text-muted hover:text-red-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},t)})}),(0,a.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>l(e=>[...e,{name:"",value:""}]),className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add header"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{type:"button",disabled:x,onClick:()=>{l(Object.entries(o).map(([e,t])=>({name:e,value:t})))},className:"rounded-md border border-border px-3 py-1.5 text-xs hover:bg-black/[0.03] dark:hover:bg-white/[0.03] disabled:opacity-50",children:"Reset"}),(0,a.jsx)("button",{type:"button",disabled:x,onClick:f,className:"rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-white hover:opacity-90 disabled:opacity-50",children:x?"Saving...":"Save"})]})]})]})]}):null}e$.propTypes={providerId:T().string.isRequired};let eA="kiro-bulk-import-active-job",eT="Bulk import progress expired or was cleared.",eO={claude:"claudeAutoPing",codex:"codexAutoPing"};function eP(e){return["completed","cancelled","failed"].includes(e)}async function eI(e){if(!e)return null;let t=await fetch(`/api/oauth/kiro/bulk-import/${e}`,{cache:"no-store"}),s=await t.json();return{res:t,data:s}}async function eE(e="active"){let t=await fetch(`/api/oauth/kiro/bulk-import/latest?scope=${encodeURIComponent(e)}`,{cache:"no-store"}),s=await t.json();return{res:t,data:s}}async function eR(e){let t=new AbortController,s=window.setTimeout(()=>t.abort(),8e3);try{let s=await fetch(e,{cache:"no-store",signal:t.signal}),a=null;try{a=await s.json()}catch{a=null}return{response:s,data:a}}finally{window.clearTimeout(s)}}function ez(){let e,t=(0,n.useParams)(),s=(0,n.useRouter)(),i=t.id,[u,b]=(0,r.useState)([]),[A,T]=(0,r.useState)(!0),[P,I]=(0,r.useState)(""),[R,z]=(0,r.useState)(null),[q,D]=(0,r.useState)([]),[_,U]=(0,r.useState)(!1),[L,K]=(0,r.useState)(!1),[F,J]=(0,r.useState)(!1),[B,W]=(0,r.useState)(!1),[G,X]=(0,r.useState)(!1),[Y,ee]=(0,r.useState)(!1),[et,ea]=(0,r.useState)(!1),[er,en]=(0,r.useState)(""),[ei,eo]=(0,r.useState)(!1),[ed,ec]=(0,r.useState)(!1),[eu,em]=(0,r.useState)(!1),[ep,eh]=(0,r.useState)(null),[ef,eb]=(0,r.useState)({}),[eg,ej]=(0,r.useState)([]),[ew,eC]=(0,r.useState)(!1),[eS,ez]=(0,r.useState)({}),[eq,eD]=(0,r.useState)({}),[eM,e_]=(0,r.useState)(()=>new Set),[eU,eL]=(0,r.useState)(!1),[eK,eF]=(0,r.useState)(!1),[eJ,eB]=(0,r.useState)(!1),[eH,eW]=(0,r.useState)(!1),[eG,eV]=(0,r.useState)(!1),[eQ,eZ]=(0,r.useState)([]),[eX,eY]=(0,r.useState)("__none__"),[e0,e1]=(0,r.useState)(!1),[e5,e2]=(0,r.useState)(!1),[e3,e4]=(0,r.useState)(null),[e7,e6]=(0,r.useState)(""),[e8,e9]=(0,r.useState)("auto"),[te,tt]=(0,r.useState)({}),[ts,ta]=(0,r.useState)({}),[tr,tn]=(0,r.useState)(null),[ti,tl]=(0,r.useState)([]),[to,td]=(0,r.useState)([]),[tc,tu]=(0,r.useState)([]),[tm,tx]=(0,r.useState)(null),[tp,th]=(0,r.useState)(!1),[tf,tb]=(0,r.useState)(null),[tg,ty]=(0,r.useState)(!1),[tv,tj]=(0,r.useState)(!1),[tk,tw]=(0,r.useState)(null),[tN,tC]=(0,r.useState)({}),[tS,t$]=(0,r.useState)(null),tA=(0,r.useRef)(!1),tT=(0,r.useRef)(null),tO=(0,r.useRef)("1"),[tP,tI]=(0,r.useState)(!1),[tE,tR]=(0,r.useState)(null),[tz,tq]=(0,r.useState)(""),[tD,tM]=(0,r.useState)(1),[t_,tU]=(0,r.useState)(20),[tL,tK]=(0,r.useState)("all"),[tF,tJ]=(0,r.useState)(""),[tB,tH]=(0,r.useState)(1),[tW,tG]=(0,r.useState)(20),{copied:tV,copy:tQ}=(0,h.C)(),tZ=(0,r.useRef)(0),tX=(0,r.useRef)([]),tY=(0,r.useRef)(!0),t0=(0,r.useRef)(null),t1=(0,S.i)(e=>e.error),t5="ag_risk_confirmed",t2=(0,r.useCallback)(()=>{tR(null),tq(""),tZ.current=0,window.localStorage.removeItem(eA)},[]),t3=()=>{U(!0)},t4=()=>{"kiro"===i&&tE?.jobId&&eP(tE.status)&&t2(),s.push(x(i))},t7=R?{id:R.id,name:R.name||("anthropic-compatible"===R.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===R.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===R.type?"AC":"OC",apiType:R.apiType,baseUrl:R.baseUrl,type:R.type}:c.zN[i]||c.fg[i]||c.IS[i]||c.nJ[i]||c.br[i],t6=t7?.authModes||[],t8=!!c.zN[i]||!!c.IS[i]||t6.includes("oauth"),t9=!!c.fg[i]||t6.includes("apikey"),se=!!c.IS[i]?.noAuth,st=(0,y.F)("kiro"===i),ss=(0,p.KC)(i),sa="kiro"===i?st:ss,sr=(0,c.wG)(i),sn=(0,c.mq)(i),si=(0,c.gb)(i),sl=sn||si,so=m(i),sd=function({providerId:e,providerInfo:t,isOAuth:s,supportsApiKeyAuth:a,isCompatible:r}){if(!t||t.noAuth||t.authModes?.includes("none"))return[];let n=[];for(let i of(s&&C(n,"oauth"),(a||r||"cookie"===t.authType||!s)&&C(n,"apikey"),w[e]||[]))C(n,i);return n.map(t=>{let s=k[t];return s?{...s,...N[e]?.[t]}:null}).filter(Boolean)}({providerId:i,providerInfo:t7,isOAuth:t8,supportsApiKeyAuth:t9,isCompatible:sn||si}),sc=function(e,{specializedChooser:t=!1}={}){return e.length?t?{type:"specialized"}:1===e.length?{type:"method",methodId:e[0].id}:{type:"chooser"}:{type:"none"}}(sd,{specializedChooser:"kiro"===i}),su=sd.map(e=>"quota-cookie"===e.id&&0===u.length?{...e,disabled:!0,description:"Add a CodeBuddy connection before attaching its quota cookie."}:e),sm=e=>{if(!e8||"auto"===e8)return null;let t=(0,$.kl)(i,e);return t&&t.includes(e8)?e8:null},sx=sl?i:sr,sp=(()=>{let e=new Set,t=new Set,s=s=>{if(!s||t.has(s))return;t.add(s);let a=(0,$.kl)(i,s);a&&a.forEach(t=>{"none"!==t&&e.add(t)})};for(let e of sa)s(e.id);for(let e of to)s(e.id);for(let e of eg)e.providerAlias===sx&&"llm"===(e.kind||e.type||"llm")&&s(e.id);return e.size?["auto",...e]:null})(),sh=sl?R?.prefix||i:sr,sf=(0,r.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(sx)}`,{cache:"no-store"}),t=await e.json();e.ok&&tu(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[sx]),sb=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:sx,ids:[e]})})).ok&&await sf()}catch(e){console.log("Error disabling model:",e)}},sg=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(sx)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await sf()}catch(e){console.log("Error enabling model:",e)}},sy=async e=>{e.length&&tx({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{tx(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:sx,ids:e})})).ok&&await sf()}catch(e){console.log("Error disabling all models:",e)}}})},sv=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(sx)}`,{method:"DELETE"})).ok&&await sf()}catch(e){console.log("Error enabling all models:",e)}},sj=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ej(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]),sk=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&eb(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]);(0,r.useEffect)(()=>{"kilocode"===i&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&td(e.models)}).catch(()=>{})},[i]);let sw=(0,r.useCallback)(async()=>{try{I("");let[e,t,s,a]=await Promise.allSettled([eR("/api/providers"),eR("/api/provider-nodes"),eR("/api/proxy-pools?isActive=true"),eR("/api/settings")]),r="fulfilled"===e.status?e.value.response:null,n="fulfilled"===e.status?e.value.data:{},l="fulfilled"===t.status?t.value.response:null,o="fulfilled"===t.status?t.value.data:{},d="fulfilled"===s.status?s.value.response:null,u="fulfilled"===s.status?s.value.data:{},m="fulfilled"===a.status?a.value.response:null,x=m?.ok&&a.value.data||{};if(r?.ok){let e=(n.connections||[]).filter(e=>e.provider===i);tX.current=e,b(e)}else I("Connections could not be loaded.");d?.ok&&D(u.proxyPools||[]);let p=(x.providerStrategies||{})[i]||{};e4(p.fallbackStrategy||null),e6(null!=p.stickyRoundRobinLimit?String(p.stickyRoundRobinLimit):"1"),tO.current=null!=p.stickyRoundRobinLimit?String(p.stickyRoundRobinLimit):"1";let h=(x.providerThinking||{})[i]||{};e9(h.mode||"auto");let f=eO[i];if(tt(f&&x?.[f]?.connections||{}),ta(f&&x?.[f]?.schedules||{}),l?.ok){let e=(o.nodes||[]).find(e=>e.id===i)||null;if(!e&&((0,c.mq)(i)||(0,c.gb)(i)))for(let t=0;t<3;t+=1){if(await new Promise(e=>setTimeout(e,150)),!tY.current)return;let{response:t,data:s}=await eR("/api/provider-nodes");if(!tY.current)return;if(t.ok&&(e=(s.nodes||[]).find(e=>e.id===i)||null))break}z(e)}}catch(e){console.log("Error fetching connections:",e),tY.current&&I("Connections could not be loaded.")}finally{tY.current&&T(!1)}},[i]),sN=async e=>{try{let t=await fetch(`/api/provider-nodes/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(z(s.node),await sw(),ec(!1))}catch(e){console.log("Error updating provider node:",e)}},sC=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},r={};e&&(r.fallbackStrategy=e),"round-robin"===e&&""!==t&&(r.stickyRoundRobinLimit=Number(t)||3);let n={...a};0===Object.keys(r).length?delete n[i]:n[i]=r,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:n})})}catch(e){console.log("Error saving provider strategy:",e)}},sS=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?s[i]={mode:e}:delete s[i],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:s})})}catch(e){console.log("Error saving thinking config:",e)}},s$=async(e,t)=>{let s=eO[i];if(!s)return;let a={...te,[e]:t};tt(a);try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[s]||{},connections:a};if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[s]:t})})).ok)throw Error("Failed to save auto-ping setting")}catch(e){tt(te),console.log("Error saving auto-ping config:",e)}},sA=async({reactive:e,schedule:t})=>{let s=eO[i];if(!tr||!s)return;let a={...te,[tr.id]:e},r={...ts,[tr.id]:t};tt(a),ta(r);try{let e=await fetch("/api/settings",{cache:"no-store"}),t=e.ok?await e.json():{};if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[s]:{...t[s]||{},connections:a,schedules:r}})})).ok)throw Error("Failed to save auto-ping schedule")}catch(e){tt(te),ta(ts),console.log("Error saving auto-ping schedule:",e)}};(0,r.useEffect)(()=>{sw(),sk(),sj(),sf()},[sw,sk,sj,sf]),(0,r.useEffect)(()=>(tY.current=!0,()=>{tY.current=!1,null!==t0.current&&window.cancelAnimationFrame(t0.current)}),[]),(0,r.useEffect)(()=>{tx(null),ez({}),eD({}),e_(new Set),tl([]),tC({}),t$(null),tw(null),ty(!1),tj(!1),tA.current=!0,tq("")},[i]),(0,r.useEffect)(()=>{tM(1),tH(1),tK("all"),tJ("")},[i]),(0,r.useEffect)(()=>{tM(1)},[tL,t_,tF]),(0,r.useEffect)(()=>{eC(!1)},[i]),(0,r.useEffect)(()=>{tH(1)},[tW,tc.length,sa.length,to.length]),(0,r.useEffect)(()=>{if("kiro"!==i)return;let e=window.localStorage.getItem(eA),t=!1;return(async()=>{try{if(tq(""),tE?.jobId)return;let a=await eE();if(!t&&a.res.ok&&a.data?.job){tR(a.data.job),tZ.current=a.data.job.summary?.success||0,window.localStorage.setItem(eA,a.data.job.jobId);return}if(e){var s;let a=await eI(e);if(!t&&a?.res.ok&&a.data?.job&&(s=a.data.job.status,["queued","running","needs_manual"].includes(s))){tR(a.data.job),tZ.current=a.data.job.summary?.success||0;return}t2(),tq(eT)}}catch{t||tq(eT)}})(),()=>{t=!0}},[t2,tE?.jobId,i]),(0,r.useEffect)(()=>{if(!("kiro"!==i||!tE?.jobId||eP(tE.status)))return(0,j.M)(async e=>{let t=await eI(tE.jobId);if(!e()){if(t?.res.ok&&t.data?.job){let s=t.data.job.summary?.success||0;if(s>tZ.current&&(tZ.current=s,await sw(),e()))return;tq(""),tR(t.data.job);return}if(t?.res.status===404){let t=await eE();if(e())return;if(t.res.ok&&t.data?.job){let s=t.data.job.summary?.success||0;if(s>tZ.current&&(tZ.current=s,await sw(),e()))return;tq(""),tR(t.data.job),window.localStorage.setItem(eA,t.data.job.jobId);return}t2(),tq(eT)}}},2e3)},[t2,sw,tE?.jobId,tE?.status,i]),(0,r.useEffect)(()=>{let e=(c.zN[i]||c.fg[i]||c.IS[i]||c.nJ[i])?.modelsFetcher;e&&g(e).then(tl)},[i]);let sT=async(e,t,s=sr)=>{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 sk();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},sO=async(e,t="llm")=>{try{let s=new URLSearchParams({providerAlias:sx,id:e,type:t});(await fetch(`/api/models/custom?${s}`,{method:"DELETE"})).ok&&(await sj(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},sP=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await sk()}catch(e){console.log("Error deleting alias:",e)}},sI=async()=>{if(tP)return;let e=u.find(e=>!1!==e.isActive);if(!e)return void alert((0,f.Tl)("Please add an active Qoder connection first"));tI(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,f.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,f.Tl)("No models returned"));let r={...ef},n=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,""),a=`${sx}/${s}`;!Object.values(r).includes(a)&&(r[s]||(await sT(s,s,sx),r[s]=a,n+=1))}0===n?alert((0,f.Tl)("All models already exist, no new models added")):alert((0,f.Tl)("Successfully added")+` ${n} `+(0,f.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,f.Tl)("Error fetching models")+": "+e.message)}finally{tI(!1)}},sE=async()=>{let e=[...u];if(tg||0===e.length)return;let t=Object.fromEntries(e.map(e=>[e.id,{state:"queued",error:null}]));tA.current=!1,ty(!0),tj(!1),tw(null),tC(t),t$({total:e.length,completed:0,passed:0,failed:0,stopped:!1});let s=0,a=0;try{for(let t=0;t<e.length;t+=1){if(tA.current){t$({total:e.length,completed:t,passed:s,failed:a,stopped:!0});break}let r=e[t];if(!tX.current.some(e=>e.id===r.id)){tC(e=>({...e,[r.id]:{state:"skipped",error:null}})),t$({total:e.length,completed:t+1,passed:s,failed:a,stopped:!1});continue}tw(r.id),tC(e=>({...e,[r.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${r.id}/test`,{method:"POST"}),t=await e.json(),n=!!t.valid;n?s+=1:a+=1,tC(e=>({...e,[r.id]:{state:n?"success":"failed",error:n?t.warning||null:t.error||null}}))}catch(e){a+=1,tC(t=>({...t,[r.id]:{state:"failed",error:e.message||"Test failed"}}))}t$({total:e.length,completed:t+1,passed:s,failed:a,stopped:!1}),t<e.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{tw(null),ty(!1),tj(!1),tA.current=!1}},sR=async e=>{tx({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{tx(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&b(u.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},sz=()=>{sw(),U(!1)},sq=(0,r.useCallback)(e=>{(tR(e),tq(""),e?.jobId)?(window.localStorage.setItem(eA,e.jobId),tZ.current=Math.max(tZ.current,e.summary?.success||0)):t2()},[t2]),sD=async e=>{en("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await sw(),ea(!1);return}en(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),en("Failed to save connection")}},sM=async e=>{try{(await fetch(`/api/providers/${ep.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await sw(),eo(!1))}catch(e){console.log("Error updating connection:",e)}},s_=async(e,t)=>{try{let s=await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})});if(s.ok){let a=await s.json().catch(()=>null);b(s=>s.map(s=>s.id===e?{...s,isActive:t,...a?.connection||{}}:s))}}catch(e){console.log("Error updating connection status:",e)}},sU=async(e,t)=>{let s=[...u];[s[e],s[t]]=[s[t],s[e]],b(s);try{let[a,r]=await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e+1})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t+1})})]);a.ok&&r.ok||(console.log("Priority swap rejected:",a.status,r.status),await sw())}catch(e){console.log("Error swapping priority:",e),await sw()}},sL=(0,r.useMemo)(()=>{let e=tF.trim().toLowerCase();return u.filter(t=>!!(0,v.i2)(t,tL)&&(!e||[t.name,t.email,t.id,t.account,t.username,t.label,t.authType,t.notes,t.proxyPoolId].filter(Boolean).join(" ").toLowerCase().includes(e)))},[u,tL,tF]),sK=(0,r.useMemo)(()=>v.gJ.reduce((e,t)=>(e[t.id]="all"===t.id?u.length:u.filter(e=>(0,v.i2)(e,t.id)).length,e),{}),[u]),sF=eQ.filter(e=>u.some(t=>t.id===e)),sJ=u.filter(e=>sF.includes(e.id)),sB="codebuddy"===i||"codebuddy-cn"===i?(sJ.length>0?sJ:u).map(e=>e.id):[],sH=sL.length>0&&sL.every(e=>sF.includes(e.id)),sW=e=>{switch(e){case"oauth":if("antigravity"===i&&"true"!==window.localStorage.getItem(t5)){tb(e),th(!0);return}t3();return;case"apikey":en(""),ea(!0);return;case"cookie":W(!0);return;case"quota-cookie":u.length>1&&0===sJ.length?alert("Select the CodeBuddy connection(s) that should use this quota cookie first."):X(!0);return;default:t1(`Unsupported connection method: ${e}`,"Add Connection")}},sG=e=>{null!==t0.current&&window.cancelAnimationFrame(t0.current),t0.current=window.requestAnimationFrame(()=>{t0.current=null,sW(e)})},sV=()=>{"specialized"===sc.type?t3():"method"===sc.type?sW(sc.methodId):"chooser"===sc.type&&ee(!0)},sQ=(()=>{if(0===sJ.length)return"";let e=new Set(sJ.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return"All selected currently unbound";let s=q.find(e=>e.id===t);return`All selected currently bound to ${s?.name||t}`}return"Selected connections have mixed proxy bindings"})(),sZ=()=>{e0||em(!1)},sX=async e=>{e1(!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 sw(),em(!1)}finally{e1(!1)}},sY=e=>sX(sJ.map(t=>({connectionId:t.id,proxyPoolId:e}))),s0=e=>{let t="gsuite"===e?"GSuite (non-Gmail)":"Gmail (@gmail.com)";tx({title:`Delete ${t}`,message:`Delete ALL ${t} accounts for this provider? This cannot be undone.`,onConfirm:async()=>{tx(null);try{(await fetch("/api/providers/bulk-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t7?.id||i,emailFilter:e})})).ok&&(eZ([]),await sw())}catch(e){console.error("bulk delete error:",e)}}})},s1=Math.max(1,Math.ceil(sL.length/t_)),s5=Math.min(tD,s1),s2=sL.slice((s5-1)*t_,s5*t_),s3=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:s2.map((e,t)=>{let s,r=u.findIndex(t=>t.id===e.id);return(0,a.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,a.jsx)("label",{className:"flex w-8 shrink-0 items-center justify-center",children:(0,a.jsx)("input",{type:"checkbox",checked:(s=e.id,sF.includes(s)),onChange:()=>{var t;return t=e.id,void eZ(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"size-4 rounded border-black/20 dark:border-white/20","aria-label":`Select ${e.name||e.email||e.id}`})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(M,{connection:e,proxyPools:q,isOAuth:t8,isFirst:0===r,isLast:r===u.length-1,onMoveUp:()=>sU(r,r-1),onMoveDown:()=>sU(r,r+1),onToggleActive:t=>s_(e.id,t),autoPingEnabled:!0===te[e.id],onToggleAutoPing:eO[i]&&"oauth"===e.authType?t=>s$(e.id,t):void 0,autoPingScheduled:ts[e.id]?.enabled===!0,onOpenAutoPingSchedule:eO[i]&&"oauth"===e.authType?()=>tn(e):void 0,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&b(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:()=>{eh(e),eo(!0)},onDelete:()=>sR(e.id),oneByOneStatus:tN[e.id]||null})})]},e.id)})}),s4=q.filter(e=>!0===e.isActive),s7=(0,a.jsx)(d.aF,{isOpen:eu,onClose:sZ,title:`Apply Proxy (${sJ.length} selected)`,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=q.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):sX(sJ.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:e0||0===s4.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] 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:()=>sY(null),disabled:e0,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] 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)"})]}),q.map(e=>(0,a.jsxs)("button",{onClick:()=>sY(e.id),disabled:e0||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] 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))]}),e0&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:sZ,variant:"ghost",fullWidth:!0,disabled:e0,children:"Cancel"})]})}),s6=async e=>{e_(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:`${sx}/${e}`})}),s=await t.json();ez(t=>({...t,[e]:s.ok?"ok":"error"})),eD(t=>({...t,[e]:s.ok?"":s.error||"Model not reachable"}))}catch{ez(t=>({...t,[e]:"error"})),eD(t=>({...t,[e]:"Network error"}))}finally{e_(t=>{let s=new Set(t);return s.delete(e),s})}};return A?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]}):t7?(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(l(),{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:`${t7.color}15`},children:ew?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:t7.color},children:t7.textIcon||t7.id.slice(0,2).toUpperCase()}):(0,a.jsx)(o.A,{src:sn&&t7.apiType?"responses"===t7.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":si?"/providers/anthropic-m.png":`/providers/${t7.id}.png`,alt:t7.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>eC(!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:t7.name}),(t7.notice?.apiKeyUrl||t7.notice?.signupUrl||t7.website)&&(0,a.jsxs)("a",{href:t7.notice?.apiKeyUrl||t7.notice?.signupUrl||t7.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"}),t7.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[u.length," connection",1===u.length?"":"s"]})]})]})]}),t7.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:t7.deprecationNotice})]}),t7.notice?.text&&!t7.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:t7.notice.text}),t7.notice.apiKeyUrl&&(0,a.jsx)("a",{href:t7.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 →"})]}),sl&&R&&(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:si?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[si?"Messages API":"responses"===R.apiType?"Responses API":"Chat Completions"," \xb7 ",(R.baseUrl||"").replace(/\/$/,""),"/",si?"messages":"responses"===R.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:()=>{en(""),ea(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>ec(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{tx({title:"Delete Compatible Node",message:`Delete this ${si?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{tx(null);try{(await fetch(`/api/provider-nodes/${i}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),se?(0,a.jsx)(d.gw,{providerId:i}):(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:[u.length>0&&q.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>{if(0===sJ.length)return;let e=[...new Set(sJ.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"))];eY(1===e.length?e[0]:"__none__"),em(!0)},disabled:0===sJ.length,children:"Apply Proxy"}),u.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:sE,disabled:tg,children:tg?"Testing Connection One-by-One...":"Test Connection One-by-One"}),tg&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{tg&&(tA.current=!0,tj(!0))},disabled:tv,children:tv?"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"===e3,onChange:e=>{let t=e?"round-robin":null,s=e?e7||"1":e7;e&&!e7&&e6("1"),tO.current=s,tT.current&&(clearTimeout(tT.current),tT.current=null),e4(t),sC(t,s)}}),"round-robin"===e3&&(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:e7,onChange:e=>{var t;e6(t=e.target.value),tO.current=t,tT.current&&clearTimeout(tT.current),tT.current=setTimeout(()=>{sC("round-robin",tO.current)},500)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),u.length>0&&(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-black/5 bg-black/[0.02] p-3 dark:border-white/5 dark:bg-white/[0.02]",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,a.jsx)("input",{type:"checkbox",checked:sH,onChange:()=>{sH?eZ(e=>e.filter(e=>!sL.some(t=>t.id===e))):eZ(e=>Array.from(new Set([...e,...sL.map(e=>e.id)])))},className:"size-4 rounded border-black/20 dark:border-white/20"}),sH?"Unselect visible":"Select visible"]}),(0,a.jsxs)(d.Ex,{variant:"default",children:[sL.length," visible"]}),sJ.length>0&&(0,a.jsxs)(d.Ex,{variant:"default",children:[sJ.length," selected"]}),sQ&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:sQ}),sJ.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:()=>{eZ([]),eY("__none__")},children:"Clear"}),sJ.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:()=>{0!==sJ.length&&tx({title:"Delete Selected Connections",message:`Delete ${sJ.length} selected connection(s)? This permanently removes the selected accounts.`,onConfirm:async()=>{tx(null);let e=[],t=0;for(let s of sJ)try{(await fetch(`/api/providers/${s.id}`,{method:"DELETE"})).ok?e.push(s.id):t+=1}catch(e){console.log("Error deleting selected connection:",e),t+=1}eZ(t=>t.filter(t=>!e.includes(t))),t>0&&alert(`Deleted ${e.length} connection(s); ${t} failed.`),await sw()}})},children:["Delete Selected (",sJ.length,")"]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"domain",onClick:()=>s0("gsuite"),children:"Delete GSuite"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"mail",onClick:()=>s0("gmail"),children:"Delete Gmail"})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:v.gJ.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>tK(e.id),className:`rounded-full border px-2.5 py-1 text-xs transition-colors ${tL===e.id?"border-primary/50 bg-primary/10 text-primary":"border-border text-text-muted hover:border-primary/30 hover:text-text-main"}`,children:[e.label,(0,a.jsx)("span",{className:"ml-1 text-[10px] opacity-70",children:sK[e.id]||0})]},e.id))}),u.length>=20&&(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[16px] text-text-subtle",children:"search"}),(0,a.jsx)("input",{type:"search",value:tF,onChange:e=>tJ(e.target.value),placeholder:`Search ${u.length} connections (email, name, id)…`,className:"w-full rounded-lg border border-border bg-background py-2 pl-8 pr-3 text-xs text-text-main outline-none placeholder:text-text-subtle focus:border-primary/40"})]})]}),P?(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:P})]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"refresh",onClick:()=>{T(!0),sw()},children:"Retry"})]}):0===u.length?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{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:t8?"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"}),sd.length>1?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Add Connection lists every available authentication method."}):null]})]}),(0,a.jsx)(ev,{showAutomation:so,showAddConnection:"none"!==sc.type,onOpenAutomation:t4,onAddConnection:sV,extra:"codex"===i||"grok-cli"===i?(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>"codex"===i?K(!0):J(!0),className:"w-full sm:w-auto",children:"Bulk Add"}):null})]}),"kiro"===i&&tE?.jobId&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",tE.status," | Success: ",tE.summary?.success||0," | Running: ",tE.summary?.running||0," | Queued: ",tE.summary?.queued||0]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>s.push(x("kiro")),children:"Resume Bulk Progress"}),eP(tE.status)&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"close",onClick:t2,children:"Clear"})]})]}),"kiro"===i&&!tE?.jobId&&tz&&(0,a.jsx)("div",{className:"mt-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:tz})]}):(0,a.jsxs)(a.Fragment,{children:[tS&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",tS.total]}),(0,a.jsxs)("span",{children:["Completed: ",tS.completed]}),(0,a.jsxs)("span",{children:["Passed: ",tS.passed]}),(0,a.jsxs)("span",{children:["Failed: ",tS.failed]}),tS.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),tg&&tk&&(0,a.jsxs)("span",{children:["Running: ",u.find(e=>e.id===tk)?.name||tk]})]})}),"kiro"===i&&tE?.jobId&&(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",tE.status," | Success: ",tE.summary?.success||0," | Running: ",tE.summary?.running||0," | Queued: ",tE.summary?.queued||0]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>s.push(x("kiro")),children:"Resume Bulk Progress"}),eP(tE.status)&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"close",onClick:t2,children:"Clear"})]})]}),"kiro"===i&&!tE?.jobId&&tz&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:tz}),s3,"kiro"===i&&s1>1&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Page ",s5," of ",s1," • Showing ",(s5-1)*t_+1,"-",Math.min(s5*t_,sL.length)," of ",sL.length," connections"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",disabled:s5<=1,onClick:()=>tM(e=>Math.max(1,e-1)),children:"Previous"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",disabled:s5>=s1,onClick:()=>tM(e=>Math.min(s1,e+1)),children:"Next"})]})]}),"kiro"!==i&&sL.length>0&&(0,a.jsx)(d.dK,{currentPage:s5,pageSize:t_,totalItems:sL.length,onPageChange:tM,onPageSizeChange:e=>{tU(e),tM(1)},className:"mt-2"}),u.length>0&&0===sL.length&&(0,a.jsx)("div",{className:"py-8 text-center text-sm text-text-muted",children:"No connections match this status filter."}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(ev,{showAutomation:so,showAddConnection:"none"!==sc.type,onOpenAutomation:t4,onAddConnection:sV,extra:"codex"===i||"grok-cli"===i?(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>"codex"===i?K(!0):J(!0),className:"w-full sm:w-auto",children:"Bulk Add"}):null})})]})]}),(0,a.jsx)(e$,{providerId:i}),(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),sp&&(0,a.jsx)("select",{value:e8,onChange:e=>{var t;e9(t=e.target.value),sS(t)},title:"Appends (level) suffix to copied model names",className:"rounded-md border border-border bg-background px-2 py-1 text-xs focus:border-primary focus:outline-none",children:sp.map(e=>(0,a.jsx)("option",{value:e,children:`Thinking: ${e.charAt(0).toUpperCase()+e.slice(1)}`},e))})]}),!sl&&(e=[...sa,...to.filter(e=>!sa.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type).map(e=>e.id).filter(e=>!tc.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[tc.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:sv,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>sy(e),children:"Disable All"})]}))]}),Object.values(eq).some(Boolean)&&(0,a.jsx)("div",{className:"mb-3 flex flex-col gap-1",children:Object.entries(eq).filter(([,e])=>!!e).map(([e,t])=>(0,a.jsxs)("p",{className:"text-xs text-red-500 break-words",children:[e,": ",t]},e))}),(()=>{let e,t,s;if(sl)return(0,a.jsx)(E,{providerStorageAlias:sx,providerDisplayAlias:sh,modelAliases:ef,copied:tV,onCopy:tQ,onSetAlias:sT,onDeleteAlias:sP,onAliasesChanged:sk,connections:u,isAnthropic:si});let r=[...sa,...to.filter(e=>!sa.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type),n=new Set(tc),l=r.filter(e=>!n.has(e.id)),o=r.filter(e=>n.has(e.id)),c=function({customModels:e=[],modelAliases:t={},providerAlias:s,builtInModels:a=[],type:r="llm",includeLegacyAliases:n=!0}){let i=new Set(a.map(e=>e.id)),l=new Set,o=[];for(let t of e){if(!t?.id||t.providerAlias!==s)continue;let e=t?.kind||t?.type||"llm";if(r&&e!==r||i.has(t.id))continue;let a=`${s}/${t.id}`;l.has(a)||(l.add(a),o.push({id:t.id,name:t.name||t.id,fullModel:a,source:"custom",type:e}))}if(!n)return o;let d=`${s}/`;for(let[e,s]of Object.entries(t||{})){if("string"!=typeof s||!s.startsWith(d))continue;let t=s.slice(d.length);!t||i.has(t)||l.has(s)||(l.add(s),o.push({id:t,alias:e,fullModel:s,source:"legacyAlias",type:r||"llm"}))}return o}({customModels:eg,modelAliases:ef,providerAlias:sx,builtInModels:sa,type:"llm"}),m=Math.min(tB,Math.max(1,Math.ceil(l.length/tW))),x=l.slice((m-1)*tW,m*tW);return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[c.map(e=>(0,a.jsx)(O,{model:{id:e.id,name:e.name},fullModel:`${sh}/${e.id}`,alias:e.alias,copied:tV,onCopy:tQ,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?sO(e.id,e.type||"llm"):sP(e.alias)},testStatus:eS[e.id],onTest:u.length>0||se?()=>s6(e.id):void 0,isTesting:eM.has(e.id),isCustom:!0,isFree:!1,thinkingSuffix:sm(e.id)},`${e.source}-${e.fullModel}`)),x.map(e=>{let t=`${sx}/${e.id}`,s=`${i}/${e.id}`,r=Object.entries(ef).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(O,{model:e,fullModel:`${sh}/${e.id}`,alias:r,copied:tV,onCopy:tQ,onSetAlias:t=>sT(e.id,t,sx),onDeleteAlias:()=>sP(r),testStatus:eS[e.id],onTest:u.length>0||se?()=>s6(e.id):void 0,isTesting:eM.has(e.id),isFree:e.isFree,onDisable:()=>sb(e.id),thinkingSuffix:sm(e.id)},e.id)}),l.length>tW&&(0,a.jsx)("div",{className:"w-full",children:(0,a.jsx)(d.dK,{currentPage:m,pageSize:tW,totalItems:l.length,onPageChange:tH,onPageSizeChange:e=>{tG(e),tH(1)}})}),(0,a.jsxs)("button",{onClick:()=>eL(!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"]}),"codebuddy"===i&&(0,a.jsxs)("button",{onClick:()=>eF(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-cyan-500/50 px-3 py-2 text-xs text-cyan-700 transition-colors hover:border-cyan-500 hover:bg-cyan-500/[0.07] dark:text-cyan-300 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Discover Models"]}),"opencode"===i&&(0,a.jsxs)("button",{onClick:()=>eB(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-orange-500/50 px-3 py-2 text-xs text-orange-700 transition-colors hover:border-orange-500 hover:bg-orange-500/[0.07] dark:text-orange-300 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"kiro"===i&&(0,a.jsxs)("button",{onClick:()=>eW(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-violet-500/50 px-3 py-2 text-xs text-violet-700 transition-colors hover:border-violet-500 hover:bg-violet-500/[0.07] dark:text-violet-300 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"cloudflare-ai"===i&&(0,a.jsxs)("button",{onClick:()=>eV(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-orange-500/50 px-3 py-2 text-xs text-orange-700 transition-colors hover:border-orange-500 hover:bg-orange-500/[0.07] dark:text-orange-300 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"qoder"===i&&u.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:sI,disabled:tP,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-blue-600 dark:text-blue-400 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:tP?{animation:"spin 1s linear infinite"}:void 0,children:tP?"progress_activity":"download"}),tP?(0,f.Tl)("Fetching..."):(0,f.Tl)("Fetch Qoder Models")]}),ti.length>0&&(e=new Set(Object.values(ef)),t=new Set(sa.map(e=>e.id)),0===(s=ti.filter(s=>!e.has(`${sx}/${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()=>{let t=e.id.split("/").pop();await sT(e.id,t,sx)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 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:()=>sg(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 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))})]})]})})()]}),eu&&s7,Y&&(0,a.jsx)(d.mz,{isOpen:!0,providerName:t7.name,methods:su,onSelect:e=>{ee(!1),sG(e)},onClose:()=>ee(!1)}),"codex"===i&&(0,a.jsx)(ek,{isOpen:L,onClose:()=>K(!1),onSuccess:sw}),"grok-cli"===i&&(0,a.jsx)(eN,{isOpen:F,onClose:()=>J(!1),onSuccess:sw}),_&&("kiro"===i?(0,a.jsx)(d.Mh,{isOpen:!0,providerInfo:t7,onSuccess:sz,onRefresh:sw,initialBulkJobId:tE?.jobId||null,onBulkJobChange:sq,onClose:()=>U(!1)}):"cursor"===i?(0,a.jsx)(d.G9,{isOpen:!0,onSuccess:sz,onClose:()=>U(!1)}):"gitlab"===i?(0,a.jsx)(d.vj,{isOpen:!0,providerInfo:t7,onSuccess:sz,onClose:()=>U(!1)}):(0,a.jsx)(d.LF,{isOpen:!0,provider:i,providerInfo:t7,onSuccess:sz,onClose:()=>U(!1)})),"iflow"===i&&B&&(0,a.jsx)(d.vE,{isOpen:!0,onSuccess:()=>{sw(),W(!1)},onClose:()=>W(!1)}),("codebuddy"===i||"codebuddy-cn"===i)&&G&&(0,a.jsx)(d.xl,{isOpen:!0,connectionIds:sB,endpoint:"codebuddy-cn"===i?"/api/oauth/codebuddy-cn/quota-cookie":"/api/oauth/codebuddy/quota-cookie",onSuccess:()=>{sw(),X(!1)},onClose:()=>X(!1)}),et&&(0,a.jsx)(V,{isOpen:!0,provider:i,providerName:t7.name,isCompatible:sl,isAnthropic:si,authType:t7?.authType,authHint:t7?.authHint,website:t7?.website,proxyPools:q,existingNames:u.map(e=>e.name).filter(Boolean),error:er,onSave:sD,onBulkDone:sw,onClose:()=>{en(""),ea(!1)}}),ei&&ep&&(0,a.jsx)(d.wI,{isOpen:!0,connection:ep,proxyPools:q,onSave:sM,onClose:()=>eo(!1)}),sl&&ed&&(0,a.jsx)(Q,{isOpen:!0,node:R,onSave:sN,onClose:()=>ec(!1),isAnthropic:si}),!sl&&eU&&(0,a.jsx)(Z,{isOpen:!0,providerAlias:sx,providerDisplayAlias:sh,onSave:async e=>{let t=t7?.passthroughModels?e.split("/").pop():e;await sT(e,t,sx),eL(!1)},onClose:()=>eL(!1)}),"codebuddy"===i&&eK&&(0,a.jsx)(es,{isOpen:!0,connections:u,onModelsAdded:async e=>{for(let t of e)await sT(t.id,t.id,"cb");await sk(),await sj()},onClose:()=>eF(!1)}),"opencode"===i&&eJ&&(0,a.jsx)(el,{isOpen:!0,onModelsAdded:async e=>{for(let t of e)await sT(t.id,t.id,"oc");await sk(),await sj()},onClose:()=>eB(!1)}),"kiro"===i&&eH&&(0,a.jsx)(ex,{isOpen:!0,connections:u,onClose:()=>eW(!1)}),"cloudflare-ai"===i&&eG&&(0,a.jsx)(ey,{isOpen:!0,connections:u,onModelsAdded:async e=>{for(let t of e)await sT(t.id,t.id,sr);await sk()},onClose:()=>eV(!1)}),tr&&(0,a.jsx)(H,{isOpen:!0,connection:tr,reactive:!0===te[tr.id],schedule:ts[tr.id]||null,onClose:()=>tn(null),onSave:sA}),tp&&(0,a.jsx)(d.uo,{isOpen:!0,onClose:()=>th(!1),onConfirm:()=>{window.localStorage.setItem(t5,"true"),th(!1),tb(null),sG(tf||"oauth")},title:"Risk Notice",message:t7?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),tm&&(0,a.jsx)(d.uo,{isOpen:!0,onClose:()=>{e5||tx(null)},onConfirm:async()=>{if(e5)return;let e=tm?.onConfirm;if(e){e2(!0);try{await e()}finally{e2(!1)}}},title:tm?.title||"Confirm",message:tm?.message,variant:"danger",loading:e5})]}):(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)(l(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}},28915:(e,t,s)=>{"use strict";s.d(t,{x6:()=>a.fetchJson,E2:()=>r,gs:()=>n});var a=s(68211);function r(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}function n(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let a=Math.floor(s/24);return`${a}d ago`}},42911:(e,t,s)=>{Promise.resolve().then(s.bind(s,3362))},68211:(e,t,s)=>{"use strict";s.d(t,{fetchJson:()=>r});let a={"Content-Type":"application/json"};async function r(e,t={}){let{body:s,headers:n,...i}=t,l={...i,headers:{...a,...n}};void 0!==s&&"string"!=typeof s?l.body=JSON.stringify(s):void 0!==s&&(l.body=s);let o=await fetch(e,l),d=await o.text(),c=null;if(d)try{c=JSON.parse(d)}catch{let t=Error(`Non-JSON response from ${e} (HTTP ${o.status})`);throw t.status=o.status,t.rawBody=d.slice(0,300),t}if(!o.ok){let e=c&&(c.error?.message||c.error||c.message)||`Request failed (HTTP ${o.status})`,t=Error("string"==typeof e?e:`HTTP ${o.status}`);throw t.status=o.status,t.data=c,t}return c}r.get=(e,t)=>r(e,{...t,method:"GET"}),r.post=(e,t,s)=>r(e,{...s,method:"POST",body:t}),r.put=(e,t,s)=>r(e,{...s,method:"PUT",body:t}),r.patch=(e,t,s)=>r(e,{...s,method:"PATCH",body:t}),r.del=(e,t)=>r(e,{...t,method:"DELETE"})},81277:(e,t,s)=>{"use strict";s.d(t,{c:()=>n});var a=s(12115),r=s(70217);function n(e={}){let[t,s]=(0,a.useState)(null),i=JSON.stringify(Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).sort(([e],[t])=>e.localeCompare(t)));return(0,a.useEffect)(()=>(function(e,t,s={}){let a=s.now||Date.now,n=s.setTimer||globalThis.setTimeout,i=s.clearTimer||globalThis.clearTimeout,l=!1,o=null,d=()=>{if(o=null,l)return;let s=a(),i=(0,r.G9)(e,s);t(i),i&&(o=n(d,Math.min(Math.max(1,new Date(i).getTime()-s+1),0x7fffffff)))};return o=n(d,0),()=>{l=!0,null!==o&&i(o),o=null}})(Object.fromEntries(JSON.parse(i)),s),[i]),t}}},e=>{e.O(0,[2574,3862,3745,3416,9501,620,5497,8441,3794,7358],()=>e(e.s=42911)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{28915:(e,t,s)=>{"use strict";s.d(t,{x6:()=>r.fetchJson,E2:()=>a,gs:()=>i});var r=s(68211);function a(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}function i(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`}},31703:(e,t,s)=>{Promise.resolve().then(s.bind(s,59123))},59123:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>k});var r=s(95155),a=s(12115),i=s(14051),l=s.n(i),n=s(35497),o=s(57250),d=s(90620),c=s(1791),m=s(98500),p=s.n(m),u=s(28915),x=s(65921),h=s(38003);let f={available:{icon:"check_circle",color:"#22c55e",label:"Available"},cooldown:{icon:"schedule",color:"#f59e0b",label:"Cooldown"},unavailable:{icon:"error",color:"#ef4444",label:"Unavailable"},unknown:{icon:"help",color:"#6b7280",label:"Unknown"}};function g(){let[e,t]=(0,a.useState)(null),[s,i]=(0,a.useState)(!0),[l,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{i(!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 l&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[l]);let h=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=e?.unavailableCount||g.filter(e=>"available"!==e.status).length,v=0===b,y={};return g.forEach(e=>{if("available"===e.status)return;let t=e.provider||"unknown";y[t]||(y[t]=[]),y[t].push(e)}),(0,r.jsxs)("div",{className:"relative",ref:m,children:[(0,r.jsxs)("button",{onClick:()=>o(!l),className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-all ${v?"bg-emerald-500/10 border-emerald-500/20 text-emerald-500 hover:bg-emerald-500/15":"bg-amber-500/10 border-amber-500/20 text-amber-500 hover:bg-amber-500/15"}`,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:v?"verified":"warning"}),v?"All models operational":`${b} model${1!==b?"s":""} with issues`]}),l&&(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:v?"#22c55e":"#f59e0b"},children:v?"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:v?(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(y).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=f[e.status]||f.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:()=>h(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))})})]})]})}var b=s(66430),v=s(40728);let y=[{value:"all",label:"All"},{value:"connected",label:"Connected"},{value:"paused",label:"Paused"},{value:"ready",label:"Ready"},{value:"setup",label:"Needs setup"}];function j(e,t,s){if(e>0)return(0,r.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-[11px] font-medium text-success",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-success"}),e," connected"]});if(t>0){let e=s?`${t} Error (${s})`:`${t} Error`;return(0,r.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-[11px] font-medium text-error",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-error"}),e]})}return(0,r.jsx)("span",{className:"text-[11px] text-text-muted",children:"No connections"})}let N={claude:10,kiro:10,openrouter:10,antigravity:20,"gemini-cli":20,nvidia:20,codex:30,ollama:30,qoder:30,"qoder-cn":30,github:40,opencode:40,vertex:40,cursor:50,gemini:50,"cloudflare-ai":60,poolside:60,nous:65,byteplus:70,kilocode:70,cline:80,"minimax-code":80,"minimax-code-global":80,clinepass:85,"codebuddy-cn":90,"codebuddy-intl":90,kimchi:95,agnes:120,muse:120,glm:140,kimi:170,"grok-cli":275,xai:280,"xiaomi-mimo":290};async function w(e){let t=new AbortController,s=window.setTimeout(()=>t.abort(),8e3);try{let s=await fetch(e,{cache:"no-store",signal:t.signal}),r=null;try{r=await s.json()}catch{r=null}return{response:s,data:r}}finally{window.clearTimeout(s)}}function k(){let[e,t]=(0,a.useState)([]),[s,i]=(0,a.useState)([]),[l,o]=(0,a.useState)(!0),[m,p]=(0,a.useState)(""),[f,j]=(0,a.useState)(1),[k,S]=(0,a.useState)(20),[E,P]=(0,a.useState)(!1),[O,_]=(0,a.useState)(!1),[U,q]=(0,a.useState)(()=>new Set),[z,M]=(0,a.useState)(null),[D,F]=(0,a.useState)("all"),[L,J]=(0,a.useState)({custom:!1,oauth:!1,free:!0,apikey:!0}),K=(0,x.i)(),H=(0,h.C)(e=>e.query),W=(0,h.C)(e=>e.setQuery),B=(0,h.C)(e=>e.unregister);(0,a.useEffect)(()=>()=>B(),[B]),(0,a.useEffect)(()=>{j(1)},[H,k,D]);let Q=e=>!H.trim()||e.toLowerCase().includes(H.trim().toLowerCase()),G=(e,t)=>t.priority??N[e]??999,V=(e,t)=>ei(e,t).connected>0?0:1,X=(e,t)=>[...e].sort(([e,s],[r,a])=>{let i=V(e,t),l=V(r,t);return i!==l?i-l:(s.name||"").localeCompare(a.name||"")}),Z=(e,t,{noAuthFirst:s=!1}={})=>[...e].sort(([e,r],[a,i])=>{let l=G(e,r),n=G(a,i);if(l!==n)return l-n;if(s){let e=Number(!!i.noAuth)-Number(!!r.noAuth);if(e)return e}let o=V(e,t),d=V(a,t);return o!==d?o-d:(r.name||"").localeCompare(i.name||"")});(0,a.useEffect)(()=>{(async()=>{try{p("");let[e,s]=await Promise.allSettled([(0,b.b7)("providers:list",v.t7),w("/api/provider-nodes")]);"fulfilled"===e.status?t(e.value?.connections||[]):(t([]),p("Provider connection stats could not be loaded. The provider catalog is still available.")),"fulfilled"===s.status&&s.value.response.ok?i(s.value.data?.nodes||[]):(i([]),p(e=>e||"Custom provider data could not be loaded. The provider catalog is still available."))}catch(e){console.log("Error fetching data:",e),p("Provider data could not be loaded. The provider catalog is still available.")}finally{o(!1)}})()},[]);let Y=(0,a.useMemo)(()=>{let t=new Map;for(let s of e){let e=s.provider||s.id;t.has(e)||t.set(e,[]),t.get(e).push(s)}return t},[e]),ee=e.length,et=(0,a.useMemo)(()=>e.filter(e=>!1!==e.isActive).length,[e]),es=Y.size,er=Math.max(0,ee-et),ea=ee>0?Math.round(et/ee*100):0,ei=(e,t)=>{let s=Array.isArray(t)?t:[t],r=(Y.get(e)||[]).filter(e=>s.includes(e.authType)),a=r.filter(e=>{let t,s=(t=Object.entries(e).some(([e,t])=>e.startsWith("modelLock_")&&t&&new Date(t).getTime()>Date.now()),"unavailable"!==e.testStatus||t?e.testStatus:"active");return"error"===s||"expired"===s||"unavailable"===s}),i=r.length>0?r.length:0,l=r.length>0?0:a.length,n=r.length,o=n>0&&r.every(e=>!1===e.isActive),d=a.sort((e,t)=>new Date(t.lastErrorAt||0)-new Date(e.lastErrorAt||0))[0];return{connected:i,error:l,total:n,errorCode:d?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=(0,u.E2)(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"}(d):null,errorTime:d?.lastErrorAt?(0,u.gs)(d.lastErrorAt):null,allDisabled:o}},el=(e,t,s)=>{var r;return r=ei(e,s),"all"===D||("connected"===D?(r?.connected||0)>0:"paused"===D?r?.allDisabled===!0:"ready"===D?0===(r?.connected||0)&&t?.noAuth===!0:0===(r?.connected||0)&&t?.noAuth!==!0)},en=e=>{J(t=>({...t,[e]:!t[e]}))},eo=async(s,r,a)=>{let i=e.filter(e=>e.provider===s&&e.authType===r);t(e=>e.map(e=>e.provider===s&&e.authType===r?{...e,isActive:a}:e));let l=(await Promise.allSettled(i.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:a})}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e})))).filter(e=>"rejected"===e.status).length;l>0?(t(e=>e.map(e=>e.provider===s&&e.authType===r?{...e,isActive:!a}:e)),K.error(`Failed to update ${l} connection${l>1?"s":""} — reverted`)):(0,b.au)("providers:list")},ed=async(e,t=null)=>{let s="provider"===e?t:e;if(s){q(e=>new Set(e).add(s)),M(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(M(r),r.summary){let{passed:e,failed:t,total:s}=r.summary;0===t?K.success(`All ${s} tests passed`):K.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){M({error:"Test request failed"}),K.error("Provider test failed")}finally{q(e=>{let t=new Set(e);return t.delete(s),t})}}},ec=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=>Q(e.name)&&el(e.id,e,"apikey")),em=s.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"})).filter(e=>Q(e.name)&&el(e.id,e,"apikey")),ep=e=>(e.serviceKinds??["llm"]).includes("llm"),eu=Z(Object.entries(d.zN).filter(([e,t])=>{let s=t?.authModes?.includes("apikey")?["oauth","apikey"]:"oauth";return!t.hidden&&Q(t.name)&&el(e,t,s)}),"oauth"),ex=Object.entries(c.IS).filter(([e,t])=>{let s=Array.isArray(t?.authModes)&&t.authModes.includes("apikey");return!t.hidden&&Q(t.name)&&el(e,t,s?["oauth","apikey"]:"oauth")}).sort(([,e],[,t])=>Number(!!t.noAuth)-Number(!!e.noAuth)),eh=Z(Object.entries(c.nJ).filter(([e,t])=>!t.hidden&&ep(t)&&Q(t.name)&&el(e,t,t?.authModes?.includes("oauth")?["oauth","apikey"]:"apikey")),"apikey",{noAuthFirst:!0}),ef=X(Object.entries(d.fg).filter(([e,t])=>!t.hidden&&(t.serviceKinds??["llm"]).includes("llm")&&Q(t.name)&&el(e,t,"apikey")),"apikey"),eg=X(Object.entries(c.br).filter(([e,t])=>!t.hidden&&ep(t)&&Q(t.name)&&el(e,t,"cookie")),"cookie"),eb=Math.min(f,Math.max(1,Math.ceil(ef.length/k))),ev=ef.slice((eb-1)*k,eb*k);if(l)return(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(n.Qv,{}),(0,r.jsx)(n.Qv,{})]});let ey=eu.length>0||ex.length>0||eh.length>0||ef.length>0||eg.length>0||ec.length>0||em.length>0,ej=ec.length>0||em.length>0||"all"===D&&!H.trim();return(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[ee>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border bg-surface/80 shadow-sm",children:(0,r.jsxs)("div",{className:"grid grid-cols-3 divide-x divide-y divide-border-subtle sm:grid-cols-4 sm:divide-y-0",children:[(0,r.jsxs)("div",{className:"col-span-3 flex items-center gap-3 px-4 py-3 sm:col-span-1",children:[(0,r.jsx)("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary/[0.08] text-primary",children:(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined",style:{fontSize:18},children:"dns"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[11px] font-medium text-text-muted",children:"Connection health"}),(0,r.jsxs)("p",{className:"mt-0.5 text-sm font-semibold tabular-nums text-text-main",children:[ea,"% active"]})]})]}),(0,r.jsxs)("div",{className:"px-4 py-3",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium text-text-muted",children:"Connections"}),(0,r.jsx)("p",{className:"mt-0.5 text-lg font-semibold tabular-nums text-text-main",children:ee})]}),(0,r.jsxs)("div",{className:"px-4 py-3",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium text-text-muted",children:"Active"}),(0,r.jsxs)("div",{className:"mt-0.5 flex items-baseline gap-2",children:[(0,r.jsx)("p",{className:"text-lg font-semibold tabular-nums text-success",children:et}),er>0&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:[er," paused"]})]})]}),(0,r.jsxs)("div",{className:"px-4 py-3",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium text-text-muted",children:"Providers"}),(0,r.jsx)("p",{className:"mt-0.5 text-lg font-semibold tabular-nums text-info",children:es})]})]})}),m&&(0,r.jsx)(n.Gi,{tone:"warning",title:"Some provider status is unavailable",children:m}),(0,r.jsxs)(n.i5,{label:"Provider search and filters",children:[(0,r.jsx)(n.pd,{"aria-label":"Search providers",icon:"search",placeholder:"Search providers...",value:H,onChange:e=>W(e.target.value),className:"w-full sm:min-w-56 sm:max-w-72",inputClassName:"h-11 sm:h-9"}),(0,r.jsx)("div",{className:"flex w-full min-w-0 gap-1 overflow-x-auto rounded-xl bg-bg/70 p-1 [scrollbar-width:none] sm:w-auto [&::-webkit-scrollbar]:hidden",children:y.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>{F(e.value),j(1),J({custom:!1,oauth:!1,free:!1,apikey:!1})},"aria-pressed":D===e.value,className:`flex h-11 flex-1 items-center justify-center whitespace-nowrap rounded-lg px-3 text-xs font-medium transition-colors sm:h-8 sm:flex-none sm:px-3 ${D===e.value?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-black/5 hover:text-text-main dark:hover:bg-white/5"}`,children:e.label},e.value))})]}),!ey&&(0,r.jsx)(n.pp,{icon:"search_off",title:H.trim()?"No providers match your search":"No providers match this filter",description:"Adjust the search or status filter to see more providers.",action:(0,r.jsx)(n.$n,{variant:"secondary",onClick:()=>{W(""),F("all")},children:"Clear filters"})}),ej&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(C,{icon:"extension",title:"Custom Providers",description:"OpenAI and Anthropic-compatible endpoints",count:ec.length+em.length,collapsed:L.custom&&!H.trim(),onToggle:()=>en("custom"),children:(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:()=>_(!0),className:"min-h-11 w-full sm:min-h-0 sm:w-auto",children:"Add Anthropic Compatible"}),(0,r.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"add",onClick:()=>P(!0),className:"min-h-11 w-full sm:min-h-0 sm:w-auto",children:"Add OpenAI Compatible"})]})}),(0,r.jsx)("div",{className:L.custom&&!H.trim()?"hidden sm:block":"",children:0===ec.length&&0===em.length?(0,r.jsxs)("div",{className:"flex items-center gap-3 rounded-xl border border-dashed border-border bg-surface/45 px-4 py-3 text-text-muted",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-[18px]",children:"add_link"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-text-main",children:"No custom endpoints yet"}),(0,r.jsx)("p",{className:"mt-0.5 text-xs",children:"Add an OpenAI or Anthropic-compatible endpoint when you need one."})]})]}):(0,r.jsx)("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3 xl:grid-cols-4",children:[...ec,...em].map(e=>(0,r.jsx)(A,{providerId:e.id,provider:e,stats:ei(e.id,"apikey"),onToggle:t=>eo(e.id,"apikey",t)},e.id))})})]}),eu.length>0&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(C,{icon:"passkey",title:"OAuth Providers",description:"Connect existing provider accounts securely",count:eu.length,collapsed:L.oauth&&!H.trim(),onToggle:()=>en("oauth"),children:(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)(g,{}),(0,r.jsxs)("button",{onClick:()=>ed("oauth"),disabled:U.has("oauth"),className:`flex h-11 w-full items-center justify-center gap-1.5 rounded-xl border px-3 text-xs font-medium transition-colors sm:h-8 sm:w-auto sm:rounded-lg ${U.has("oauth")?"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]${U.has("oauth")?" animate-spin":""}`,children:"play_arrow"}),U.has("oauth")?"Testing...":"Test All"]})]})}),(0,r.jsx)("div",{className:`${L.oauth&&!H.trim()?"hidden sm:grid":"grid"} grid-cols-1 gap-2.5 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3 xl:grid-cols-4`,children:eu.map(([e,t])=>{let s=t?.authModes?.includes("apikey")?["oauth","apikey"]:"oauth";return(0,r.jsx)(T,{providerId:e,provider:t,stats:ei(e,s),onToggle:t=>eo(e,"oauth",t)},e)})})]}),(ex.length>0||eh.length>0)&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(C,{icon:"savings",title:"Free Tier Providers",description:"Ready-to-use and free-tier routing options",count:ex.length+eh.length,collapsed:L.free&&!H.trim(),onToggle:()=>en("free"),children:(0,r.jsxs)("button",{onClick:()=>ed("free"),disabled:U.has("free"),className:`flex h-11 w-full items-center justify-center gap-1.5 rounded-xl border px-3 text-xs font-medium transition-colors sm:h-8 sm:w-auto sm:rounded-lg ${U.has("free")?"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]${U.has("free")?" animate-spin":""}`,children:"play_arrow"}),U.has("free")?"Testing...":"Test All"]})}),(0,r.jsxs)("div",{className:`${L.free&&!H.trim()?"hidden sm:grid":"grid"} grid-cols-1 gap-2.5 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3 xl:grid-cols-4`,children:[ex.map(([e,t])=>{let s=Array.isArray(t?.authModes)&&t.authModes.includes("apikey");return(0,r.jsx)(T,{providerId:e,provider:t,stats:ei(e,s?["oauth","apikey"]:"oauth"),onToggle:t=>eo(e,s?"apikey":"oauth",t)},e)}),eh.map(([e,t])=>(0,r.jsx)(A,{providerId:e,provider:t,stats:ei(e,"apikey"),onToggle:t=>eo(e,"apikey",t)},e))]})]}),(ef.length>0||eg.length>0)&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(C,{icon:"key",title:"API Key Providers",description:"Bring your own provider credentials",count:ef.length+eg.length,collapsed:L.apikey&&!H.trim(),onToggle:()=>en("apikey"),children:(0,r.jsxs)("button",{onClick:()=>ed("apikey"),disabled:U.has("apikey"),className:`flex h-11 w-full items-center justify-center gap-1.5 rounded-xl border px-3 text-xs font-medium transition-colors sm:h-8 sm:w-auto sm:rounded-lg ${U.has("apikey")?"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]${U.has("apikey")?" animate-spin":""}`,children:"play_arrow"}),U.has("apikey")?"Testing...":"Test All"]})}),(0,r.jsxs)("div",{className:`${L.apikey&&!H.trim()?"hidden sm:grid":"grid"} grid-cols-1 gap-2.5 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3 xl:grid-cols-4`,children:[ev.map(([e,t])=>(0,r.jsx)(A,{providerId:e,provider:t,stats:ei(e,"apikey"),onToggle:t=>eo(e,"apikey",t)},e)),eg.map(([e,t])=>(0,r.jsx)(A,{providerId:e,provider:t,stats:ei(e,"cookie"),onToggle:t=>eo(e,"cookie",t)},e))]}),ef.length>0&&(0,r.jsx)("div",{className:L.apikey&&!H.trim()?"hidden sm:block":"",children:(0,r.jsx)(n.dK,{currentPage:eb,pageSize:k,totalItems:ef.length,onPageChange:j,onPageSizeChange:e=>{S(e),j(1)}})})]}),(0,r.jsx)($,{isOpen:E,onClose:()=>P(!1),onCreated:e=>{i(t=>[...t,e]),P(!1)}}),(0,r.jsx)(I,{isOpen:O,onClose:()=>_(!1),onCreated:e=>{i(t=>[...t,e]),_(!1)}}),z&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center px-3 pt-[6vh] sm:pt-[10vh]",onClick:()=>M(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:()=>M(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)(R,{results:z})})]})]})]})}function C({icon:e,title:t,description:s,count:a,collapsed:i,onToggle:l,children:n}){return(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("div",{className:"flex w-full min-w-0 items-center gap-2.5 sm:w-auto",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 sm:flex-none",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/[0.08] text-[17px] text-primary",children:e}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h2",{className:"truncate text-lg font-semibold leading-tight",children:t}),(0,r.jsx)("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold tabular-nums text-text-muted",children:a})]}),(0,r.jsx)("p",{className:"mt-0.5 truncate text-[11px] text-text-muted sm:text-xs",children:s})]})]}),(0,r.jsx)("button",{type:"button",onClick:l,className:"flex size-11 shrink-0 items-center justify-center rounded-xl border border-border text-text-muted transition-colors hover:border-primary/30 hover:text-primary sm:hidden","aria-expanded":!i,"aria-label":`${i?"Expand":"Collapse"} ${t}`,children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:i?"expand_more":"expand_less"})})]}),n&&(0,r.jsx)("div",{className:i?"hidden sm:block":"block",children:n})]})}function T({providerId:e,provider:t,stats:s,onToggle:a}){let{connected:i,error:l,errorCode:d,allDisabled:c}=s,m=!!t.noAuth;return(0,r.jsx)("div",{className:"group min-w-0",children:(0,r.jsx)(n.Zp,{padding:"none",className:`relative h-[76px] min-h-[76px] cursor-pointer overflow-hidden transition-[border-color,box-shadow,opacity] group-hover:border-primary/30 group-hover:shadow-[0_10px_26px_-22px_rgba(229,106,74,0.55)] sm:h-[78px] sm:min-h-[78px] ${c?"opacity-55":""}`,children:(0,r.jsxs)("div",{className:"flex h-full min-w-0 items-center justify-between gap-2.5 p-3",children:[(0,r.jsxs)(p(),{href:`/dashboard/providers/${e}`,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",children:[(0,r.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg ring-1 ring-black/[0.04] dark:ring-white/[0.06]",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,r.jsx)(o.A,{src:`/providers/${t.id}.png`,alt:"",size:28,className:"max-h-7 max-w-7 rounded-md object-contain",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 text-sm font-semibold text-text-main",children:t.name}),(0,r.jsx)("div",{className:"mt-1 flex min-w-0 items-center overflow-hidden whitespace-nowrap",children:c?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] text-text-muted",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[13px]",children:"pause_circle"}),"Disabled"]}):m?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-medium text-success",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full bg-success"}),"Ready"]}):j(i,l,d)})]})]}),(0,r.jsxs)("div",{className:"hidden shrink-0 items-center gap-2 sm:flex",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(),a(!!c)},children:(0,r.jsx)(n.lM,{size:"sm",touchTarget:!0,checked:!c,onChange:()=>{},title:c?"Enable provider":"Disable provider"})}),(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[17px] text-text-subtle transition-[transform,color] group-hover:translate-x-0.5 group-hover:text-primary",children:"chevron_right"})]}),(0,r.jsx)(S,{providerId:e,hasConnections:s.total>0,active:!c,onToggle:a})]})})})}function A({providerId:e,provider:t,stats:s,onToggle:a}){let{connected:i,error:l,errorCode:d,allDisabled:m}=s,u=e.startsWith(c.JH),x=e.startsWith(c.DI);return(0,r.jsx)("div",{className:"group min-w-0",children:(0,r.jsx)(n.Zp,{padding:"none",className:`relative h-[76px] min-h-[76px] cursor-pointer overflow-hidden transition-[border-color,box-shadow,opacity] group-hover:border-primary/30 group-hover:shadow-[0_10px_26px_-22px_rgba(229,106,74,0.55)] sm:h-[78px] sm:min-h-[78px] ${m?"opacity-55":""}`,children:(0,r.jsxs)("div",{className:"flex h-full min-w-0 items-center justify-between gap-2.5 p-3",children:[(0,r.jsxs)(p(),{href:`/dashboard/providers/${e}`,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",children:[(0,r.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg ring-1 ring-black/[0.04] dark:ring-white/[0.06]",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,r.jsx)(o.A,{src:u?"responses"===t.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":x?"/providers/anthropic-m.png":`/providers/${t.id}.png`,alt:"",size:28,className:"max-h-7 max-w-7 rounded-md object-contain",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 text-sm font-semibold text-text-main",children:t.name}),(0,r.jsx)("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap",children:m?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] text-text-muted",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[13px]",children:"pause_circle"}),"Disabled"]}):(0,r.jsxs)(r.Fragment,{children:[j(i,l,d),u&&(0,r.jsxs)("span",{className:"text-[10px] text-text-subtle",children:["\xb7 ","responses"===t.apiType?"Responses":"Chat"]}),x&&(0,r.jsx)("span",{className:"text-[10px] text-text-subtle",children:"\xb7 Messages"})]})})]})]}),(0,r.jsxs)("div",{className:"hidden shrink-0 items-center gap-2 sm:flex",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(),a(!!m)},children:(0,r.jsx)(n.lM,{size:"sm",touchTarget:!0,checked:!m,onChange:()=>{},title:m?"Enable provider":"Disable provider"})}),(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[17px] text-text-subtle transition-[transform,color] group-hover:translate-x-0.5 group-hover:text-primary",children:"chevron_right"})]}),(0,r.jsx)(S,{providerId:e,hasConnections:s.total>0,active:!m,onToggle:a})]})})})}function S({providerId:e,hasConnections:t,active:s,onToggle:i}){let[l,n]=(0,a.useState)(!1),o=(0,a.useRef)(null),d=(0,a.useId)();return(0,a.useEffect)(()=>{if(!l)return;let e=e=>{"Escape"!==e.key&&o.current?.contains(e.target)||n(!1)};return document.addEventListener("keydown",e),document.addEventListener("pointerdown",e),()=>{document.removeEventListener("keydown",e),document.removeEventListener("pointerdown",e)}},[l]),(0,r.jsxs)("div",{ref:o,className:"relative shrink-0 sm:hidden",children:[(0,r.jsx)("button",{type:"button","aria-label":"Provider actions","aria-expanded":l,"aria-controls":d,onClick:()=>n(e=>!e),className:"grid size-11 place-items-center rounded-xl text-text-muted transition-colors hover:bg-surface-2 hover:text-text-main focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",children:(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined",children:"more_vert"})}),l&&(0,r.jsxs)("div",{id:d,className:"absolute right-0 top-full z-20 mt-1 w-48 overflow-hidden rounded-xl border border-border bg-surface p-1 shadow-[var(--shadow-elev)]",children:[(0,r.jsxs)(p(),{href:`/dashboard/providers/${e}`,className:"flex min-h-11 items-center gap-2 rounded-lg px-3 text-sm text-text-main hover:bg-surface-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[18px]",children:"arrow_forward"}),"Open provider"]}),t&&(0,r.jsxs)("button",{type:"button",onClick:()=>{i(!s),n(!1)},className:"flex min-h-11 w-full items-center gap-2 rounded-lg px-3 text-left text-sm text-text-main hover:bg-surface-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[18px]",children:s?"pause_circle":"play_circle"}),s?"Disable provider":"Enable provider"]})]})]})}function $({isOpen:e,onClose:t,onCreated:s}){let[i,l]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[o,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)(""),[p,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(null),[b,v]=(0,a.useState)("");(0,a.useEffect)(()=>{let e="https://api.openai.com/v1";l(t=>t.baseUrl&&t.baseUrl!==e?t:{...t,baseUrl:e})},[i.apiType]);let y=async()=>{if(i.name.trim()&&i.prefix.trim()&&i.baseUrl.trim()){d(!0),v("");try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i.name,prefix:i.prefix,apiType:i.apiType,baseUrl:i.baseUrl,type:"openai-compatible"})}),t=await e.json().catch(()=>({}));e.ok?(s(t.node),l({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),m(""),g(null)):v(t?.error||`Failed to create node (HTTP ${e.status})`)}catch(e){console.log("Error creating OpenAI Compatible node:",e),v("Network error — could not create the node")}finally{d(!1)}}},j=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:i.baseUrl,apiKey:c,type:"openai-compatible",modelId:p.trim()||void 0})}),t=await e.json();g(t)}catch{g({valid:!1,error:"Network error"})}finally{h(!1)}};return(0,r.jsx)(n.aF,{isOpen:e,title:"Add OpenAI Compatible",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(n.pd,{label:"Name",value:i.name,onChange:e=>l({...i,name:e.target.value}),placeholder:"OpenAI Compatible (Prod)",hint:"Required. A friendly label for this node."}),(0,r.jsx)(n.pd,{label:"Prefix",value:i.prefix,onChange:e=>l({...i,prefix:e.target.value}),placeholder:"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),(0,r.jsx)(n.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:i.apiType,onChange:e=>l({...i,apiType:e.target.value})}),(0,r.jsx)(n.pd,{label:"Base URL",value:i.baseUrl,onChange:e=>l({...i,baseUrl:e.target.value}),placeholder:"https://api.openai.com/v1",hint:"Use the base URL (ending in /v1) for your OpenAI-compatible API."}),(0,r.jsx)(n.pd,{label:"API Key (for Check)",type:"password",value:c,onChange:e=>m(e.target.value)}),(0,r.jsx)(n.pd,{label:"Model ID (optional)",value:p,onChange:e=>u(e.target.value),placeholder:"e.g. gpt-4, claude-3-opus",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),b&&(0,r.jsx)("p",{className:"text-sm text-red-500 break-words",children:b}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,r.jsx)(n.$n,{onClick:j,disabled:!c||x||!i.baseUrl.trim(),variant:"secondary",className:"w-full sm:w-auto",children:x?"Checking...":"Check"}),(()=>{if(!f)return null;let{valid:e,error:t,method:s}=f;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:y,fullWidth:!0,disabled:!i.name.trim()||!i.prefix.trim()||!i.baseUrl.trim()||o,children:o?"Creating...":"Create"}),(0,r.jsx)(n.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function I({isOpen:e,onClose:t,onCreated:s}){let[i,l]=(0,a.useState)({name:"",prefix:"",baseUrl:"https://api.anthropic.com/v1"}),[o,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)(""),[p,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(null),[b,v]=(0,a.useState)("");(0,a.useEffect)(()=>{e&&(g(null),m(""),u(""),v(""))},[e]);let y=async()=>{if(i.name.trim()&&i.prefix.trim()&&i.baseUrl.trim()){d(!0),v("");try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i.name,prefix:i.prefix,baseUrl:i.baseUrl,type:"anthropic-compatible"})}),t=await e.json().catch(()=>({}));e.ok?(s(t.node),l({name:"",prefix:"",baseUrl:"https://api.anthropic.com/v1"}),m(""),g(null)):v(t?.error||`Failed to create node (HTTP ${e.status})`)}catch(e){console.log("Error creating Anthropic Compatible node:",e),v("Network error — could not create the node")}finally{d(!1)}}},j=async()=>{h(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:i.baseUrl,apiKey:c,type:"anthropic-compatible",modelId:p.trim()||void 0})}),t=await e.json();g(t)}catch{g({valid:!1,error:"Network error"})}finally{h(!1)}};return(0,r.jsx)(n.aF,{isOpen:e,title:"Add Anthropic Compatible",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(n.pd,{label:"Name",value:i.name,onChange:e=>l({...i,name:e.target.value}),placeholder:"Anthropic Compatible (Prod)",hint:"Required. A friendly label for this node."}),(0,r.jsx)(n.pd,{label:"Prefix",value:i.prefix,onChange:e=>l({...i,prefix:e.target.value}),placeholder:"ac-prod",hint:"Required. Used as the provider prefix for model IDs."}),(0,r.jsx)(n.pd,{label:"Base URL",value:i.baseUrl,onChange:e=>l({...i,baseUrl:e.target.value}),placeholder:"https://api.anthropic.com/v1",hint:"Use the base URL (ending in /v1) for your Anthropic-compatible API. The system will append /messages."}),(0,r.jsx)(n.pd,{label:"API Key (for Check)",type:"password",value:c,onChange:e=>m(e.target.value)}),(0,r.jsx)(n.pd,{label:"Model ID (optional)",value:p,onChange:e=>u(e.target.value),placeholder:"e.g. claude-3-opus",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),b&&(0,r.jsx)("p",{className:"text-sm text-red-500 break-words",children:b}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,r.jsx)(n.$n,{onClick:j,disabled:!c||x||!i.baseUrl.trim(),variant:"secondary",className:"w-full sm:w-auto",children:x?"Checking...":"Check"}),(()=>{if(!f)return null;let{valid:e,error:t,method:s}=f;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:y,fullWidth:!0,disabled:!i.name.trim()||!i.prefix.trim()||!i.baseUrl.trim()||o,children:o?"Creating...":"Create"}),(0,r.jsx)(n.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function R({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-red-500 text-[32px] mb-2 block",children:"error"}),(0,r.jsx)("p",{className:"text-sm text-red-400",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-emerald-500/15 text-emerald-400 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-red-400 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-red-500"}`,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,")"]}),!e.valid&&(e.diagnosis?.message||e.error)&&(0,r.jsx)("span",{className:"block truncate text-[11px] text-red-400/90",title:String(e.diagnosis?.message||e.error),children:String(e.diagnosis?.message||e.error)})]}),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-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:e.valid?"OK":e.diagnosis?.type||"ERROR"})]},e.connectionId||t)),0===a.length&&(0,r.jsx)("div",{className:"text-center py-4 text-text-muted text-sm",children:"No active connections found for this group."})]})}C.propTypes={icon:l().string.isRequired,title:l().string.isRequired,description:l().string.isRequired,count:l().number.isRequired,collapsed:l().bool.isRequired,onToggle:l().func.isRequired,children:l().node},T.propTypes={providerId:l().string.isRequired,provider:l().shape({id:l().string.isRequired,name:l().string.isRequired,color:l().string,textIcon:l().string}).isRequired,stats:l().shape({connected:l().number,error:l().number,errorCode:l().string,errorTime:l().string,total:l().number,allDisabled:l().bool}).isRequired,onToggle:l().func},S.propTypes={providerId:l().string.isRequired,hasConnections:l().bool.isRequired,active:l().bool.isRequired,onToggle:l().func.isRequired},A.propTypes={providerId:l().string.isRequired,provider:l().shape({id:l().string.isRequired,name:l().string.isRequired,color:l().string,textIcon:l().string,apiType:l().string}).isRequired,stats:l().shape({connected:l().number,error:l().number,errorCode:l().string,errorTime:l().string,total:l().number,allDisabled:l().bool}).isRequired,onToggle:l().func},$.propTypes={isOpen:l().bool.isRequired,onClose:l().func.isRequired,onCreated:l().func.isRequired},I.propTypes={isOpen:l().bool.isRequired,onClose:l().func.isRequired,onCreated:l().func.isRequired},R.propTypes={results:l().shape({mode:l().string,results:l().array,summary:l().shape({total:l().number,passed:l().number,failed:l().number}),error:l().string}).isRequired}},68211:(e,t,s)=>{"use strict";s.d(t,{fetchJson:()=>a});let r={"Content-Type":"application/json"};async function a(e,t={}){let{body:s,headers:i,...l}=t,n={...l,headers:{...r,...i}};void 0!==s&&"string"!=typeof s?n.body=JSON.stringify(s):void 0!==s&&(n.body=s);let o=await fetch(e,n),d=await o.text(),c=null;if(d)try{c=JSON.parse(d)}catch{let t=Error(`Non-JSON response from ${e} (HTTP ${o.status})`);throw t.status=o.status,t.rawBody=d.slice(0,300),t}if(!o.ok){let e=c&&(c.error?.message||c.error||c.message)||`Request failed (HTTP ${o.status})`,t=Error("string"==typeof e?e:`HTTP ${o.status}`);throw t.status=o.status,t.data=c,t}return c}a.get=(e,t)=>a(e,{...t,method:"GET"}),a.post=(e,t,s)=>a(e,{...s,method:"POST",body:t}),a.put=(e,t,s)=>a(e,{...s,method:"PUT",body:t}),a.patch=(e,t,s)=>a(e,{...s,method:"PATCH",body:t}),a.del=(e,t)=>a(e,{...t,method:"DELETE"})}},e=>{e.O(0,[2574,3862,3745,3416,9501,620,5497,8441,3794,7358],()=>e(e.s=31703)),_N_E=e.O()}]);