@synthever/jrouter 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (630) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +11 -11
  3. package/app/.next-cli-build/build-manifest.json +3 -3
  4. package/app/.next-cli-build/prerender-manifest.json +19 -19
  5. package/app/.next-cli-build/react-loadable-manifest.json +4 -4
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/health/page.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/health/page.js.nft.json +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +2 -2
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page.js +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page.js.nft.json +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  78. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  79. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  80. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  81. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  82. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  83. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  84. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  85. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  86. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  87. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  88. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  89. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  90. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  91. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  92. package/app/.next-cli-build/server/app/_not-found.rsc +5 -5
  93. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +5 -5
  94. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -5
  95. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  96. package/app/.next-cli-build/server/app/api/auth/login/route.js +1 -1
  97. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  98. package/app/.next-cli-build/server/app/api/auth/logout/route.js +1 -1
  99. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  100. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js +1 -1
  101. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js +1 -1
  103. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  104. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js +1 -1
  105. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js +1 -1
  107. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js +1 -1
  109. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js +1 -1
  111. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js +1 -1
  113. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js +1 -1
  115. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/auth/status/route.js +1 -1
  117. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +1 -1
  131. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
  134. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  136. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +1 -1
  138. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
  140. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +1 -1
  144. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +1 -1
  146. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +1 -1
  152. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  155. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +1 -1
  157. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +1 -1
  159. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
  161. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/combos/presets/route.js +1 -1
  163. package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/combos/route.js +1 -1
  165. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js +1 -1
  168. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/headroom/restart/route.js +1 -1
  170. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/headroom/start/route.js +1 -1
  172. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/headroom/status/route.js +1 -1
  174. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  175. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/keys/[id]/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/keys/[id]/secret/route.js +1 -1
  181. package/app/.next-cli-build/server/app/api/keys/[id]/secret/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/keys/route.js +1 -1
  183. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  184. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  186. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
  188. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  190. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
  192. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js +1 -1
  194. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  196. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/model-health/check/route.js +2 -2
  198. package/app/.next-cli-build/server/app/api/model-health/check/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/model-health/check-all/route.js +2 -2
  200. package/app/.next-cli-build/server/app/api/model-health/check-all/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/model-health/config/route.js +2 -2
  202. package/app/.next-cli-build/server/app/api/model-health/config/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/model-health/history/route.js +2 -2
  204. package/app/.next-cli-build/server/app/api/model-health/history/route.js.nft.json +1 -1
  205. package/app/.next-cli-build/server/app/api/model-health/model/route.js +2 -2
  206. package/app/.next-cli-build/server/app/api/model-health/model/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/model-health/models/route.js +2 -2
  208. package/app/.next-cli-build/server/app/api/model-health/models/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/model-health/route.js +2 -2
  210. package/app/.next-cli-build/server/app/api/model-health/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/model-health/run-scheduled/route.js +2 -2
  212. package/app/.next-cli-build/server/app/api/model-health/run-scheduled/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/model-health/summary/route.js +2 -2
  214. package/app/.next-cli-build/server/app/api/model-health/summary/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/models/alias/route.js +1 -1
  216. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/models/availability/route.js +1 -1
  218. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js +1 -1
  220. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  222. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/models/disabled/route.js +1 -1
  224. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/models/limits/route.js +1 -1
  226. package/app/.next-cli-build/server/app/api/models/limits/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  228. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  230. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  232. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  234. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  236. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  239. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js +1 -1
  241. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js +1 -1
  243. package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js +1 -1
  245. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  247. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  250. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js +1 -1
  252. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  254. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  256. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js +1 -1
  258. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js +1 -1
  264. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/pricing/route.js +1 -1
  266. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js +1 -1
  268. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  270. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js +1 -1
  272. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/providers/[id]/connections/keys/route.js +1 -1
  274. package/app/.next-cli-build/server/app/api/providers/[id]/connections/keys/route.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  276. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  277. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js +1 -1
  278. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
  279. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  280. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  281. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  282. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  283. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  284. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  286. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  288. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  289. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  290. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js +1 -1
  291. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  292. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  293. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  294. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  295. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  296. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js +1 -1
  297. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  298. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js +1 -1
  299. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  300. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js +2 -2
  301. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  302. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js +1 -1
  303. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  304. package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js +1 -1
  305. package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js.nft.json +1 -1
  306. package/app/.next-cli-build/server/app/api/proxy-pools/route.js +1 -1
  307. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  308. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js +1 -1
  309. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  310. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  311. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  312. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  313. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  314. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js +1 -1
  315. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  316. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  317. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js +1 -1
  318. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  319. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  320. package/app/.next-cli-build/server/app/api/settings/database/route.js +1 -1
  321. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  322. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  323. package/app/.next-cli-build/server/app/api/settings/require-login/route.js +1 -1
  324. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  325. package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  326. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  327. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  328. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  329. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  330. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  331. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
  332. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  333. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  334. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  335. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  336. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  337. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  338. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  339. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js +1 -1
  340. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  341. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js +1 -1
  342. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  343. package/app/.next-cli-build/server/app/api/tunnel/status/route.js +1 -1
  344. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  345. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js +1 -1
  346. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  347. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js +1 -1
  348. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  349. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js +1 -1
  350. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  351. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +1 -1
  352. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  353. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  354. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
  355. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  356. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  357. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  358. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  359. package/app/.next-cli-build/server/app/api/usage/chart/route.js +1 -1
  360. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  361. package/app/.next-cli-build/server/app/api/usage/history/route.js +1 -1
  362. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  363. package/app/.next-cli-build/server/app/api/usage/logs/route.js +1 -1
  364. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  365. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  366. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  367. package/app/.next-cli-build/server/app/api/usage/request-details/route.js +1 -1
  368. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  369. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js +1 -1
  370. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  371. package/app/.next-cli-build/server/app/api/usage/stats/route.js +1 -1
  372. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  373. package/app/.next-cli-build/server/app/api/usage/stream/route.js +1 -1
  374. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  375. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  376. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  377. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  378. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  379. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  380. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  381. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  382. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  383. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  384. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  385. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  386. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  387. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  388. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  389. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js +1 -1
  390. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  391. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  392. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  393. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js +1 -1
  394. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
  395. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  396. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  397. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  398. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  399. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  400. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  401. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  402. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  403. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  404. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  405. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  406. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  407. package/app/.next-cli-build/server/app/api/v1/systemone/route.js +1 -1
  408. package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
  409. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  410. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  411. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  412. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  413. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  414. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  415. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  416. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  417. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  418. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  419. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  420. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  421. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  422. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  423. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  424. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  425. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  426. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  427. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  428. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  429. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  430. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  431. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  432. package/app/.next-cli-build/server/app/callback.html +1 -1
  433. package/app/.next-cli-build/server/app/callback.rsc +5 -5
  434. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +5 -5
  435. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  436. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +5 -5
  437. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  438. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +7 -7
  439. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +7 -7
  440. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
  441. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  442. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  443. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +7 -7
  444. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +7 -7
  445. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +7 -7
  446. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  447. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  448. package/app/.next-cli-build/server/app/dashboard/combos.rsc +7 -7
  449. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +7 -7
  450. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +7 -7
  451. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  452. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  453. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +7 -7
  454. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +7 -7
  455. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
  456. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  457. package/app/.next-cli-build/server/app/dashboard/health.html +1 -1
  458. package/app/.next-cli-build/server/app/dashboard/health.rsc +6 -6
  459. package/app/.next-cli-build/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk/dashboard/health/__PAGE__.segment.rsc +6 -6
  460. package/app/.next-cli-build/server/app/dashboard/health.segments/_full.segment.rsc +6 -6
  461. package/app/.next-cli-build/server/app/dashboard/health.segments/_tree.segment.rsc +2 -2
  462. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  463. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +7 -7
  464. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +7 -7
  465. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +7 -7
  466. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  467. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  468. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +7 -7
  469. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +7 -7
  470. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +7 -7
  471. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  472. package/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
  473. package/app/.next-cli-build/server/app/dashboard/playground.rsc +7 -7
  474. package/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +7 -7
  475. package/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +7 -7
  476. package/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +2 -2
  477. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  478. package/app/.next-cli-build/server/app/dashboard/profile.rsc +7 -7
  479. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +7 -7
  480. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +7 -7
  481. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  482. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  483. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +7 -7
  484. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +7 -7
  485. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
  486. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  487. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  488. package/app/.next-cli-build/server/app/dashboard/providers.rsc +7 -7
  489. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +7 -7
  490. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +7 -7
  491. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  492. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  493. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +7 -7
  494. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +7 -7
  495. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +7 -7
  496. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  497. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  498. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +7 -7
  499. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +7 -7
  500. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +7 -7
  501. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
  502. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  503. package/app/.next-cli-build/server/app/dashboard/quota.rsc +8 -8
  504. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +8 -8
  505. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +8 -8
  506. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  507. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  508. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  509. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  510. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  511. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +5 -5
  512. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +5 -5
  513. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  514. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +5 -5
  515. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  516. package/app/.next-cli-build/server/app/dashboard/skills.rsc +7 -7
  517. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +7 -7
  518. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +7 -7
  519. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  520. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  521. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +7 -7
  522. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +7 -7
  523. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +7 -7
  524. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
  525. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  526. package/app/.next-cli-build/server/app/dashboard/translator.rsc +7 -7
  527. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +7 -7
  528. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +7 -7
  529. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  530. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  531. package/app/.next-cli-build/server/app/dashboard/usage.rsc +7 -7
  532. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +7 -7
  533. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
  534. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  535. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  536. package/app/.next-cli-build/server/app/dashboard.rsc +6 -6
  537. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +6 -6
  538. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
  539. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  540. package/app/.next-cli-build/server/app/index.html +1 -1
  541. package/app/.next-cli-build/server/app/index.rsc +5 -5
  542. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +5 -5
  543. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +5 -5
  544. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  545. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  546. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  547. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  548. package/app/.next-cli-build/server/app/landing.html +1 -1
  549. package/app/.next-cli-build/server/app/landing.rsc +5 -5
  550. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +5 -5
  551. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  552. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +5 -5
  553. package/app/.next-cli-build/server/app/login/page.js +1 -1
  554. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  555. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  556. package/app/.next-cli-build/server/app/login.html +1 -1
  557. package/app/.next-cli-build/server/app/login.rsc +6 -6
  558. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +6 -6
  559. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  560. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +6 -6
  561. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  562. package/app/.next-cli-build/server/app/page.js +1 -1
  563. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  564. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  565. package/app/.next-cli-build/server/app-paths-manifest.json +11 -11
  566. package/app/.next-cli-build/server/chunks/2318.js +1 -1
  567. package/app/.next-cli-build/server/chunks/2631.js +1 -1
  568. package/app/.next-cli-build/server/chunks/2760.js +1 -17
  569. package/app/.next-cli-build/server/chunks/3360.js +1 -1
  570. package/app/.next-cli-build/server/chunks/3449.js +1 -1
  571. package/app/.next-cli-build/server/chunks/412.js +1 -1
  572. package/app/.next-cli-build/server/chunks/4190.js +1 -1
  573. package/app/.next-cli-build/server/chunks/436.js +1 -1
  574. package/app/.next-cli-build/server/chunks/4406.js +1 -0
  575. package/app/.next-cli-build/server/chunks/455.js +1 -1
  576. package/app/.next-cli-build/server/chunks/4746.js +1 -1
  577. package/app/.next-cli-build/server/chunks/4764.js +1 -1
  578. package/app/.next-cli-build/server/chunks/4827.js +1 -1
  579. package/app/.next-cli-build/server/chunks/4864.js +1 -1
  580. package/app/.next-cli-build/server/chunks/5298.js +17 -0
  581. package/app/.next-cli-build/server/chunks/5563.js +1 -1
  582. package/app/.next-cli-build/server/chunks/5665.js +27 -0
  583. package/app/.next-cli-build/server/chunks/6070.js +1 -1
  584. package/app/.next-cli-build/server/chunks/615.js +1 -1
  585. package/app/.next-cli-build/server/chunks/6296.js +6 -6
  586. package/app/.next-cli-build/server/chunks/6708.js +1 -1
  587. package/app/.next-cli-build/server/chunks/7066.js +1 -1
  588. package/app/.next-cli-build/server/chunks/7247.js +1 -1
  589. package/app/.next-cli-build/server/chunks/735.js +1 -1
  590. package/app/.next-cli-build/server/chunks/7525.js +1 -1
  591. package/app/.next-cli-build/server/chunks/7716.js +1 -1
  592. package/app/.next-cli-build/server/chunks/8126.js +1 -1
  593. package/app/.next-cli-build/server/chunks/8306.js +1 -1
  594. package/app/.next-cli-build/server/chunks/{2524.js → 8451.js} +1 -1
  595. package/app/.next-cli-build/server/chunks/8895.js +1 -1
  596. package/app/.next-cli-build/server/chunks/9032.js +1 -1
  597. package/app/.next-cli-build/server/chunks/9128.js +1 -1
  598. package/app/.next-cli-build/server/chunks/9489.js +1 -1
  599. package/app/.next-cli-build/server/chunks/9906.js +1 -0
  600. package/app/.next-cli-build/server/instrumentation.js +1 -1
  601. package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
  602. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  603. package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
  604. package/app/.next-cli-build/server/middleware.js +10 -10
  605. package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
  606. package/app/.next-cli-build/server/pages/404.html +1 -1
  607. package/app/.next-cli-build/server/pages/500.html +1 -1
  608. package/app/.next-cli-build/static/chunks/{124.2812449f50e38c6c.js → 124.129f13ee23ff9b23.js} +1 -1
  609. package/app/.next-cli-build/static/chunks/1321-e5a456e7ba2447da.js +1 -0
  610. package/app/.next-cli-build/static/chunks/{2435.7dca2c9630249a05.js → 2435.683f65cfb8f79701.js} +2 -2
  611. package/app/.next-cli-build/static/chunks/{5462.75bfd156f9bc4e3b.js → 5462.79bf24eb0584ddda.js} +2 -2
  612. package/app/.next-cli-build/static/chunks/{5497-973a06c94a94aff7.js → 5497-f836574435383a9a.js} +1 -1
  613. package/app/.next-cli-build/static/chunks/6808-10f960f3fc924a76.js +1 -0
  614. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-0616e02f3ff06acd.js → page-87ca193c32e4c066.js} +11 -11
  615. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-0a9dfeb5c4e2b097.js +27 -0
  616. package/app/.next-cli-build/static/chunks/webpack-6a79f0ded38135ba.js +1 -0
  617. package/app/.next-cli-build/static/css/{f0e9ffc68c4f886a.css → 56aa6e7907cd49f9.css} +1 -1
  618. package/app/package.json +1 -1
  619. package/app/public/providers/beatapi.png +0 -0
  620. package/package.json +1 -1
  621. package/app/.next-cli-build/server/chunks/238.js +0 -1
  622. package/app/.next-cli-build/server/chunks/3192.js +0 -27
  623. package/app/.next-cli-build/server/chunks/379.js +0 -1
  624. package/app/.next-cli-build/server/chunks/4642.js +0 -1
  625. package/app/.next-cli-build/static/chunks/1321-9eb7d54c5b900efb.js +0 -1
  626. package/app/.next-cli-build/static/chunks/6808-ed8012b059559430.js +0 -1
  627. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-d2787f11613d3447.js +0 -27
  628. package/app/.next-cli-build/static/chunks/webpack-e582fe7763255be4.js +0 -1
  629. /package/app/.next-cli-build/static/{MDZXE-9g1sq006f6JNky9 → HtObZTtODFj1Lp9h6IeqY}/_buildManifest.js +0 -0
  630. /package/app/.next-cli-build/static/{MDZXE-9g1sq006f6JNky9 → HtObZTtODFj1Lp9h6IeqY}/_ssgManifest.js +0 -0
@@ -1,10 +1,10 @@
1
- (()=>{var a={};a.id=2134,a.ids=[2134],a.modules={643:a=>{"use strict";a.exports=require("node:perf_hooks")},1708:a=>{"use strict";a.exports=require("node:process")},1932:a=>{"use strict";a.exports=require("url")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},6262:(a,b,c)=>{var d=c(30083);a.exports={page:"providers_page__lNQhJ "+d.formScope,toolbar:"providers_toolbar__2pR_g",header:"providers_header__s_NP2",description:"providers_description__zL7w6",filter:"providers_filter__uXyjM",actions:"providers_actions__tZbB3",rowActions:"providers_rowActions__jo8WW",select:"providers_select__qT5m6",panel:"providers_panel__HhfEl",list:"providers_list__Xl0Bx",providerRow:"providers_providerRow__7w53x",modelRow:"providers_modelRow__BaZk7",providerLink:"providers_providerLink__p1_5n",providerIcon:"providers_providerIcon__4Smce",identity:"providers_identity__gc5tm",providerName:"providers_providerName__Q5P80",metadata:"providers_metadata__lljWr",providerAddress:"providers_providerAddress__S_6uZ",status:"providers_status__0o78C",iconButton:"providers_iconButton__wueX2 "+d.iconButton,errorBadge:"providers_errorBadge__39MFD",dialog:"providers_dialog__P87TZ "+d.dialog,success:"providers_success__dL3RB",error:"providers_error__yBcA8",empty:"providers_empty__cy1cY",emptyTitle:"providers_emptyTitle___2E_x",showMore:"providers_showMore__hmFpK",testRow:"providers_testRow__FX937",fieldGroup:"providers_fieldGroup__e_9HL",settingsGroup:"providers_settingsGroup__BKD1U",customHeaderRow:"providers_customHeaderRow__GyQ3r",detailTitle:"providers_detailTitle__uBT1b",detailLink:"providers_detailLink__0O8z2"}},7066:a=>{"use strict";a.exports=require("node:tty")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14985:a=>{"use strict";a.exports=require("dns")},16698:a=>{"use strict";a.exports=require("node:async_hooks")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29423:(a,b,c)=>{Promise.resolve().then(c.bind(c,93110))},30083:a=>{a.exports={dialog:"DashboardControls_dialog__YyPS4",formScope:"DashboardControls_formScope__ID02o",fields:"DashboardControls_fields__IY485",iconButton:"DashboardControls_iconButton__v_EJw",modelPicker:"DashboardControls_modelPicker__BheYV DashboardControls_dialog__YyPS4"}},31185:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>x,handler:()=>z,routeModule:()=>y});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,57529))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,30508))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),q=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),r=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),s=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),t=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),u=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),v={children:["",{children:["(dashboard)",{children:["dashboard",{children:["providers",{children:["[id]",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,93110))),"/root/workspace/JRouter/src/app/(dashboard)/dashboard/providers/[id]/page.js"]}]},{"global-error":[u,"next/dist/client/components/builtin/global-error.js"]},["new"]]},{"global-error":[t,"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[s,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"/root/workspace/JRouter/src/app/(dashboard)/layout.js"],"global-error":[o,"next/dist/client/components/builtin/global-error.js"],"not-found":[p,"next/dist/client/components/builtin/not-found.js"],forbidden:[q,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[r,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]},{layout:[i,"/root/workspace/JRouter/src/app/layout.js"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]}.children,w=(0,e.H)({tree:v,page:"/(dashboard)/dashboard/providers/[id]/page",pathname:"/dashboard/providers/[id]",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),x=w.__next_app__,y=w.routeModule,z=w.handler},31421:a=>{"use strict";a.exports=require("node:child_process")},31886:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>af});var d=c(48249),e=c(21707),f=c(67484),g=c(19099),h=c(2116),i=c.n(h),j=c(81220),k=c(29225),l=c(50412),m=c(92592),n=c(91431),o=c(70552),p=c(18982);c(87592);var q=c(60757);let r=["none","low","medium","high"],s=["none","thinking"],t=["none","low","medium","high","xhigh","max"],u={openai:["none","minimal","low","medium","high","xhigh"],"claude-adaptive":t,"claude-budget":t,"gemini-level":["minimal","low","medium","high"],"gemini-budget":r,zai:s,qwen:r,kimi:["none","low","medium","high","max"],deepseek:["none","high","max"],commandcode:["none","low","medium","high","xhigh","max"],river:["none","low","medium","high","xhigh","max"],minimax:s,hunyuan:r,step:r,nous:r},v=["none","minimal","low","medium","high","xhigh","max"],w=["none","low","medium","high","max"],x=[{pattern:"*gemini-4*",levels:["low","medium","high"]},{pattern:"*claude*4.6*",levels:w},{pattern:"*claude*4-6*",levels:w},{provider:"codex",pattern:"*gpt-6*",levels:v},{provider:"codex",pattern:"*gpt-5.6-sol*",levels:[...v,"ultra"]},{provider:"codex",pattern:"*gpt-5.6-terra*",levels:[...v,"ultra"]},{provider:"codex",pattern:"*gpt-5.6-luna*",levels:v},{pattern:"*codex*",levels:["low","medium","high","xhigh"]},{pattern:"*mimo*v2.6*",levels:["none","low","medium","high","xhigh"]},{pattern:"*mimo*v2.5-pro*",levels:["none","low","medium","high","xhigh"]},{provider:"codebuddy-cn",pattern:"deepseek-v4-pro",levels:["low","high","xhigh"]},{provider:"codebuddy-cn",pattern:"deepseek-v4.1-flash",levels:["low","high","max"]},{pattern:"*deepseek-v4.*",levels:["none","low","medium","high","xhigh","max"]},{provider:"codebuddy-cn",pattern:"glm-5.3",levels:["low","high","max"]},{provider:"codebuddy-cn",pattern:"glm-5.3-flash",levels:["low","high","max"]},{provider:"codebuddy-cn",pattern:"glm-5.2",levels:["high","xhigh"]},{provider:"codebuddy-cn",pattern:"kimi-k2.8-preview",levels:["low","medium","high"]},{provider:"codebuddy-cn",pattern:"hy3",levels:["low","high"]},{provider:"codebuddy-cn",pattern:"hy4-preview",levels:["high"]},{provider:"codebuddy-intl",pattern:"deepseek-v4*",levels:["low","high","xhigh"]},{provider:"minimax-code",pattern:"MiniMax-M3.1*",levels:["low","medium","high","xhigh","max"]},{provider:"minimax-code",pattern:"MiniMax-M3",levels:["none","high"]},{provider:"minimax-code-global",pattern:"MiniMax-M3.1*",levels:["low","medium","high","xhigh","max"]},{provider:"minimax-code-global",pattern:"MiniMax-M3",levels:["none","high"]}];function y(a,b){if("kiro"===a&&null===function(a){if("string"!=typeof a)return null;let b=a.toLowerCase().replace(/-/g,".");if(/(?:^|[/.])gpt[/.]5[/.]6(?:[/.]|$)/.test(b))return"reasoning";if(!b.includes("claude"))return null;let c=function(a){if("string"!=typeof a)return null;let b=a.toLowerCase().replace(/-/g,".").match(/(?:^|[/.])claude(?:[/.][a-z]+)*[/.](\d+)(?:[/.](\d+))?(?:[/.]|$)/);return b?{major:Number(b[1]),minor:void 0===b[2]?null:Number(b[2])}:null}(a);if(!c)return null;let{major:d,minor:e}=c;return d<4||4===d&&(null===e||e<=5||null!==e&&e>=1e3)?null:"output_config"}(b))return null;let c=(0,o.nl)(a,b);if(!c.reasoning)return null;let d=String(b||"").replace(/\([^()]+\)\s*$/,""),e="codex"===a?(0,q.SM)("cx").find(a=>a.id===d)?.thinkingLevels:null,f=x.find(c=>(!c.provider||c.provider===a)&&(0,p.gH)(c.pattern,b)),g=e||f?.levels||u[c.thinkingFormat]||r;return!1===c.thinkingCanDisable&&(g=g.filter(a=>"none"!==a)),g}var z=c(50377),A=c(29476),B=c(99258);function C({customModels:a=[],modelAliases:b={},providerAlias:c,builtInModels:d=[],type:e="llm",includeLegacyAliases:f=!0}){let g=new Set(d.map(a=>a.id)),h=new Set,i=[];for(let b of a){if(!b?.id||b.providerAlias!==c)continue;let a=b?.kind||b?.type||"llm";if(e&&a!==e||g.has(b.id))continue;let d=`${c}/${b.id}`;h.has(d)||(h.add(d),i.push({id:b.id,name:b.name||b.id,fullModel:d,source:"custom",type:a}))}if(!f)return i;let j=`${c}/`;for(let[a,c]of Object.entries(b||{})){if("string"!=typeof c||!c.startsWith(j))continue;let b=c.slice(j.length);!b||g.has(b)||h.has(c)||(h.add(c),i.push({id:b,alias:a,fullModel:c,source:"legacyAlias",type:e||"llm"}))}return i}var D=c(49885),E=c.n(D);function F({model:a,fullModel:b,alias:c,copied:f,onCopy:g,testStatus:h,isCustom:i,isFree:j,onDeleteAlias:k,onTest:m,isTesting:n,onDisable:o,caps:p,thinkingSuffix:q}){let r=q?`${b}(${q})`:b,s="ok"===h?"#22c55e":"error"===h?"#ef4444":void 0;return(0,d.jsx)("div",{className:`group w-full sm:w-auto min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===h?"border-green-500/40":"error"===h?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,d.jsx)(e.default,{className:"shrink-0 text-base mt-0.5 sm:mt-0",style:s?{color:s}:void 0,children:"ok"===h?"check_circle":"error"===h?"cancel":"smart_toy"}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,d.jsx)("code",{className:"w-fit max-w-full break-all rounded bg-sidebar px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px] sm:truncate",children:r}),(0,d.jsxs)("span",{className:"flex min-w-0 items-center text-[9px] gap-1 pl-1",children:[a.name&&(0,d.jsx)("span",{className:"break-all sm:truncate text-[9px] italic text-text-muted/70",children:a.name}),(0,d.jsx)(l.nh,{caps:p,colorOverride:"text-text-muted/70",size:12})]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 sm:gap-1",children:[m&&(0,d.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,d.jsx)("button",{onClick:m,disabled:n,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${n?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,d.jsx)(e.default,{className:"text-sm",style:n?{animation:"spin 1s linear infinite"}:void 0,children:n?"progress_activity":"science"})}),(0,d.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:n?"Testing...":"Test"})]}),(0,d.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,d.jsx)("button",{onClick:()=>g(r,`model-${a.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,d.jsx)(e.default,{className:"text-sm",children:f===`model-${a.id}`?"check":"content_copy"})}),(0,d.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:f===`model-${a.id}`?"Copied!":"Copy"})]}),i?(0,d.jsx)("button",{onClick:k,className:"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,d.jsx)(e.default,{className:"text-sm",children:"close"})}):o?(0,d.jsx)("button",{onClick:o,className:"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,d.jsx)(e.default,{className:"text-sm",children:"close"})}):null]})]})})}F.propTypes={model:E().shape({id:E().string.isRequired}).isRequired,fullModel:E().string.isRequired,alias:E().string,copied:E().string,onCopy:E().func.isRequired,testStatus:E().oneOf(["ok","error"]),isCustom:E().bool,isFree:E().bool,onDeleteAlias:E().func,onTest:E().func,isTesting:E().bool,onDisable:E().func,caps:E().object,thinkingSuffix:E().string},E().string.isRequired,E().string.isRequired,E().string,E().func.isRequired,E().func.isRequired,E().func,E().oneOf(["ok","error"]),E().bool,E().string.isRequired,E().object.isRequired,E().arrayOf(E().object),E().string,E().func.isRequired,E().func.isRequired,E().func.isRequired,E().func.isRequired;var G=c(6262),H=c.n(G);function I({modelId:a,fullModel:b,copied:c,onCopy:f,onDeleteAlias:g,onTest:h,testStatus:i,isTesting:j}){let k="ok"===i?"var(--pos)":"error"===i?"var(--danger)":void 0;return(0,d.jsxs)("div",{className:H().modelRow,children:[(0,d.jsx)(e.default,{className:"text-base text-text-muted",style:k?{color:k}:void 0,children:"ok"===i?"check_circle":"error"===i?"cancel":"smart_toy"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium truncate",children:a}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1 mt-1",children:[(0,d.jsx)("code",{className:"min-w-0 text-xs text-text-muted font-mono break-all",children:b}),(0,d.jsxs)("div",{className:"relative group/btn",children:[(0,d.jsx)("button",{onClick:()=>f(b,`model-${a}`),className:H().iconButton,"aria-label":`Copy ${b}`,title:`Copy ${b}`,children:(0,d.jsx)(e.default,{className:"text-sm",children:c===`model-${a}`?"check":"content_copy"})}),(0,d.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:c===`model-${a}`?"Copied!":"Copy"})]}),h&&(0,d.jsxs)("div",{className:"relative group/btn",children:[(0,d.jsx)("button",{onClick:h,disabled:j,className:H().iconButton,"aria-label":`Test ${a}`,title:`Test ${a}`,children:(0,d.jsx)(e.default,{className:"text-sm",style:j?{animation:"spin 1s linear infinite"}:void 0,children:j?"progress_activity":"science"})}),(0,d.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:j?"Testing...":"Test"})]})]})]}),(0,d.jsx)("button",{onClick:g,className:`${H().iconButton} ${H().error}`,"aria-label":`Remove ${a}`,title:"Remove model",children:(0,d.jsx)(e.default,{className:"text-sm",children:"delete"})})]})}function J({providerStorageAlias:a,providerDisplayAlias:b,modelAliases:c,customModels:e,copied:g,onCopy:h,onDeleteAlias:i,onAddCustomModel:j,onDeleteCustomModel:k,connections:m,isAnthropic:n}){let[o,p]=(0,f.useState)(""),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(null),[w,x]=(0,f.useState)({}),y=async b=>{if(!u){v(b);try{let c=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${a}/${b}`})}),d=await c.json();x(a=>({...a,[b]:d.ok?"ok":"error"}))}catch{x(a=>({...a,[b]:"error"}))}finally{v(null)}}},z=C({customModels:e,modelAliases:c,providerAlias:a,type:"llm"}),A=async()=>{if(!o.trim()||q)return;let a=o.trim();if(z.some(b=>b.id===a))return void alert("Model already exists for this provider.");r(!0);try{await j(a),p("")}catch(a){console.log("Error adding model:",a)}finally{r(!1)}},B=async()=>{if(s)return;let a=m.find(a=>!1!==a.isActive);if(a){t(!0);try{let b=await fetch(`/api/providers/${a.id}/models`),c=await b.json();if(!b.ok)return void alert(c.error||"Failed to import models");let d=c.models||[];if(0===d.length)return void alert("No models returned from /models.");let e=0;for(let a of d){let b=a.id||a.name||a.model;b&&(z.some(a=>a.id===b)||(await j(b),e+=1))}0===e&&alert("No new models were added.")}catch(a){console.log("Error importing models:",a)}finally{t(!1)}}},D=m.some(a=>!1!==a.isActive);return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("p",{className:H().description,children:["Add ",n?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,d.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,d.jsx)(l.pd,{className:"flex-[1_1_200px] min-w-0",label:"Model ID",id:"new-compatible-model-input",type:"text",value:o,onChange:a=>p(a.target.value),onKeyDown:a=>"Enter"===a.key&&A(),placeholder:n?"claude-3-opus-20240229":"gpt-4o"}),(0,d.jsx)(l.$n,{size:"sm",variant:"contrast",icon:"add",onClick:A,disabled:!o.trim()||q,children:q?"Adding...":"Add"}),(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",icon:"download",onClick:B,disabled:!D||s,children:s?"Importing...":"Import from /models"})]}),!D&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),z.length>0&&(0,d.jsx)("div",{className:"flex min-w-0 flex-col",children:z.map(({id:c,alias:e,source:f})=>(0,d.jsx)(I,{modelId:c,fullModel:`${b}/${c}`,copied:g,onCopy:h,onDeleteAlias:()=>"custom"===f?k(c):i(e),onTest:m.length>0?()=>y(c):void 0,testStatus:w[c],isTesting:u===c},`${f}-${a}/${c}`))})]})}J.propTypes={providerStorageAlias:E().string.isRequired,providerDisplayAlias:E().string.isRequired,modelAliases:E().object.isRequired,customModels:E().arrayOf(E().object),copied:E().string,onCopy:E().func.isRequired,onDeleteAlias:E().func.isRequired,onAddCustomModel:E().func.isRequired,onDeleteCustomModel:E().func.isRequired,connections:E().arrayOf(E().shape({id:E().string,isActive:E().bool})).isRequired,isAnthropic:E().bool};var K=c(74429),L=c(74875);function M({until:a}){let[b,c]=(0,f.useState)("");return b?(0,d.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",b]}):null}M.propTypes={until:E().string.isRequired};var N=c(98153);function O({connection:a,proxyPools:b,isOAuth:c,isFirst:g,isLast:h,onMoveUp:i,onMoveDown:j,onToggleActive:k,onUpdateProxy:m,onEdit:n,onDelete:o,oneByOneStatus:p=null,autoPing:q=null}){let[r,s]=(0,f.useState)(!1),[t,u]=(0,f.useState)(!1),v=(0,f.useRef)(null),w=(0,f.useRef)(null),[x,y]=(0,f.useState)(null),z=new Map((b||[]).map(a=>[a.id,a])),A=a.providerSpecificData?.proxyPoolId||null,B=A?z.get(A):null,C=a.providerSpecificData?.connectionProxyEnabled===!0&&!!a.providerSpecificData?.connectionProxyUrl,D=!!A||C,E=B?`Pool: ${B.name}`:A?`Pool: ${A} (inactive/missing)`:C?`Legacy: ${a.providerSpecificData?.connectionProxyUrl}`:"",F=(()=>{if(!q)return"";let a=[];return(q.reactiveOn&&a.push("On reset"),q.scheduleOn&&a.push(`Scheduled (${q.scheduleSummary||"active"})`),a.length>0)?`Auto-ping active: ${a.join(" + ")}. Click to configure.`:"codex"===q.provider?"Auto-starts the next 5h Codex window after reset or on schedule. Click to configure.":"Auto-starts a new window on quota reset or fixed schedule. Click to configure."})(),G="";if(B?.proxyUrl||a.providerSpecificData?.connectionProxyUrl){let b=B?.proxyUrl||a.providerSpecificData?.connectionProxyUrl;try{let a=new URL(b);G=`${a.protocol}//${a.hostname}${a.port?`:${a.port}`:""}`}catch{G=b}}let I=B?.noProxy||a.providerSpecificData?.connectionNoProxy||"",J="default";B?.isActive===!0?J="success":(A||C)&&(J="error");let P=async a=>{u(!0);try{await m("__none__"===a?null:a)}finally{u(!1),s(!1)}},Q=a.authType||(c?"oauth":"apikey"),R="oauth"===Q,S="cookie"===Q,T=a.name?.trim()||a.email?.trim()||a.displayName?.trim()||(R?"OAuth Account":S?"Cookie Account":"API Key"),U=a.name?.trim()&&a.email?.trim()&&a.name.trim()!==a.email.trim()?a.email.trim():a.name?.trim()&&a.displayName?.trim()&&a.name.trim()!==a.displayName.trim()?a.displayName.trim():null,[V,W]=(0,f.useState)(!1),X=Object.entries(a).filter(([a])=>a.startsWith("modelLock_")).map(([,a])=>a).filter(a=>!!a).sort()[0]||null,Y="unavailable"!==a.testStatus||V?a.testStatus:"active",Z=()=>(0,L.g)(a.isActive,Y),$=()=>p?"success"===p.state?"success":"failed"===p.state?"error":"testing"===p.state?"primary":"default":"default",_=()=>p?"queued"===p.state?"queued":"testing"===p.state?"testing":"success"===p.state?"success":"failed"===p.state?p.error?`failed: ${p.error}`:"failed":null:null;return(0,d.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===a.isActive?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,d.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,d.jsx)("button",{"aria-label":`Move ${T} up`,onClick:i,disabled:g,className:`p-0.5 rounded ${g?"text-text-muted/30 cursor-not-allowed":"hover:bg-surface-2 text-text-muted hover:text-text-main"}`,children:(0,d.jsx)(e.default,{className:"text-sm",children:"keyboard_arrow_up"})}),(0,d.jsx)("button",{"aria-label":`Move ${T} down`,onClick:j,disabled:h,className:`p-0.5 rounded ${h?"text-text-muted/30 cursor-not-allowed":"hover:bg-surface-2 text-text-muted hover:text-text-main"}`,children:(0,d.jsx)(e.default,{className:"text-sm",children:"keyboard_arrow_down"})})]}),(0,d.jsx)(e.default,{className:"shrink-0 text-base text-text-muted",children:S?"cookie":R?"lock":"key"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium truncate",children:T}),U&&(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:U}),(0,d.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,d.jsx)(N.A,{variant:Z(),className:"error"===Z()?H().errorBadge:void 0,children:!1===a.isActive?"disabled":Y||"Unknown"}),(0,d.jsx)(N.A,{dot:!1,children:R?"OAuth":S?"Cookie":"API Key"}),D&&(0,d.jsx)(N.A,{variant:J,dot:!1,children:"Proxy"}),V&&!1!==a.isActive&&(0,d.jsx)(M,{until:X}),a.lastError&&!1!==a.isActive&&(0,d.jsx)("span",{className:`max-w-full truncate text-xs sm:max-w-[300px] ${H().error}`,title:a.lastError,children:a.lastError}),(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["#",a.priority]}),a.globalPriority&&(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",a.globalPriority]}),_()&&(0,d.jsx)(N.A,{variant:"primary"===$()?"default":$(),dot:!1,children:_()})]}),D&&(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:E,children:E}),G&&(0,d.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:G}),I&&(0,d.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:I,children:["no_proxy: ",I]})]})]})]}),(0,d.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,d.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[(b||[]).length>0&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("button",{ref:w,onClick:()=>{if(r)return void s(!1);let a=w.current?.getBoundingClientRect();if(!a)return void s(!0);let c=((b?.length||0)+1)*34+8,d=window.innerHeight-a.bottom,e=d<c&&a.top>d;y({position:"fixed",right:window.innerWidth-a.right,...e?{bottom:window.innerHeight-a.top+4,maxHeight:Math.max(a.top-8,120)}:{top:a.bottom+4,maxHeight:Math.max(d-8,120)}}),s(!0)},className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-surface-2 ${D?"text-text-main":"text-text-muted hover:text-text-main"}`,disabled:t,children:[(0,d.jsx)(e.default,{className:"text-[18px]",children:t?"progress_activity":"lan"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),r&&(0,K.createPortal)((0,d.jsxs)("div",{ref:v,style:x,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,d.jsx)("button",{onClick:()=>P("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!A?"text-primary font-medium":"text-text-main"}`,children:"None"}),(b||[]).map(a=>(0,d.jsx)("button",{onClick:()=>P(a.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${A===a.id?"text-primary font-medium":"text-text-main"}`,children:a.name},a.id))]}),document.body)]}),q&&(0,d.jsx)(l.m_,{text:F,children:(0,d.jsxs)("button",{onClick:q.onConfigure,className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-surface-2 ${q.isActive?"text-text-main":"text-text-muted hover:text-text-main"}`,children:[(0,d.jsx)(e.default,{className:"text-[18px]",children:"bolt"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]})}),(0,d.jsx)("button",{onClick:n,className:H().iconButton,"aria-label":`Edit ${T}`,title:`Edit ${T}`,children:(0,d.jsx)(e.default,{className:"text-[18px]",children:"edit"})}),(0,d.jsx)("button",{onClick:o,className:`${H().iconButton} ${H().error}`,"aria-label":`Delete ${T}`,title:`Delete ${T}`,children:(0,d.jsx)(e.default,{className:"text-[18px]",children:"delete"})})]}),(0,d.jsx)(l.lM,{size:"sm",checked:a.isActive??!0,"aria-label":`${!1===a.isActive?"Enable":"Disable"} ${T}`,onChange:k,title:a.isActive??!0?"Disable connection":"Enable connection"})]})]})}function P(a,b,c={}){let{isCloudflareAi:d=!1}=c,e=new Set((Array.isArray(b)?b:[]).map(a=>"string"==typeof a?a.toLowerCase():"")),f=[];for(let b of a){let a,c="string"==typeof b?b.trim():"";if(!c)continue;let g=function(a,b={}){let{isCloudflareAi:c=!1}=b,d=a.split("|");if(c&&d.length>=3){let a=d[0].trim();return{baseName:a||"Key",apiKey:d.slice(1,-1).join("|").trim(),providerSpecificData:{accountId:d[d.length-1].trim()}}}return d.length>=2?{baseName:d[0].trim()||"Key",apiKey:d.slice(1).join("|").trim()}:{baseName:"Key",apiKey:d[0].trim()}}(c,{isCloudflareAi:d});if(!g||!g.apiKey)continue;let h=g.baseName,i=1;for(;a=`${h} ${i}`,e.has(a.toLowerCase());)i+=1;e.add(a.toLowerCase());let j={name:a,apiKey:g.apiKey,skipped:!1};g.providerSpecificData&&(j.providerSpecificData=g.providerSpecificData),f.push(j)}return f}O.propTypes={connection:E().shape({id:E().string,name:E().string,email:E().string,displayName:E().string,modelLockUntil:E().string,testStatus:E().string,isActive:E().bool,lastError:E().string,priority:E().number,globalPriority:E().number}).isRequired,proxyPools:E().arrayOf(E().shape({id:E().string,name:E().string,proxyUrl:E().string,noProxy:E().string,isActive:E().bool})),isOAuth:E().bool.isRequired,isFirst:E().bool.isRequired,isLast:E().bool.isRequired,onMoveUp:E().func.isRequired,onMoveDown:E().func.isRequired,onToggleActive:E().func.isRequired,onUpdateProxy:E().func,onEdit:E().func.isRequired,onDelete:E().func.isRequired,oneByOneStatus:E().shape({state:E().string,error:E().string}),autoPing:E().shape({isActive:E().bool,provider:E().string,reactiveOn:E().bool,scheduleOn:E().bool,scheduleSummary:E().string,onConfigure:E().func})};let Q=`name1|sk-key1
1
+ (()=>{var a={};a.id=2134,a.ids=[2134],a.modules={643:a=>{"use strict";a.exports=require("node:perf_hooks")},1708:a=>{"use strict";a.exports=require("node:process")},1932:a=>{"use strict";a.exports=require("url")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},6262:(a,b,c)=>{var d=c(30083);a.exports={page:"providers_page__lNQhJ "+d.formScope,toolbar:"providers_toolbar__2pR_g",header:"providers_header__s_NP2",description:"providers_description__zL7w6",filter:"providers_filter__uXyjM",actions:"providers_actions__tZbB3",rowActions:"providers_rowActions__jo8WW",select:"providers_select__qT5m6",panel:"providers_panel__HhfEl",list:"providers_list__Xl0Bx",providerRow:"providers_providerRow__7w53x",modelRow:"providers_modelRow__BaZk7",providerLink:"providers_providerLink__p1_5n",providerIcon:"providers_providerIcon__4Smce",identity:"providers_identity__gc5tm",providerName:"providers_providerName__Q5P80",metadata:"providers_metadata__lljWr",providerAddress:"providers_providerAddress__S_6uZ",status:"providers_status__0o78C",iconButton:"providers_iconButton__wueX2 "+d.iconButton,errorBadge:"providers_errorBadge__39MFD",dialog:"providers_dialog__P87TZ "+d.dialog,success:"providers_success__dL3RB",error:"providers_error__yBcA8",empty:"providers_empty__cy1cY",emptyTitle:"providers_emptyTitle___2E_x",showMore:"providers_showMore__hmFpK",testRow:"providers_testRow__FX937",fieldGroup:"providers_fieldGroup__e_9HL",settingsGroup:"providers_settingsGroup__BKD1U",customHeaderRow:"providers_customHeaderRow__GyQ3r",detailTitle:"providers_detailTitle__uBT1b",detailLink:"providers_detailLink__0O8z2"}},7066:a=>{"use strict";a.exports=require("node:tty")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14985:a=>{"use strict";a.exports=require("dns")},16698:a=>{"use strict";a.exports=require("node:async_hooks")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29423:(a,b,c)=>{Promise.resolve().then(c.bind(c,93110))},30083:a=>{a.exports={dialog:"DashboardControls_dialog__YyPS4",formScope:"DashboardControls_formScope__ID02o",fields:"DashboardControls_fields__IY485",iconButton:"DashboardControls_iconButton__v_EJw",modelPicker:"DashboardControls_modelPicker__BheYV DashboardControls_dialog__YyPS4"}},31185:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>x,handler:()=>z,routeModule:()=>y});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,57529))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,30508))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),q=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),r=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),s=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),t=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),u=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),v={children:["",{children:["(dashboard)",{children:["dashboard",{children:["providers",{children:["[id]",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,93110))),"/root/workspace/JRouter/src/app/(dashboard)/dashboard/providers/[id]/page.js"]}]},{"global-error":[u,"next/dist/client/components/builtin/global-error.js"]},["new"]]},{"global-error":[t,"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[s,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"/root/workspace/JRouter/src/app/(dashboard)/layout.js"],"global-error":[o,"next/dist/client/components/builtin/global-error.js"],"not-found":[p,"next/dist/client/components/builtin/not-found.js"],forbidden:[q,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[r,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]},{layout:[i,"/root/workspace/JRouter/src/app/layout.js"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]}.children,w=(0,e.H)({tree:v,page:"/(dashboard)/dashboard/providers/[id]/page",pathname:"/dashboard/providers/[id]",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),x=w.__next_app__,y=w.routeModule,z=w.handler},31421:a=>{"use strict";a.exports=require("node:child_process")},31886:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>af});var d=c(48249),e=c(21707),f=c(67484),g=c(19099),h=c(2116),i=c.n(h),j=c(81220),k=c(29225),l=c(50412),m=c(92592),n=c(91431),o=c(70552),p=c(18982);c(87592);var q=c(60757);let r=["none","low","medium","high"],s=["none","thinking"],t=["none","low","medium","high","xhigh","max"],u={openai:["none","minimal","low","medium","high","xhigh"],"claude-adaptive":t,"claude-budget":t,"gemini-level":["minimal","low","medium","high"],"gemini-budget":r,zai:s,qwen:r,kimi:["none","low","medium","high","max"],deepseek:["none","high","max"],commandcode:["none","low","medium","high","xhigh","max"],river:["none","low","medium","high","xhigh","max"],minimax:s,hunyuan:r,step:r,nous:r},v=["none","minimal","low","medium","high","xhigh","max"],w=["none","low","medium","high","max"],x=[{pattern:"*gemini-4*",levels:["low","medium","high"]},{pattern:"*claude*4.6*",levels:w},{pattern:"*claude*4-6*",levels:w},{provider:"codex",pattern:"*gpt-6*",levels:v},{provider:"codex",pattern:"*gpt-5.6-sol*",levels:[...v,"ultra"]},{provider:"codex",pattern:"*gpt-5.6-terra*",levels:[...v,"ultra"]},{provider:"codex",pattern:"*gpt-5.6-luna*",levels:v},{pattern:"*codex*",levels:["low","medium","high","xhigh"]},{pattern:"*mimo*v2.6*",levels:["none","low","medium","high","xhigh"]},{pattern:"*mimo*v2.5-pro*",levels:["none","low","medium","high","xhigh"]},{provider:"codebuddy-cn",pattern:"deepseek-v4-pro",levels:["low","high","xhigh"]},{provider:"codebuddy-cn",pattern:"deepseek-v4.1-flash",levels:["low","high","max"]},{pattern:"*deepseek-v4.*",levels:["none","low","medium","high","xhigh","max"]},{provider:"codebuddy-cn",pattern:"glm-5.3",levels:["low","high","max"]},{provider:"codebuddy-cn",pattern:"glm-5.3-flash",levels:["low","high","max"]},{provider:"codebuddy-cn",pattern:"glm-5.2",levels:["high","xhigh"]},{provider:"codebuddy-cn",pattern:"kimi-k2.8-preview",levels:["low","medium","high"]},{provider:"codebuddy-cn",pattern:"hy3",levels:["low","high"]},{provider:"codebuddy-cn",pattern:"hy4-preview",levels:["high"]},{provider:"codebuddy-intl",pattern:"deepseek-v4*",levels:["low","high","xhigh"]},{provider:"minimax-code",pattern:"MiniMax-M3.1*",levels:["low","medium","high","xhigh","max"]},{provider:"minimax-code",pattern:"MiniMax-M3",levels:["none","high"]},{provider:"minimax-code-global",pattern:"MiniMax-M3.1*",levels:["low","medium","high","xhigh","max"]},{provider:"minimax-code-global",pattern:"MiniMax-M3",levels:["none","high"]}];function y(a,b){if("kiro"===a&&null===function(a){if("string"!=typeof a)return null;let b=a.toLowerCase().replace(/-/g,".");if(/(?:^|[/.])gpt[/.]5[/.]6(?:[/.]|$)/.test(b))return"reasoning";if(!b.includes("claude"))return null;let c=function(a){if("string"!=typeof a)return null;let b=a.toLowerCase().replace(/-/g,".").match(/(?:^|[/.])claude(?:[/.][a-z]+)*[/.](\d+)(?:[/.](\d+))?(?:[/.]|$)/);return b?{major:Number(b[1]),minor:void 0===b[2]?null:Number(b[2])}:null}(a);if(!c)return null;let{major:d,minor:e}=c;return d<4||4===d&&(null===e||e<=5||null!==e&&e>=1e3)?null:"output_config"}(b))return null;let c=(0,o.nl)(a,b);if(!c.reasoning)return null;let d=String(b||"").replace(/\([^()]+\)\s*$/,""),e="codex"===a?(0,q.SM)("cx").find(a=>a.id===d)?.thinkingLevels:null,f=x.find(c=>(!c.provider||c.provider===a)&&(0,p.gH)(c.pattern,b)),g=e||f?.levels||u[c.thinkingFormat]||r;return!1===c.thinkingCanDisable&&(g=g.filter(a=>"none"!==a)),g}var z=c(50377),A=c(29476),B=c(99258);function C({customModels:a=[],modelAliases:b={},providerAlias:c,builtInModels:d=[],type:e="llm",includeLegacyAliases:f=!0}){let g=new Set(d.map(a=>a.id)),h=new Set,i=[];for(let b of a){if(!b?.id||b.providerAlias!==c)continue;let a=b?.kind||b?.type||"llm";if(e&&a!==e||g.has(b.id))continue;let d=`${c}/${b.id}`;h.has(d)||(h.add(d),i.push({id:b.id,name:b.name||b.id,fullModel:d,source:"custom",type:a}))}if(!f)return i;let j=`${c}/`;for(let[a,c]of Object.entries(b||{})){if("string"!=typeof c||!c.startsWith(j))continue;let b=c.slice(j.length);!b||g.has(b)||h.has(c)||(h.add(c),i.push({id:b,alias:a,fullModel:c,source:"legacyAlias",type:e||"llm"}))}return i}var D=c(49885),E=c.n(D);function F({model:a,fullModel:b,alias:c,copied:f,onCopy:g,testStatus:h,isCustom:i,isFree:j,onDeleteAlias:k,onTest:m,isTesting:n,onDisable:o,caps:p,thinkingSuffix:q}){let r=q?`${b}(${q})`:b,s="ok"===h?"#22c55e":"error"===h?"#ef4444":void 0;return(0,d.jsx)("div",{className:`group w-full sm:w-auto min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===h?"border-green-500/40":"error"===h?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,d.jsx)(e.default,{className:"shrink-0 text-base mt-0.5 sm:mt-0",style:s?{color:s}:void 0,children:"ok"===h?"check_circle":"error"===h?"cancel":"smart_toy"}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,d.jsx)("code",{className:"w-fit max-w-full break-all rounded bg-sidebar px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px] sm:truncate",children:r}),(0,d.jsxs)("span",{className:"flex min-w-0 items-center text-[9px] gap-1 pl-1",children:[a.name&&(0,d.jsx)("span",{className:"break-all sm:truncate text-[9px] italic text-text-muted/70",children:a.name}),(0,d.jsx)(l.nh,{caps:p,colorOverride:"text-text-muted/70",size:12})]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 sm:gap-1",children:[m&&(0,d.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,d.jsx)("button",{onClick:m,disabled:n,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${n?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,d.jsx)(e.default,{className:"text-sm",style:n?{animation:"spin 1s linear infinite"}:void 0,children:n?"progress_activity":"science"})}),(0,d.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:n?"Testing...":"Test"})]}),(0,d.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,d.jsx)("button",{onClick:()=>g(r,`model-${a.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,d.jsx)(e.default,{className:"text-sm",children:f===`model-${a.id}`?"check":"content_copy"})}),(0,d.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:f===`model-${a.id}`?"Copied!":"Copy"})]}),i?(0,d.jsx)("button",{onClick:k,className:"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,d.jsx)(e.default,{className:"text-sm",children:"close"})}):o?(0,d.jsx)("button",{onClick:o,className:"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,d.jsx)(e.default,{className:"text-sm",children:"close"})}):null]})]})})}F.propTypes={model:E().shape({id:E().string.isRequired}).isRequired,fullModel:E().string.isRequired,alias:E().string,copied:E().string,onCopy:E().func.isRequired,testStatus:E().oneOf(["ok","error"]),isCustom:E().bool,isFree:E().bool,onDeleteAlias:E().func,onTest:E().func,isTesting:E().bool,onDisable:E().func,caps:E().object,thinkingSuffix:E().string},E().string.isRequired,E().string.isRequired,E().string,E().func.isRequired,E().func.isRequired,E().func,E().oneOf(["ok","error"]),E().bool,E().string.isRequired,E().object.isRequired,E().arrayOf(E().object),E().string,E().func.isRequired,E().func.isRequired,E().func.isRequired,E().func.isRequired;var G=c(6262),H=c.n(G);function I({modelId:a,fullModel:b,copied:c,onCopy:f,onDeleteAlias:g,onTest:h,testStatus:i,isTesting:j}){let k="ok"===i?"var(--pos)":"error"===i?"var(--danger)":void 0;return(0,d.jsxs)("div",{className:H().modelRow,children:[(0,d.jsx)(e.default,{className:"text-base text-text-muted",style:k?{color:k}:void 0,children:"ok"===i?"check_circle":"error"===i?"cancel":"smart_toy"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium truncate",children:a}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1 mt-1",children:[(0,d.jsx)("code",{className:"min-w-0 text-xs text-text-muted font-mono break-all",children:b}),(0,d.jsxs)("div",{className:"relative group/btn",children:[(0,d.jsx)("button",{onClick:()=>f(b,`model-${a}`),className:H().iconButton,"aria-label":`Copy ${b}`,title:`Copy ${b}`,children:(0,d.jsx)(e.default,{className:"text-sm",children:c===`model-${a}`?"check":"content_copy"})}),(0,d.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:c===`model-${a}`?"Copied!":"Copy"})]}),h&&(0,d.jsxs)("div",{className:"relative group/btn",children:[(0,d.jsx)("button",{onClick:h,disabled:j,className:H().iconButton,"aria-label":`Test ${a}`,title:`Test ${a}`,children:(0,d.jsx)(e.default,{className:"text-sm",style:j?{animation:"spin 1s linear infinite"}:void 0,children:j?"progress_activity":"science"})}),(0,d.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:j?"Testing...":"Test"})]})]})]}),(0,d.jsx)("button",{onClick:g,className:`${H().iconButton} ${H().error}`,"aria-label":`Remove ${a}`,title:"Remove model",children:(0,d.jsx)(e.default,{className:"text-sm",children:"delete"})})]})}function J({providerStorageAlias:a,providerDisplayAlias:b,modelAliases:c,customModels:e,copied:g,onCopy:h,onDeleteAlias:i,onAddCustomModel:j,onDeleteCustomModel:k,connections:m,isAnthropic:n}){let[o,p]=(0,f.useState)(""),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(null),[w,x]=(0,f.useState)({}),y=async b=>{if(!u){v(b);try{let c=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${a}/${b}`})}),d=await c.json();x(a=>({...a,[b]:d.ok?"ok":"error"}))}catch{x(a=>({...a,[b]:"error"}))}finally{v(null)}}},z=C({customModels:e,modelAliases:c,providerAlias:a,type:"llm"}),A=async()=>{if(!o.trim()||q)return;let a=o.trim();if(z.some(b=>b.id===a))return void alert("Model already exists for this provider.");r(!0);try{await j(a),p("")}catch(a){console.log("Error adding model:",a)}finally{r(!1)}},B=async()=>{if(s)return;let a=m.find(a=>!1!==a.isActive);if(a){t(!0);try{let b=await fetch(`/api/providers/${a.id}/models`),c=await b.json();if(!b.ok)return void alert(c.error||"Failed to import models");let d=c.models||[];if(0===d.length)return void alert("No models returned from /models.");let e=0;for(let a of d){let b=a.id||a.name||a.model;b&&(z.some(a=>a.id===b)||(await j(b),e+=1))}0===e&&alert("No new models were added.")}catch(a){console.log("Error importing models:",a)}finally{t(!1)}}},D=m.some(a=>!1!==a.isActive);return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("p",{className:H().description,children:["Add ",n?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,d.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,d.jsx)(l.pd,{className:"flex-[1_1_200px] min-w-0",label:"Model ID",id:"new-compatible-model-input",type:"text",value:o,onChange:a=>p(a.target.value),onKeyDown:a=>"Enter"===a.key&&A(),placeholder:n?"claude-3-opus-20240229":"gpt-4o"}),(0,d.jsx)(l.$n,{size:"sm",variant:"contrast",icon:"add",onClick:A,disabled:!o.trim()||q,children:q?"Adding...":"Add"}),(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",icon:"download",onClick:B,disabled:!D||s,children:s?"Importing...":"Import from /models"})]}),!D&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),z.length>0&&(0,d.jsx)("div",{className:"flex min-w-0 flex-col",children:z.map(({id:c,alias:e,source:f})=>(0,d.jsx)(I,{modelId:c,fullModel:`${b}/${c}`,copied:g,onCopy:h,onDeleteAlias:()=>"custom"===f?k(c):i(e),onTest:m.length>0?()=>y(c):void 0,testStatus:w[c],isTesting:u===c},`${f}-${a}/${c}`))})]})}J.propTypes={providerStorageAlias:E().string.isRequired,providerDisplayAlias:E().string.isRequired,modelAliases:E().object.isRequired,customModels:E().arrayOf(E().object),copied:E().string,onCopy:E().func.isRequired,onDeleteAlias:E().func.isRequired,onAddCustomModel:E().func.isRequired,onDeleteCustomModel:E().func.isRequired,connections:E().arrayOf(E().shape({id:E().string,isActive:E().bool})).isRequired,isAnthropic:E().bool};var K=c(74429),L=c(74875);function M({until:a}){let[b,c]=(0,f.useState)("");return b?(0,d.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",b]}):null}M.propTypes={until:E().string.isRequired};var N=c(98153);function O({connection:a,proxyPools:b,isOAuth:c,isFirst:g,isLast:h,onMoveUp:i,onMoveDown:j,onToggleActive:k,onUpdateProxy:m,onEdit:n,onDelete:o,oneByOneStatus:p=null,autoPing:q=null}){let[r,s]=(0,f.useState)(!1),[t,u]=(0,f.useState)(!1),v=(0,f.useRef)(null),w=(0,f.useRef)(null),[x,y]=(0,f.useState)(null),z=new Map((b||[]).map(a=>[a.id,a])),A=a.providerSpecificData?.proxyPoolId||null,B=A?z.get(A):null,C=a.providerSpecificData?.connectionProxyEnabled===!0&&!!a.providerSpecificData?.connectionProxyUrl,D=!!A||C,E=B?`Pool: ${B.name}`:A?`Pool: ${A} (inactive/missing)`:C?`Legacy: ${a.providerSpecificData?.connectionProxyUrl}`:"",F=(()=>{if(!q)return"";let a=[];return(q.reactiveOn&&a.push("On reset"),q.scheduleOn&&a.push(`Scheduled (${q.scheduleSummary||"active"})`),a.length>0)?`Auto-ping active: ${a.join(" + ")}. Click to configure.`:"codex"===q.provider?"Auto-starts the next 5h Codex window after reset or on schedule. Click to configure.":"Auto-starts a new window on quota reset or fixed schedule. Click to configure."})(),G="";if(B?.proxyUrl||a.providerSpecificData?.connectionProxyUrl){let b=B?.proxyUrl||a.providerSpecificData?.connectionProxyUrl;try{let a=new URL(b);G=`${a.protocol}//${a.hostname}${a.port?`:${a.port}`:""}`}catch{G=b}}let I=B?.noProxy||a.providerSpecificData?.connectionNoProxy||"",J="default";B?.isActive===!0?J="success":(A||C)&&(J="error");let P=async a=>{u(!0);try{await m("__none__"===a?null:a)}finally{u(!1),s(!1)}},Q=a.authType||(c?"oauth":"apikey"),R="oauth"===Q,S="cookie"===Q,T=a.name?.trim()||a.email?.trim()||a.displayName?.trim()||(R?"OAuth Account":S?"Cookie Account":"API Key"),U=a.name?.trim()&&a.email?.trim()&&a.name.trim()!==a.email.trim()?a.email.trim():a.name?.trim()&&a.displayName?.trim()&&a.name.trim()!==a.displayName.trim()?a.displayName.trim():null,[V,W]=(0,f.useState)(!1),X=Object.entries(a).filter(([a])=>a.startsWith("modelLock_")).map(([,a])=>a).filter(a=>!!a).sort()[0]||null,Y="unavailable"!==a.testStatus||V?a.testStatus:"active",Z=()=>(0,L.g)(a.isActive,Y),$=()=>p?"success"===p.state?"success":"failed"===p.state?"error":"testing"===p.state?"primary":"default":"default",_=()=>p?"queued"===p.state?"queued":"testing"===p.state?"testing":"success"===p.state?"success":"failed"===p.state?p.error?`failed: ${p.error}`:"failed":null:null;return(0,d.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===a.isActive?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,d.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,d.jsx)("button",{"aria-label":`Move ${T} up`,onClick:i,disabled:g,className:`p-0.5 rounded ${g?"text-text-muted/30 cursor-not-allowed":"hover:bg-surface-2 text-text-muted hover:text-text-main"}`,children:(0,d.jsx)(e.default,{className:"text-sm",children:"keyboard_arrow_up"})}),(0,d.jsx)("button",{"aria-label":`Move ${T} down`,onClick:j,disabled:h,className:`p-0.5 rounded ${h?"text-text-muted/30 cursor-not-allowed":"hover:bg-surface-2 text-text-muted hover:text-text-main"}`,children:(0,d.jsx)(e.default,{className:"text-sm",children:"keyboard_arrow_down"})})]}),(0,d.jsx)(e.default,{className:"shrink-0 text-base text-text-muted",children:S?"cookie":R?"lock":"key"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium truncate",children:T}),U&&(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:U}),(0,d.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,d.jsx)(N.A,{variant:Z(),className:"error"===Z()?H().errorBadge:void 0,children:!1===a.isActive?"disabled":Y||"Unknown"}),a.demotedAt&&!1!==a.isActive&&(0,d.jsx)("span",{title:`Failed recently — serving at the back of the rotation until its next success (since ${new Date(a.demotedAt).toLocaleTimeString()})`,className:"px-1.5 py-0.5 rounded-[var(--r1)] bg-transparent border border-[var(--line)] text-[10px] font-mono text-[var(--text-2)]",children:"⬇ demoted"}),(0,d.jsx)(N.A,{dot:!1,children:R?"OAuth":S?"Cookie":"API Key"}),D&&(0,d.jsx)(N.A,{variant:J,dot:!1,children:"Proxy"}),V&&!1!==a.isActive&&(0,d.jsx)(M,{until:X}),a.lastError&&!1!==a.isActive&&(0,d.jsx)("span",{className:`max-w-full truncate text-xs sm:max-w-[300px] ${H().error}`,title:a.lastError,children:a.lastError}),(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["#",a.priority]}),a.globalPriority&&(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",a.globalPriority]}),_()&&(0,d.jsx)(N.A,{variant:"primary"===$()?"default":$(),dot:!1,children:_()})]}),D&&(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:E,children:E}),G&&(0,d.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:G}),I&&(0,d.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:I,children:["no_proxy: ",I]})]})]})]}),(0,d.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,d.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[(b||[]).length>0&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("button",{ref:w,onClick:()=>{if(r)return void s(!1);let a=w.current?.getBoundingClientRect();if(!a)return void s(!0);let c=((b?.length||0)+1)*34+8,d=window.innerHeight-a.bottom,e=d<c&&a.top>d;y({position:"fixed",right:window.innerWidth-a.right,...e?{bottom:window.innerHeight-a.top+4,maxHeight:Math.max(a.top-8,120)}:{top:a.bottom+4,maxHeight:Math.max(d-8,120)}}),s(!0)},className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-surface-2 ${D?"text-text-main":"text-text-muted hover:text-text-main"}`,disabled:t,children:[(0,d.jsx)(e.default,{className:"text-[18px]",children:t?"progress_activity":"lan"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),r&&(0,K.createPortal)((0,d.jsxs)("div",{ref:v,style:x,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,d.jsx)("button",{onClick:()=>P("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!A?"text-primary font-medium":"text-text-main"}`,children:"None"}),(b||[]).map(a=>(0,d.jsx)("button",{onClick:()=>P(a.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${A===a.id?"text-primary font-medium":"text-text-main"}`,children:a.name},a.id))]}),document.body)]}),q&&(0,d.jsx)(l.m_,{text:F,children:(0,d.jsxs)("button",{onClick:q.onConfigure,className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-surface-2 ${q.isActive?"text-text-main":"text-text-muted hover:text-text-main"}`,children:[(0,d.jsx)(e.default,{className:"text-[18px]",children:"bolt"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]})}),(0,d.jsx)("button",{onClick:n,className:H().iconButton,"aria-label":`Edit ${T}`,title:`Edit ${T}`,children:(0,d.jsx)(e.default,{className:"text-[18px]",children:"edit"})}),(0,d.jsx)("button",{onClick:o,className:`${H().iconButton} ${H().error}`,"aria-label":`Delete ${T}`,title:`Delete ${T}`,children:(0,d.jsx)(e.default,{className:"text-[18px]",children:"delete"})})]}),(0,d.jsx)(l.lM,{size:"sm",checked:a.isActive??!0,"aria-label":`${!1===a.isActive?"Enable":"Disable"} ${T}`,onChange:k,title:a.isActive??!0?"Disable connection":"Enable connection"})]})]})}function P(a,b,c={}){let{isCloudflareAi:d=!1}=c,e=new Set((Array.isArray(b)?b:[]).map(a=>"string"==typeof a?a.toLowerCase():"")),f=[];for(let b of a){let a,c="string"==typeof b?b.trim():"";if(!c)continue;let g=function(a,b={}){let{isCloudflareAi:c=!1}=b,d=a.split("|");if(c&&d.length>=3){let a=d[0].trim();return{baseName:a||"Key",apiKey:d.slice(1,-1).join("|").trim(),providerSpecificData:{accountId:d[d.length-1].trim()}}}return d.length>=2?{baseName:d[0].trim()||"Key",apiKey:d.slice(1).join("|").trim()}:{baseName:"Key",apiKey:d[0].trim()}}(c,{isCloudflareAi:d});if(!g||!g.apiKey)continue;let h=g.baseName,i=1;for(;a=`${h} ${i}`,e.has(a.toLowerCase());)i+=1;e.add(a.toLowerCase());let j={name:a,apiKey:g.apiKey,skipped:!1};g.providerSpecificData&&(j.providerSpecificData=g.providerSpecificData),f.push(j)}return f}O.propTypes={connection:E().shape({id:E().string,name:E().string,email:E().string,displayName:E().string,modelLockUntil:E().string,testStatus:E().string,isActive:E().bool,lastError:E().string,priority:E().number,globalPriority:E().number}).isRequired,proxyPools:E().arrayOf(E().shape({id:E().string,name:E().string,proxyUrl:E().string,noProxy:E().string,isActive:E().bool})),isOAuth:E().bool.isRequired,isFirst:E().bool.isRequired,isLast:E().bool.isRequired,onMoveUp:E().func.isRequired,onMoveDown:E().func.isRequired,onToggleActive:E().func.isRequired,onUpdateProxy:E().func,onEdit:E().func.isRequired,onDelete:E().func.isRequired,oneByOneStatus:E().shape({state:E().string,error:E().string}),autoPing:E().shape({isActive:E().bool,provider:E().string,reactiveOn:E().bool,scheduleOn:E().bool,scheduleSummary:E().string,onConfigure:E().func})};let Q=`name1|sk-key1
2
2
  name2|sk-key2
3
3
  sk-key-only-auto-named`;function R({isOpen:a,provider:b,providerName:c,isCompatible:e,isAnthropic:g,authType:h,authHint:i,website:j,proxyPools:k,error:n,existingNames:o,onSave:p,onBulkDone:q,onClose:r}){let s="__none__",t="ollama-local"===b,u="cookie"===h,v="xai"===b&&!u,w=u?"Cookie Value":"qoder"===b||"qoder-cn"===b?"Personal Access Token (PAT)":"API Key",x="azure"===b,y="cloudflare-ai"===b,z=m.Q2?.[b]?.credentialForm==="aws",A=m.Q2?.[b]?.apiKeyOptionalWith||null,B=m.Q2?.[b]?.regions||null,C=m.Q2?.[b]?.defaultRegion||B?.[0]?.id||"",[D,E]=(0,f.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:s,ollamaHostUrl:""}),[F,G]=(0,f.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[I,J]=(0,f.useState)({accountId:""}),[K,L]=(0,f.useState)({profile:"",region:"",accessKeyId:"",sessionToken:""}),[M,O]=(0,f.useState)(C),[S,T]=(0,f.useState)(!1),[U,V]=(0,f.useState)(null),[W,X]=(0,f.useState)(!1),Y=y?`name1|sk-key1|acc123456
4
4
  name2|sk-key2|def789012
5
5
  sk-key-only-auto-named`:"qoder"===b||"qoder-cn"===b?`name1|pt-xxxxx
6
6
  name2|pt-yyyyy
7
- pt-only-auto-named`:Q,[Z,$]=(0,f.useState)("single"),[_,aa]=(0,f.useState)(""),[ab,ac]=(0,f.useState)(null),[ad,ae]=(0,f.useState)(""),[af,ag]=(0,f.useState)(null),ah=()=>{if(t&&D.ollamaHostUrl.trim())return{baseUrl:D.ollamaHostUrl.trim()};if(x)return{azureEndpoint:F.azureEndpoint,apiVersion:F.apiVersion,deployment:F.deployment,organization:F.organization};if(y)return{accountId:I.accountId};if(z){let a={};return K.profile.trim()&&(a.profile=K.profile.trim()),K.region.trim()&&(a.region=K.region.trim()),K.accessKeyId.trim()&&(a.accessKeyId=K.accessKeyId.trim()),K.sessionToken.trim()&&(a.sessionToken=K.sessionToken.trim()),Object.keys(a).length?a:void 0}if(B&&M)return{region:M}},ai=()=>{let a=ah();return!!(A&&a?.[A])||(z?!!D.apiKey&&!!a?.accessKeyId:!!D.apiKey)},aj=async()=>{T(!0);try{let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:D.apiKey,providerSpecificData:ah()})}),c=await a.json();V(c.valid?"success":"failed")}catch{V("failed")}finally{T(!1)}},ak=async()=>{if(b&&(t||ai())&&(t||D.name)&&(!e||D.defaultModel.trim())){X(!0);try{let a=!1;try{T(!0),V(null);let c=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:D.apiKey,providerSpecificData:ah()})});a=!!(await c.json()).valid,V(a?"success":"failed")}catch{V("failed")}finally{T(!1)}await p({name:D.name||(t?"Ollama Local":""),apiKey:D.apiKey,defaultModel:e?D.defaultModel.trim():void 0,priority:D.priority,proxyPoolId:D.proxyPoolId===s?null:D.proxyPoolId,testStatus:a?"active":"unknown",providerSpecificData:ah()})}finally{X(!1)}}},al=async()=>{let a=_.split("\n");if(!a.length)return;let c=P(a,o,{isCloudflareAi:y});if(!c.length)return;X(!0),ac(null);let d=0,e=0;for(let a of c)try{let c=!1;try{let d=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:a.apiKey})});c=!!(await d.json().catch(()=>({}))).valid}catch{c=!1}(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:a.apiKey,name:a.name,priority:1,testStatus:c?"active":"unknown",...a.providerSpecificData?{providerSpecificData:a.providerSpecificData}:{}})})).ok?d++:e++}catch{e++}X(!1),ac({success:d,failed:e}),d>0&&q&&q()},am=async()=>{let a=function(a){let b,c=a=>({entries:[],provider:null,skipped:0,error:a});try{b=JSON.parse(a)}catch{return c("Invalid JSON.")}let d=Array.isArray(b)?b:b?.keys;if(!Array.isArray(d))return c('JSON must contain a "keys" array (or be an array of entries).');let e=[],f=0;for(let a of d){let b="string"==typeof a?.apiKey?a.apiKey.trim():"",c="string"==typeof a?.name?a.name.trim():"";if(!b||a?.isActive===!1){f+=1;continue}e.push({name:c,apiKey:b})}return!e.length&&f>0?c("No usable keys found (all entries empty or inactive)."):{entries:e,provider:"string"==typeof b?.provider?b.provider:null,skipped:f,error:null}}(ad);if(a.error)return void ag({error:a.error});if(!a.entries.length)return;X(!0),ag(null);let c=P(a.entries.map(a=>a.name?`${a.name}|${a.apiKey}`:a.apiKey),o,{isCloudflareAi:y}),d=0,e=0;for(let a of c)try{let c=!1;try{let d=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:a.apiKey})});c=!!(await d.json().catch(()=>({}))).valid}catch{c=!1}(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:a.apiKey,name:a.name,priority:1,testStatus:c?"active":"unknown",...a.providerSpecificData?{providerSpecificData:a.providerSpecificData}:{}})})).ok?d++:e++}catch{e++}X(!1),ag({success:d,failed:e,skipped:a.skipped}),d>0&&q&&q()};return b?(0,d.jsx)(l.aF,{isOpen:a,title:`Add ${c||b} ${w}`,onClose:r,className:H().dialog,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[!z&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{size:"sm",variant:"single"===Z?"contrast":"ghost","aria-pressed":"single"===Z,onClick:()=>{$("single"),ac(null),ag(null)},children:"Single"}),(0,d.jsx)(l.$n,{size:"sm",variant:"bulk"===Z?"contrast":"ghost","aria-pressed":"bulk"===Z,onClick:()=>{$("bulk"),ac(null),ag(null)},children:"Bulk Add"}),(0,d.jsx)(l.$n,{size:"sm",variant:"json"===Z?"contrast":"ghost","aria-pressed":"json"===Z,onClick:()=>{$("json"),ac(null),ag(null)},children:"Import JSON"})]}),"json"===Z&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Paste the JSON produced by another provider's ",(0,d.jsx)("strong",{children:"Extract Keys"})," button (","{",'"keys": [',"apiKey","]","}","). Inactive and empty entries are skipped; names are kept, missing names are auto-numbered."]}),(0,d.jsx)("textarea",{className:"w-full font-mono resize-y min-h-[160px]","aria-label":"Extracted keys JSON",placeholder:'{\n "provider": "commandcode",\n "keys": [{ "name": "Key 1", "apiKey": "user_..." }]\n}',value:ad,onChange:a=>ae(a.target.value)}),af&&(0,d.jsx)("div",{className:`text-xs font-medium ${af.error||af.failed>0?"text-[var(--warn)]":H().success}`,role:"status",children:af.error?`✗ ${af.error}`:`✓ ${af.success} added${af.failed>0?`, ✗ ${af.failed} failed`:""}${af.skipped>0?`, ${af.skipped} skipped`:""}`}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{onClick:am,variant:"contrast",fullWidth:!0,disabled:W||!ad.trim(),children:W?"Importing...":"Import Keys"}),(0,d.jsx)(l.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"bulk"===Z&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:y?(0,d.jsxs)(d.Fragment,{children:["One key per line. Format: ",(0,d.jsx)("code",{children:"name|apiKey|accountId"})," or just ",(0,d.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}):"qoder"===b||"qoder-cn"===b?(0,d.jsxs)(d.Fragment,{children:["One PAT per line. Format: ",(0,d.jsx)("code",{children:"name|pt-..."})," or just ",(0,d.jsx)("code",{children:"pt-..."})," (auto-named by index)."]}):(0,d.jsxs)(d.Fragment,{children:["One key per line. Format: ",(0,d.jsx)("code",{children:"name|apiKey"})," or just ",(0,d.jsx)("code",{children:"apiKey"})," (auto-named by index)."]})}),(0,d.jsx)("textarea",{className:"w-full font-mono resize-y min-h-[140px]","aria-label":"API keys to add in bulk",placeholder:Y,value:_,onChange:a=>aa(a.target.value)}),ab&&(0,d.jsxs)("div",{className:`text-xs font-medium ${ab.failed>0?"text-[var(--warn)]":H().success}`,role:"status",children:["✓ ",ab.success," added",ab.failed>0?`, ✗ ${ab.failed} failed`:""]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{onClick:al,variant:"contrast",fullWidth:!0,disabled:W||!_.trim(),children:W?"Adding...":"Add All Keys"}),(0,d.jsx)(l.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===Z&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.pd,{label:"Name",value:D.name,onChange:a=>E({...D,name:a.target.value}),placeholder:t?"Ollama Local":"Production Key"}),t&&(0,d.jsxs)("div",{className:H().fieldGroup,children:[(0,d.jsx)(l.pd,{label:"Ollama Host URL",value:D.ollamaHostUrl,onChange:a=>E({...D,ollamaHostUrl:a.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(l.$n,{onClick:aj,disabled:S||W,variant:"secondary",children:S?"Checking...":"Check"})})]}),!t&&(0,d.jsxs)("div",{className:H().fieldGroup,children:[(0,d.jsx)(l.pd,{label:w,type:u?"text":"password",value:D.apiKey,onChange:a=>E({...D,apiKey:a.target.value}),placeholder:u?"grok-web"===b?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":v?"xai-...":"qoder"===b||"qoder-cn"===b?"pt-...":"",className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(l.$n,{onClick:aj,disabled:!ai()||S||W,variant:"secondary",children:S?"Checking...":"Check"})})]}),v&&(0,d.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."}),u&&i&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[i,j&&(0,d.jsxs)(d.Fragment,{children:[" ",(0,d.jsxs)("a",{href:j,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",j.replace(/^https?:\/\//,"")]})]})]}),B&&(0,d.jsx)(l.l6,{label:"Region",value:M,onChange:a=>O(a.target.value),options:B.map(a=>({value:a.id,label:a.label}))}),e&&(0,d.jsx)(l.pd,{label:"Default Model",value:D.defaultModel,onChange:a=>E({...D,defaultModel:a.target.value}),placeholder:g?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),t&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,d.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,d.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),U&&(0,d.jsx)(N.A,{variant:"success"===U?"success":"error",className:"success"===U?void 0:H().errorBadge,children:"success"===U?"Valid":"Invalid"}),n&&(0,d.jsx)("p",{className:`text-xs break-words ${H().error}`,role:"alert",children:n}),e&&(0,d.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."}),y&&(0,d.jsxs)("div",{className:H().settingsGroup,children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,d.jsx)(l.pd,{label:"Account ID",value:I.accountId,onChange:a=>J({...I,accountId:a.target.value}),placeholder:"abc123def456..."}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,d.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),z&&(0,d.jsxs)("div",{className:H().settingsGroup,children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"AWS Bedrock Credentials"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(l.pd,{label:"AWS Profile (SSO — recommended)",value:K.profile,onChange:a=>L({...K,profile:a.target.value}),placeholder:"my-sso-profile"}),(0,d.jsx)(l.pd,{label:"Region",value:K.region,onChange:a=>L({...K,region:a.target.value}),placeholder:"us-east-1"})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Set a profile from ",(0,d.jsx)("code",{children:"~/.aws/config"})," and leave the API key empty, then run"," ",(0,d.jsxs)("code",{children:["aws sso login --profile ",K.profile||"my-sso-profile"]}),". Credentials refresh automatically."]}),(0,d.jsxs)("div",{className:"flex flex-col gap-3 mt-4",children:[(0,d.jsx)(l.pd,{label:"Access Key ID (only for static keys)",value:K.accessKeyId,onChange:a=>L({...K,accessKeyId:a.target.value}),placeholder:"AKIA..."}),(0,d.jsx)(l.pd,{label:"Session Token (only for temporary ASIA… keys)",type:"password",value:K.sessionToken,onChange:a=>L({...K,sessionToken:a.target.value}),placeholder:"FwoGZXIvYXdz..."})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["For static keys instead: put the AWS ",(0,d.jsx)("strong",{children:"secret"})," access key in the API Key field above and the access key id here. A profile, if set, takes precedence."]})]}),x&&(0,d.jsxs)("div",{className:H().settingsGroup,children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(l.pd,{label:"Azure Endpoint",value:F.azureEndpoint,onChange:a=>G({...F,azureEndpoint:a.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,d.jsx)(l.pd,{label:"Deployment Name",value:F.deployment,onChange:a=>G({...F,deployment:a.target.value}),placeholder:"gpt-4"}),(0,d.jsx)(l.pd,{label:"API Version",value:F.apiVersion,onChange:a=>G({...F,apiVersion:a.target.value}),placeholder:"2024-10-01-preview"}),(0,d.jsx)(l.pd,{label:"Organization",value:F.organization,onChange:a=>G({...F,organization:a.target.value}),placeholder:"Organization ID"})]})]}),(0,d.jsx)(l.pd,{label:"Priority",type:"number",value:D.priority,onChange:a=>E({...D,priority:Number.parseInt(a.target.value)||1})}),(0,d.jsx)(l.l6,{label:"Proxy Pool",value:D.proxyPoolId,onChange:a=>E({...D,proxyPoolId:a.target.value}),options:[{value:s,label:"None"},...(k||[]).map(a=>({value:a.id,label:a.name}))],placeholder:"None"}),0===(k||[]).length&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{onClick:ak,variant:"contrast",fullWidth:!0,disabled:W||!t&&(!D.name||!ai())||e&&!D.defaultModel.trim()||x&&(!F.azureEndpoint||!F.deployment||!F.organization)||y&&!I.accountId,children:W?"Saving...":"Save"}),(0,d.jsx)(l.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function S({isOpen:a,node:b,onSave:c,onClose:e,isAnthropic:g}){let[h,i]=(0,f.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[j,k]=(0,f.useState)(!1),[m,n]=(0,f.useState)(""),[o,p]=(0,f.useState)(""),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)(null),u=async()=>{if(h.name.trim()&&h.prefix.trim()&&h.baseUrl.trim()){k(!0);try{let a={name:h.name,prefix:h.prefix,baseUrl:h.baseUrl};g||(a.apiType=h.apiType),await c(a)}finally{k(!1)}}},v=async()=>{r(!0);try{let a=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:h.baseUrl,apiKey:m,type:g?"anthropic-compatible":"openai-compatible",modelId:o.trim()||void 0})}),b=await a.json();t(b.valid?"success":"failed")}catch{t("failed")}finally{r(!1)}};return b?(0,d.jsx)(l.aF,{isOpen:a,title:`Edit ${g?"Anthropic":"OpenAI"} Compatible`,onClose:e,className:H().dialog,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(l.pd,{label:"Name",value:h.name,onChange:a=>i({...h,name:a.target.value}),placeholder:`${g?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,d.jsx)(l.pd,{label:"Prefix",value:h.prefix,onChange:a=>i({...h,prefix:a.target.value}),placeholder:g?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!g&&(0,d.jsx)(l.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:h.apiType,onChange:a=>i({...h,apiType:a.target.value})}),(0,d.jsx)(l.pd,{label:"Base URL",value:h.baseUrl,onChange:a=>i({...h,baseUrl:a.target.value}),placeholder:g?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${g?"Anthropic":"OpenAI"}-compatible API.`}),(0,d.jsxs)("div",{className:H().fieldGroup,children:[(0,d.jsx)(l.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:a=>n(a.target.value),className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(l.$n,{onClick:v,disabled:!m||q||!h.baseUrl.trim(),variant:"secondary",children:q?"Checking...":"Check"})})]}),(0,d.jsx)(l.pd,{label:"Model ID (optional)",value:o,onChange:a=>p(a.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),s&&(0,d.jsx)(N.A,{variant:"success"===s?"success":"error",className:"success"===s?void 0:H().errorBadge,children:"success"===s?"Valid":"Invalid"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{onClick:u,variant:"contrast",fullWidth:!0,disabled:!h.name.trim()||!h.prefix.trim()||!h.baseUrl.trim()||j,children:j?"Saving...":"Save"}),(0,d.jsx)(l.$n,{onClick:e,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}R.propTypes={isOpen:E().bool.isRequired,provider:E().string,providerName:E().string,isCompatible:E().bool,isAnthropic:E().bool,authType:E().string,authHint:E().string,website:E().string,proxyPools:E().arrayOf(E().shape({id:E().string,name:E().string})),error:E().string,existingNames:E().arrayOf(E().string),onSave:E().func.isRequired,onBulkDone:E().func,onClose:E().func.isRequired},S.propTypes={isOpen:E().bool.isRequired,node:E().shape({id:E().string,name:E().string,prefix:E().string,apiType:E().string,baseUrl:E().string}),onSave:E().func.isRequired,onClose:E().func.isRequired,isAnthropic:E().bool};let T=()=>Object.fromEntries(Object.keys(n.bs).map(a=>[a,!1]));function U({isOpen:a,providerAlias:b,providerDisplayAlias:c,onSave:g,onClose:h}){let[i,j]=(0,f.useState)(""),[k,m]=(0,f.useState)(T),[o,p]=(0,f.useState)(null),[q,r]=(0,f.useState)(""),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(""),w=a=>{let c=`${b}/`;return a.startsWith(c)?a.slice(c.length):a},x=async()=>{let a=w(i.trim());if(a){p("testing"),r("");try{let c=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${b}/${a}`})}),d=await c.json();p(d.ok?"ok":"error"),r(d.error||"")}catch(a){p("error"),r(a.message)}}},y=async()=>{let a=w(i.trim());if(a&&!s){t(!0);try{await g(a,k,k.stt?u:null)}finally{t(!1)}}};return(0,d.jsx)(l.aF,{isOpen:a,onClose:h,title:"Add Custom Model",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("input",{type:"text",value:i,onChange:a=>{j(a.target.value),p(null),r("")},onKeyDown:a=>{"Enter"===a.key&&x()},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,d.jsx)(l.$n,{variant:"secondary",icon:"science",loading:"testing"===o,onClick:x,disabled:!i.trim()||"testing"===o,children:"testing"===o?"Testing...":"Test"})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,d.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:w(i.trim())||"model-id"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Capabilities"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-4",children:Object.entries(n.bs).map(([a,b])=>(0,d.jsx)(l.lM,{checked:!!k[a],onChange:b=>m(c=>({...c,[a]:b})),label:b.label,description:b.desc,size:"sm"},a))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(l.lM,{checked:!!k.stt,onChange:a=>{m(b=>({...b,stt:a})),a||v("")},label:"Speech to text",description:"Transcribes audio via /v1/audio/transcriptions",size:"sm"}),k.stt&&(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(l.l6,{label:"Transport",value:u,onChange:a=>v(a.target.value),placeholder:"Provider default (REST)",options:n.vp.map(a=>({value:a,label:n.qw[a].label})),hint:"Realtime transport marker for the STT dispatcher. Empty keeps the provider's REST format."})})]}),"ok"===o&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,d.jsx)(e.default,{className:"text-base",children:"check_circle"}),"Model is reachable"]}),"error"===o&&(0,d.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,d.jsx)(e.default,{className:"text-base shrink-0",children:"cancel"}),(0,d.jsx)("span",{children:q||"Model not reachable"})]}),(0,d.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,d.jsx)(l.$n,{onClick:h,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,d.jsx)(l.$n,{onClick:y,fullWidth:!0,size:"sm",disabled:!i.trim()||s,children:s?"Adding...":"Add Model"})]})]})})}U.propTypes={isOpen:E().bool.isRequired,providerAlias:E().string.isRequired,providerDisplayAlias:E().string.isRequired,onSave:E().func.isRequired,onClose:E().func.isRequired};let V=`[
7
+ pt-only-auto-named`:Q,[Z,$]=(0,f.useState)("single"),[_,aa]=(0,f.useState)(""),[ab,ac]=(0,f.useState)(null),[ad,ae]=(0,f.useState)(""),[af,ag]=(0,f.useState)(null),ah=()=>{if(t&&D.ollamaHostUrl.trim())return{baseUrl:D.ollamaHostUrl.trim()};if(x)return{azureEndpoint:F.azureEndpoint,apiVersion:F.apiVersion,deployment:F.deployment,organization:F.organization};if(y)return{accountId:I.accountId};if(z){let a={};return K.profile.trim()&&(a.profile=K.profile.trim()),K.region.trim()&&(a.region=K.region.trim()),K.accessKeyId.trim()&&(a.accessKeyId=K.accessKeyId.trim()),K.sessionToken.trim()&&(a.sessionToken=K.sessionToken.trim()),Object.keys(a).length?a:void 0}if(B&&M)return{region:M}},ai=()=>{let a=ah();return!!(A&&a?.[A])||(z?!!D.apiKey&&!!a?.accessKeyId:!!D.apiKey)},aj=async()=>{T(!0);try{let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:D.apiKey,providerSpecificData:ah()})}),c=await a.json();V(c.valid?"success":"failed")}catch{V("failed")}finally{T(!1)}},ak=async()=>{if(b&&(t||ai())&&(t||D.name)&&(!e||D.defaultModel.trim())){X(!0);try{let a=!1;try{T(!0),V(null);let c=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:D.apiKey,providerSpecificData:ah()})});a=!!(await c.json()).valid,V(a?"success":"failed")}catch{V("failed")}finally{T(!1)}await p({name:D.name||(t?"Ollama Local":""),apiKey:D.apiKey,defaultModel:e?D.defaultModel.trim():void 0,priority:D.priority,proxyPoolId:D.proxyPoolId===s?null:D.proxyPoolId,testStatus:a?"active":"unknown",providerSpecificData:ah()})}finally{X(!1)}}},al=async()=>{let a=_.split("\n");if(!a.length)return;let c=P(a,o,{isCloudflareAi:y});if(!c.length)return;X(!0),ac(null);let d=0,e=0;for(let a of c)try{let c=!1;try{let d=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:a.apiKey})});c=!!(await d.json().catch(()=>({}))).valid}catch{c=!1}(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:a.apiKey,name:a.name,priority:1,testStatus:c?"active":"unknown",...a.providerSpecificData?{providerSpecificData:a.providerSpecificData}:{}})})).ok?d++:e++}catch{e++}X(!1),ac({success:d,failed:e}),d>0&&q&&q()},am=async()=>{let a=function(a){let b,c=a=>({entries:[],provider:null,skipped:0,error:a});try{b=JSON.parse(a)}catch{return c("Invalid JSON.")}let d=Array.isArray(b)?b:b?.keys;if(!Array.isArray(d))return c('JSON must contain a "keys" array (or be an array of entries).');let e=[],f=0;for(let a of d){let b="string"==typeof a?.apiKey?a.apiKey.trim():"",c="string"==typeof a?.name?a.name.trim():"";if(!b||a?.isActive===!1){f+=1;continue}e.push({name:c,apiKey:b})}return!e.length&&f>0?c("No usable keys found (all entries empty or inactive)."):{entries:e,provider:"string"==typeof b?.provider?b.provider:null,skipped:f,error:null}}(ad);if(a.error)return void ag({error:a.error});if(!a.entries.length)return;X(!0),ag(null);let c=P(a.entries.map(a=>a.name?`${a.name}|${a.apiKey}`:a.apiKey),o,{isCloudflareAi:y}),d=0,e=0,f=async a=>{try{let c=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:a})});return!!(await c.json().catch(()=>({}))).valid}catch{return!1}};for(let a=0;a<c.length;a+=4){let g=c.slice(a,a+4),h=await Promise.all(g.map(a=>f(a.apiKey)));for(let a=0;a<g.length;a++){let c=g[a];try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:c.apiKey,name:c.name,priority:1,testStatus:h[a]?"active":"unknown",...c.providerSpecificData?{providerSpecificData:c.providerSpecificData}:{}})})).ok?d++:e++}catch{e++}}}X(!1),ag({success:d,failed:e,skipped:a.skipped}),d>0&&q&&q()};return b?(0,d.jsx)(l.aF,{isOpen:a,title:`Add ${c||b} ${w}`,onClose:r,className:H().dialog,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[!z&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{size:"sm",variant:"single"===Z?"contrast":"ghost","aria-pressed":"single"===Z,onClick:()=>{$("single"),ac(null),ag(null)},children:"Single"}),(0,d.jsx)(l.$n,{size:"sm",variant:"bulk"===Z?"contrast":"ghost","aria-pressed":"bulk"===Z,onClick:()=>{$("bulk"),ac(null),ag(null)},children:"Bulk Add"}),(0,d.jsx)(l.$n,{size:"sm",variant:"json"===Z?"contrast":"ghost","aria-pressed":"json"===Z,onClick:()=>{$("json"),ac(null),ag(null)},children:"Import JSON"})]}),"json"===Z&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Paste the JSON produced by another provider's ",(0,d.jsx)("strong",{children:"Extract Keys"})," button (","{",'"keys": [',"apiKey","]","}","). Inactive and empty entries are skipped; names are kept, missing names are auto-numbered."]}),(0,d.jsx)("textarea",{className:"w-full font-mono resize-y min-h-[160px]","aria-label":"Extracted keys JSON",placeholder:'{\n "provider": "commandcode",\n "keys": [{ "name": "Key 1", "apiKey": "user_..." }]\n}',value:ad,onChange:a=>ae(a.target.value)}),af&&(0,d.jsx)("div",{className:`text-xs font-medium ${af.error||af.failed>0?"text-[var(--warn)]":H().success}`,role:"status",children:af.error?`✗ ${af.error}`:`✓ ${af.success} added${af.failed>0?`, ✗ ${af.failed} failed`:""}${af.skipped>0?`, ${af.skipped} skipped`:""}`}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{onClick:am,variant:"contrast",fullWidth:!0,disabled:W||!ad.trim(),children:W?"Importing...":"Import Keys"}),(0,d.jsx)(l.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"bulk"===Z&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:y?(0,d.jsxs)(d.Fragment,{children:["One key per line. Format: ",(0,d.jsx)("code",{children:"name|apiKey|accountId"})," or just ",(0,d.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}):"qoder"===b||"qoder-cn"===b?(0,d.jsxs)(d.Fragment,{children:["One PAT per line. Format: ",(0,d.jsx)("code",{children:"name|pt-..."})," or just ",(0,d.jsx)("code",{children:"pt-..."})," (auto-named by index)."]}):(0,d.jsxs)(d.Fragment,{children:["One key per line. Format: ",(0,d.jsx)("code",{children:"name|apiKey"})," or just ",(0,d.jsx)("code",{children:"apiKey"})," (auto-named by index)."]})}),(0,d.jsx)("textarea",{className:"w-full font-mono resize-y min-h-[140px]","aria-label":"API keys to add in bulk",placeholder:Y,value:_,onChange:a=>aa(a.target.value)}),ab&&(0,d.jsxs)("div",{className:`text-xs font-medium ${ab.failed>0?"text-[var(--warn)]":H().success}`,role:"status",children:["✓ ",ab.success," added",ab.failed>0?`, ✗ ${ab.failed} failed`:""]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{onClick:al,variant:"contrast",fullWidth:!0,disabled:W||!_.trim(),children:W?"Adding...":"Add All Keys"}),(0,d.jsx)(l.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===Z&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.pd,{label:"Name",value:D.name,onChange:a=>E({...D,name:a.target.value}),placeholder:t?"Ollama Local":"Production Key"}),t&&(0,d.jsxs)("div",{className:H().fieldGroup,children:[(0,d.jsx)(l.pd,{label:"Ollama Host URL",value:D.ollamaHostUrl,onChange:a=>E({...D,ollamaHostUrl:a.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(l.$n,{onClick:aj,disabled:S||W,variant:"secondary",children:S?"Checking...":"Check"})})]}),!t&&(0,d.jsxs)("div",{className:H().fieldGroup,children:[(0,d.jsx)(l.pd,{label:w,type:u?"text":"password",value:D.apiKey,onChange:a=>E({...D,apiKey:a.target.value}),placeholder:u?"grok-web"===b?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":v?"xai-...":"qoder"===b||"qoder-cn"===b?"pt-...":"",className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(l.$n,{onClick:aj,disabled:!ai()||S||W,variant:"secondary",children:S?"Checking...":"Check"})})]}),v&&(0,d.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."}),u&&i&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[i,j&&(0,d.jsxs)(d.Fragment,{children:[" ",(0,d.jsxs)("a",{href:j,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",j.replace(/^https?:\/\//,"")]})]})]}),B&&(0,d.jsx)(l.l6,{label:"Region",value:M,onChange:a=>O(a.target.value),options:B.map(a=>({value:a.id,label:a.label}))}),e&&(0,d.jsx)(l.pd,{label:"Default Model",value:D.defaultModel,onChange:a=>E({...D,defaultModel:a.target.value}),placeholder:g?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),t&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,d.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,d.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),U&&(0,d.jsx)(N.A,{variant:"success"===U?"success":"error",className:"success"===U?void 0:H().errorBadge,children:"success"===U?"Valid":"Invalid"}),n&&(0,d.jsx)("p",{className:`text-xs break-words ${H().error}`,role:"alert",children:n}),e&&(0,d.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."}),y&&(0,d.jsxs)("div",{className:H().settingsGroup,children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,d.jsx)(l.pd,{label:"Account ID",value:I.accountId,onChange:a=>J({...I,accountId:a.target.value}),placeholder:"abc123def456..."}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,d.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),z&&(0,d.jsxs)("div",{className:H().settingsGroup,children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"AWS Bedrock Credentials"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(l.pd,{label:"AWS Profile (SSO — recommended)",value:K.profile,onChange:a=>L({...K,profile:a.target.value}),placeholder:"my-sso-profile"}),(0,d.jsx)(l.pd,{label:"Region",value:K.region,onChange:a=>L({...K,region:a.target.value}),placeholder:"us-east-1"})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Set a profile from ",(0,d.jsx)("code",{children:"~/.aws/config"})," and leave the API key empty, then run"," ",(0,d.jsxs)("code",{children:["aws sso login --profile ",K.profile||"my-sso-profile"]}),". Credentials refresh automatically."]}),(0,d.jsxs)("div",{className:"flex flex-col gap-3 mt-4",children:[(0,d.jsx)(l.pd,{label:"Access Key ID (only for static keys)",value:K.accessKeyId,onChange:a=>L({...K,accessKeyId:a.target.value}),placeholder:"AKIA..."}),(0,d.jsx)(l.pd,{label:"Session Token (only for temporary ASIA… keys)",type:"password",value:K.sessionToken,onChange:a=>L({...K,sessionToken:a.target.value}),placeholder:"FwoGZXIvYXdz..."})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["For static keys instead: put the AWS ",(0,d.jsx)("strong",{children:"secret"})," access key in the API Key field above and the access key id here. A profile, if set, takes precedence."]})]}),x&&(0,d.jsxs)("div",{className:H().settingsGroup,children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(l.pd,{label:"Azure Endpoint",value:F.azureEndpoint,onChange:a=>G({...F,azureEndpoint:a.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,d.jsx)(l.pd,{label:"Deployment Name",value:F.deployment,onChange:a=>G({...F,deployment:a.target.value}),placeholder:"gpt-4"}),(0,d.jsx)(l.pd,{label:"API Version",value:F.apiVersion,onChange:a=>G({...F,apiVersion:a.target.value}),placeholder:"2024-10-01-preview"}),(0,d.jsx)(l.pd,{label:"Organization",value:F.organization,onChange:a=>G({...F,organization:a.target.value}),placeholder:"Organization ID"})]})]}),(0,d.jsx)(l.pd,{label:"Priority",type:"number",value:D.priority,onChange:a=>E({...D,priority:Number.parseInt(a.target.value)||1})}),(0,d.jsx)(l.l6,{label:"Proxy Pool",value:D.proxyPoolId,onChange:a=>E({...D,proxyPoolId:a.target.value}),options:[{value:s,label:"None"},...(k||[]).map(a=>({value:a.id,label:a.name}))],placeholder:"None"}),0===(k||[]).length&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{onClick:ak,variant:"contrast",fullWidth:!0,disabled:W||!t&&(!D.name||!ai())||e&&!D.defaultModel.trim()||x&&(!F.azureEndpoint||!F.deployment||!F.organization)||y&&!I.accountId,children:W?"Saving...":"Save"}),(0,d.jsx)(l.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function S({isOpen:a,node:b,onSave:c,onClose:e,isAnthropic:g}){let[h,i]=(0,f.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[j,k]=(0,f.useState)(!1),[m,n]=(0,f.useState)(""),[o,p]=(0,f.useState)(""),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)(null),u=async()=>{if(h.name.trim()&&h.prefix.trim()&&h.baseUrl.trim()){k(!0);try{let a={name:h.name,prefix:h.prefix,baseUrl:h.baseUrl};g||(a.apiType=h.apiType),await c(a)}finally{k(!1)}}},v=async()=>{r(!0);try{let a=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:h.baseUrl,apiKey:m,type:g?"anthropic-compatible":"openai-compatible",modelId:o.trim()||void 0})}),b=await a.json();t(b.valid?"success":"failed")}catch{t("failed")}finally{r(!1)}};return b?(0,d.jsx)(l.aF,{isOpen:a,title:`Edit ${g?"Anthropic":"OpenAI"} Compatible`,onClose:e,className:H().dialog,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(l.pd,{label:"Name",value:h.name,onChange:a=>i({...h,name:a.target.value}),placeholder:`${g?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,d.jsx)(l.pd,{label:"Prefix",value:h.prefix,onChange:a=>i({...h,prefix:a.target.value}),placeholder:g?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!g&&(0,d.jsx)(l.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:h.apiType,onChange:a=>i({...h,apiType:a.target.value})}),(0,d.jsx)(l.pd,{label:"Base URL",value:h.baseUrl,onChange:a=>i({...h,baseUrl:a.target.value}),placeholder:g?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${g?"Anthropic":"OpenAI"}-compatible API.`}),(0,d.jsxs)("div",{className:H().fieldGroup,children:[(0,d.jsx)(l.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:a=>n(a.target.value),className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(l.$n,{onClick:v,disabled:!m||q||!h.baseUrl.trim(),variant:"secondary",children:q?"Checking...":"Check"})})]}),(0,d.jsx)(l.pd,{label:"Model ID (optional)",value:o,onChange:a=>p(a.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),s&&(0,d.jsx)(N.A,{variant:"success"===s?"success":"error",className:"success"===s?void 0:H().errorBadge,children:"success"===s?"Valid":"Invalid"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{onClick:u,variant:"contrast",fullWidth:!0,disabled:!h.name.trim()||!h.prefix.trim()||!h.baseUrl.trim()||j,children:j?"Saving...":"Save"}),(0,d.jsx)(l.$n,{onClick:e,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}R.propTypes={isOpen:E().bool.isRequired,provider:E().string,providerName:E().string,isCompatible:E().bool,isAnthropic:E().bool,authType:E().string,authHint:E().string,website:E().string,proxyPools:E().arrayOf(E().shape({id:E().string,name:E().string})),error:E().string,existingNames:E().arrayOf(E().string),onSave:E().func.isRequired,onBulkDone:E().func,onClose:E().func.isRequired},S.propTypes={isOpen:E().bool.isRequired,node:E().shape({id:E().string,name:E().string,prefix:E().string,apiType:E().string,baseUrl:E().string}),onSave:E().func.isRequired,onClose:E().func.isRequired,isAnthropic:E().bool};let T=()=>Object.fromEntries(Object.keys(n.bs).map(a=>[a,!1]));function U({isOpen:a,providerAlias:b,providerDisplayAlias:c,onSave:g,onClose:h}){let[i,j]=(0,f.useState)(""),[k,m]=(0,f.useState)(T),[o,p]=(0,f.useState)(null),[q,r]=(0,f.useState)(""),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(""),w=a=>{let c=`${b}/`;return a.startsWith(c)?a.slice(c.length):a},x=async()=>{let a=w(i.trim());if(a){p("testing"),r("");try{let c=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${b}/${a}`})}),d=await c.json();p(d.ok?"ok":"error"),r(d.error||"")}catch(a){p("error"),r(a.message)}}},y=async()=>{let a=w(i.trim());if(a&&!s){t(!0);try{await g(a,k,k.stt?u:null)}finally{t(!1)}}};return(0,d.jsx)(l.aF,{isOpen:a,onClose:h,title:"Add Custom Model",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("input",{type:"text",value:i,onChange:a=>{j(a.target.value),p(null),r("")},onKeyDown:a=>{"Enter"===a.key&&x()},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,d.jsx)(l.$n,{variant:"secondary",icon:"science",loading:"testing"===o,onClick:x,disabled:!i.trim()||"testing"===o,children:"testing"===o?"Testing...":"Test"})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,d.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:w(i.trim())||"model-id"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Capabilities"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-4",children:Object.entries(n.bs).map(([a,b])=>(0,d.jsx)(l.lM,{checked:!!k[a],onChange:b=>m(c=>({...c,[a]:b})),label:b.label,description:b.desc,size:"sm"},a))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(l.lM,{checked:!!k.stt,onChange:a=>{m(b=>({...b,stt:a})),a||v("")},label:"Speech to text",description:"Transcribes audio via /v1/audio/transcriptions",size:"sm"}),k.stt&&(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(l.l6,{label:"Transport",value:u,onChange:a=>v(a.target.value),placeholder:"Provider default (REST)",options:n.vp.map(a=>({value:a,label:n.qw[a].label})),hint:"Realtime transport marker for the STT dispatcher. Empty keeps the provider's REST format."})})]}),"ok"===o&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,d.jsx)(e.default,{className:"text-base",children:"check_circle"}),"Model is reachable"]}),"error"===o&&(0,d.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,d.jsx)(e.default,{className:"text-base shrink-0",children:"cancel"}),(0,d.jsx)("span",{children:q||"Model not reachable"})]}),(0,d.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,d.jsx)(l.$n,{onClick:h,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,d.jsx)(l.$n,{onClick:y,fullWidth:!0,size:"sm",disabled:!i.trim()||s,children:s?"Adding...":"Add Model"})]})]})})}U.propTypes={isOpen:E().bool.isRequired,providerAlias:E().string.isRequired,providerDisplayAlias:E().string.isRequired,onSave:E().func.isRequired,onClose:E().func.isRequired};let V=`[
8
8
  {
9
9
  "accessToken": "eyJhbGc...",
10
10
  "refreshToken": "rt_...",
@@ -24,4 +24,4 @@ pt-only-auto-named`:Q,[Z,$]=(0,f.useState)("single"),[_,aa]=(0,f.useState)(""),[
24
24
  "id_token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
25
25
  "email": "account2@example.com"
26
26
  }
27
- ]`;function Y(a){let b,c=a.trim();if(!c)return[];try{b=JSON.parse(c)}catch(a){try{let a=c;a.startsWith("[")||((a=a.replace(/\}\s*,\s*\{/g,"},{").replace(/\}\s*\{/g,"},{")).endsWith(",")&&(a=a.slice(0,-1)),a=`[${a}]`),b=JSON.parse(a)}catch{throw a}}if(Array.isArray(b))return b;if(b&&"object"==typeof b)return Array.isArray(b.accounts)?b.accounts:[b];throw Error("Input must be a JSON object or array of objects")}function Z({isOpen:a,onClose:b,onSuccess:c}){let[g,h]=(0,f.useState)(""),[i,j]=(0,f.useState)(!1),[k,m]=(0,f.useState)(""),[n,o]=(0,f.useState)(null),[p,q]=(0,f.useState)(!1),[r,s]=(0,f.useState)(null),t=(0,f.useRef)(null),u=()=>{i||(h(""),m(""),o(null),s(null),q(!1),b())},v=async a=>{if(!a||0===a.length)return;m("");let b=Array.from(a).filter(a=>a.name.endsWith(".json")||"application/json"===a.type||""===a.type);if(0===b.length)return void m((0,B.Tl)("Please select valid .json files"));try{let a=[];for(let c of b){let b=await c.text(),d=Y(b);Array.isArray(d)?a.push(...d):d&&a.push(d)}if(0===a.length)return void m((0,B.Tl)("No accounts found in selected files"));h(JSON.stringify(a,null,2)),s({filesCount:b.length,accountsCount:a.length})}catch(a){m(`${(0,B.Tl)("Error reading files")}: ${a.message}`)}},w=async()=>{let a;m(""),o(null);try{a=Y(g)}catch(a){m(`${(0,B.Tl)("Invalid JSON")}: ${a.message}`);return}if(!a||0===a.length)return void m((0,B.Tl)("No accounts found in input"));j(!0);try{let b=await fetch("/api/oauth/grok-cli/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:a})}),d=await b.json();if(!b.ok)return void m(d?.error||`Request failed: ${b.status}`);o(d),d.success>0&&"function"==typeof c&&c()}catch(a){m(a.message||(0,B.Tl)("Request failed"))}finally{j(!1)}},x=n?.results?.filter(a=>!a.ok)||[];return(0,d.jsx)(l.aF,{isOpen:a,title:(0,B.Tl)("Bulk Add Grok CLI Accounts"),onClose:u,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:(0,B.Tl)("Upload multiple .json files or paste JSON array / object.")}),(0,d.jsx)("input",{ref:t,type:"file",accept:".json,application/json",multiple:!0,className:"hidden",onChange:a=>{v(a.target.files),a.target&&(a.target.value="")}}),(0,d.jsx)(l.$n,{type:"button",size:"sm",variant:"secondary",icon:"upload_file",onClick:()=>t.current?.click(),disabled:i,children:(0,B.Tl)("Upload JSON Files")})]}),(0,d.jsxs)("div",{onDragOver:a=>{a.preventDefault(),q(!0)},onDragLeave:a=>{a.preventDefault(),q(!1)},onDrop:a=>{a.preventDefault(),q(!1),a.dataTransfer?.files?.length>0&&v(a.dataTransfer.files)},className:`relative rounded border transition-colors ${p?"border-primary bg-primary/10 ring-2 ring-primary/30":"border-accent/30 bg-sidebar"}`,children:[(0,d.jsx)("textarea",{className:"w-full rounded bg-transparent p-2.5 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:X,value:g,onChange:a=>{h(a.target.value),s(null)},disabled:i}),p&&(0,d.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-sidebar/90 rounded pointer-events-none backdrop-blur-xs",children:[(0,d.jsx)(e.default,{className:"text-3xl text-primary mb-1",children:"upload_file"}),(0,d.jsx)("span",{className:"text-sm font-medium text-primary",children:(0,B.Tl)("Drop .json files here")})]})]}),r&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-green-400 font-medium bg-green-500/10 border border-green-500/20 px-2.5 py-1.5 rounded",children:[(0,d.jsx)(e.default,{className:"text-sm",children:"check_circle"}),(0,d.jsxs)("span",{children:[(0,B.Tl)("Loaded")," ",r.accountsCount," ",(0,B.Tl)("account(s) from")," ",r.filesCount," ",(0,B.Tl)("file(s)")]})]}),k&&(0,d.jsx)("p",{className:"text-xs text-red-500 break-words",children:k}),n&&n.failed>0&&(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"text-sm font-medium text-yellow-400",children:["✗ ",n.failed," ",(0,B.Tl)("failed")]}),x.length>0&&(0,d.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:x.map(a=>(0,d.jsxs)("li",{className:"text-red-400",children:["[",a.index,"] ",a.error]},a.index))})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{onClick:w,fullWidth:!0,disabled:i||!g.trim(),children:i?(0,B.Tl)("Importing..."):(0,B.Tl)("Import All")}),(0,d.jsx)(l.$n,{onClick:u,variant:"ghost",fullWidth:!0,disabled:i,children:(0,B.Tl)("Close")})]})]})})}var $=c(41371);let _=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],aa=/^[A-Za-z0-9-]+$/;function ab({providerId:a}){let b=(0,$.i)(),[c,g]=(0,f.useState)(!1),[h,i]=(0,f.useState)([{name:"",value:""}]),[j,k]=(0,f.useState)({}),[m,n]=(0,f.useState)(!1),[o,p]=(0,f.useState)(!1),q=(a,b,c)=>{i(d=>d.map((d,e)=>e===a?{...d,[b]:c}:d))},r=(0,f.useCallback)(async()=>{let c={};for(let a of h.filter(a=>a.name.trim())){let d=a.name.trim();if(!aa.test(d))return void b.error(`Invalid header name: ${d}`);if(_.includes(d.toLowerCase()))return void b.error(`Header ${d} cannot be overridden`);if(d in c)return void b.error(`Duplicate header name: ${d}`);a.value!==j[d]&&(c[d]=a.value)}p(!0);try{let d=await fetch(`/api/providers/${a}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:c})});if(!d.ok){let a=await d.json().catch(()=>({}));b.error(a.error||"Failed to save");return}n(Object.keys(c).length>0),b.success("Custom headers saved")}finally{p(!1)}},[h,j,a,b]);return 0!==Object.keys(j).length||m?(0,d.jsxs)(l.Zp,{className:`ui-card ${H().panel}`,children:[(0,d.jsxs)("button",{type:"button",onClick:()=>g(a=>!a),"aria-expanded":c,className:"flex w-full items-center justify-between text-left",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("span",{className:"ui-eyebrow",children:[(0,d.jsx)(e.default,{className:"text-[16px]",children:"tune"}),"Custom Headers"]}),m&&(0,d.jsx)(N.A,{variant:"success",children:"Active"})]}),(0,d.jsx)(e.default,{className:"text-[16px] text-text-muted",children:c?"expand_less":"expand_more"})]}),c&&(0,d.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,d.jsx)("div",{className:"flex flex-col gap-2",children:h.map((a,b)=>{let c=a.name.trim()in j&&a.value!==j[a.name.trim()];return(0,d.jsxs)("div",{className:H().customHeaderRow,children:[(0,d.jsx)(l.pd,{"aria-label":`Header ${b+1} name`,value:a.name,onChange:a=>q(b,"name",a.target.value),placeholder:"Header-Name",spellCheck:!1,className:"min-w-0"}),(0,d.jsx)(l.pd,{"aria-label":`Header ${b+1} value`,value:a.value,onChange:a=>q(b,"value",a.target.value),placeholder:"Value",spellCheck:!1,title:c?"Overridden":a.name.trim()in j?"Registry default":"",className:"min-w-0",inputClassName:c?"border-[var(--warn)]":void 0}),(0,d.jsx)("button",{type:"button",title:"Remove header","aria-label":`Remove header ${b+1}`,onClick:()=>i(a=>a.length>1?a.filter((a,c)=>c!==b):[{name:"",value:""}]),className:`${H().iconButton} ${H().error}`,children:(0,d.jsx)(e.default,{className:"text-[16px]",children:"delete"})})]},b)})}),(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,d.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"add",onClick:()=>i(a=>[...a,{name:"",value:""}]),children:"Add header"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",disabled:o,onClick:()=>{i(Object.entries(j).map(([a,b])=>({name:a,value:b})))},children:"Reset"}),(0,d.jsx)(l.$n,{size:"sm",variant:"contrast",disabled:o,onClick:r,children:o?"Saving...":"Save"})]})]})]})]}):null}ab.propTypes={providerId:E().string.isRequired};var ac=c(56020),ad=c(54589);let ae={claude:"claudeAutoPing",codex:"codexAutoPing"};function af(){let a,b,c,h,o,p=(0,g.useParams)(),q=(0,g.useRouter)(),r=p.id,{getCaps:s}=(0,A.y)(),[t,u]=(0,f.useState)([]),[v,w]=(0,f.useState)(!0),[x,D]=(0,f.useState)(null),[E,G]=(0,f.useState)([]),[I,K]=(0,f.useState)(!1),[L,M]=(0,f.useState)(!1),[N,P]=(0,f.useState)(!1),[Q,T]=(0,f.useState)(!1),[V,X]=(0,f.useState)(""),[Y,$]=(0,f.useState)(!1),[_,aa]=(0,f.useState)(!1),[af,ag]=(0,f.useState)(!1),[ah,ai]=(0,f.useState)(!1),[aj,ak]=(0,f.useState)(!1),[al,am]=(0,f.useState)(null),[an,ao]=(0,f.useState)({}),[ap,aq]=(0,f.useState)([]),[ar,as]=(0,f.useState)(!1),[at,au]=(0,f.useState)({}),[av,aw]=(0,f.useState)(""),[ax,ay]=(0,f.useState)(()=>new Set),[az,aA]=(0,f.useState)(!1),[aB,aC]=(0,f.useState)([]),[aD,aE]=(0,f.useState)("__none__"),[aF,aG]=(0,f.useState)(!1),[aH,aI]=(0,f.useState)(null),[aJ,aK]=(0,f.useState)(""),[aL,aM]=(0,f.useState)("auto"),[aN,aO]=(0,f.useState)({enabled:!1,connections:{},schedules:{}}),[aP,aQ]=(0,f.useState)(null),[aR,aS]=(0,f.useState)([]),[aT,aU]=(0,f.useState)([]),[aV,aW]=(0,f.useState)(null),[aX,aY]=(0,f.useState)([]),[aZ,a$]=(0,f.useState)([]),[a_,a0]=(0,f.useState)(null),[a1,a2]=(0,f.useState)(!1),[a3,a4]=(0,f.useState)(!1),[a5,a6]=(0,f.useState)(!1),[a7,a8]=(0,f.useState)(null),[a9,ba]=(0,f.useState)({}),[bb,bc]=(0,f.useState)(null),bd=(0,f.useRef)(!1),[be,bf]=(0,f.useState)(!1),[bg,bh]=(0,f.useState)(!1),{copied:bi,copy:bj}=(0,z.C)(),bk=()=>{K(!0)},bl=()=>{"xiaomi-mimo"===r?M(!0):bq?bk():(X(""),T(!0))},bm=()=>{X(""),T(!0)},bn=()=>{bq?bl():bm()},bo=x?{id:x.id,name:x.name||("anthropic-compatible"===x.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===x.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===x.type?"AC":"OC",apiType:x.apiType,baseUrl:x.baseUrl,type:x.type}:m.zN[r]||m.fg[r]||m.IS[r]||m.nJ[r]||m.br[r],bp=bo?.authModes||[],bq=!!m.zN[r]||!!m.IS[r]||bp.includes("oauth"),br=!!m.fg[r]||bp.includes("apikey"),bs=!!m.IS[r]?.noAuth,bt=(0,n.KC)(r),bu=("cursor"===r||"zed"===r)&&aT.length>0?aT:bt,bv=(0,m.wG)(r),bw=(0,m.mq)(r),bx=(0,m.gb)(r),by=bw||bx,bz=!by&&bq&&br,bA="xai"===r?"Grok Build OAuth":"grok-cli"===r?"Grok CLI Device Login":"kimi"===r?"Kimi Coding OAuth":"OAuth",bB="xai"===r?"xAI API Key":"kimi"===r?"Kimi API Key":"qoder"===r||"qoder-cn"===r?"PAT":"API Key",bC=a=>{if(!aL||"auto"===aL)return null;let b=y(r,a);return b&&b.includes(aL)?aL:null},bD=by?r:bv,bE=(()=>{let a=new Set,b=new Set,c=c=>{if(!c||b.has(c))return;b.add(c);let d=y(r,c);d&&d.forEach(b=>{"none"!==b&&a.add(b)})};for(let a of bu)c(a.id);for(let a of aX)c(a.id);for(let a of ap)a.providerAlias===bD&&"llm"===(a.kind||a.type||"llm")&&c(a.id);return a.size?["auto",...a]:null})(),bF=by?x?.prefix||r:bv,bG=(0,f.useCallback)(async()=>{try{let a=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(bD)}`,{cache:"no-store"}),b=await a.json();a.ok&&a$(b.ids||[])}catch(a){console.log("Error fetching disabled models:",a)}},[bD]),bH=async a=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:bD,ids:[a]})})).ok&&await bG()}catch(a){console.log("Error disabling model:",a)}},bI=async a=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(bD)}&id=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await bG()}catch(a){console.log("Error enabling model:",a)}},bJ=async a=>{a.length&&a0({title:"Disable All Models",message:`Disable all ${a.length} model(s)?`,onConfirm:async()=>{a0(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:bD,ids:a})})).ok&&await bG()}catch(a){console.log("Error disabling all models:",a)}}})},bK=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(bD)}`,{method:"DELETE"})).ok&&await bG()}catch(a){console.log("Error enabling all models:",a)}},bL=(0,f.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&ao(b.aliases||{})}catch(a){console.log("Error fetching aliases:",a)}},[]),bM=(0,f.useCallback)(async()=>{try{let a=await fetch("/api/models/custom",{cache:"no-store"}),b=await a.json();a.ok&&aq(b.models||[])}catch(a){console.log("Error fetching custom models:",a)}},[]),bN=(0,f.useCallback)(async()=>{try{let[a,b,c,d]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),e=await a.json(),f=await b.json(),g=await c.json(),h=d.ok?await d.json():{};if(a.ok){let a=(e.connections||[]).filter(a=>a.provider===r);u(a)}c.ok&&G(g.proxyPools||[]);let i=(h.providerStrategies||{})[r]||{};aI(i.fallbackStrategy||null),aK(null!=i.stickyRoundRobinLimit?String(i.stickyRoundRobinLimit):"1");let j=(h.providerThinking||{})[r]||{};aM(j.mode||"auto");let k=ae[r],l=k&&h[k]||{};if(aO({enabled:!0===l.enabled,connections:l.connections||{},schedules:l.schedules||{}}),b.ok){let a=(f.nodes||[]).find(a=>a.id===r)||null;if(!a&&by)for(let b=0;b<3;b+=1){await new Promise(a=>setTimeout(a,150));let b=await fetch("/api/provider-nodes",{cache:"no-store"});if(b.ok&&(a=((await b.json()).nodes||[]).find(a=>a.id===r)||null))break}D(a)}}catch(a){console.log("Error fetching connections:",a)}finally{w(!1)}},[r,by]),bO=async a=>{try{let b=await fetch(`/api/provider-nodes/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();b.ok&&(D(c.node),await bN(),ai(!1))}catch(a){console.log("Error updating provider node:",a)}},bP=async(a,b)=>{try{let c=await fetch("/api/settings",{cache:"no-store"}),d=(c.ok?await c.json():{}).providerStrategies||{},e={};a&&(e.fallbackStrategy=a),"round-robin"===a&&""!==b&&(e.stickyRoundRobinLimit=Number(b)||3);let f={...d};0===Object.keys(e).length?delete f[r]:f[r]=e,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:f})})}catch(a){console.log("Error saving provider strategy:",a)}},bQ=async a=>{try{let b=await fetch("/api/settings",{cache:"no-store"}),c={...(b.ok?await b.json():{}).providerThinking||{}};a&&"auto"!==a?c[r]={mode:a}:delete c[r],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:c})})}catch(a){console.log("Error saving thinking config:",a)}},bR=async a=>{let b=ae[r];if(b){aO(a);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[b]:a})})}catch(a){console.log("Error saving auto-ping config:",a)}}},bS=async(a,b,c=bv)=>{let d=`${c}/${a}`;try{let a=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:d,alias:b})});if(a.ok)await bL();else{let b=await a.json();alert(b.error||"Failed to set alias")}}catch(a){console.log("Error setting alias:",a)}},bT=async a=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await bL()}catch(a){console.log("Error deleting alias:",a)}},bU=async(a,b="llm",c=bD,d,e)=>{try{let f=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:c,id:a,type:b,...d?{caps:d}:{},...e?{transport:e}:{}})});if(f.ok)await bM();else{let a=await f.json();alert(a.error||"Failed to add custom model")}}catch(a){console.log("Error adding custom model:",a)}},bV=async(a,b="llm",c=bD)=>{try{let d=new URLSearchParams({providerAlias:c,id:a,type:b});(await fetch(`/api/models/custom?${d}`,{method:"DELETE"})).ok&&await bM()}catch(a){console.log("Error deleting custom model:",a)}},bW=async()=>{if(be)return;let a=t.find(a=>!1!==a.isActive);if(!a)return void alert((0,B.Tl)("Please add an active Qoder connection first"));bf(!0);try{let b=await fetch(`/api/providers/${a.id}/models`),c=await b.json();if(!b.ok)return void alert(c.error||(0,B.Tl)("Failed to fetch models"));let d=c.models||[];if(0===d.length)return void alert((0,B.Tl)("No models returned"));let e=0;for(let a of d){let b=a.id||a.name;if(!b)continue;let c=b.replace(/^(qoder-cn|qoder)\//,"");ap.some(a=>a.providerAlias===bD&&a.id===c&&"llm"===(a.kind||a.type||"llm"))||Object.values(an).includes(`${bD}/${c}`)||(await bU(c,"llm",bD),e+=1)}0===e?alert((0,B.Tl)("All models already exist, no new models added")):alert((0,B.Tl)("Successfully added")+` ${e} `+(0,B.Tl)("models"))}catch(a){console.log("Error importing Qoder models:",a),alert((0,B.Tl)("Error fetching models")+": "+a.message)}finally{bf(!1)}},bX=async()=>{if(bg)return;let a=t.find(a=>!1!==a.isActive);if(!a)return void alert((0,B.Tl)("Please add an active Cline connection first"));bh(!0);try{let b=await fetch(`/api/providers/${a.id}/models`),c=await b.json();if(!b.ok)return void alert(c.error||(0,B.Tl)("Failed to fetch models"));let d=c.models||[];if(0===d.length)return void alert((0,B.Tl)("No models returned"));let e=0;for(let a of d){let b=a.id||a.name;b&&(ap.some(a=>a.providerAlias===bD&&a.id===b&&"llm"===(a.kind||a.type||"llm"))||Object.values(an).includes(`${bD}/${b}`)||(await bU(b,"llm",bD),e+=1))}0===e?alert((0,B.Tl)("All models already exist, no new models added")):alert((0,B.Tl)("Successfully added")+` ${e} `+(0,B.Tl)("models"))}catch(a){console.log("Error importing Cline models:",a),alert((0,B.Tl)("Error fetching models")+": "+a.message)}finally{bh(!1)}},bY=async()=>{if(a3||0===t.length)return;let a=Object.fromEntries(t.map(a=>[a.id,{state:"queued",error:null}]));bd.current=!1,a4(!0),a6(!1),a8(null),ba(a),bc({total:t.length,completed:0,passed:0,failed:0,stopped:!1});let b=0,c=0;try{for(let a=0;a<t.length;a+=1){if(bd.current){bc({total:t.length,completed:a,passed:b,failed:c,stopped:!0});break}let d=t[a];a8(d.id),ba(a=>({...a,[d.id]:{state:"testing",error:null}}));try{let a=await fetch(`/api/providers/${d.id}/test`,{method:"POST"}),e=await a.json(),f=!!e.valid;f?b+=1:c+=1,ba(a=>({...a,[d.id]:{state:f?"success":"failed",error:f?null:e.error||null}}))}catch(a){c+=1,ba(b=>({...b,[d.id]:{state:"failed",error:a.message||"Test failed"}}))}bc({total:t.length,completed:a+1,passed:b,failed:c,stopped:!1}),a<t.length-1&&await new Promise(a=>setTimeout(a,1e3))}}finally{a8(null),a4(!1),a6(!1),bd.current=!1}},bZ=async a=>{a0({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{a0(null);try{(await fetch(`/api/providers/${a}`,{method:"DELETE"})).ok&&u(b=>b.filter(b=>b.id!==a))}catch(a){console.log("Error deleting connection:",a)}}})},b$=()=>{bN(),K(!1)},b_=async a=>{X("");try{let b=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,...a})}),c=null;try{c=await b.json()}catch{c=null}if(b.ok){await bN(),T(!1);return}X(c?.error||"Failed to save connection")}catch(a){console.log("Error saving connection:",a),X("Failed to save connection")}},b0=async a=>{try{(await fetch(`/api/providers/${al.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok&&(await bN(),ag(!1))}catch(a){console.log("Error updating connection:",a)}},b1=async(a,b)=>{try{(await fetch(`/api/providers/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:b})})).ok&&u(c=>c.map(c=>c.id===a?{...c,isActive:b}:c))}catch(a){console.log("Error updating connection status:",a)}},b2=async(a,b)=>{let c=[...t];[c[a],c[b]]=[c[b],c[a]],u(c);try{await Promise.all([fetch(`/api/providers/${c[a].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:a})}),fetch(`/api/providers/${c[b].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:b})})])}catch(a){console.log("Error swapping priority:",a),await bN()}},b3=t.filter(a=>aB.includes(a.id)),b4=t.length>0&&aB.length===t.length;(()=>{if(0===b3.length)return;let a=new Set(b3.map(a=>a.providerSpecificData?.proxyPoolId||"__none__"));if(1===a.size){let b=[...a][0];if("__none__"===b)return;let c=E.find(a=>a.id===b);return c?.name}})();let b5=()=>{aF||ak(!1)},b6=async a=>{aG(!0);try{let b=0;for(let{connectionId:c,proxyPoolId:d}of a)try{(await fetch(`/api/providers/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:d})})).ok||(b+=1)}catch(a){console.log("Error applying proxy for",c,a),b+=1}b>0&&alert(`Updated with ${b} failed request(s).`),await bN(),ak(!1)}finally{aG(!1)}},b7=a=>b6(t.map(b=>({connectionId:b.id,proxyPoolId:a}))),[b8,b9]=(0,f.useState)(!1),ca=async()=>{if(!b8){b9(!0);try{let a=await fetch(`/api/providers/${encodeURIComponent(r)}/connections/keys`),b=await a.json().catch(()=>({}));if(!a.ok)throw Error(b.error||"Failed to export connection keys");let c=new Blob([JSON.stringify(b,null,2)],{type:"application/json"}),d=URL.createObjectURL(c),e=document.createElement("a");e.href=d,e.download=`keys-${r}.json`,document.body.appendChild(e),e.click(),e.remove(),URL.revokeObjectURL(d)}catch(a){useNotificationStore.getState().error(a.message)}finally{b9(!1)}}},cb=(0,d.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03] max-h-[500px] overflow-y-auto pr-1",children:t.map((a,b)=>{let c;return(0,d.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,d.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,d.jsx)("input",{type:"checkbox",checked:(c=a.id,aB.includes(c)),onChange:()=>{var b;return b=a.id,void aC(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])},className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"})}),(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)(O,{connection:a,proxyPools:E,isOAuth:bq,isFirst:0===b,isLast:b===t.length-1,onMoveUp:()=>b2(b,b-1),onMoveDown:()=>b2(b,b+1),onToggleActive:b=>b1(a.id,b),autoPing:ae[r]&&"oauth"===a.authType?{isActive:!0===aN.connections[a.id]||aN.schedules?.[a.id]?.enabled===!0,reactiveOn:!0===aN.connections[a.id],provider:r,scheduleOn:aN.schedules?.[a.id]?.enabled===!0,scheduleSummary:(0,ad.JW)(aN.schedules?.[a.id]).join(" / "),onConfigure:()=>aQ(a)}:null,onUpdateProxy:async b=>{try{(await fetch(`/api/providers/${a.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:b||null})})).ok&&u(c=>c.map(c=>c.id===a.id?{...c,providerSpecificData:{...c.providerSpecificData,proxyPoolId:b||null}}:c))}catch(a){console.log("Error updating proxy:",a)}},onEdit:()=>{am(a),ag(!0)},onDelete:()=>bZ(a.id),oneByOneStatus:a9[a.id]||null})})]},a.id)})}),cc=E.filter(a=>!0===a.isActive),cd=(0,d.jsx)(l.aF,{isOpen:aj,onClose:b5,title:`Apply Proxy (${t.length} connections)`,children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsxs)("button",{onClick:()=>{let a=E.filter(a=>!0===a.isActive);return 0===a.length?void alert("No active proxy pools available."):b6(t.map((b,c)=>({connectionId:b.id,proxyPoolId:a[c%a.length].id})))},disabled:aF||0===cc.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,d.jsx)(e.default,{className:"text-text-muted text-[18px]",children:"sync_alt"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,d.jsxs)("button",{onClick:()=>b7(null),disabled:aF,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,d.jsx)(e.default,{className:"text-text-muted text-[18px]",children:"link_off"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),E.map(a=>(0,d.jsxs)("button",{onClick:()=>b7(a.id),disabled:aF||!0!==a.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,d.jsx)(e.default,{className:"text-text-muted text-[18px]",children:"lan"}),(0,d.jsx)("span",{className:"truncate text-sm text-text-main",children:a.name}),!0!==a.isActive&&(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},a.id))]}),aF&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,d.jsx)(l.$n,{onClick:b5,variant:"ghost",fullWidth:!0,disabled:aF,children:"Cancel"})]})}),ce=async a=>{if(!ax.has(a)){ay(b=>new Set(b).add(a));try{let b=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${bD}/${a}`})}),c=await b.json();au(b=>({...b,[a]:c.ok?"ok":"error"})),aw(c.ok?"":c.error||"Model not reachable")}catch{au(b=>({...b,[a]:"error"})),aw("Network error")}finally{ay(b=>{let c=new Set(b);return c.delete(a),c})}}};if(v)return(0,d.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,d.jsx)(l.Qv,{}),(0,d.jsx)(l.Qv,{})]});if(!bo)return(0,d.jsxs)("div",{className:"text-center py-20",children:[(0,d.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,d.jsx)(i(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let cf=()=>bw&&bo.apiType?"responses"===bo.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":bx?"/providers/anthropic-m.png":(0,k.HY)(bo.id);return(0,d.jsxs)("div",{className:`dashboard-surface ${H().page}`,children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)(i(),{href:"/dashboard/providers",className:H().detailLink,children:[(0,d.jsx)(e.default,{className:"text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,d.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${bo.color}15`},children:ar||!cf()?(0,d.jsx)("span",{className:"text-sm font-bold",style:{color:bo.color},children:bo.textIcon||bo.id.slice(0,2).toUpperCase()}):(0,d.jsx)(j.default,{src:cf(),alt:bo.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>{(0,k.Kw)(bo.id),as(!0)},loading:"lazy",decoding:"async"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,d.jsx)("h1",{className:H().detailTitle,children:bo.name}),(bo.notice?.apiKeyUrl||bo.notice?.signupUrl||bo.website)&&(0,d.jsxs)("a",{href:bo.notice?.apiKeyUrl||bo.notice?.signupUrl||bo.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-text-muted hover:text-text-main hover:underline inline-flex items-center gap-1",children:[(0,d.jsx)(e.default,{className:"text-sm",children:"open_in_new"}),bo.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,d.jsxs)("p",{className:H().description,children:[t.length," connection",1===t.length?"":"s"]})]})]})]}),bo.deprecated&&(0,d.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,d.jsx)(e.default,{className:"text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:bo.deprecationNotice})]}),bo.notice?.text&&!bo.deprecated&&(0,d.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,d.jsx)(e.default,{className:"text-[16px] text-blue-500 shrink-0",children:"info"}),(0,d.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:bo.notice.text}),bo.notice.apiKeyUrl&&(0,d.jsx)("a",{href:bo.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 →"})]}),by&&x&&(0,d.jsx)(l.Zp,{className:`ui-card ${H().panel}`,children:(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("h2",{className:"ui-eyebrow",children:[(0,d.jsx)(e.default,{className:"text-[16px]",children:"api"}),bx?"Anthropic Compatible Details":"OpenAI Compatible Details"]}),(0,d.jsxs)("p",{className:`break-all mt-2 ${H().description}`,children:[bx?"Messages API":"responses"===x.apiType?"Responses API":"Chat Completions"," \xb7 ",(x.baseUrl||"").replace(/\/$/,""),"/",bx?"messages":"responses"===x.apiType?"responses":"chat/completions"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsx)(l.$n,{size:"sm",variant:"contrast",icon:"add",onClick:()=>{X(""),T(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>ai(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,d.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"delete",onClick:async()=>{a0({title:"Delete Compatible Node",message:`Delete this ${bx?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{a0(null);try{(await fetch(`/api/provider-nodes/${r}`,{method:"DELETE"})).ok&&q.push("/dashboard/providers")}catch(a){console.log("Error deleting provider node:",a)}}})},className:`w-full sm:w-auto ${H().error}`,children:"Delete"})]})]})}),bs?(0,d.jsx)(l.gw,{providerId:r}):(0,d.jsxs)(l.Zp,{className:`ui-card ${H().panel}`,children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("h2",{className:"ui-eyebrow",children:[(0,d.jsx)(e.default,{className:"text-[16px]",children:"vpn_key"}),"Connections"]}),(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[t.some(a=>"apikey"===(a.authType||"apikey"))&&(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",icon:"download",onClick:ca,disabled:b8,children:b8?"Extracting...":"Extract Keys"}),t.length>0&&E.length>0&&(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>ak(!0),children:"Apply Proxy"}),t.length>0&&(0,d.jsxs)(d.Fragment,{children:[aB.length>0&&(0,d.jsxs)(l.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let a=aB.length;0!==a&&a0({title:`Delete ${a} Connection${a>1?"s":""}`,message:`Delete ${a} connection${a>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{a0(null);let a=0,b=[...aB];for(let c of b)try{(await fetch(`/api/providers/${c}`,{method:"DELETE"})).ok||(a+=1)}catch(b){console.log("Error deleting connection:",b),a+=1}u(a=>a.filter(a=>!b.includes(a.id))),aC([]),a>0&&alert(`Deleted ${b.length-a} connection(s), ${a} failed.`)}})},children:["Delete Selected (",aB.length,")"]}),(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:bY,disabled:a3,children:a3?"Testing Connection One-by-One...":"Test Connection One-by-One"}),a3&&(0,d.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{a3&&(bd.current=!0,a6(!0))},disabled:a5,children:a5?"Stopping...":"Stop"})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,d.jsx)(l.lM,{checked:"round-robin"===aH,onChange:a=>{let b=a?"round-robin":null,c=a?aJ||"1":aJ;a&&!aJ&&aK("1"),aI(b),bP(b,c)}}),"round-robin"===aH&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,d.jsx)("input",{type:"number",min:1,value:aJ,onChange:a=>{var b;aK(b=a.target.value),bP("round-robin",b)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),0===t.length?(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 text-text-muted shrink-0",children:(0,d.jsx)(e.default,{className:"text-[18px]",children:bq?"lock":"key"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),bz&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",bA," or ",bB,"."]})]})]}),(0,d.jsx)("div",{className:"flex gap-2",children:bz?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:bl,children:bA}),(0,d.jsx)(l.$n,{size:"sm",variant:"contrast",icon:"key",onClick:bm,children:bB})]}):(0,d.jsxs)(d.Fragment,{children:[!by&&"iflow"===r&&(0,d.jsx)(l.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>P(!0),children:"Cookie"}),"codex"===r&&(0,d.jsx)(l.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>$(!0),children:(0,B.Tl)("Bulk Add")}),"grok-cli"===r&&(0,d.jsx)(l.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>aa(!0),children:(0,B.Tl)("Bulk Add")}),(0,d.jsx)(l.$n,{size:"sm",icon:"add",onClick:bn,children:by?"Add API Key":"iflow"===r?"OAuth":"Add Connection"})]})})]}):(0,d.jsxs)(d.Fragment,{children:[bb&&(0,d.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,d.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,d.jsxs)("span",{children:["Total: ",bb.total]}),(0,d.jsxs)("span",{children:["Completed: ",bb.completed]}),(0,d.jsxs)("span",{children:["Passed: ",bb.passed]}),(0,d.jsxs)("span",{children:["Failed: ",bb.failed]}),bb.stopped&&(0,d.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),a3&&a7&&(0,d.jsxs)("span",{children:["Running: ",t.find(a=>a.id===a7)?.name||a7]})]})}),t.length>0&&(0,d.jsx)("div",{className:"mb-3 flex items-center gap-2 border-b border-black/[0.03] pb-2 dark:border-white/[0.03]",children:(0,d.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,d.jsx)("input",{type:"checkbox",checked:b4,onChange:()=>{b4?aC([]):aC(t.map(a=>a.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),cb,!by&&(0,d.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===r&&(0,d.jsx)(l.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>P(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===r&&(0,d.jsx)(l.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>$(!0),title:(0,B.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,B.Tl)("Bulk Add")}),"grok-cli"===r&&(0,d.jsx)(l.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>aa(!0),title:(0,B.Tl)("Bulk import Grok CLI accounts from JSON"),className:"w-full sm:w-auto",children:(0,B.Tl)("Bulk Add")}),bz?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:bl,className:"w-full sm:w-auto",children:bA}),(0,d.jsx)(l.$n,{size:"sm",icon:"key",onClick:bm,className:"w-full sm:w-auto",children:bB})]}):(0,d.jsx)(l.$n,{size:"sm",icon:"add",onClick:bn,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,d.jsx)(ab,{providerId:r}),(0,d.jsxs)(l.Zp,{className:`ui-card ${H().panel}`,children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsxs)("h2",{className:"ui-eyebrow",children:[(0,d.jsx)(e.default,{className:"text-[16px]",children:"smart_toy"}),"Available Models"]}),bE&&(0,d.jsx)("select",{value:aL,onChange:a=>{var b;aM(b=a.target.value),bQ(b)},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:bE.map(a=>(0,d.jsx)("option",{value:a,children:`Thinking: ${a.charAt(0).toUpperCase()+a.slice(1)}`},a))})]}),!by&&(a=[...bu,...aX.filter(a=>!bu.some(b=>b.id===a.id))].filter(a=>{let b=(0,n.CP)(a);return!b||"llm"===b}).map(a=>a.id).filter(a=>!aZ.includes(a)),(0,d.jsxs)("div",{className:"flex gap-2",children:[aZ.length>0&&(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:bK,children:"Active All"}),a.length>0&&(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>bJ(a),children:"Disable All"})]}))]}),!!av&&(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsx)("p",{className:"text-xs text-red-500 break-words",children:av}),/RegionError|hosted in China|regionNotAllowed/i.test(av)&&(c=(b="string"==typeof av?av:JSON.stringify(av)).match(/https:\/\/opencode\.ai\/workspace\/[^\s"')]+/),h=b.match(/wrk_[0-9A-Za-z]+/),o=c?c[0].endsWith("/go")?c[0]:`${c[0]}/go`:h?`https://opencode.ai/workspace/${h[0]}/go`:"https://opencode.ai",(0,d.jsx)("div",{className:"mt-1.5",children:(0,d.jsxs)("a",{href:o,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-600 hover:bg-amber-500/20 dark:text-amber-400 transition-colors",children:[(0,d.jsx)("span",{children:"Allow China-hosted models"}),(0,d.jsx)(e.default,{className:"text-[13px]",children:"open_in_new"})]})}))]}),"zed"===r&&!!aV&&(0,d.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:aV}),(()=>{let a,b,c;if(by)return(0,d.jsx)(J,{providerStorageAlias:bD,providerDisplayAlias:bF,modelAliases:an,customModels:ap,copied:bi,onCopy:bj,onSetAlias:bS,onDeleteAlias:bT,onAddCustomModel:a=>bU(a,"llm",bD),onDeleteCustomModel:a=>bV(a,"llm",bD),connections:t,isAnthropic:bx});let f=[...bu,...aX.filter(a=>!bu.some(b=>b.id===a.id))].filter(a=>{let b=(0,n.CP)(a);return!b||"llm"===b}),g=new Set(aZ),h=f.filter(a=>!g.has(a.id)),i=f.filter(a=>g.has(a.id)),j=C({customModels:ap,modelAliases:an,providerAlias:bD,builtInModels:bu,type:"llm"});return(0,d.jsxs)("div",{className:"flex flex-wrap gap-3",children:[j.map(a=>(0,d.jsx)(F,{model:{id:a.id,name:a.name},fullModel:`${bF}/${a.id}`,alias:a.alias,copied:bi,onCopy:bj,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===a.source?bV(a.id,"llm",bD):bT(a.alias)},testStatus:at[a.id],onTest:t.length>0||bs?()=>ce(a.id):void 0,isTesting:ax.has(a.id),isCustom:!0,isFree:!1,caps:s(`${r}/${a.id}`),thinkingSuffix:bC(a.id)},`${a.source}-${a.fullModel}`)),h.map(a=>{let b=`${bD}/${a.id}`,c=`${r}/${a.id}`,e=Object.entries(an).find(([,a])=>a===b||a===c)?.[0];return(0,d.jsx)(F,{model:a,fullModel:`${bF}/${a.id}`,alias:e,copied:bi,onCopy:bj,onSetAlias:b=>bS(a.id,b,bD),onDeleteAlias:()=>bT(e),testStatus:at[a.id],onTest:t.length>0||bs?()=>ce(a.id):void 0,isTesting:ax.has(a.id),isFree:a.isFree,onDisable:()=>bH(a.id),caps:s(`${r}/${a.id}`),thinkingSuffix:bC(a.id)},a.id)}),(0,d.jsxs)("button",{onClick:()=>aA(!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,d.jsx)(e.default,{className:"text-sm",children:"add"}),"Add Model"]}),("qoder"===r||"qoder-cn"===r)&&t.some(a=>!1!==a.isActive)&&(0,d.jsxs)("button",{onClick:bW,disabled:be,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,d.jsx)(e.default,{className:"text-sm",style:be?{animation:"spin 1s linear infinite"}:void 0,children:be?"progress_activity":"download"}),be?(0,B.Tl)("Fetching..."):(0,B.Tl)("Fetch Qoder Models")]}),("cline"===r||"clinepass"===r)&&t.some(a=>!1!==a.isActive)&&(0,d.jsxs)("button",{onClick:bX,disabled:bg,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,d.jsx)(e.default,{className:"text-sm",style:bg?{animation:"spin 1s linear infinite"}:void 0,children:bg?"progress_activity":"download"}),bg?(0,B.Tl)("Fetching..."):(0,B.Tl)("Import from /models")]}),aR.length>0&&(a=new Set([...Object.values(an),...j.map(a=>a.fullModel)]),b=new Set(bu.map(a=>a.id)),0===(c=aR.filter(c=>!a.has(`${bD}/${c.id}`)&&!b.has(c.id))).length?null:(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:c.map(a=>(0,d.jsxs)("button",{onClick:async()=>{await bU(a.id,"llm",bD)},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:`${a.name} \xb7 ${(a.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,d.jsx)(e.default,{className:"text-[13px]",children:"add"}),a.id.split("/").pop()]},a.id))})]})),i.length>0&&(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",i.length,"):"]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(a=>(0,d.jsxs)("button",{onClick:()=>bI(a.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,d.jsx)(e.default,{className:"text-[13px]",children:"add"}),a.id]},a.id))})]})]})})()]}),cd,"kiro"===r?(0,d.jsx)(l.Mh,{isOpen:I,providerInfo:bo,onSuccess:b$,onClose:()=>K(!1)}):"cursor"===r?(0,d.jsx)(l.G9,{isOpen:I,onSuccess:b$,onClose:()=>K(!1)}):"zed"===r?(0,d.jsx)(l.TE,{isOpen:I,providerInfo:bo,onSuccess:b$,onClose:()=>K(!1)}):"gitlab"===r?(0,d.jsx)(l.vj,{isOpen:I,providerInfo:bo,onSuccess:b$,onClose:()=>K(!1)}):(0,d.jsx)(l.LF,{isOpen:I,provider:r,providerInfo:bo,onSuccess:b$,onClose:()=>K(!1)}),(0,d.jsx)(l.LH,{isOpen:L,onSuccess:b$,onClose:()=>M(!1)}),"iflow"===r&&(0,d.jsx)(l.vE,{isOpen:N,onSuccess:()=>{bN(),P(!1)},onClose:()=>P(!1)}),(0,d.jsx)(R,{isOpen:Q,provider:r,providerName:bo.name,isCompatible:by,isAnthropic:bx,authType:bo?.authType,authHint:bo?.authHint,website:bo?.website,proxyPools:E,error:V,existingNames:t.map(a=>a.name).filter(Boolean),onSave:b_,onBulkDone:bN,onClose:()=>{X(""),T(!1)}}),(0,d.jsx)(l.wI,{isOpen:af,connection:al,proxyPools:E,onSave:b0,onClose:()=>ag(!1)}),by&&(0,d.jsx)(S,{isOpen:ah,node:x,onSave:bO,onClose:()=>ai(!1),isAnthropic:bx}),!by&&(0,d.jsx)(U,{isOpen:az,providerAlias:bD,providerDisplayAlias:bF,onSave:async(a,b,c)=>{await bU(a,b?.stt?"stt":"llm",bD,b,c),aA(!1)},onClose:()=>aA(!1)}),"codex"===r&&(0,d.jsx)(W,{isOpen:Y,onClose:()=>$(!1),onSuccess:bN}),"grok-cli"===r&&(0,d.jsx)(Z,{isOpen:_,onClose:()=>aa(!1),onSuccess:bN}),aP&&(0,d.jsx)(ac.A,{isOpen:!!aP,onClose:()=>aQ(null),connection:aP,reactive:!0===aN.connections[aP.id],schedule:aN.schedules?.[aP.id]||null,onSave:a=>((a,{reactive:b,schedule:c})=>{bR({...aN,connections:{...aN.connections,[a]:b},schedules:{...aN.schedules,[a]:c}})})(aP.id,a)}),(0,d.jsx)(l.uo,{isOpen:a1,onClose:()=>a2(!1),onConfirm:()=>{(a2(!1),bq)?bk():bm()},title:"Risk Notice",message:bo?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,d.jsx)(l.uo,{isOpen:!!a_,onClose:()=>a0(null),onConfirm:a_?.onConfirm,title:a_?.title||"Confirm",message:a_?.message,variant:"danger"})]})}},32467:a=>{"use strict";a.exports=require("node:http2")},33873:a=>{"use strict";a.exports=require("path")},34589:a=>{"use strict";a.exports=require("node:assert")},37067:a=>{"use strict";a.exports=require("node:http")},37540:a=>{"use strict";a.exports=require("node:console")},38522:a=>{"use strict";a.exports=require("node:zlib")},40610:a=>{"use strict";a.exports=require("node:dns")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41692:a=>{"use strict";a.exports=require("node:tls")},41792:a=>{"use strict";a.exports=require("node:querystring")},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},46293:a=>{"use strict";a.exports=require("sql.js")},48161:a=>{"use strict";a.exports=require("node:os")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},54589:(a,b,c)=>{"use strict";function d(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}c.d(b,{JW:()=>i,Vm:()=>d,fB:()=>f,gy:()=>e,nz:()=>g});let e={anchor:"09:30",timezone:d(),windowHours:5,slotsPerDay:3};function f(a){let b=/^(\d{1,2}):(\d{2})$/.exec(String(a||"").trim());if(!b)return null;let c=Number(b[1]),d=Number(b[2]);return c>23||d>59?null:{hour:c,minute:d}}function g(a){return Math.max(1,Math.floor(24/a))}function h(a,b,c,d){let e="number"==typeof a?a:Number(a);return Number.isFinite(e)?Math.min(d,Math.max(c,e)):b}function i(a){let b=function(a){if(!a||!0!==a.enabled)return null;let b=f(a.anchor)||f(e.anchor),c=`${String(b.hour).padStart(2,"0")}:${String(b.minute).padStart(2,"0")}`,d=!function(a){if(!a||"string"!=typeof a)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:a}),!0}catch{return!1}}(a.timezone)?e.timezone:a.timezone,i=h(a.windowHours,e.windowHours,.5,24),j=Math.round(h(a.slotsPerDay,e.slotsPerDay,1,g(i)));return{enabled:!0,anchor:c,timezone:d,windowHours:i,slotsPerDay:j}}(a);if(!b)return[];let{hour:c,minute:d}=f(b.anchor),i=60*c+d;return Array.from({length:b.slotsPerDay},(a,c)=>{let d=Math.round(i+c*b.windowHours*60)%1440;return`${String(Math.floor(d/60)).padStart(2,"0")}:${String(d%60).padStart(2,"0")}`})}},55511:a=>{"use strict";a.exports=require("crypto")},55591:a=>{"use strict";a.exports=require("https")},56020:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(71404),j=c(54589);let k=[{value:"off",label:"Off",icon:"block"},{value:"reset",label:"On reset",icon:"bolt"},{value:"schedule",label:"Schedule",icon:"schedule"}];function l({isOpen:a,onClose:b,onSave:c,connection:f,reactive:g=!1,schedule:m=null}){let[n,o]=(0,e.useState)(()=>({mode:m?.enabled===!0?"schedule":!0===g?"reset":"off",anchor:m?.anchor||j.gy.anchor,timezone:(0,j.Vm)(),windowHours:String(m?.windowHours??j.gy.windowHours),slotsPerDay:String(m?.slotsPerDay??j.gy.slotsPerDay)})),p=Number(n.windowHours),q=Number(n.slotsPerDay),r=!!(0,j.fB)(n.anchor),s=Number.isFinite(p)&&p>=.5&&p<=24,t=s?(0,j.nz)(p):24,u=Number.isInteger(q)&&q>=1&&q<=t,v=r&&s&&u,w="schedule"!==n.mode||v,x=v?(0,j.JW)({enabled:!0,...n,windowHours:p,slotsPerDay:q}):[],y=x.length&&s?(()=>{let{hour:a,minute:b}=(0,j.fB)(n.anchor),c=Math.round(60*a+b+q*p*60)%1440;return`${String(Math.floor(c/60)).padStart(2,"0")}:${String(c%60).padStart(2,"0")}`})():"",z=a=>o(b=>({...b,...a}));return(0,d.jsx)(h.aF,{isOpen:a,onClose:b,title:"Auto-ping settings",size:"lg",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.$n,{variant:"secondary",onClick:b,children:"Cancel"}),(0,d.jsx)(h.$n,{onClick:()=>{w&&(c({reactive:"reset"===n.mode,schedule:"schedule"===n.mode?{enabled:!0,anchor:n.anchor,timezone:n.timezone,windowHours:p,slotsPerDay:q}:{enabled:!1}}),b())},disabled:!w,children:"Save"})]}),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Configure automated quota pings",f?.name?` for ${f.name}`:""," — pick one mode."]}),(0,d.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-[10px] bg-surface-2 p-1",children:k.map(a=>{let b=n.mode===a.value;return(0,d.jsxs)("button",{type:"button",onClick:()=>z({mode:a.value}),className:(0,i.cn)("flex h-9 items-center justify-center gap-1.5 rounded-[8px] px-3 text-sm font-medium transition-all",b?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px] leading-none",children:a.icon}),(0,d.jsx)("span",{children:a.label})]},a.value)})}),"reset"===n.mode&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Pings right after the 5h quota window resets, so a new window starts immediately."}),"schedule"===n.mode&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Pings at fixed local times so the 5h windows align with your workday."}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[(0,d.jsx)(h.pd,{label:"Anchor time",type:"time",value:n.anchor,onChange:a=>z({anchor:a.target.value}),error:r?"":"Use HH:MM",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,d.jsx)(h.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:n.windowHours,onChange:a=>z({windowHours:a.target.value}),error:s?"":"0.5 – 24",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,d.jsx)(h.pd,{label:"Pings per day",type:"number",min:"1",max:String(t),step:"1",value:n.slotsPerDay,onChange:a=>z({slotsPerDay:a.target.value}),error:u?"":`1 – ${t}`,hint:u?`Max ${t}`:"",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"})]}),x.length>0&&(0,d.jsxs)("div",{className:"rounded-[10px] bg-surface-2 px-3 py-2.5",children:[(0,d.jsxs)("p",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:["Daily slots (",n.timezone,")"]}),(0,d.jsx)("p",{className:"mt-1 text-sm font-medium text-text-main",children:x.join(" → ")}),(0,d.jsxs)("p",{className:"mt-1 text-xs text-text-muted",children:["Covers ",x[0]," – ",y,", then pauses until ",x[0]," next day."]})]})]})]})})}l.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSave:g().func.isRequired,connection:g().object,reactive:g().bool,schedule:g().object}},57075:a=>{"use strict";a.exports=require("node:stream")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71553:a=>{"use strict";a.exports=require("node:dns/promises")},71622:a=>{"use strict";a.exports=import("open")},72271:a=>{"use strict";a.exports=require("@aws-sdk/credential-providers")},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},73429:a=>{"use strict";a.exports=require("node:util/types")},73496:a=>{"use strict";a.exports=require("http2")},74075:a=>{"use strict";a.exports=require("zlib")},74875:(a,b,c)=>{"use strict";function d(a,b){return!1===a?"default":"active"===b||"success"===b?"success":"error"===b||"expired"===b||"unavailable"===b?"error":"default"}c.d(b,{g:()=>d})},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78474:a=>{"use strict";a.exports=require("node:events")},79646:a=>{"use strict";a.exports=require("child_process")},79868:a=>{"use strict";a.exports=require("node:sqlite")},81630:a=>{"use strict";a.exports=require("http")},81787:a=>{"use strict";a.exports=require("bun:sqlite")},87550:a=>{"use strict";a.exports=require("better-sqlite3")},87997:a=>{"use strict";a.exports=require("node:timers")},89255:(a,b,c)=>{Promise.resolve().then(c.bind(c,31886))},91645:a=>{"use strict";a.exports=require("net")},93110:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/root/workspace/JRouter/src/app/(dashboard)/dashboard/providers/[id]/page.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/root/workspace/JRouter/src/app/(dashboard)/dashboard/providers/[id]/page.js","default")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[2970,1260,2430,1273,9415,379,1220,4642,3192,6070,4864,6457,4123,455,6777,412,6698],()=>b(b.s=31185));module.exports=c})();
27
+ ]`;function Y(a){let b,c=a.trim();if(!c)return[];try{b=JSON.parse(c)}catch(a){try{let a=c;a.startsWith("[")||((a=a.replace(/\}\s*,\s*\{/g,"},{").replace(/\}\s*\{/g,"},{")).endsWith(",")&&(a=a.slice(0,-1)),a=`[${a}]`),b=JSON.parse(a)}catch{throw a}}if(Array.isArray(b))return b;if(b&&"object"==typeof b)return Array.isArray(b.accounts)?b.accounts:[b];throw Error("Input must be a JSON object or array of objects")}function Z({isOpen:a,onClose:b,onSuccess:c}){let[g,h]=(0,f.useState)(""),[i,j]=(0,f.useState)(!1),[k,m]=(0,f.useState)(""),[n,o]=(0,f.useState)(null),[p,q]=(0,f.useState)(!1),[r,s]=(0,f.useState)(null),t=(0,f.useRef)(null),u=()=>{i||(h(""),m(""),o(null),s(null),q(!1),b())},v=async a=>{if(!a||0===a.length)return;m("");let b=Array.from(a).filter(a=>a.name.endsWith(".json")||"application/json"===a.type||""===a.type);if(0===b.length)return void m((0,B.Tl)("Please select valid .json files"));try{let a=[];for(let c of b){let b=await c.text(),d=Y(b);Array.isArray(d)?a.push(...d):d&&a.push(d)}if(0===a.length)return void m((0,B.Tl)("No accounts found in selected files"));h(JSON.stringify(a,null,2)),s({filesCount:b.length,accountsCount:a.length})}catch(a){m(`${(0,B.Tl)("Error reading files")}: ${a.message}`)}},w=async()=>{let a;m(""),o(null);try{a=Y(g)}catch(a){m(`${(0,B.Tl)("Invalid JSON")}: ${a.message}`);return}if(!a||0===a.length)return void m((0,B.Tl)("No accounts found in input"));j(!0);try{let b=await fetch("/api/oauth/grok-cli/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:a})}),d=await b.json();if(!b.ok)return void m(d?.error||`Request failed: ${b.status}`);o(d),d.success>0&&"function"==typeof c&&c()}catch(a){m(a.message||(0,B.Tl)("Request failed"))}finally{j(!1)}},x=n?.results?.filter(a=>!a.ok)||[];return(0,d.jsx)(l.aF,{isOpen:a,title:(0,B.Tl)("Bulk Add Grok CLI Accounts"),onClose:u,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:(0,B.Tl)("Upload multiple .json files or paste JSON array / object.")}),(0,d.jsx)("input",{ref:t,type:"file",accept:".json,application/json",multiple:!0,className:"hidden",onChange:a=>{v(a.target.files),a.target&&(a.target.value="")}}),(0,d.jsx)(l.$n,{type:"button",size:"sm",variant:"secondary",icon:"upload_file",onClick:()=>t.current?.click(),disabled:i,children:(0,B.Tl)("Upload JSON Files")})]}),(0,d.jsxs)("div",{onDragOver:a=>{a.preventDefault(),q(!0)},onDragLeave:a=>{a.preventDefault(),q(!1)},onDrop:a=>{a.preventDefault(),q(!1),a.dataTransfer?.files?.length>0&&v(a.dataTransfer.files)},className:`relative rounded border transition-colors ${p?"border-primary bg-primary/10 ring-2 ring-primary/30":"border-accent/30 bg-sidebar"}`,children:[(0,d.jsx)("textarea",{className:"w-full rounded bg-transparent p-2.5 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:X,value:g,onChange:a=>{h(a.target.value),s(null)},disabled:i}),p&&(0,d.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-sidebar/90 rounded pointer-events-none backdrop-blur-xs",children:[(0,d.jsx)(e.default,{className:"text-3xl text-primary mb-1",children:"upload_file"}),(0,d.jsx)("span",{className:"text-sm font-medium text-primary",children:(0,B.Tl)("Drop .json files here")})]})]}),r&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-green-400 font-medium bg-green-500/10 border border-green-500/20 px-2.5 py-1.5 rounded",children:[(0,d.jsx)(e.default,{className:"text-sm",children:"check_circle"}),(0,d.jsxs)("span",{children:[(0,B.Tl)("Loaded")," ",r.accountsCount," ",(0,B.Tl)("account(s) from")," ",r.filesCount," ",(0,B.Tl)("file(s)")]})]}),k&&(0,d.jsx)("p",{className:"text-xs text-red-500 break-words",children:k}),n&&n.failed>0&&(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"text-sm font-medium text-yellow-400",children:["✗ ",n.failed," ",(0,B.Tl)("failed")]}),x.length>0&&(0,d.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:x.map(a=>(0,d.jsxs)("li",{className:"text-red-400",children:["[",a.index,"] ",a.error]},a.index))})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{onClick:w,fullWidth:!0,disabled:i||!g.trim(),children:i?(0,B.Tl)("Importing..."):(0,B.Tl)("Import All")}),(0,d.jsx)(l.$n,{onClick:u,variant:"ghost",fullWidth:!0,disabled:i,children:(0,B.Tl)("Close")})]})]})})}var $=c(41371);let _=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],aa=/^[A-Za-z0-9-]+$/;function ab({providerId:a}){let b=(0,$.i)(),[c,g]=(0,f.useState)(!1),[h,i]=(0,f.useState)([{name:"",value:""}]),[j,k]=(0,f.useState)({}),[m,n]=(0,f.useState)(!1),[o,p]=(0,f.useState)(!1),q=(a,b,c)=>{i(d=>d.map((d,e)=>e===a?{...d,[b]:c}:d))},r=(0,f.useCallback)(async()=>{let c={};for(let a of h.filter(a=>a.name.trim())){let d=a.name.trim();if(!aa.test(d))return void b.error(`Invalid header name: ${d}`);if(_.includes(d.toLowerCase()))return void b.error(`Header ${d} cannot be overridden`);if(d in c)return void b.error(`Duplicate header name: ${d}`);a.value!==j[d]&&(c[d]=a.value)}p(!0);try{let d=await fetch(`/api/providers/${a}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:c})});if(!d.ok){let a=await d.json().catch(()=>({}));b.error(a.error||"Failed to save");return}n(Object.keys(c).length>0),b.success("Custom headers saved")}finally{p(!1)}},[h,j,a,b]);return 0!==Object.keys(j).length||m?(0,d.jsxs)(l.Zp,{className:`ui-card ${H().panel}`,children:[(0,d.jsxs)("button",{type:"button",onClick:()=>g(a=>!a),"aria-expanded":c,className:"flex w-full items-center justify-between text-left",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("span",{className:"ui-eyebrow",children:[(0,d.jsx)(e.default,{className:"text-[16px]",children:"tune"}),"Custom Headers"]}),m&&(0,d.jsx)(N.A,{variant:"success",children:"Active"})]}),(0,d.jsx)(e.default,{className:"text-[16px] text-text-muted",children:c?"expand_less":"expand_more"})]}),c&&(0,d.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,d.jsx)("div",{className:"flex flex-col gap-2",children:h.map((a,b)=>{let c=a.name.trim()in j&&a.value!==j[a.name.trim()];return(0,d.jsxs)("div",{className:H().customHeaderRow,children:[(0,d.jsx)(l.pd,{"aria-label":`Header ${b+1} name`,value:a.name,onChange:a=>q(b,"name",a.target.value),placeholder:"Header-Name",spellCheck:!1,className:"min-w-0"}),(0,d.jsx)(l.pd,{"aria-label":`Header ${b+1} value`,value:a.value,onChange:a=>q(b,"value",a.target.value),placeholder:"Value",spellCheck:!1,title:c?"Overridden":a.name.trim()in j?"Registry default":"",className:"min-w-0",inputClassName:c?"border-[var(--warn)]":void 0}),(0,d.jsx)("button",{type:"button",title:"Remove header","aria-label":`Remove header ${b+1}`,onClick:()=>i(a=>a.length>1?a.filter((a,c)=>c!==b):[{name:"",value:""}]),className:`${H().iconButton} ${H().error}`,children:(0,d.jsx)(e.default,{className:"text-[16px]",children:"delete"})})]},b)})}),(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,d.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"add",onClick:()=>i(a=>[...a,{name:"",value:""}]),children:"Add header"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",disabled:o,onClick:()=>{i(Object.entries(j).map(([a,b])=>({name:a,value:b})))},children:"Reset"}),(0,d.jsx)(l.$n,{size:"sm",variant:"contrast",disabled:o,onClick:r,children:o?"Saving...":"Save"})]})]})]})]}):null}ab.propTypes={providerId:E().string.isRequired};var ac=c(56020),ad=c(54589);let ae={claude:"claudeAutoPing",codex:"codexAutoPing"};function af(){let a,b,c,h,o,p=(0,g.useParams)(),q=(0,g.useRouter)(),r=p.id,{getCaps:s}=(0,A.y)(),[t,u]=(0,f.useState)([]),[v,w]=(0,f.useState)(!0),[x,D]=(0,f.useState)(null),[E,G]=(0,f.useState)([]),[I,K]=(0,f.useState)(!1),[L,M]=(0,f.useState)(!1),[N,P]=(0,f.useState)(!1),[Q,T]=(0,f.useState)(!1),[V,X]=(0,f.useState)(""),[Y,$]=(0,f.useState)(!1),[_,aa]=(0,f.useState)(!1),[af,ag]=(0,f.useState)(!1),[ah,ai]=(0,f.useState)(!1),[aj,ak]=(0,f.useState)(!1),[al,am]=(0,f.useState)(null),[an,ao]=(0,f.useState)({}),[ap,aq]=(0,f.useState)([]),[ar,as]=(0,f.useState)(!1),[at,au]=(0,f.useState)({}),[av,aw]=(0,f.useState)(""),[ax,ay]=(0,f.useState)(()=>new Set),[az,aA]=(0,f.useState)(!1),[aB,aC]=(0,f.useState)([]),[aD,aE]=(0,f.useState)("__none__"),[aF,aG]=(0,f.useState)(!1),[aH,aI]=(0,f.useState)(null),[aJ,aK]=(0,f.useState)(""),[aL,aM]=(0,f.useState)(null),[aN,aO]=(0,f.useState)("auto"),[aP,aQ]=(0,f.useState)({enabled:!1,connections:{},schedules:{}}),[aR,aS]=(0,f.useState)(null),[aT,aU]=(0,f.useState)([]),[aV,aW]=(0,f.useState)([]),[aX,aY]=(0,f.useState)(null),[aZ,a$]=(0,f.useState)([]),[a_,a0]=(0,f.useState)([]),[a1,a2]=(0,f.useState)(null),[a3,a4]=(0,f.useState)(!1),[a5,a6]=(0,f.useState)(!1),[a7,a8]=(0,f.useState)(!1),[a9,ba]=(0,f.useState)(null),[bb,bc]=(0,f.useState)({}),[bd,be]=(0,f.useState)(null),bf=(0,f.useRef)(!1),[bg,bh]=(0,f.useState)(!1),[bi,bj]=(0,f.useState)(!1),{copied:bk,copy:bl}=(0,z.C)(),bm=()=>{K(!0)},bn=()=>{"xiaomi-mimo"===r?M(!0):bs?bm():(X(""),T(!0))},bo=()=>{X(""),T(!0)},bp=()=>{bs?bn():bo()},bq=x?{id:x.id,name:x.name||("anthropic-compatible"===x.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===x.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===x.type?"AC":"OC",apiType:x.apiType,baseUrl:x.baseUrl,type:x.type}:m.zN[r]||m.fg[r]||m.IS[r]||m.nJ[r]||m.br[r],br=bq?.authModes||[],bs=!!m.zN[r]||!!m.IS[r]||br.includes("oauth"),bt=!!m.fg[r]||br.includes("apikey"),bu=!!m.IS[r]?.noAuth,bv=(0,n.KC)(r),bw=("cursor"===r||"zed"===r)&&aV.length>0?aV:bv,bx=(0,m.wG)(r),by=(0,m.mq)(r),bz=(0,m.gb)(r),bA=by||bz,bB=!bA&&bs&&bt,bC="xai"===r?"Grok Build OAuth":"grok-cli"===r?"Grok CLI Device Login":"kimi"===r?"Kimi Coding OAuth":"OAuth",bD="xai"===r?"xAI API Key":"kimi"===r?"Kimi API Key":"qoder"===r||"qoder-cn"===r?"PAT":"API Key",bE=a=>{if(!aN||"auto"===aN)return null;let b=y(r,a);return b&&b.includes(aN)?aN:null},bF=bA?r:bx,bG=(()=>{let a=new Set,b=new Set,c=c=>{if(!c||b.has(c))return;b.add(c);let d=y(r,c);d&&d.forEach(b=>{"none"!==b&&a.add(b)})};for(let a of bw)c(a.id);for(let a of aZ)c(a.id);for(let a of ap)a.providerAlias===bF&&"llm"===(a.kind||a.type||"llm")&&c(a.id);return a.size?["auto",...a]:null})(),bH=bA?x?.prefix||r:bx,bI=(0,f.useCallback)(async()=>{try{let a=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(bF)}`,{cache:"no-store"}),b=await a.json();a.ok&&a0(b.ids||[])}catch(a){console.log("Error fetching disabled models:",a)}},[bF]),bJ=async a=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:bF,ids:[a]})})).ok&&await bI()}catch(a){console.log("Error disabling model:",a)}},bK=async a=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(bF)}&id=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await bI()}catch(a){console.log("Error enabling model:",a)}},bL=async a=>{a.length&&a2({title:"Disable All Models",message:`Disable all ${a.length} model(s)?`,onConfirm:async()=>{a2(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:bF,ids:a})})).ok&&await bI()}catch(a){console.log("Error disabling all models:",a)}}})},bM=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(bF)}`,{method:"DELETE"})).ok&&await bI()}catch(a){console.log("Error enabling all models:",a)}},bN=(0,f.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&ao(b.aliases||{})}catch(a){console.log("Error fetching aliases:",a)}},[]),bO=(0,f.useCallback)(async()=>{try{let a=await fetch("/api/models/custom",{cache:"no-store"}),b=await a.json();a.ok&&aq(b.models||[])}catch(a){console.log("Error fetching custom models:",a)}},[]),bP=(0,f.useCallback)(async()=>{try{let[a,b,c,d]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),e=await a.json(),f=await b.json(),g=await c.json(),h=d.ok?await d.json():{};if(a.ok){let a=(e.connections||[]).filter(a=>a.provider===r);u(a)}c.ok&&G(g.proxyPools||[]);let i=(h.providerStrategies||{})[r]||{};aI(i.fallbackStrategy||null),aK(null!=i.stickyRoundRobinLimit?String(i.stickyRoundRobinLimit):"1"),aM(!1!==i.demoteOnError&&null);let j=(h.providerThinking||{})[r]||{};aO(j.mode||"auto");let k=ae[r],l=k&&h[k]||{};if(aQ({enabled:!0===l.enabled,connections:l.connections||{},schedules:l.schedules||{}}),b.ok){let a=(f.nodes||[]).find(a=>a.id===r)||null;if(!a&&bA)for(let b=0;b<3;b+=1){await new Promise(a=>setTimeout(a,150));let b=await fetch("/api/provider-nodes",{cache:"no-store"});if(b.ok&&(a=((await b.json()).nodes||[]).find(a=>a.id===r)||null))break}D(a)}}catch(a){console.log("Error fetching connections:",a)}finally{w(!1)}},[r,bA]),bQ=async a=>{try{let b=await fetch(`/api/provider-nodes/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();b.ok&&(D(c.node),await bP(),ai(!1))}catch(a){console.log("Error updating provider node:",a)}},bR=async(a,b)=>{try{let c=await fetch("/api/settings",{cache:"no-store"}),d=(c.ok?await c.json():{}).providerStrategies||{},e={};a&&(e.fallbackStrategy=a),"round-robin"===a&&""!==b&&(e.stickyRoundRobinLimit=Number(b)||3);let f={...d};0===Object.keys(e).length?delete f[r]:f[r]=e,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:f})})}catch(a){console.log("Error saving provider strategy:",a)}},bS=async a=>{aM(!!a&&null);try{let b=await fetch("/api/settings",{cache:"no-store"}),c=(b.ok?await b.json():{}).providerStrategies||{},d={...c[r]||{}};a?delete d.demoteOnError:d.demoteOnError=!1;let e={...c};0===Object.keys(d).length?delete e[r]:e[r]=d,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:e})})}catch(a){console.log("Error saving demoteOnError toggle:",a)}},bT=async a=>{try{let b=await fetch("/api/settings",{cache:"no-store"}),c={...(b.ok?await b.json():{}).providerThinking||{}};a&&"auto"!==a?c[r]={mode:a}:delete c[r],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:c})})}catch(a){console.log("Error saving thinking config:",a)}},bU=async a=>{let b=ae[r];if(b){aQ(a);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[b]:a})})}catch(a){console.log("Error saving auto-ping config:",a)}}},bV=async(a,b,c=bx)=>{let d=`${c}/${a}`;try{let a=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:d,alias:b})});if(a.ok)await bN();else{let b=await a.json();alert(b.error||"Failed to set alias")}}catch(a){console.log("Error setting alias:",a)}},bW=async a=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await bN()}catch(a){console.log("Error deleting alias:",a)}},bX=async(a,b="llm",c=bF,d,e)=>{try{let f=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:c,id:a,type:b,...d?{caps:d}:{},...e?{transport:e}:{}})});if(f.ok)await bO();else{let a=await f.json();alert(a.error||"Failed to add custom model")}}catch(a){console.log("Error adding custom model:",a)}},bY=async(a,b="llm",c=bF)=>{try{let d=new URLSearchParams({providerAlias:c,id:a,type:b});(await fetch(`/api/models/custom?${d}`,{method:"DELETE"})).ok&&await bO()}catch(a){console.log("Error deleting custom model:",a)}},bZ=async()=>{if(bg)return;let a=t.find(a=>!1!==a.isActive);if(!a)return void alert((0,B.Tl)("Please add an active Qoder connection first"));bh(!0);try{let b=await fetch(`/api/providers/${a.id}/models`),c=await b.json();if(!b.ok)return void alert(c.error||(0,B.Tl)("Failed to fetch models"));let d=c.models||[];if(0===d.length)return void alert((0,B.Tl)("No models returned"));let e=0;for(let a of d){let b=a.id||a.name;if(!b)continue;let c=b.replace(/^(qoder-cn|qoder)\//,"");ap.some(a=>a.providerAlias===bF&&a.id===c&&"llm"===(a.kind||a.type||"llm"))||Object.values(an).includes(`${bF}/${c}`)||(await bX(c,"llm",bF),e+=1)}0===e?alert((0,B.Tl)("All models already exist, no new models added")):alert((0,B.Tl)("Successfully added")+` ${e} `+(0,B.Tl)("models"))}catch(a){console.log("Error importing Qoder models:",a),alert((0,B.Tl)("Error fetching models")+": "+a.message)}finally{bh(!1)}},b$=async()=>{if(bi)return;let a=t.find(a=>!1!==a.isActive);if(!a)return void alert((0,B.Tl)("Please add an active Cline connection first"));bj(!0);try{let b=await fetch(`/api/providers/${a.id}/models`),c=await b.json();if(!b.ok)return void alert(c.error||(0,B.Tl)("Failed to fetch models"));let d=c.models||[];if(0===d.length)return void alert((0,B.Tl)("No models returned"));let e=0;for(let a of d){let b=a.id||a.name;b&&(ap.some(a=>a.providerAlias===bF&&a.id===b&&"llm"===(a.kind||a.type||"llm"))||Object.values(an).includes(`${bF}/${b}`)||(await bX(b,"llm",bF),e+=1))}0===e?alert((0,B.Tl)("All models already exist, no new models added")):alert((0,B.Tl)("Successfully added")+` ${e} `+(0,B.Tl)("models"))}catch(a){console.log("Error importing Cline models:",a),alert((0,B.Tl)("Error fetching models")+": "+a.message)}finally{bj(!1)}},b_=async()=>{if(a5||0===t.length)return;let a=Object.fromEntries(t.map(a=>[a.id,{state:"queued",error:null}]));bf.current=!1,a6(!0),a8(!1),ba(null),bc(a),be({total:t.length,completed:0,passed:0,failed:0,stopped:!1});let b=0,c=0;try{for(let a=0;a<t.length;a+=1){if(bf.current){be({total:t.length,completed:a,passed:b,failed:c,stopped:!0});break}let d=t[a];ba(d.id),bc(a=>({...a,[d.id]:{state:"testing",error:null}}));try{let a=await fetch(`/api/providers/${d.id}/test`,{method:"POST"}),e=await a.json(),f=!!e.valid;f?b+=1:c+=1,bc(a=>({...a,[d.id]:{state:f?"success":"failed",error:f?null:e.error||null}}))}catch(a){c+=1,bc(b=>({...b,[d.id]:{state:"failed",error:a.message||"Test failed"}}))}be({total:t.length,completed:a+1,passed:b,failed:c,stopped:!1}),a<t.length-1&&await new Promise(a=>setTimeout(a,1e3))}}finally{ba(null),a6(!1),a8(!1),bf.current=!1}},b0=async a=>{a2({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{a2(null);try{(await fetch(`/api/providers/${a}`,{method:"DELETE"})).ok&&u(b=>b.filter(b=>b.id!==a))}catch(a){console.log("Error deleting connection:",a)}}})},b1=()=>{bP(),K(!1)},b2=async a=>{X("");try{let b=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,...a})}),c=null;try{c=await b.json()}catch{c=null}if(b.ok){await bP(),T(!1);return}X(c?.error||"Failed to save connection")}catch(a){console.log("Error saving connection:",a),X("Failed to save connection")}},b3=async a=>{try{(await fetch(`/api/providers/${al.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok&&(await bP(),ag(!1))}catch(a){console.log("Error updating connection:",a)}},b4=async(a,b)=>{try{(await fetch(`/api/providers/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:b})})).ok&&u(c=>c.map(c=>c.id===a?{...c,isActive:b}:c))}catch(a){console.log("Error updating connection status:",a)}},b5=async(a,b)=>{let c=[...t];[c[a],c[b]]=[c[b],c[a]],u(c);try{await Promise.all([fetch(`/api/providers/${c[a].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:a})}),fetch(`/api/providers/${c[b].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:b})})])}catch(a){console.log("Error swapping priority:",a),await bP()}},b6=t.filter(a=>aB.includes(a.id)),b7=t.length>0&&aB.length===t.length;(()=>{if(0===b6.length)return;let a=new Set(b6.map(a=>a.providerSpecificData?.proxyPoolId||"__none__"));if(1===a.size){let b=[...a][0];if("__none__"===b)return;let c=E.find(a=>a.id===b);return c?.name}})();let b8=()=>{aF||ak(!1)},b9=async a=>{aG(!0);try{let b=0;for(let{connectionId:c,proxyPoolId:d}of a)try{(await fetch(`/api/providers/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:d})})).ok||(b+=1)}catch(a){console.log("Error applying proxy for",c,a),b+=1}b>0&&alert(`Updated with ${b} failed request(s).`),await bP(),ak(!1)}finally{aG(!1)}},ca=a=>b9(t.map(b=>({connectionId:b.id,proxyPoolId:a}))),[cb,cc]=(0,f.useState)(!1),cd=async()=>{if(!cb){cc(!0);try{let a=await fetch(`/api/providers/${encodeURIComponent(r)}/connections/keys`),b=await a.json().catch(()=>({}));if(!a.ok)throw Error(b.error||"Failed to export connection keys");let c=new Blob([JSON.stringify(b,null,2)],{type:"application/json"}),d=URL.createObjectURL(c),e=document.createElement("a");e.href=d,e.download=`keys-${r}.json`,document.body.appendChild(e),e.click(),e.remove(),URL.revokeObjectURL(d)}catch(a){useNotificationStore.getState().error(a.message)}finally{cc(!1)}}},ce=(0,d.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03] max-h-[500px] overflow-y-auto pr-1",children:t.map((a,b)=>{let c;return(0,d.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,d.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,d.jsx)("input",{type:"checkbox",checked:(c=a.id,aB.includes(c)),onChange:()=>{var b;return b=a.id,void aC(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])},className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"})}),(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)(O,{connection:a,proxyPools:E,isOAuth:bs,isFirst:0===b,isLast:b===t.length-1,onMoveUp:()=>b5(b,b-1),onMoveDown:()=>b5(b,b+1),onToggleActive:b=>b4(a.id,b),autoPing:ae[r]&&"oauth"===a.authType?{isActive:!0===aP.connections[a.id]||aP.schedules?.[a.id]?.enabled===!0,reactiveOn:!0===aP.connections[a.id],provider:r,scheduleOn:aP.schedules?.[a.id]?.enabled===!0,scheduleSummary:(0,ad.JW)(aP.schedules?.[a.id]).join(" / "),onConfigure:()=>aS(a)}:null,onUpdateProxy:async b=>{try{(await fetch(`/api/providers/${a.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:b||null})})).ok&&u(c=>c.map(c=>c.id===a.id?{...c,providerSpecificData:{...c.providerSpecificData,proxyPoolId:b||null}}:c))}catch(a){console.log("Error updating proxy:",a)}},onEdit:()=>{am(a),ag(!0)},onDelete:()=>b0(a.id),oneByOneStatus:bb[a.id]||null})})]},a.id)})}),cf=E.filter(a=>!0===a.isActive),cg=(0,d.jsx)(l.aF,{isOpen:aj,onClose:b8,title:`Apply Proxy (${t.length} connections)`,children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsxs)("button",{onClick:()=>{let a=E.filter(a=>!0===a.isActive);return 0===a.length?void alert("No active proxy pools available."):b9(t.map((b,c)=>({connectionId:b.id,proxyPoolId:a[c%a.length].id})))},disabled:aF||0===cf.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,d.jsx)(e.default,{className:"text-text-muted text-[18px]",children:"sync_alt"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,d.jsxs)("button",{onClick:()=>ca(null),disabled:aF,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,d.jsx)(e.default,{className:"text-text-muted text-[18px]",children:"link_off"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),E.map(a=>(0,d.jsxs)("button",{onClick:()=>ca(a.id),disabled:aF||!0!==a.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,d.jsx)(e.default,{className:"text-text-muted text-[18px]",children:"lan"}),(0,d.jsx)("span",{className:"truncate text-sm text-text-main",children:a.name}),!0!==a.isActive&&(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},a.id))]}),aF&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,d.jsx)(l.$n,{onClick:b8,variant:"ghost",fullWidth:!0,disabled:aF,children:"Cancel"})]})}),ch=async a=>{if(!ax.has(a)){ay(b=>new Set(b).add(a));try{let b=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${bF}/${a}`})}),c=await b.json();au(b=>({...b,[a]:c.ok?"ok":"error"})),aw(c.ok?"":c.error||"Model not reachable")}catch{au(b=>({...b,[a]:"error"})),aw("Network error")}finally{ay(b=>{let c=new Set(b);return c.delete(a),c})}}};if(v)return(0,d.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,d.jsx)(l.Qv,{}),(0,d.jsx)(l.Qv,{})]});if(!bq)return(0,d.jsxs)("div",{className:"text-center py-20",children:[(0,d.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,d.jsx)(i(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let ci=()=>by&&bq.apiType?"responses"===bq.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":bz?"/providers/anthropic-m.png":(0,k.HY)(bq.id);return(0,d.jsxs)("div",{className:`dashboard-surface ${H().page}`,children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)(i(),{href:"/dashboard/providers",className:H().detailLink,children:[(0,d.jsx)(e.default,{className:"text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,d.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${bq.color}15`},children:ar||!ci()?(0,d.jsx)("span",{className:"text-sm font-bold",style:{color:bq.color},children:bq.textIcon||bq.id.slice(0,2).toUpperCase()}):(0,d.jsx)(j.default,{src:ci(),alt:bq.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>{(0,k.Kw)(bq.id),as(!0)},loading:"lazy",decoding:"async"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,d.jsx)("h1",{className:H().detailTitle,children:bq.name}),(bq.notice?.apiKeyUrl||bq.notice?.signupUrl||bq.website)&&(0,d.jsxs)("a",{href:bq.notice?.apiKeyUrl||bq.notice?.signupUrl||bq.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-text-muted hover:text-text-main hover:underline inline-flex items-center gap-1",children:[(0,d.jsx)(e.default,{className:"text-sm",children:"open_in_new"}),bq.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,d.jsxs)("p",{className:H().description,children:[t.length," connection",1===t.length?"":"s"]})]})]})]}),bq.deprecated&&(0,d.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,d.jsx)(e.default,{className:"text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:bq.deprecationNotice})]}),bq.notice?.text&&!bq.deprecated&&(0,d.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,d.jsx)(e.default,{className:"text-[16px] text-blue-500 shrink-0",children:"info"}),(0,d.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:bq.notice.text}),bq.notice.apiKeyUrl&&(0,d.jsx)("a",{href:bq.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 →"})]}),bA&&x&&(0,d.jsx)(l.Zp,{className:`ui-card ${H().panel}`,children:(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("h2",{className:"ui-eyebrow",children:[(0,d.jsx)(e.default,{className:"text-[16px]",children:"api"}),bz?"Anthropic Compatible Details":"OpenAI Compatible Details"]}),(0,d.jsxs)("p",{className:`break-all mt-2 ${H().description}`,children:[bz?"Messages API":"responses"===x.apiType?"Responses API":"Chat Completions"," \xb7 ",(x.baseUrl||"").replace(/\/$/,""),"/",bz?"messages":"responses"===x.apiType?"responses":"chat/completions"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsx)(l.$n,{size:"sm",variant:"contrast",icon:"add",onClick:()=>{X(""),T(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>ai(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,d.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"delete",onClick:async()=>{a2({title:"Delete Compatible Node",message:`Delete this ${bz?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{a2(null);try{(await fetch(`/api/provider-nodes/${r}`,{method:"DELETE"})).ok&&q.push("/dashboard/providers")}catch(a){console.log("Error deleting provider node:",a)}}})},className:`w-full sm:w-auto ${H().error}`,children:"Delete"})]})]})}),bu?(0,d.jsx)(l.gw,{providerId:r}):(0,d.jsxs)(l.Zp,{className:`ui-card ${H().panel}`,children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("h2",{className:"ui-eyebrow",children:[(0,d.jsx)(e.default,{className:"text-[16px]",children:"vpn_key"}),"Connections"]}),(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[t.some(a=>"apikey"===(a.authType||"apikey"))&&(0,d.jsx)("button",{type:"button",onClick:cd,disabled:cb,title:cb?"Extracting keys…":"Extract keys","aria-label":cb?"Extracting keys":"Extract keys",className:"inline-flex size-7 items-center justify-center rounded-[var(--r1)] text-[var(--text-3)] transition-colors hover:text-[var(--text)] focus-visible:text-[var(--text)] disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer",children:(0,d.jsx)(e.default,{className:"text-[16px]",children:cb?"hourglass_top":"download"})}),t.length>0&&E.length>0&&(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>ak(!0),children:"Apply Proxy"}),t.length>0&&(0,d.jsxs)(d.Fragment,{children:[aB.length>0&&(0,d.jsxs)(l.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let a=aB.length;0!==a&&a2({title:`Delete ${a} Connection${a>1?"s":""}`,message:`Delete ${a} connection${a>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{a2(null);let a=0,b=[...aB];for(let c of b)try{(await fetch(`/api/providers/${c}`,{method:"DELETE"})).ok||(a+=1)}catch(b){console.log("Error deleting connection:",b),a+=1}u(a=>a.filter(a=>!b.includes(a.id))),aC([]),a>0&&alert(`Deleted ${b.length-a} connection(s), ${a} failed.`)}})},children:["Delete Selected (",aB.length,")"]}),(0,d.jsx)("button",{type:"button",onClick:b_,disabled:a5,title:a5?"Testing connections one-by-one…":"Test connections one-by-one","aria-label":a5?"Testing connections one by one":"Test connections one by one",className:"inline-flex size-7 items-center justify-center rounded-[var(--r1)] text-[var(--text-3)] transition-colors hover:text-[var(--text)] focus-visible:text-[var(--text)] disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer",children:(0,d.jsx)(e.default,{className:"text-[16px]",children:a5?"hourglass_top":"sync"})}),a5&&(0,d.jsx)("button",{type:"button",onClick:()=>{a5&&(bf.current=!0,a8(!0))},disabled:a7,title:a7?"Stopping…":"Stop testing","aria-label":a7?"Stopping":"Stop testing",className:"inline-flex size-7 items-center justify-center rounded-[var(--r1)] text-[var(--text-3)] transition-colors hover:text-[var(--text)] disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer",children:(0,d.jsx)(e.default,{className:"text-[16px]",children:"stop"})})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,d.jsx)(l.lM,{checked:"round-robin"===aH,onChange:a=>{let b=a?"round-robin":null,c=a?aJ||"1":aJ;a&&!aJ&&aK("1"),aI(b),bR(b,c)}}),"round-robin"===aH&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Pool:"}),(0,d.jsx)("input",{type:"number",min:1,value:aJ,onChange:a=>{var b;aK(b=a.target.value),bR("round-robin",b)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Auto-demote on error"}),(0,d.jsx)(l.lM,{checked:null===aL||aL,onChange:bS})]})]})]}),0===t.length?(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 text-text-muted shrink-0",children:(0,d.jsx)(e.default,{className:"text-[18px]",children:bs?"lock":"key"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),bB&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",bC," or ",bD,"."]})]})]}),(0,d.jsx)("div",{className:"flex gap-2",children:bB?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:bn,children:bC}),(0,d.jsx)(l.$n,{size:"sm",variant:"contrast",icon:"key",onClick:bo,children:bD})]}):(0,d.jsxs)(d.Fragment,{children:[!bA&&"iflow"===r&&(0,d.jsx)(l.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>P(!0),children:"Cookie"}),"codex"===r&&(0,d.jsx)(l.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>$(!0),children:(0,B.Tl)("Bulk Add")}),"grok-cli"===r&&(0,d.jsx)(l.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>aa(!0),children:(0,B.Tl)("Bulk Add")}),(0,d.jsx)(l.$n,{size:"sm",icon:"add",onClick:bp,children:bA?"Add API Key":"iflow"===r?"OAuth":"Add Connection"})]})})]}):(0,d.jsxs)(d.Fragment,{children:[bd&&(0,d.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,d.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,d.jsxs)("span",{children:["Total: ",bd.total]}),(0,d.jsxs)("span",{children:["Completed: ",bd.completed]}),(0,d.jsxs)("span",{children:["Passed: ",bd.passed]}),(0,d.jsxs)("span",{children:["Failed: ",bd.failed]}),bd.stopped&&(0,d.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),a5&&a9&&(0,d.jsxs)("span",{children:["Running: ",t.find(a=>a.id===a9)?.name||a9]})]})}),t.length>0&&(0,d.jsx)("div",{className:"mb-3 flex items-center gap-2 border-b border-black/[0.03] pb-2 dark:border-white/[0.03]",children:(0,d.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,d.jsx)("input",{type:"checkbox",checked:b7,onChange:()=>{b7?aC([]):aC(t.map(a=>a.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),ce,!bA&&(0,d.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===r&&(0,d.jsx)(l.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>P(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===r&&(0,d.jsx)(l.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>$(!0),title:(0,B.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,B.Tl)("Bulk Add")}),"grok-cli"===r&&(0,d.jsx)(l.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>aa(!0),title:(0,B.Tl)("Bulk import Grok CLI accounts from JSON"),className:"w-full sm:w-auto",children:(0,B.Tl)("Bulk Add")}),bB?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:bn,className:"w-full sm:w-auto",children:bC}),(0,d.jsx)(l.$n,{size:"sm",icon:"key",onClick:bo,className:"w-full sm:w-auto",children:bD})]}):(0,d.jsx)(l.$n,{size:"sm",icon:"add",onClick:bp,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,d.jsx)(ab,{providerId:r}),(0,d.jsxs)(l.Zp,{className:`ui-card ${H().panel}`,children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsxs)("h2",{className:"ui-eyebrow",children:[(0,d.jsx)(e.default,{className:"text-[16px]",children:"smart_toy"}),"Available Models"]}),bG&&(0,d.jsx)("select",{value:aN,onChange:a=>{var b;aO(b=a.target.value),bT(b)},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:bG.map(a=>(0,d.jsx)("option",{value:a,children:`Thinking: ${a.charAt(0).toUpperCase()+a.slice(1)}`},a))})]}),!bA&&(a=[...bw,...aZ.filter(a=>!bw.some(b=>b.id===a.id))].filter(a=>{let b=(0,n.CP)(a);return!b||"llm"===b}).map(a=>a.id).filter(a=>!a_.includes(a)),(0,d.jsxs)("div",{className:"flex gap-2",children:[a_.length>0&&(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:bM,children:"Active All"}),a.length>0&&(0,d.jsx)(l.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>bL(a),children:"Disable All"})]}))]}),!!av&&(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsx)("p",{className:"text-xs text-red-500 break-words",children:av}),/RegionError|hosted in China|regionNotAllowed/i.test(av)&&(c=(b="string"==typeof av?av:JSON.stringify(av)).match(/https:\/\/opencode\.ai\/workspace\/[^\s"')]+/),h=b.match(/wrk_[0-9A-Za-z]+/),o=c?c[0].endsWith("/go")?c[0]:`${c[0]}/go`:h?`https://opencode.ai/workspace/${h[0]}/go`:"https://opencode.ai",(0,d.jsx)("div",{className:"mt-1.5",children:(0,d.jsxs)("a",{href:o,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-600 hover:bg-amber-500/20 dark:text-amber-400 transition-colors",children:[(0,d.jsx)("span",{children:"Allow China-hosted models"}),(0,d.jsx)(e.default,{className:"text-[13px]",children:"open_in_new"})]})}))]}),"zed"===r&&!!aX&&(0,d.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:aX}),(()=>{let a,b,c;if(bA)return(0,d.jsx)(J,{providerStorageAlias:bF,providerDisplayAlias:bH,modelAliases:an,customModels:ap,copied:bk,onCopy:bl,onSetAlias:bV,onDeleteAlias:bW,onAddCustomModel:a=>bX(a,"llm",bF),onDeleteCustomModel:a=>bY(a,"llm",bF),connections:t,isAnthropic:bz});let f=[...bw,...aZ.filter(a=>!bw.some(b=>b.id===a.id))].filter(a=>{let b=(0,n.CP)(a);return!b||"llm"===b}),g=new Set(a_),h=f.filter(a=>!g.has(a.id)),i=f.filter(a=>g.has(a.id)),j=C({customModels:ap,modelAliases:an,providerAlias:bF,builtInModels:bw,type:"llm"});return(0,d.jsxs)("div",{className:"flex flex-wrap gap-3",children:[j.map(a=>(0,d.jsx)(F,{model:{id:a.id,name:a.name},fullModel:`${bH}/${a.id}`,alias:a.alias,copied:bk,onCopy:bl,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===a.source?bY(a.id,"llm",bF):bW(a.alias)},testStatus:at[a.id],onTest:t.length>0||bu?()=>ch(a.id):void 0,isTesting:ax.has(a.id),isCustom:!0,isFree:!1,caps:s(`${r}/${a.id}`),thinkingSuffix:bE(a.id)},`${a.source}-${a.fullModel}`)),h.map(a=>{let b=`${bF}/${a.id}`,c=`${r}/${a.id}`,e=Object.entries(an).find(([,a])=>a===b||a===c)?.[0];return(0,d.jsx)(F,{model:a,fullModel:`${bH}/${a.id}`,alias:e,copied:bk,onCopy:bl,onSetAlias:b=>bV(a.id,b,bF),onDeleteAlias:()=>bW(e),testStatus:at[a.id],onTest:t.length>0||bu?()=>ch(a.id):void 0,isTesting:ax.has(a.id),isFree:a.isFree,onDisable:()=>bJ(a.id),caps:s(`${r}/${a.id}`),thinkingSuffix:bE(a.id)},a.id)}),(0,d.jsxs)("button",{onClick:()=>aA(!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,d.jsx)(e.default,{className:"text-sm",children:"add"}),"Add Model"]}),("qoder"===r||"qoder-cn"===r)&&t.some(a=>!1!==a.isActive)&&(0,d.jsxs)("button",{onClick:bZ,disabled:bg,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,d.jsx)(e.default,{className:"text-sm",style:bg?{animation:"spin 1s linear infinite"}:void 0,children:bg?"progress_activity":"download"}),bg?(0,B.Tl)("Fetching..."):(0,B.Tl)("Fetch Qoder Models")]}),("cline"===r||"clinepass"===r)&&t.some(a=>!1!==a.isActive)&&(0,d.jsxs)("button",{onClick:b$,disabled:bi,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,d.jsx)(e.default,{className:"text-sm",style:bi?{animation:"spin 1s linear infinite"}:void 0,children:bi?"progress_activity":"download"}),bi?(0,B.Tl)("Fetching..."):(0,B.Tl)("Import from /models")]}),aT.length>0&&(a=new Set([...Object.values(an),...j.map(a=>a.fullModel)]),b=new Set(bw.map(a=>a.id)),0===(c=aT.filter(c=>!a.has(`${bF}/${c.id}`)&&!b.has(c.id))).length?null:(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:c.map(a=>(0,d.jsxs)("button",{onClick:async()=>{await bX(a.id,"llm",bF)},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:`${a.name} \xb7 ${(a.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,d.jsx)(e.default,{className:"text-[13px]",children:"add"}),a.id.split("/").pop()]},a.id))})]})),i.length>0&&(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",i.length,"):"]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(a=>(0,d.jsxs)("button",{onClick:()=>bK(a.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,d.jsx)(e.default,{className:"text-[13px]",children:"add"}),a.id]},a.id))})]})]})})()]}),cg,"kiro"===r?(0,d.jsx)(l.Mh,{isOpen:I,providerInfo:bq,onSuccess:b1,onClose:()=>K(!1)}):"cursor"===r?(0,d.jsx)(l.G9,{isOpen:I,onSuccess:b1,onClose:()=>K(!1)}):"zed"===r?(0,d.jsx)(l.TE,{isOpen:I,providerInfo:bq,onSuccess:b1,onClose:()=>K(!1)}):"gitlab"===r?(0,d.jsx)(l.vj,{isOpen:I,providerInfo:bq,onSuccess:b1,onClose:()=>K(!1)}):(0,d.jsx)(l.LF,{isOpen:I,provider:r,providerInfo:bq,onSuccess:b1,onClose:()=>K(!1)}),(0,d.jsx)(l.LH,{isOpen:L,onSuccess:b1,onClose:()=>M(!1)}),"iflow"===r&&(0,d.jsx)(l.vE,{isOpen:N,onSuccess:()=>{bP(),P(!1)},onClose:()=>P(!1)}),(0,d.jsx)(R,{isOpen:Q,provider:r,providerName:bq.name,isCompatible:bA,isAnthropic:bz,authType:bq?.authType,authHint:bq?.authHint,website:bq?.website,proxyPools:E,error:V,existingNames:t.map(a=>a.name).filter(Boolean),onSave:b2,onBulkDone:bP,onClose:()=>{X(""),T(!1)}}),(0,d.jsx)(l.wI,{isOpen:af,connection:al,proxyPools:E,onSave:b3,onClose:()=>ag(!1)}),bA&&(0,d.jsx)(S,{isOpen:ah,node:x,onSave:bQ,onClose:()=>ai(!1),isAnthropic:bz}),!bA&&(0,d.jsx)(U,{isOpen:az,providerAlias:bF,providerDisplayAlias:bH,onSave:async(a,b,c)=>{await bX(a,b?.stt?"stt":"llm",bF,b,c),aA(!1)},onClose:()=>aA(!1)}),"codex"===r&&(0,d.jsx)(W,{isOpen:Y,onClose:()=>$(!1),onSuccess:bP}),"grok-cli"===r&&(0,d.jsx)(Z,{isOpen:_,onClose:()=>aa(!1),onSuccess:bP}),aR&&(0,d.jsx)(ac.A,{isOpen:!!aR,onClose:()=>aS(null),connection:aR,reactive:!0===aP.connections[aR.id],schedule:aP.schedules?.[aR.id]||null,onSave:a=>((a,{reactive:b,schedule:c})=>{bU({...aP,connections:{...aP.connections,[a]:b},schedules:{...aP.schedules,[a]:c}})})(aR.id,a)}),(0,d.jsx)(l.uo,{isOpen:a3,onClose:()=>a4(!1),onConfirm:()=>{(a4(!1),bs)?bm():bo()},title:"Risk Notice",message:bq?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,d.jsx)(l.uo,{isOpen:!!a1,onClose:()=>a2(null),onConfirm:a1?.onConfirm,title:a1?.title||"Confirm",message:a1?.message,variant:"danger"})]})}},32467:a=>{"use strict";a.exports=require("node:http2")},33873:a=>{"use strict";a.exports=require("path")},34589:a=>{"use strict";a.exports=require("node:assert")},37067:a=>{"use strict";a.exports=require("node:http")},37540:a=>{"use strict";a.exports=require("node:console")},38522:a=>{"use strict";a.exports=require("node:zlib")},40610:a=>{"use strict";a.exports=require("node:dns")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41692:a=>{"use strict";a.exports=require("node:tls")},41792:a=>{"use strict";a.exports=require("node:querystring")},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},46293:a=>{"use strict";a.exports=require("sql.js")},48161:a=>{"use strict";a.exports=require("node:os")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},54589:(a,b,c)=>{"use strict";function d(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}c.d(b,{JW:()=>i,Vm:()=>d,fB:()=>f,gy:()=>e,nz:()=>g});let e={anchor:"09:30",timezone:d(),windowHours:5,slotsPerDay:3};function f(a){let b=/^(\d{1,2}):(\d{2})$/.exec(String(a||"").trim());if(!b)return null;let c=Number(b[1]),d=Number(b[2]);return c>23||d>59?null:{hour:c,minute:d}}function g(a){return Math.max(1,Math.floor(24/a))}function h(a,b,c,d){let e="number"==typeof a?a:Number(a);return Number.isFinite(e)?Math.min(d,Math.max(c,e)):b}function i(a){let b=function(a){if(!a||!0!==a.enabled)return null;let b=f(a.anchor)||f(e.anchor),c=`${String(b.hour).padStart(2,"0")}:${String(b.minute).padStart(2,"0")}`,d=!function(a){if(!a||"string"!=typeof a)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:a}),!0}catch{return!1}}(a.timezone)?e.timezone:a.timezone,i=h(a.windowHours,e.windowHours,.5,24),j=Math.round(h(a.slotsPerDay,e.slotsPerDay,1,g(i)));return{enabled:!0,anchor:c,timezone:d,windowHours:i,slotsPerDay:j}}(a);if(!b)return[];let{hour:c,minute:d}=f(b.anchor),i=60*c+d;return Array.from({length:b.slotsPerDay},(a,c)=>{let d=Math.round(i+c*b.windowHours*60)%1440;return`${String(Math.floor(d/60)).padStart(2,"0")}:${String(d%60).padStart(2,"0")}`})}},55511:a=>{"use strict";a.exports=require("crypto")},55591:a=>{"use strict";a.exports=require("https")},56020:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(71404),j=c(54589);let k=[{value:"off",label:"Off",icon:"block"},{value:"reset",label:"On reset",icon:"bolt"},{value:"schedule",label:"Schedule",icon:"schedule"}];function l({isOpen:a,onClose:b,onSave:c,connection:f,reactive:g=!1,schedule:m=null}){let[n,o]=(0,e.useState)(()=>({mode:m?.enabled===!0?"schedule":!0===g?"reset":"off",anchor:m?.anchor||j.gy.anchor,timezone:(0,j.Vm)(),windowHours:String(m?.windowHours??j.gy.windowHours),slotsPerDay:String(m?.slotsPerDay??j.gy.slotsPerDay)})),p=Number(n.windowHours),q=Number(n.slotsPerDay),r=!!(0,j.fB)(n.anchor),s=Number.isFinite(p)&&p>=.5&&p<=24,t=s?(0,j.nz)(p):24,u=Number.isInteger(q)&&q>=1&&q<=t,v=r&&s&&u,w="schedule"!==n.mode||v,x=v?(0,j.JW)({enabled:!0,...n,windowHours:p,slotsPerDay:q}):[],y=x.length&&s?(()=>{let{hour:a,minute:b}=(0,j.fB)(n.anchor),c=Math.round(60*a+b+q*p*60)%1440;return`${String(Math.floor(c/60)).padStart(2,"0")}:${String(c%60).padStart(2,"0")}`})():"",z=a=>o(b=>({...b,...a}));return(0,d.jsx)(h.aF,{isOpen:a,onClose:b,title:"Auto-ping settings",size:"lg",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.$n,{variant:"secondary",onClick:b,children:"Cancel"}),(0,d.jsx)(h.$n,{onClick:()=>{w&&(c({reactive:"reset"===n.mode,schedule:"schedule"===n.mode?{enabled:!0,anchor:n.anchor,timezone:n.timezone,windowHours:p,slotsPerDay:q}:{enabled:!1}}),b())},disabled:!w,children:"Save"})]}),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Configure automated quota pings",f?.name?` for ${f.name}`:""," — pick one mode."]}),(0,d.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-[10px] bg-surface-2 p-1",children:k.map(a=>{let b=n.mode===a.value;return(0,d.jsxs)("button",{type:"button",onClick:()=>z({mode:a.value}),className:(0,i.cn)("flex h-9 items-center justify-center gap-1.5 rounded-[8px] px-3 text-sm font-medium transition-all",b?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px] leading-none",children:a.icon}),(0,d.jsx)("span",{children:a.label})]},a.value)})}),"reset"===n.mode&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Pings right after the 5h quota window resets, so a new window starts immediately."}),"schedule"===n.mode&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Pings at fixed local times so the 5h windows align with your workday."}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[(0,d.jsx)(h.pd,{label:"Anchor time",type:"time",value:n.anchor,onChange:a=>z({anchor:a.target.value}),error:r?"":"Use HH:MM",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,d.jsx)(h.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:n.windowHours,onChange:a=>z({windowHours:a.target.value}),error:s?"":"0.5 – 24",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,d.jsx)(h.pd,{label:"Pings per day",type:"number",min:"1",max:String(t),step:"1",value:n.slotsPerDay,onChange:a=>z({slotsPerDay:a.target.value}),error:u?"":`1 – ${t}`,hint:u?`Max ${t}`:"",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"})]}),x.length>0&&(0,d.jsxs)("div",{className:"rounded-[10px] bg-surface-2 px-3 py-2.5",children:[(0,d.jsxs)("p",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:["Daily slots (",n.timezone,")"]}),(0,d.jsx)("p",{className:"mt-1 text-sm font-medium text-text-main",children:x.join(" → ")}),(0,d.jsxs)("p",{className:"mt-1 text-xs text-text-muted",children:["Covers ",x[0]," – ",y,", then pauses until ",x[0]," next day."]})]})]})]})})}l.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSave:g().func.isRequired,connection:g().object,reactive:g().bool,schedule:g().object}},57075:a=>{"use strict";a.exports=require("node:stream")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71553:a=>{"use strict";a.exports=require("node:dns/promises")},71622:a=>{"use strict";a.exports=import("open")},72271:a=>{"use strict";a.exports=require("@aws-sdk/credential-providers")},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},73429:a=>{"use strict";a.exports=require("node:util/types")},73496:a=>{"use strict";a.exports=require("http2")},74075:a=>{"use strict";a.exports=require("zlib")},74875:(a,b,c)=>{"use strict";function d(a,b){return!1===a?"default":"active"===b||"success"===b?"success":"error"===b||"expired"===b||"unavailable"===b?"error":"default"}c.d(b,{g:()=>d})},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78474:a=>{"use strict";a.exports=require("node:events")},79646:a=>{"use strict";a.exports=require("child_process")},79868:a=>{"use strict";a.exports=require("node:sqlite")},81630:a=>{"use strict";a.exports=require("http")},81787:a=>{"use strict";a.exports=require("bun:sqlite")},87550:a=>{"use strict";a.exports=require("better-sqlite3")},87997:a=>{"use strict";a.exports=require("node:timers")},89255:(a,b,c)=>{Promise.resolve().then(c.bind(c,31886))},91645:a=>{"use strict";a.exports=require("net")},93110:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/root/workspace/JRouter/src/app/(dashboard)/dashboard/providers/[id]/page.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/root/workspace/JRouter/src/app/(dashboard)/dashboard/providers/[id]/page.js","default")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[2970,1260,2430,1273,9415,2760,1220,4406,5665,6070,4864,6457,4123,455,6777,412,6698],()=>b(b.s=31185));module.exports=c})();