polyrouter 1.0.18 → 1.0.20

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 (638) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +17 -17
  3. package/app/.next-cli-build/build-manifest.json +2 -2
  4. package/app/.next-cli-build/prerender-manifest.json +3 -3
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/realtime/page.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/realtime/page.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/realtime/page_client-reference-manifest.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  78. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  79. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  80. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  81. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  82. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  83. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  84. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  85. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  86. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  87. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  88. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  89. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  90. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  91. package/app/.next-cli-build/server/app/_not-found.rsc +7 -7
  92. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +7 -7
  93. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  94. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +7 -7
  95. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  96. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  97. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  98. package/app/.next-cli-build/server/app/api/analytics/installation/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  100. package/app/.next-cli-build/server/app/api/auth/logout/route.js +1 -1
  101. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +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.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/auth/setup-password/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
  109. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  111. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  114. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
  116. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  118. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/commandcode-settings/route.js +2 -2
  120. package/app/.next-cli-build/server/app/api/cli-tools/commandcode-settings/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  122. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
  124. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  126. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
  130. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
  132. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +1 -1
  134. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  136. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  138. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +1 -1
  140. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  142. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  144. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/embedding-banners/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  155. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/mcp/chatgpt-web/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/mcp/chatgpt-web/status/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  165. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  169. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  175. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  177. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/oauth/chatgpt-web/cookie/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  182. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  184. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  186. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  187. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  190. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  191. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  192. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  194. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  196. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  197. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  199. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/oauth/trae/import/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/oauth/web-cookie/browser/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  205. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  208. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  210. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  212. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  214. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  216. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  219. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js +1 -1
  221. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  223. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  225. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  230. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  232. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  234. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/realtime/authorize/route.js +1 -1
  241. package/app/.next-cli-build/server/app/api/realtime/authorize/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/realtime/tickets/route.js +1 -1
  243. package/app/.next-cli-build/server/app/api/realtime/tickets/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/settings/database/route.js +1 -1
  245. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/settings/public-telemetry/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  250. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/sponsors/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  255. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  257. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  261. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  263. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  270. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
  271. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  273. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  275. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  276. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  277. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  278. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  279. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  280. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  281. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  283. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  284. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  286. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  288. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  289. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  290. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  291. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  292. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  293. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  294. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  295. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  296. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/api/v1/images/edits/route.js +1 -1
  298. package/app/.next-cli-build/server/app/api/v1/images/edits/route.js.nft.json +1 -1
  299. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  300. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  301. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  302. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  303. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  304. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
  305. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  306. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  307. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  308. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  309. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  310. package/app/.next-cli-build/server/app/api/v1/rerank/route.js +1 -1
  311. package/app/.next-cli-build/server/app/api/v1/rerank/route.js.nft.json +1 -1
  312. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  313. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  314. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  315. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  316. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  317. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  318. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  319. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  320. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  321. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  322. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  323. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  324. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  325. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  326. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  327. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  328. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  329. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  330. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  331. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  332. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  333. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  334. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  335. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  336. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  337. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  338. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  339. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  340. package/app/.next-cli-build/server/app/authorize/route.js.nft.json +1 -1
  341. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  342. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  343. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  344. package/app/.next-cli-build/server/app/callback.html +1 -1
  345. package/app/.next-cli-build/server/app/callback.rsc +7 -7
  346. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +7 -7
  347. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  348. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +7 -7
  349. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  350. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  351. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  352. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  353. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +9 -9
  354. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  355. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  356. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  357. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  358. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +9 -9
  359. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  360. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +7 -7
  361. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  362. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  363. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +10 -10
  364. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  365. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  366. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  367. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  368. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +10 -10
  369. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  370. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +7 -7
  371. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  372. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  373. package/app/.next-cli-build/server/app/dashboard/combos.rsc +9 -9
  374. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  375. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  376. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  377. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  378. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +9 -9
  379. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  380. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +7 -7
  381. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  382. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  383. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +10 -10
  384. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  385. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  386. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  387. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  388. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +10 -10
  389. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  390. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +7 -7
  391. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  392. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  393. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +9 -9
  394. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  395. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  396. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  397. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  398. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  399. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +9 -9
  400. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  401. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +7 -7
  402. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  403. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  404. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +9 -9
  405. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  406. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  407. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  408. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  409. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +9 -9
  410. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  411. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +7 -7
  412. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  413. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  414. package/app/.next-cli-build/server/app/dashboard/profile.rsc +9 -9
  415. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  416. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  417. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  418. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  419. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +9 -9
  420. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  421. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +7 -7
  422. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  423. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  424. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +9 -9
  425. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  426. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  427. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  428. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  429. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  430. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +9 -9
  431. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  432. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +7 -7
  433. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  434. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  435. package/app/.next-cli-build/server/app/dashboard/providers.rsc +9 -9
  436. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  437. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  438. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  439. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  440. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +9 -9
  441. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  442. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +7 -7
  443. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  444. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  445. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +9 -9
  446. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  447. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  448. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  449. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  450. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +9 -9
  451. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  452. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +7 -7
  453. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  454. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  455. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +9 -9
  456. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
  457. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
  458. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  459. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  460. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +9 -9
  461. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
  462. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +7 -7
  463. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
  464. package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  465. package/app/.next-cli-build/server/app/dashboard/quota.rsc +10 -10
  466. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  467. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  468. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  469. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  470. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +10 -10
  471. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  472. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +7 -7
  473. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  474. package/app/.next-cli-build/server/app/dashboard/realtime.html +1 -1
  475. package/app/.next-cli-build/server/app/dashboard/realtime.rsc +8 -8
  476. package/app/.next-cli-build/server/app/dashboard/realtime.segments/!KGRhc2hib2FyZCk/dashboard/realtime/__PAGE__.segment.rsc +1 -1
  477. package/app/.next-cli-build/server/app/dashboard/realtime.segments/!KGRhc2hib2FyZCk/dashboard/realtime.segment.rsc +1 -1
  478. package/app/.next-cli-build/server/app/dashboard/realtime.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  479. package/app/.next-cli-build/server/app/dashboard/realtime.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  480. package/app/.next-cli-build/server/app/dashboard/realtime.segments/_full.segment.rsc +8 -8
  481. package/app/.next-cli-build/server/app/dashboard/realtime.segments/_head.segment.rsc +1 -1
  482. package/app/.next-cli-build/server/app/dashboard/realtime.segments/_index.segment.rsc +7 -7
  483. package/app/.next-cli-build/server/app/dashboard/realtime.segments/_tree.segment.rsc +2 -2
  484. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  485. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  486. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  487. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  488. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +7 -7
  489. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +7 -7
  490. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  491. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +7 -7
  492. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  493. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  494. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  495. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  496. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  497. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  498. package/app/.next-cli-build/server/app/dashboard/skills.rsc +9 -9
  499. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  500. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  501. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  502. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  503. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +9 -9
  504. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  505. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +7 -7
  506. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  507. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  508. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +9 -9
  509. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
  510. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
  511. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  512. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  513. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +9 -9
  514. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
  515. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +7 -7
  516. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
  517. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  518. package/app/.next-cli-build/server/app/dashboard/translator.rsc +9 -9
  519. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  520. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  521. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  522. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  523. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +9 -9
  524. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  525. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +7 -7
  526. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  527. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  528. package/app/.next-cli-build/server/app/dashboard/usage.rsc +9 -9
  529. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  530. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  531. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  532. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  533. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +9 -9
  534. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  535. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +7 -7
  536. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  537. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  538. package/app/.next-cli-build/server/app/dashboard.rsc +10 -10
  539. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  540. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  541. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  542. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +10 -10
  543. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  544. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +7 -7
  545. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  546. package/app/.next-cli-build/server/app/index.html +1 -1
  547. package/app/.next-cli-build/server/app/index.rsc +7 -7
  548. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  549. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +7 -7
  550. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  551. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +7 -7
  552. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  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 +8 -8
  558. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +8 -8
  559. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  560. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +7 -7
  561. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  562. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  563. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  564. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  565. package/app/.next-cli-build/server/app/page.js +1 -1
  566. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  567. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  568. package/app/.next-cli-build/server/app/privacy/page.js +1 -1
  569. package/app/.next-cli-build/server/app/privacy/page.js.nft.json +1 -1
  570. package/app/.next-cli-build/server/app/privacy/page_client-reference-manifest.js +1 -1
  571. package/app/.next-cli-build/server/app/privacy.html +1 -1
  572. package/app/.next-cli-build/server/app/privacy.rsc +7 -7
  573. package/app/.next-cli-build/server/app/privacy.segments/_full.segment.rsc +7 -7
  574. package/app/.next-cli-build/server/app/privacy.segments/_head.segment.rsc +1 -1
  575. package/app/.next-cli-build/server/app/privacy.segments/_index.segment.rsc +7 -7
  576. package/app/.next-cli-build/server/app/privacy.segments/_tree.segment.rsc +2 -2
  577. package/app/.next-cli-build/server/app/privacy.segments/privacy/__PAGE__.segment.rsc +1 -1
  578. package/app/.next-cli-build/server/app/privacy.segments/privacy.segment.rsc +1 -1
  579. package/app/.next-cli-build/server/app-paths-manifest.json +17 -17
  580. package/app/.next-cli-build/server/chunks/112.js +1 -1
  581. package/app/.next-cli-build/server/chunks/1455.js +1 -0
  582. package/app/.next-cli-build/server/chunks/1522.js +2 -2
  583. package/app/.next-cli-build/server/chunks/1605.js +1 -1
  584. package/app/.next-cli-build/server/chunks/1829.js +1 -1
  585. package/app/.next-cli-build/server/chunks/2268.js +1 -1
  586. package/app/.next-cli-build/server/chunks/318.js +1 -1
  587. package/app/.next-cli-build/server/chunks/3212.js +1 -1
  588. package/app/.next-cli-build/server/chunks/3922.js +1 -1
  589. package/app/.next-cli-build/server/chunks/3943.js +1 -1
  590. package/app/.next-cli-build/server/chunks/412.js +1 -1
  591. package/app/.next-cli-build/server/chunks/4123.js +1 -1
  592. package/app/.next-cli-build/server/chunks/4293.js +1 -1
  593. package/app/.next-cli-build/server/chunks/5245.js +1 -1
  594. package/app/.next-cli-build/server/chunks/5699.js +1 -1
  595. package/app/.next-cli-build/server/chunks/6070.js +1 -1
  596. package/app/.next-cli-build/server/chunks/615.js +1 -1
  597. package/app/.next-cli-build/server/chunks/6306.js +1 -1
  598. package/app/.next-cli-build/server/chunks/{2932.js → 6705.js} +1 -1
  599. package/app/.next-cli-build/server/chunks/7774.js +13 -13
  600. package/app/.next-cli-build/server/chunks/8185.js +1 -1
  601. package/app/.next-cli-build/server/chunks/827.js +1 -1
  602. package/app/.next-cli-build/server/chunks/8292.js +1 -1
  603. package/app/.next-cli-build/server/chunks/8302.js +1 -1
  604. package/app/.next-cli-build/server/chunks/869.js +1 -1
  605. package/app/.next-cli-build/server/chunks/9570.js +1 -0
  606. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  607. package/app/.next-cli-build/server/middleware.js +3 -3
  608. package/app/.next-cli-build/server/pages/404.html +1 -1
  609. package/app/.next-cli-build/server/pages/500.html +1 -1
  610. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  611. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  612. package/app/.next-cli-build/static/chunks/1321-c67e8c09db0f12a7.js +1 -0
  613. package/app/.next-cli-build/static/chunks/5497-ce8d2f6b23280ae7.js +7 -0
  614. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-802103aed49d4515.js → page-dfc93e4d2ecd766a.js} +4 -4
  615. package/app/.next-cli-build/static/chunks/app/{layout-b5dceb29f62eb194.js → layout-2d0385ce4543a81e.js} +1 -1
  616. package/app/.next-cli-build/static/chunks/b468fba8-0fe8861cc53ab943.js +1 -0
  617. package/app/.next-cli-build/static/css/d55dcf99ce3b35c0.css +1 -0
  618. package/app/node_modules/baseline-browser-mapping/dist/index.cjs +1 -1
  619. package/app/node_modules/baseline-browser-mapping/package.json +3 -3
  620. package/app/node_modules/playwright-core/browsers.json +9 -32
  621. package/app/node_modules/playwright-core/lib/coreBundle.js +5402 -4419
  622. package/app/node_modules/playwright-core/lib/utilsBundle.js +1934 -7341
  623. package/app/node_modules/playwright-core/package.json +1 -1
  624. package/app/package.json +2 -2
  625. package/app/public/downloads/polyrouter-connector.zip +0 -0
  626. package/app/public/providers/experiential.png +0 -0
  627. package/app/public/providers/explabs.png +0 -0
  628. package/app/public/providers/explabs.svg +9 -0
  629. package/app/public/providers/xpl.png +0 -0
  630. package/package.json +1 -1
  631. package/app/.next-cli-build/server/chunks/2065.js +0 -1
  632. package/app/.next-cli-build/server/chunks/5640.js +0 -1
  633. package/app/.next-cli-build/static/chunks/1321-ee3ec643f67e845b.js +0 -1
  634. package/app/.next-cli-build/static/chunks/5497-9cf3552b2aa4b803.js +0 -7
  635. package/app/.next-cli-build/static/chunks/9da6db1e-bc711addbcad371c.js +0 -1
  636. package/app/.next-cli-build/static/css/248ddb1ca8e6ead3.css +0 -1
  637. /package/app/.next-cli-build/static/{I7Y8qiCnVE04FMFcLwos9 → lTALs5HJRQMXVPV8wheRw}/_buildManifest.js +0 -0
  638. /package/app/.next-cli-build/static/{I7Y8qiCnVE04FMFcLwos9 → lTALs5HJRQMXVPV8wheRw}/_ssgManifest.js +0 -0
@@ -1,12 +1,12 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{14297:(e,t,s)=>{Promise.resolve().then(s.bind(s,18493))},18493:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>J});var i=s(95155),a=s(12115),l=s(73321),r=s(98500),n=s.n(r),o=s(5772),d=s(8247),c=s(35497),m=s(88105),p=s(28777),x=s(990),u=s(62630);let h=["none","low","medium","high"],f=["none","thinking"],y=["none","low","medium","high","max"],g={openai:["none","minimal","low","medium","high","xhigh"],"claude-adaptive":y,"claude-budget":["none","low","medium","high","xhigh","max"],"gemini-level":["minimal","low","medium","high"],"gemini-budget":h,zai:f,qwen:h,kimi:y,deepseek:["none","high","max"],minimax:f,hunyuan:h,step:h},b=[{pattern:"*gpt-5.6-sol*",levels:["none","minimal","low","medium","high","xhigh","max"]},{pattern:"*codex*",levels:["low","medium","high","xhigh"]}];function v(e,t){let s=(0,x.nl)(e,t);if(!s.reasoning)return null;let i=b.find(e=>(0,u.gH)(e.pattern,t)),a=i?.levels||g[s.thinkingFormat]||h;return!1===s.thinkingCanDisable&&(a=a.filter(e=>"none"!==e)),a}var j=s(11059),w=s(929),k=s(73006);let N=new Map;async function C(e){if(!e?.url||!e?.type)return[];let t=N.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=new URLSearchParams({url:e.url,type:e.type}),s=await fetch(`/api/providers/suggested-models?${t}`);if(!s.ok)return[];let i=(await s.json()).data??[];return N.set(e.url,{data:i,expiresAt:Date.now()+6e5}),i}catch{return[]}}function S({customModels:e=[],modelAliases:t={},providerAlias:s,builtInModels:i=[],type:a="llm",includeLegacyAliases:l=!0}){let r=new Set(i.map(e=>e.id)),n=new Set,o=[];for(let t of e){if(!t?.id||t.providerAlias!==s)continue;let e=t?.kind||t?.type||"llm";if(a&&e!==a||r.has(t.id))continue;let i=`${s}/${t.id}`;n.has(i)||(n.add(i),o.push({id:t.id,name:t.name||t.id,fullModel:i,source:"custom",type:e}))}if(!l)return o;let d=`${s}/`;for(let[e,s]of Object.entries(t||{})){if("string"!=typeof s||!s.startsWith(d))continue;let t=s.slice(d.length);!t||r.has(t)||n.has(s)||(n.add(s),o.push({id:t,alias:e,fullModel:s,source:"legacyAlias",type:a||"llm"}))}return o}var A=s(14051),$=s.n(A);function T({model:e,fullModel:t,alias:s,copied:a,onCopy:l,testStatus:r,isCustom:n,isFree:o,onDeleteAlias:d,onTest:m,isTesting:p,onDisable:x,caps:u,thinkingSuffix:h}){let f=h?`${t}(${h})`:t,y="ok"===r?"#22c55e":"error"===r?"#ef4444":void 0;return(0,i.jsx)("div",{className:`group min-w-0 max-w-full border px-3 py-2 ${"ok"===r?"border-green-500/40":"error"===r?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,i.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,i.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:y?{color:y}:void 0,children:"ok"===r?"check_circle":"error"===r?"cancel":"smart_toy"}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,i.jsx)("code",{className:"max-w-[72vw] truncate bg-sidebar px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px]",children:f}),(0,i.jsxs)("span",{className:"flex min-w-0 items-center text-[9px] gap-1 pl-1",children:[e.name&&(0,i.jsx)("span",{className:"truncate text-[9px] italic text-text-muted/70",children:e.name}),(0,i.jsx)(c.nh,{caps:u,colorOverride:"text-text-muted/70",size:12})]})]}),m&&(0,i.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,i.jsx)("button",{onClick:m,disabled:p,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${p?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:p?{animation:"spin 1s linear infinite"}:void 0,children:p?"progress_activity":"science"})}),(0,i.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:p?"Testing...":"Test"})]}),(0,i.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,i.jsx)("button",{onClick:()=>l(f,`model-${e.id}`),className:" p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})}),(0,i.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:a===`model-${e.id}`?"Copied!":"Copy"})]}),n?(0,i.jsx)("button",{onClick:d,className:"ml-auto 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,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):x?(0,i.jsx)("button",{onClick:x,className:"ml-auto 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,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function O({modelId:e,fullModel:t,copied:s,onCopy:a,onDeleteAlias:l,onTest:r,testStatus:n,isTesting:o}){let d="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0;return(0,i.jsxs)("div",{className:`flex items-center gap-3 p-3 border ${"ok"===n?"border-green-500/40":"error"===n?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:d?{color:d}:void 0,children:"ok"===n?"check_circle":"error"===n?"cancel":"smart_toy"}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,i.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,i.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 ",children:t}),(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:()=>a(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar text-text-muted hover:text-primary",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})}),(0,i.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:s===`model-${e}`?"Copied!":"Copy"})]}),r&&(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:r,disabled:o,className:"p-0.5 hover:bg-sidebar text-text-muted hover:text-primary transition-colors",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:o?{animation:"spin 1s linear infinite"}:void 0,children:o?"progress_activity":"science"})}),(0,i.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:o?"Testing...":"Test"})]})]})]}),(0,i.jsx)("button",{onClick:l,className:"p-1 hover:bg-red-50 text-red-500",title:"Remove model",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function P({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,customModels:l,copied:r,onCopy:n,onDeleteAlias:o,onAddCustomModel:d,onDeleteCustomModel:m,connections:p,isAnthropic:x}){let[u,h]=(0,a.useState)(""),[f,y]=(0,a.useState)(!1),[g,b]=(0,a.useState)(!1),[v,j]=(0,a.useState)(null),[w,k]=(0,a.useState)({}),N=async t=>{if(!v){j(t);try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${e}/${t}`})}),i=await s.json();k(e=>({...e,[t]:i.ok?"ok":"error"}))}catch{k(e=>({...e,[t]:"error"}))}finally{j(null)}}},C=S({customModels:l,modelAliases:s,providerAlias:e,type:"llm"}),A=async()=>{if(!u.trim()||f)return;let e=u.trim();if(C.some(t=>t.id===e))return void alert("Model already exists for this provider.");y(!0);try{await d(e),h("")}catch(e){console.log("Error adding model:",e)}finally{y(!1)}},$=async()=>{if(g)return;let e=p.find(e=>!1!==e.isActive);if(e){b(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||"Failed to import models");let i=s.models||[];if(0===i.length)return void alert("No models returned from /models.");let a=0;for(let e of i){let t=e.id||e.name||e.model;t&&(C.some(e=>e.id===t)||(await d(t),a+=1))}0===a&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{b(!1)}}},T=p.some(e=>!1!==e.isActive);return(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",x?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,i.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,i.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,i.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,i.jsx)("input",{id:"new-compatible-model-input",type:"text",value:u,onChange:e=>h(e.target.value),onKeyDown:e=>"Enter"===e.key&&A(),placeholder:x?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border bg-background focus:outline-none focus:border-primary"})]}),(0,i.jsx)(c.$n,{size:"sm",icon:"add",onClick:A,disabled:!u.trim()||f,children:f?"Adding...":"Add"}),(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"download",onClick:$,disabled:!T||g,children:g?"Importing...":"Import from /models"})]}),!T&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),C.length>0&&(0,i.jsx)("div",{className:"flex flex-col gap-3",children:C.map(({id:s,alias:a,source:l})=>(0,i.jsx)(O,{modelId:s,fullModel:`${t}/${s}`,copied:r,onCopy:n,onDeleteAlias:()=>"custom"===l?m(s):o(a),onTest:p.length>0?()=>N(s):void 0,testStatus:w[s],isTesting:v===s},`${l}-${e}/${s}`))})]})}T.propTypes={model:$().shape({id:$().string.isRequired}).isRequired,fullModel:$().string.isRequired,alias:$().string,copied:$().string,onCopy:$().func.isRequired,testStatus:$().oneOf(["ok","error"]),isCustom:$().bool,isFree:$().bool,onDeleteAlias:$().func,onTest:$().func,isTesting:$().bool,onDisable:$().func,caps:$().object,thinkingSuffix:$().string},$().string.isRequired,$().string.isRequired,$().string,$().func.isRequired,$().func.isRequired,$().func,$().oneOf(["ok","error"]),$().bool,$().string.isRequired,$().object.isRequired,$().arrayOf($().object),$().string,$().func.isRequired,$().func.isRequired,$().func.isRequired,$().func.isRequired,P.propTypes={providerStorageAlias:$().string.isRequired,providerDisplayAlias:$().string.isRequired,modelAliases:$().object.isRequired,customModels:$().arrayOf($().object),copied:$().string,onCopy:$().func.isRequired,onDeleteAlias:$().func.isRequired,onAddCustomModel:$().func.isRequired,onDeleteCustomModel:$().func.isRequired,connections:$().arrayOf($().shape({id:$().string,isActive:$().bool})).isRequired,isAnthropic:$().bool};var E=s(70217);function I({until:e}){let[t,s]=(0,a.useState)("");return((0,a.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void s("");let i=Math.floor(t/1e3);if(i<60)s(`${i}s`);else if(i<3600)s(`${Math.floor(i/60)}m ${i%60}s`);else{let e=Math.floor(i/3600),t=Math.floor(i%3600/60);s(`${e}h ${t}m`)}};t();let i=setInterval(t,1e3);return()=>clearInterval(i)},[e]),t)?(0,i.jsxs)("span",{className:"text-xs text-green-500 font-mono",children:["⏱ ",t]}):null}function D({connection:e,proxyPools:t,isOAuth:s,isFirst:l,isLast:r,onMoveUp:n,onMoveDown:o,onToggleActive:d,onUpdateProxy:m,onEdit:p,onRenew:x,onDelete:u,oneByOneStatus:h=null,autoPing:f=null}){let[y,g]=(0,a.useState)(!1),b=new Map((t||[]).map(e=>[e.id,e])),v=e.providerSpecificData?.proxyPoolId||null,j=v?b.get(v):null,w=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,k=!!v||w,N=j?`Pool: ${j.name}`:v?`Pool: ${v} (inactive/missing)`:w?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",C=f?.provider==="codex"?"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota.":"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",S="";if(j?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=j?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);S=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{S=t}}let A=j?.noProxy||e.providerSpecificData?.connectionNoProxy||"",$="default";j?.isActive===!0?$="success":(v||w)&&($="error");let T=async e=>{g(!0);try{await m("__none__"===e?null:e)}finally{g(!1)}},O=e.authType||(s?"oauth":"apikey"),P="oauth"===O,R="cookie"===O,U=e.name?.trim()||e.email?.trim()||e.displayName?.trim()||(P?"OAuth Account":R?"Cookie Account":"API Key"),_=e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null,[z,q]=(0,a.useState)(!1),K=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,a.useEffect)(()=>{let t=()=>{q(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let s=K?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[K]);let M="unavailable"!==e.testStatus||z?e.testStatus:"active",F=()=>h?"queued"===h.state?"queued":"testing"===h.state?"testing":"success"===h.state?"success":"failed"===h.state?h.error?`failed: ${h.error}`:"failed":null:null;return(0,i.jsxs)("div",{className:`group flex min-w-0 flex-col gap-3 p-2 transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between ${!1===e.isActive?"opacity-60":""}`,children:[(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,i.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,i.jsx)("button",{onClick:n,disabled:l,className:`p-0.5 ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,i.jsx)("button",{onClick:o,disabled:r,className:`p-0.5 ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,i.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:R?"cookie":P?"lock":"key"}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm font-medium truncate",children:U}),_&&(0,i.jsx)("p",{className:"text-xs text-text-muted truncate",children:_}),(0,i.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,i.jsx)(c.Ex,{variant:(0,E.g)(e.isActive,M),size:"sm",dot:!0,children:!1===e.isActive?"disabled":M||"Unknown"}),(0,i.jsx)(c.Ex,{variant:"default",size:"sm",children:P?"OAuth":R?"Cookie":"API Key"}),k&&(0,i.jsx)(c.Ex,{variant:$,size:"sm",children:"Proxy"}),z&&!1!==e.isActive&&(0,i.jsx)(I,{until:K}),e.lastError&&!1!==e.isActive&&(0,i.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:e.lastError,children:e.lastError}),(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),F()&&(0,i.jsx)(c.Ex,{variant:h?"success"===h.state?"success":"failed"===h.state?"error":"testing"===h.state?"primary":"default":"default",size:"sm",children:F()})]}),k&&(0,i.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,i.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:N,children:N}),S&&(0,i.jsx)("code",{className:"max-w-full truncate bg-black/5 px-1 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[260px]",children:S}),A&&(0,i.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:A,children:["no_proxy: ",A]})]})]})]}),(0,i.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,i.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[(t||[]).length>0&&(0,i.jsxs)(c.ms,{trigger:(0,i.jsxs)("button",{className:`flex w-full flex-col items-center px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${k?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),children:[(0,i.jsx)(c.tJ,{icon:null,label:"None",onClick:()=>T("__none__")}),(t||[]).map(e=>(0,i.jsx)(c.tJ,{icon:null,label:e.name,onClick:()=>T(e.id)},e.id))]}),f&&(0,i.jsx)(c.m_,{text:C,children:(0,i.jsxs)("button",{onClick:()=>f.onToggle(!f.on),className:`flex w-full flex-col items-center px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${f.on?"text-primary":"text-text-muted hover:text-primary"}`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]})}),x&&(0,i.jsxs)("button",{onClick:x,className:"flex flex-col items-center px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"login"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Renew"})]}),(0,i.jsxs)("button",{onClick:p,className:"flex flex-col items-center px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,i.jsxs)("button",{onClick:u,className:"flex flex-col items-center px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,i.jsx)(c.lM,{size:"sm",checked:e.isActive??!0,onChange:d,title:e.isActive??!0?"Disable connection":"Enable connection"})]})]})}I.propTypes={until:$().string.isRequired},D.propTypes={connection:$().shape({id:$().string,name:$().string,email:$().string,displayName:$().string,modelLockUntil:$().string,testStatus:$().string,isActive:$().bool,lastError:$().string,priority:$().number,globalPriority:$().number}).isRequired,proxyPools:$().arrayOf($().shape({id:$().string,name:$().string,proxyUrl:$().string,noProxy:$().string,isActive:$().bool})),isOAuth:$().bool.isRequired,isFirst:$().bool.isRequired,isLast:$().bool.isRequired,onMoveUp:$().func.isRequired,onMoveDown:$().func.isRequired,onToggleActive:$().func.isRequired,onUpdateProxy:$().func,onEdit:$().func.isRequired,onRenew:$().func,onDelete:$().func.isRequired,oneByOneStatus:$().shape({state:$().string,error:$().string}),autoPing:$().shape({on:$().bool,onToggle:$().func,provider:$().string})};let R=`name1|sk-key1
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{14297:(e,t,s)=>{Promise.resolve().then(s.bind(s,18493))},18493:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>J});var i=s(95155),a=s(12115),l=s(73321),n=s(98500),r=s.n(n),o=s(5772),d=s(8247),c=s(35497),m=s(88105),p=s(28777),x=s(990),u=s(62630);let h=["none","low","medium","high"],f=["none","thinking"],y=["none","low","medium","high","max"],g={openai:["none","minimal","low","medium","high","xhigh"],"claude-adaptive":y,"claude-budget":["none","low","medium","high","xhigh","max"],"gemini-level":["minimal","low","medium","high"],"gemini-budget":h,zai:f,qwen:h,kimi:y,deepseek:["none","high","max"],minimax:f,hunyuan:h,step:h},b=[{pattern:"*gpt-5.6-sol*",levels:["none","minimal","low","medium","high","xhigh","max"]},{pattern:"*codex*",levels:["low","medium","high","xhigh"]}];function v(e,t){let s=(0,x.nl)(e,t);if(!s.reasoning)return null;let i=b.find(e=>(0,u.gH)(e.pattern,t)),a=i?.levels||g[s.thinkingFormat]||h;return!1===s.thinkingCanDisable&&(a=a.filter(e=>"none"!==e)),a}var j=s(11059),w=s(929),k=s(73006);let N=new Map;async function C(e){if(!e?.url||!e?.type)return[];let t=N.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=new URLSearchParams({url:e.url,type:e.type}),s=await fetch(`/api/providers/suggested-models?${t}`);if(!s.ok)return[];let i=(await s.json()).data??[];return N.set(e.url,{data:i,expiresAt:Date.now()+6e5}),i}catch{return[]}}function S({customModels:e=[],modelAliases:t={},providerAlias:s,builtInModels:i=[],type:a="llm",includeLegacyAliases:l=!0}){let n=new Set(i.map(e=>e.id)),r=new Set,o=[];for(let t of e){if(!t?.id||t.providerAlias!==s)continue;let e=t?.kind||t?.type||"llm";if(a&&e!==a||n.has(t.id))continue;let i=`${s}/${t.id}`;r.has(i)||(r.add(i),o.push({id:t.id,name:t.name||t.id,fullModel:i,source:"custom",type:e}))}if(!l)return o;let d=`${s}/`;for(let[e,s]of Object.entries(t||{})){if("string"!=typeof s||!s.startsWith(d))continue;let t=s.slice(d.length);!t||n.has(t)||r.has(s)||(r.add(s),o.push({id:t,alias:e,fullModel:s,source:"legacyAlias",type:a||"llm"}))}return o}var A=s(14051),$=s.n(A);function T({model:e,fullModel:t,alias:s,copied:a,onCopy:l,testStatus:n,isCustom:r,isFree:o,onDeleteAlias:d,onTest:m,isTesting:p,onDisable:x,caps:u,thinkingSuffix:h}){let f=h?`${t}(${h})`:t,y="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0;return(0,i.jsx)("div",{className:`group min-w-0 max-w-full border px-3 py-2 ${"ok"===n?"border-green-500/40":"error"===n?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,i.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,i.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:y?{color:y}:void 0,children:"ok"===n?"check_circle":"error"===n?"cancel":"smart_toy"}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,i.jsx)("code",{className:"max-w-[72vw] truncate bg-sidebar px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px]",children:f}),(0,i.jsxs)("span",{className:"flex min-w-0 items-center text-[9px] gap-1 pl-1",children:[e.name&&(0,i.jsx)("span",{className:"truncate text-[9px] italic text-text-muted/70",children:e.name}),(0,i.jsx)(c.nh,{caps:u,colorOverride:"text-text-muted/70",size:12})]})]}),m&&(0,i.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,i.jsx)("button",{onClick:m,disabled:p,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${p?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:p?{animation:"spin 1s linear infinite"}:void 0,children:p?"progress_activity":"science"})}),(0,i.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:p?"Testing...":"Test"})]}),(0,i.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,i.jsx)("button",{onClick:()=>l(f,`model-${e.id}`),className:" p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})}),(0,i.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:a===`model-${e.id}`?"Copied!":"Copy"})]}),r?(0,i.jsx)("button",{onClick:d,className:"ml-auto 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,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):x?(0,i.jsx)("button",{onClick:x,className:"ml-auto 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,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function O({modelId:e,fullModel:t,copied:s,onCopy:a,onDeleteAlias:l,onTest:n,testStatus:r,isTesting:o}){let d="ok"===r?"#22c55e":"error"===r?"#ef4444":void 0;return(0,i.jsxs)("div",{className:`flex items-center gap-3 p-3 border ${"ok"===r?"border-green-500/40":"error"===r?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:d?{color:d}:void 0,children:"ok"===r?"check_circle":"error"===r?"cancel":"smart_toy"}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,i.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,i.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 ",children:t}),(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:()=>a(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar text-text-muted hover:text-primary",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})}),(0,i.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:s===`model-${e}`?"Copied!":"Copy"})]}),n&&(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:n,disabled:o,className:"p-0.5 hover:bg-sidebar text-text-muted hover:text-primary transition-colors",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:o?{animation:"spin 1s linear infinite"}:void 0,children:o?"progress_activity":"science"})}),(0,i.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:o?"Testing...":"Test"})]})]})]}),(0,i.jsx)("button",{onClick:l,className:"p-1 hover:bg-red-50 text-red-500",title:"Remove model",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function P({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,customModels:l,copied:n,onCopy:r,onDeleteAlias:o,onAddCustomModel:d,onDeleteCustomModel:m,connections:p,isAnthropic:x}){let[u,h]=(0,a.useState)(""),[f,y]=(0,a.useState)(!1),[g,b]=(0,a.useState)(!1),[v,j]=(0,a.useState)(null),[w,k]=(0,a.useState)({}),N=async t=>{if(!v){j(t);try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${e}/${t}`})}),i=await s.json();k(e=>({...e,[t]:i.ok?"ok":"error"}))}catch{k(e=>({...e,[t]:"error"}))}finally{j(null)}}},C=S({customModels:l,modelAliases:s,providerAlias:e,type:"llm"}),A=async()=>{if(!u.trim()||f)return;let e=u.trim();if(C.some(t=>t.id===e))return void alert("Model already exists for this provider.");y(!0);try{await d(e),h("")}catch(e){console.log("Error adding model:",e)}finally{y(!1)}},$=async()=>{if(g)return;let e=p.find(e=>!1!==e.isActive);if(e){b(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||"Failed to import models");let i=s.models||[];if(0===i.length)return void alert("No models returned from /models.");let a=0;for(let e of i){let t=e.id||e.name||e.model;t&&(C.some(e=>e.id===t)||(await d(t),a+=1))}0===a&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{b(!1)}}},T=p.some(e=>!1!==e.isActive);return(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",x?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,i.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,i.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,i.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,i.jsx)("input",{id:"new-compatible-model-input",type:"text",value:u,onChange:e=>h(e.target.value),onKeyDown:e=>"Enter"===e.key&&A(),placeholder:x?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border bg-background focus:outline-none focus:border-primary"})]}),(0,i.jsx)(c.$n,{size:"sm",icon:"add",onClick:A,disabled:!u.trim()||f,children:f?"Adding...":"Add"}),(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"download",onClick:$,disabled:!T||g,children:g?"Importing...":"Import from /models"})]}),!T&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),C.length>0&&(0,i.jsx)("div",{className:"flex flex-col gap-3",children:C.map(({id:s,alias:a,source:l})=>(0,i.jsx)(O,{modelId:s,fullModel:`${t}/${s}`,copied:n,onCopy:r,onDeleteAlias:()=>"custom"===l?m(s):o(a),onTest:p.length>0?()=>N(s):void 0,testStatus:w[s],isTesting:v===s},`${l}-${e}/${s}`))})]})}T.propTypes={model:$().shape({id:$().string.isRequired}).isRequired,fullModel:$().string.isRequired,alias:$().string,copied:$().string,onCopy:$().func.isRequired,testStatus:$().oneOf(["ok","error"]),isCustom:$().bool,isFree:$().bool,onDeleteAlias:$().func,onTest:$().func,isTesting:$().bool,onDisable:$().func,caps:$().object,thinkingSuffix:$().string},$().string.isRequired,$().string.isRequired,$().string,$().func.isRequired,$().func.isRequired,$().func,$().oneOf(["ok","error"]),$().bool,$().string.isRequired,$().object.isRequired,$().arrayOf($().object),$().string,$().func.isRequired,$().func.isRequired,$().func.isRequired,$().func.isRequired,P.propTypes={providerStorageAlias:$().string.isRequired,providerDisplayAlias:$().string.isRequired,modelAliases:$().object.isRequired,customModels:$().arrayOf($().object),copied:$().string,onCopy:$().func.isRequired,onDeleteAlias:$().func.isRequired,onAddCustomModel:$().func.isRequired,onDeleteCustomModel:$().func.isRequired,connections:$().arrayOf($().shape({id:$().string,isActive:$().bool})).isRequired,isAnthropic:$().bool};var E=s(70217);function I({until:e}){let[t,s]=(0,a.useState)("");return((0,a.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void s("");let i=Math.floor(t/1e3);if(i<60)s(`${i}s`);else if(i<3600)s(`${Math.floor(i/60)}m ${i%60}s`);else{let e=Math.floor(i/3600),t=Math.floor(i%3600/60);s(`${e}h ${t}m`)}};t();let i=setInterval(t,1e3);return()=>clearInterval(i)},[e]),t)?(0,i.jsxs)("span",{className:"text-xs text-green-500 font-mono",children:["⏱ ",t]}):null}function D({connection:e,proxyPools:t,isOAuth:s,isFirst:l,isLast:n,onMoveUp:r,onMoveDown:o,onToggleActive:d,onUpdateProxy:m,onEdit:p,onRenew:x,onDelete:u,oneByOneStatus:h=null,autoPing:f=null}){let[y,g]=(0,a.useState)(!1),b=new Map((t||[]).map(e=>[e.id,e])),v=e.providerSpecificData?.proxyPoolId||null,j=v?b.get(v):null,w=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,k=!!v||w,N=j?`Pool: ${j.name}`:v?`Pool: ${v} (inactive/missing)`:w?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",C=f?.provider==="codex"?"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota.":"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",S="";if(j?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=j?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);S=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{S=t}}let A=j?.noProxy||e.providerSpecificData?.connectionNoProxy||"",$="default";j?.isActive===!0?$="success":(v||w)&&($="error");let T=async e=>{g(!0);try{await m("__none__"===e?null:e)}finally{g(!1)}},O=e.authType||(s?"oauth":"apikey"),P="oauth"===O,R="cookie"===O,U=e.name?.trim()||e.email?.trim()||e.displayName?.trim()||(P?"OAuth Account":R?"Cookie Account":"API Key"),_=e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null,[z,q]=(0,a.useState)(!1),K=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,a.useEffect)(()=>{let t=()=>{q(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let s=K?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[K]);let M="unavailable"!==e.testStatus||z?e.testStatus:"active",F=()=>h?"queued"===h.state?"queued":"testing"===h.state?"testing":"success"===h.state?"success":"failed"===h.state?h.error?`failed: ${h.error}`:"failed":null:null;return(0,i.jsxs)("div",{className:`group flex min-w-0 flex-col gap-3 p-2 transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between ${!1===e.isActive?"opacity-60":""}`,children:[(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,i.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,i.jsx)("button",{onClick:r,disabled:l,className:`p-0.5 ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,i.jsx)("button",{onClick:o,disabled:n,className:`p-0.5 ${n?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,i.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:R?"cookie":P?"lock":"key"}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm font-medium truncate",children:U}),_&&(0,i.jsx)("p",{className:"text-xs text-text-muted truncate",children:_}),(0,i.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,i.jsx)(c.Ex,{variant:(0,E.g)(e.isActive,M),size:"sm",dot:!0,children:!1===e.isActive?"disabled":M||"Unknown"}),(0,i.jsx)(c.Ex,{variant:"default",size:"sm",children:P?"OAuth":R?"Cookie":"API Key"}),k&&(0,i.jsx)(c.Ex,{variant:$,size:"sm",children:"Proxy"}),z&&!1!==e.isActive&&(0,i.jsx)(I,{until:K}),e.lastError&&!1!==e.isActive&&(0,i.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:e.lastError,children:e.lastError}),(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),F()&&(0,i.jsx)(c.Ex,{variant:h?"success"===h.state?"success":"failed"===h.state?"error":"testing"===h.state?"primary":"default":"default",size:"sm",children:F()})]}),k&&(0,i.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,i.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:N,children:N}),S&&(0,i.jsx)("code",{className:"max-w-full truncate bg-black/5 px-1 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[260px]",children:S}),A&&(0,i.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:A,children:["no_proxy: ",A]})]})]})]}),(0,i.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,i.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[(t||[]).length>0&&(0,i.jsxs)(c.ms,{trigger:(0,i.jsxs)("button",{className:`flex w-full flex-col items-center px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${k?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),children:[(0,i.jsx)(c.tJ,{icon:null,label:"None",onClick:()=>T("__none__")}),(t||[]).map(e=>(0,i.jsx)(c.tJ,{icon:null,label:e.name,onClick:()=>T(e.id)},e.id))]}),f&&(0,i.jsx)(c.m_,{text:C,children:(0,i.jsxs)("button",{onClick:()=>f.onToggle(!f.on),className:`flex w-full flex-col items-center px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${f.on?"text-primary":"text-text-muted hover:text-primary"}`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]})}),x&&(0,i.jsxs)("button",{onClick:x,className:"flex flex-col items-center px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"login"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Renew"})]}),(0,i.jsxs)("button",{onClick:p,className:"flex flex-col items-center px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,i.jsxs)("button",{onClick:u,className:"flex flex-col items-center px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,i.jsx)(c.lM,{size:"sm",checked:e.isActive??!0,onChange:d,title:e.isActive??!0?"Disable connection":"Enable connection"})]})]})}I.propTypes={until:$().string.isRequired},D.propTypes={connection:$().shape({id:$().string,name:$().string,email:$().string,displayName:$().string,modelLockUntil:$().string,testStatus:$().string,isActive:$().bool,lastError:$().string,priority:$().number,globalPriority:$().number}).isRequired,proxyPools:$().arrayOf($().shape({id:$().string,name:$().string,proxyUrl:$().string,noProxy:$().string,isActive:$().bool})),isOAuth:$().bool.isRequired,isFirst:$().bool.isRequired,isLast:$().bool.isRequired,onMoveUp:$().func.isRequired,onMoveDown:$().func.isRequired,onToggleActive:$().func.isRequired,onUpdateProxy:$().func,onEdit:$().func.isRequired,onRenew:$().func,onDelete:$().func.isRequired,oneByOneStatus:$().shape({state:$().string,error:$().string}),autoPing:$().shape({on:$().bool,onToggle:$().func,provider:$().string})};let R=`name1|sk-key1
2
2
  name2|sk-key2
3
- sk-key-only-auto-named`;function U({isOpen:e,provider:t,providerName:s,isCompatible:l,isAnthropic:r,authType:n,authHint:o,website:d,proxyPools:p,error:x,existingNames:u,onSave:h,onBulkDone:f,onClose:y}){let g="__none__",b="ollama-local"===t,v="cookie"===n,j="xai"===t&&!v,w=v?"Cookie Value":"API Key",k="azure"===t,N="cloudflare-ai"===t,C=m.Q2?.[t]?.regions||null,S=m.Q2?.[t]?.defaultRegion||C?.[0]?.id||"",[A,$]=(0,a.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:g,ollamaHostUrl:""}),[T,O]=(0,a.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[P,E]=(0,a.useState)({accountId:""}),[I,D]=(0,a.useState)(S),[_,z]=(0,a.useState)(!1),[q,K]=(0,a.useState)(null),[M,F]=(0,a.useState)(!1),L=N?`name1|sk-key1|acc123456
3
+ sk-key-only-auto-named`;function U({isOpen:e,provider:t,providerName:s,isCompatible:l,isAnthropic:n,authType:r,authHint:o,website:d,proxyPools:p,error:x,existingNames:u,onSave:h,onBulkDone:f,onClose:y}){let g="__none__",b="ollama-local"===t,v="cookie"===r,j="xai"===t&&!v,w=v?"Cookie Value":"API Key",k="azure"===t,N="cloudflare-ai"===t,C=m.Q2?.[t]?.regions||null,S=m.Q2?.[t]?.defaultRegion||C?.[0]?.id||"",[A,$]=(0,a.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:g,ollamaHostUrl:""}),[T,O]=(0,a.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[P,E]=(0,a.useState)({accountId:""}),[I,D]=(0,a.useState)(S),[_,z]=(0,a.useState)(!1),[q,K]=(0,a.useState)(null),[M,F]=(0,a.useState)(!1),L=N?`name1|sk-key1|acc123456
4
4
  name2|sk-key2|def789012
5
- sk-key-only-auto-named`:R,[J,W]=(0,a.useState)("single"),[B,H]=(0,a.useState)(""),[V,G]=(0,a.useState)(null),Q=()=>b&&A.ollamaHostUrl.trim()?{baseUrl:A.ollamaHostUrl.trim()}:k?{azureEndpoint:T.azureEndpoint,apiVersion:T.apiVersion,deployment:T.deployment,organization:T.organization}:N?{accountId:P.accountId}:C&&I?{region:I}:void 0,Z=async()=>{z(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:A.apiKey,providerSpecificData:Q()})}),s=await e.json();K(s.valid?"success":"failed")}catch{K("failed")}finally{z(!1)}},Y=async()=>{if(t&&(b||A.apiKey)&&(b||A.name)&&(!l||A.defaultModel.trim())){F(!0);try{let e=!1;try{z(!0),K(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:A.apiKey,providerSpecificData:Q()})});e=!!(await s.json()).valid,K(e?"success":"failed")}catch{K("failed")}finally{z(!1)}await h({name:A.name||(b?"Ollama Local":""),apiKey:A.apiKey,defaultModel:l?A.defaultModel.trim():void 0,priority:A.priority,proxyPoolId:A.proxyPoolId===g?null:A.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:Q()})}finally{F(!1)}}},X=async()=>{let e=B.split("\n");if(!e.length)return;let s=function(e,t,s={}){let{isCloudflareAi:i=!1}=s,a=new Set((Array.isArray(t)?t:[]).map(e=>"string"==typeof e?e.toLowerCase():"")),l=[];for(let t of e){let e,s="string"==typeof t?t.trim():"";if(!s)continue;let r=function(e,t={}){let{isCloudflareAi:s=!1}=t,i=e.split("|");if(s&&i.length>=3){let e=i[0].trim();return{baseName:e||"Key",apiKey:i.slice(1,-1).join("|").trim(),providerSpecificData:{accountId:i[i.length-1].trim()}}}return i.length>=2?{baseName:i[0].trim()||"Key",apiKey:i.slice(1).join("|").trim()}:{baseName:"Key",apiKey:i[0].trim()}}(s,{isCloudflareAi:i});if(!r||!r.apiKey)continue;let n=r.baseName,o=1;for(;e=`${n} ${o}`,a.has(e.toLowerCase());)o+=1;a.add(e.toLowerCase());let d={name:e,apiKey:r.apiKey,skipped:!1};r.providerSpecificData&&(d.providerSpecificData=r.providerSpecificData),l.push(d)}return l}(e,u,{isCloudflareAi:N});if(!s.length)return;F(!0),G(null);let i=0,a=0;for(let e of s)try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:e.apiKey,name:e.name,priority:1,testStatus:"unknown",...e.providerSpecificData?{providerSpecificData:e.providerSpecificData}:{}})})).ok?i++:a++}catch{a++}F(!1),G({success:i,failed:a}),i>0&&f&&f()};return t?(0,i.jsx)(c.aF,{isOpen:e,title:`Add ${s||t} ${w}`,onClose:y,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.$n,{size:"sm",variant:"single"===J?"primary":"ghost",onClick:()=>{W("single"),G(null)},children:"Single"}),(0,i.jsx)(c.$n,{size:"sm",variant:"bulk"===J?"primary":"ghost",onClick:()=>{W("bulk"),G(null)},children:"Bulk Add"})]}),"bulk"===J&&(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:N?(0,i.jsxs)(i.Fragment,{children:["One key per line. Format: ",(0,i.jsx)("code",{children:"name|apiKey|accountId"})," or just ",(0,i.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}):(0,i.jsxs)(i.Fragment,{children:["One key per line. Format: ",(0,i.jsx)("code",{children:"name|apiKey"})," or just ",(0,i.jsx)("code",{children:"apiKey"})," (auto-named by index)."]})}),(0,i.jsx)("textarea",{className:"w-full border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[140px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:L,value:B,onChange:e=>H(e.target.value)}),V&&(0,i.jsxs)("div",{className:`text-sm font-medium ${V.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",V.success," added",V.failed>0?`, ✗ ${V.failed} failed`:""]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.$n,{onClick:X,fullWidth:!0,disabled:M||!B.trim(),children:M?"Adding...":"Add All Keys"}),(0,i.jsx)(c.$n,{onClick:y,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===J&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.pd,{label:"Name",value:A.name,onChange:e=>$({...A,name:e.target.value}),placeholder:b?"Ollama Local":"Production Key"}),b&&(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.pd,{label:"Ollama Host URL",value:A.ollamaHostUrl,onChange:e=>$({...A,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(c.$n,{onClick:Z,disabled:_||M,variant:"secondary",children:_?"Checking...":"Check"})})]}),!b&&(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.pd,{label:w,type:v?"text":"password",value:A.apiKey,onChange:e=>$({...A,apiKey:e.target.value}),placeholder:v?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":j?"xai-...":"",className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(c.$n,{onClick:Z,disabled:!A.apiKey||_||M,variant:"secondary",children:_?"Checking...":"Check"})})]}),j&&(0,i.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."}),v&&o&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:[o,d&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsxs)("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",d.replace(/^https?:\/\//,"")]})]})]}),C&&(0,i.jsx)(c.l6,{label:"Region",value:I,onChange:e=>D(e.target.value),options:C.map(e=>({value:e.id,label:e.label}))}),l&&(0,i.jsx)(c.pd,{label:"Default Model",value:A.defaultModel,onChange:e=>$({...A,defaultModel:e.target.value}),placeholder:r?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),b&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,i.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,i.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),q&&(0,i.jsx)(c.Ex,{variant:"success"===q?"success":"error",children:"success"===q?"Valid":"Invalid"}),x&&(0,i.jsx)("p",{className:"text-xs text-red-500 break-words",children:x}),l&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default."}),N&&(0,i.jsxs)("div",{className:"bg-sidebar/50 p-4 border border-accent/20",children:[(0,i.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,i.jsx)(c.pd,{label:"Account ID",value:P.accountId,onChange:e=>E({...P,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,i.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),k&&(0,i.jsxs)("div",{className:"bg-sidebar/50 p-4 border border-accent/20",children:[(0,i.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)(c.pd,{label:"Azure Endpoint",value:T.azureEndpoint,onChange:e=>O({...T,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,i.jsx)(c.pd,{label:"Deployment Name",value:T.deployment,onChange:e=>O({...T,deployment:e.target.value}),placeholder:"gpt-4"}),(0,i.jsx)(c.pd,{label:"API Version",value:T.apiVersion,onChange:e=>O({...T,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,i.jsx)(c.pd,{label:"Organization",value:T.organization,onChange:e=>O({...T,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,i.jsx)(c.pd,{label:"Priority",type:"number",value:A.priority,onChange:e=>$({...A,priority:Number.parseInt(e.target.value)||1})}),(0,i.jsx)(c.l6,{label:"Proxy Pool",value:A.proxyPoolId,onChange:e=>$({...A,proxyPoolId:e.target.value}),options:[{value:g,label:"None"},...(p||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(p||[]).length&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.$n,{onClick:Y,fullWidth:!0,disabled:M||!b&&(!A.name||!A.apiKey)||l&&!A.defaultModel.trim()||k&&(!T.azureEndpoint||!T.deployment||!T.organization)||N&&!P.accountId,children:M?"Saving...":"Save"}),(0,i.jsx)(c.$n,{onClick:y,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function _({isOpen:e,node:t,onSave:s,onClose:l,isAnthropic:r}){let[n,o]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[d,m]=(0,a.useState)(!1),[p,x]=(0,a.useState)(""),[u,h]=(0,a.useState)(""),[f,y]=(0,a.useState)(!1),[g,b]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(r?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,r]);let v=async()=>{if(n.name.trim()&&n.prefix.trim()&&n.baseUrl.trim()){m(!0);try{let e={name:n.name,prefix:n.prefix,baseUrl:n.baseUrl};r||(e.apiType=n.apiType),await s(e)}finally{m(!1)}}},j=async()=>{y(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:p,type:r?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{y(!1)}};return t?(0,i.jsx)(c.aF,{isOpen:e,title:`Edit ${r?"Anthropic":"OpenAI"} Compatible`,onClose:l,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(c.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:`${r?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,i.jsx)(c.pd,{label:"Prefix",value:n.prefix,onChange:e=>o({...n,prefix:e.target.value}),placeholder:r?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!r&&(0,i.jsx)(c.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:n.apiType,onChange:e=>o({...n,apiType:e.target.value})}),(0,i.jsx)(c.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>o({...n,baseUrl:e.target.value}),placeholder:r?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${r?"Anthropic":"OpenAI"}-compatible API.`}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.pd,{label:"API Key (for Check)",type:"password",value:p,onChange:e=>x(e.target.value),className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(c.$n,{onClick:j,disabled:!p||f||!n.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,i.jsx)(c.pd,{label:"Model ID (optional)",value:u,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),g&&(0,i.jsx)(c.Ex,{variant:"success"===g?"success":"error",children:"success"===g?"Valid":"Invalid"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.$n,{onClick:v,fullWidth:!0,disabled:!n.name.trim()||!n.prefix.trim()||!n.baseUrl.trim()||d,children:d?"Saving...":"Save"}),(0,i.jsx)(c.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function z({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:l,onClose:r}){let[n,o]=(0,a.useState)(""),[d,m]=(0,a.useState)(null),[p,x]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e&&(o(""),m(null),x(""))},[e]);let f=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},y=async()=>{let e=f(n.trim());if(e){m("testing"),x("");try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${e}`})}),i=await s.json();m(i.ok?"ok":"error"),x(i.error||"")}catch(e){m("error"),x(e.message)}}},g=async()=>{let e=f(n.trim());if(e&&!u){h(!0);try{await l(e)}finally{h(!1)}}};return(0,i.jsx)(c.aF,{isOpen:e,onClose:r,title:"Add Custom Model",children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("input",{type:"text",value:n,onChange:e=>{o(e.target.value),m(null),x("")},onKeyDown:e=>{"Enter"===e.key&&y()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,i.jsx)(c.$n,{variant:"secondary",icon:"science",loading:"testing"===d,onClick:y,disabled:!n.trim()||"testing"===d,children:"testing"===d?"Testing...":"Test"})]}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,i.jsx)("code",{className:"font-mono bg-sidebar px-1 ",children:f(n.trim())||"model-id"})]})]}),"ok"===d&&(0,i.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===d&&(0,i.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,i.jsx)("span",{children:p||"Model not reachable"})]}),(0,i.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,i.jsx)(c.$n,{onClick:r,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,i.jsx)(c.$n,{onClick:g,fullWidth:!0,size:"sm",disabled:!n.trim()||u,children:u?"Adding...":"Add Model"})]})]})})}U.propTypes={isOpen:$().bool.isRequired,provider:$().string,providerName:$().string,isCompatible:$().bool,isAnthropic:$().bool,authType:$().string,authHint:$().string,website:$().string,proxyPools:$().arrayOf($().shape({id:$().string,name:$().string})),error:$().string,existingNames:$().arrayOf($().string),onSave:$().func.isRequired,onBulkDone:$().func,onClose:$().func.isRequired},_.propTypes={isOpen:$().bool.isRequired,node:$().shape({id:$().string,name:$().string,prefix:$().string,apiType:$().string,baseUrl:$().string}),onSave:$().func.isRequired,onClose:$().func.isRequired,isAnthropic:$().bool},z.propTypes={isOpen:$().bool.isRequired,providerAlias:$().string.isRequired,providerDisplayAlias:$().string.isRequired,onSave:$().func.isRequired,onClose:$().func.isRequired};let q=`[
5
+ sk-key-only-auto-named`:R,[J,W]=(0,a.useState)("single"),[B,H]=(0,a.useState)(""),[V,G]=(0,a.useState)(null),Q=()=>b&&A.ollamaHostUrl.trim()?{baseUrl:A.ollamaHostUrl.trim()}:k?{azureEndpoint:T.azureEndpoint,apiVersion:T.apiVersion,deployment:T.deployment,organization:T.organization}:N?{accountId:P.accountId}:C&&I?{region:I}:void 0,Z=async()=>{z(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:A.apiKey,providerSpecificData:Q()})}),s=await e.json();K(s.valid?"success":"failed")}catch{K("failed")}finally{z(!1)}},Y=async()=>{if(t&&(b||A.apiKey)&&(b||A.name)&&(!l||A.defaultModel.trim())){F(!0);try{let e=!1;try{z(!0),K(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:A.apiKey,providerSpecificData:Q()})});e=!!(await s.json()).valid,K(e?"success":"failed")}catch{K("failed")}finally{z(!1)}await h({name:A.name||(b?"Ollama Local":""),apiKey:A.apiKey,defaultModel:l?A.defaultModel.trim():void 0,priority:A.priority,proxyPoolId:A.proxyPoolId===g?null:A.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:Q()})}finally{F(!1)}}},X=async()=>{let e=B.split("\n");if(!e.length)return;let s=function(e,t,s={}){let{isCloudflareAi:i=!1}=s,a=new Set((Array.isArray(t)?t:[]).map(e=>"string"==typeof e?e.toLowerCase():"")),l=[];for(let t of e){let e,s="string"==typeof t?t.trim():"";if(!s)continue;let n=function(e,t={}){let{isCloudflareAi:s=!1}=t,i=e.split("|");if(s&&i.length>=3){let e=i[0].trim();return{baseName:e||"Key",apiKey:i.slice(1,-1).join("|").trim(),providerSpecificData:{accountId:i[i.length-1].trim()}}}return i.length>=2?{baseName:i[0].trim()||"Key",apiKey:i.slice(1).join("|").trim()}:{baseName:"Key",apiKey:i[0].trim()}}(s,{isCloudflareAi:i});if(!n||!n.apiKey)continue;let r=n.baseName,o=1;for(;e=`${r} ${o}`,a.has(e.toLowerCase());)o+=1;a.add(e.toLowerCase());let d={name:e,apiKey:n.apiKey,skipped:!1};n.providerSpecificData&&(d.providerSpecificData=n.providerSpecificData),l.push(d)}return l}(e,u,{isCloudflareAi:N});if(!s.length)return;F(!0),G(null);let i=0,a=0;for(let e of s)try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:e.apiKey,name:e.name,priority:1,testStatus:"unknown",...e.providerSpecificData?{providerSpecificData:e.providerSpecificData}:{}})})).ok?i++:a++}catch{a++}F(!1),G({success:i,failed:a}),i>0&&f&&f()};return t?(0,i.jsx)(c.aF,{isOpen:e,title:`Add ${s||t} ${w}`,onClose:y,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.$n,{size:"sm",variant:"single"===J?"primary":"ghost",onClick:()=>{W("single"),G(null)},children:"Single"}),(0,i.jsx)(c.$n,{size:"sm",variant:"bulk"===J?"primary":"ghost",onClick:()=>{W("bulk"),G(null)},children:"Bulk Add"})]}),"bulk"===J&&(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:N?(0,i.jsxs)(i.Fragment,{children:["One key per line. Format: ",(0,i.jsx)("code",{children:"name|apiKey|accountId"})," or just ",(0,i.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}):(0,i.jsxs)(i.Fragment,{children:["One key per line. Format: ",(0,i.jsx)("code",{children:"name|apiKey"})," or just ",(0,i.jsx)("code",{children:"apiKey"})," (auto-named by index)."]})}),(0,i.jsx)("textarea",{className:"w-full border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[140px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:L,value:B,onChange:e=>H(e.target.value)}),V&&(0,i.jsxs)("div",{className:`text-sm font-medium ${V.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",V.success," added",V.failed>0?`, ✗ ${V.failed} failed`:""]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.$n,{onClick:X,fullWidth:!0,disabled:M||!B.trim(),children:M?"Adding...":"Add All Keys"}),(0,i.jsx)(c.$n,{onClick:y,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===J&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.pd,{label:"Name",value:A.name,onChange:e=>$({...A,name:e.target.value}),placeholder:b?"Ollama Local":"Production Key"}),b&&(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.pd,{label:"Ollama Host URL",value:A.ollamaHostUrl,onChange:e=>$({...A,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(c.$n,{onClick:Z,disabled:_||M,variant:"secondary",children:_?"Checking...":"Check"})})]}),!b&&(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.pd,{label:w,type:v?"text":"password",value:A.apiKey,onChange:e=>$({...A,apiKey:e.target.value}),placeholder:v?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":j?"xai-...":"",className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(c.$n,{onClick:Z,disabled:!A.apiKey||_||M,variant:"secondary",children:_?"Checking...":"Check"})})]}),j&&(0,i.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."}),v&&o&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:[o,d&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsxs)("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",d.replace(/^https?:\/\//,"")]})]})]}),C&&(0,i.jsx)(c.l6,{label:"Region",value:I,onChange:e=>D(e.target.value),options:C.map(e=>({value:e.id,label:e.label}))}),l&&(0,i.jsx)(c.pd,{label:"Default Model",value:A.defaultModel,onChange:e=>$({...A,defaultModel:e.target.value}),placeholder:n?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),b&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,i.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,i.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),q&&(0,i.jsx)(c.Ex,{variant:"success"===q?"success":"error",children:"success"===q?"Valid":"Invalid"}),x&&(0,i.jsx)("p",{className:"text-xs text-red-500 break-words",children:x}),l&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default."}),N&&(0,i.jsxs)("div",{className:"bg-sidebar/50 p-4 border border-accent/20",children:[(0,i.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,i.jsx)(c.pd,{label:"Account ID",value:P.accountId,onChange:e=>E({...P,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,i.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),k&&(0,i.jsxs)("div",{className:"bg-sidebar/50 p-4 border border-accent/20",children:[(0,i.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)(c.pd,{label:"Azure Endpoint",value:T.azureEndpoint,onChange:e=>O({...T,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,i.jsx)(c.pd,{label:"Deployment Name",value:T.deployment,onChange:e=>O({...T,deployment:e.target.value}),placeholder:"gpt-4"}),(0,i.jsx)(c.pd,{label:"API Version",value:T.apiVersion,onChange:e=>O({...T,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,i.jsx)(c.pd,{label:"Organization",value:T.organization,onChange:e=>O({...T,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,i.jsx)(c.pd,{label:"Priority",type:"number",value:A.priority,onChange:e=>$({...A,priority:Number.parseInt(e.target.value)||1})}),(0,i.jsx)(c.l6,{label:"Proxy Pool",value:A.proxyPoolId,onChange:e=>$({...A,proxyPoolId:e.target.value}),options:[{value:g,label:"None"},...(p||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(p||[]).length&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.$n,{onClick:Y,fullWidth:!0,disabled:M||!b&&(!A.name||!A.apiKey)||l&&!A.defaultModel.trim()||k&&(!T.azureEndpoint||!T.deployment||!T.organization)||N&&!P.accountId,children:M?"Saving...":"Save"}),(0,i.jsx)(c.$n,{onClick:y,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function _({isOpen:e,node:t,onSave:s,onClose:l,isAnthropic:n}){let[r,o]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[d,m]=(0,a.useState)(!1),[p,x]=(0,a.useState)(""),[u,h]=(0,a.useState)(""),[f,y]=(0,a.useState)(!1),[g,b]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(n?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,n]);let v=async()=>{if(r.name.trim()&&r.prefix.trim()&&r.baseUrl.trim()){m(!0);try{let e={name:r.name,prefix:r.prefix,baseUrl:r.baseUrl};n||(e.apiType=r.apiType),await s(e)}finally{m(!1)}}},j=async()=>{y(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:r.baseUrl,apiKey:p,type:n?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{y(!1)}};return t?(0,i.jsx)(c.aF,{isOpen:e,title:`Edit ${n?"Anthropic":"OpenAI"} Compatible`,onClose:l,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(c.pd,{label:"Name",value:r.name,onChange:e=>o({...r,name:e.target.value}),placeholder:`${n?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,i.jsx)(c.pd,{label:"Prefix",value:r.prefix,onChange:e=>o({...r,prefix:e.target.value}),placeholder:n?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!n&&(0,i.jsx)(c.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:r.apiType,onChange:e=>o({...r,apiType:e.target.value})}),(0,i.jsx)(c.pd,{label:"Base URL",value:r.baseUrl,onChange:e=>o({...r,baseUrl:e.target.value}),placeholder:n?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${n?"Anthropic":"OpenAI"}-compatible API.`}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.pd,{label:"API Key (for Check)",type:"password",value:p,onChange:e=>x(e.target.value),className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(c.$n,{onClick:j,disabled:!p||f||!r.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,i.jsx)(c.pd,{label:"Model ID (optional)",value:u,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),g&&(0,i.jsx)(c.Ex,{variant:"success"===g?"success":"error",children:"success"===g?"Valid":"Invalid"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.$n,{onClick:v,fullWidth:!0,disabled:!r.name.trim()||!r.prefix.trim()||!r.baseUrl.trim()||d,children:d?"Saving...":"Save"}),(0,i.jsx)(c.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function z({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:l,onClose:n}){let[r,o]=(0,a.useState)(""),[d,m]=(0,a.useState)(null),[p,x]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e&&(o(""),m(null),x(""))},[e]);let f=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},y=async()=>{let e=f(r.trim());if(e){m("testing"),x("");try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${e}`})}),i=await s.json();m(i.ok?"ok":"error"),x(i.error||"")}catch(e){m("error"),x(e.message)}}},g=async()=>{let e=f(r.trim());if(e&&!u){h(!0);try{await l(e)}finally{h(!1)}}};return(0,i.jsx)(c.aF,{isOpen:e,onClose:n,title:"Add Custom Model",children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("input",{type:"text",value:r,onChange:e=>{o(e.target.value),m(null),x("")},onKeyDown:e=>{"Enter"===e.key&&y()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,i.jsx)(c.$n,{variant:"secondary",icon:"science",loading:"testing"===d,onClick:y,disabled:!r.trim()||"testing"===d,children:"testing"===d?"Testing...":"Test"})]}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,i.jsx)("code",{className:"font-mono bg-sidebar px-1 ",children:f(r.trim())||"model-id"})]})]}),"ok"===d&&(0,i.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===d&&(0,i.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,i.jsx)("span",{children:p||"Model not reachable"})]}),(0,i.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,i.jsx)(c.$n,{onClick:n,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,i.jsx)(c.$n,{onClick:g,fullWidth:!0,size:"sm",disabled:!r.trim()||u,children:u?"Adding...":"Add Model"})]})]})})}U.propTypes={isOpen:$().bool.isRequired,provider:$().string,providerName:$().string,isCompatible:$().bool,isAnthropic:$().bool,authType:$().string,authHint:$().string,website:$().string,proxyPools:$().arrayOf($().shape({id:$().string,name:$().string})),error:$().string,existingNames:$().arrayOf($().string),onSave:$().func.isRequired,onBulkDone:$().func,onClose:$().func.isRequired},_.propTypes={isOpen:$().bool.isRequired,node:$().shape({id:$().string,name:$().string,prefix:$().string,apiType:$().string,baseUrl:$().string}),onSave:$().func.isRequired,onClose:$().func.isRequired,isAnthropic:$().bool},z.propTypes={isOpen:$().bool.isRequired,providerAlias:$().string.isRequired,providerDisplayAlias:$().string.isRequired,onSave:$().func.isRequired,onClose:$().func.isRequired};let q=`[
6
6
  {
7
7
  "accessToken": "eyJhbGc...",
8
8
  "refreshToken": "rt_...",
9
9
  "idToken": "eyJhbGc...",
10
10
  "email": "user@example.com"
11
11
  }
12
- ]`;function K({isOpen:e,onClose:t,onSuccess:s}){let[l,r]=(0,a.useState)(""),[n,o]=(0,a.useState)(!1),[d,m]=(0,a.useState)(""),[p,x]=(0,a.useState)(null),u=()=>{n||(r(""),m(""),x(null),t())},h=async()=>{var e;let t;m(""),x(null);let i=l.trim();if(!i)return;try{t=JSON.parse(i)}catch(e){m(`${(0,k.Tl)("Invalid JSON")}: ${e.message}`);return}let a=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!a||0===a.length)return void m((0,k.Tl)("No accounts found in input"));o(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:a})}),t=await e.json();if(!e.ok)return void m(t?.error||`Request failed: ${e.status}`);x(t),t.success>0&&"function"==typeof s&&s()}catch(e){m(e.message||(0,k.Tl)("Request failed"))}finally{o(!1)}},f=p?.results?.filter(e=>!e.ok)||[];return(0,i.jsx)(c.aF,{isOpen:e,title:(0,k.Tl)("Bulk Add Codex Accounts"),onClose:u,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:(0,k.Tl)("Paste an array of codex account JSON objects. Each must include accessToken (and ideally refreshToken, idToken).")}),(0,i.jsx)("textarea",{className:"w-full border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:q,value:l,onChange:e=>r(e.target.value),disabled:n}),d&&(0,i.jsx)("p",{className:"text-xs text-red-500 break-words",children:d}),p&&(0,i.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,i.jsxs)("div",{className:`text-sm font-medium ${p.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",p.success," ",(0,k.Tl)("added"),p.failed>0?`, ✗ ${p.failed} ${(0,k.Tl)("failed")}`:""]}),f.length>0&&(0,i.jsx)("ul",{className:" border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:f.map(e=>(0,i.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.$n,{onClick:h,fullWidth:!0,disabled:n||!l.trim(),children:n?(0,k.Tl)("Importing..."):(0,k.Tl)("Import All")}),(0,i.jsx)(c.$n,{onClick:u,variant:"ghost",fullWidth:!0,disabled:n,children:(0,k.Tl)("Close")})]})]})})}function M({banner:e}){let t=e.displayName||"Banner";if("image"===e.mediaKind)return(0,i.jsx)("img",{src:e.mediaContent,alt:t,loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",className:"block max-h-64 w-full object-contain",onError:e=>{e.currentTarget.style.display="none"}});if("youtube"===e.mediaKind)return(0,i.jsx)("iframe",{src:`https://www.youtube-nocookie.com/embed/${e.mediaContent}`,title:t,className:"block aspect-video w-full",sandbox:"allow-scripts allow-same-origin allow-presentation",allow:"encrypted-media; picture-in-picture",referrerPolicy:"strict-origin-when-cross-origin",loading:"lazy",allowFullScreen:!0});let s=/^\s*<(!doctype|html)\b/i.test(e.mediaContent)?e.mediaContent:`<style>html,body{margin:0;padding:0;overflow:hidden}</style>${e.mediaContent}`;return(0,i.jsx)("iframe",{srcDoc:s,title:t,className:"block h-56 w-full",sandbox:"",referrerPolicy:"no-referrer"})}function F({providerId:e}){let[t,s]=(0,a.useState)([]);return((0,a.useEffect)(()=>{if(!e)return;let t=!1;return fetch(`/api/embedding-banners?provider_id=${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{t||s(Array.isArray(e?.banners)?e.banners:[])}).catch(()=>{}),()=>{t=!0}},[e]),0===t.length)?null:(0,i.jsx)(i.Fragment,{children:t.map(e=>{let t=(0,i.jsx)(M,{banner:e});return(0,i.jsxs)(c.Zp,{padding:"none",className:"w-full min-w-0 overflow-hidden",children:[e.href&&"image"===e.mediaKind?(0,i.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"block",children:t}):t,e.href&&"image"!==e.mediaKind?(0,i.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 border-t border-border-subtle px-3 py-2 text-xs text-text-muted hover:underline",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"open_in_new"}),e.displayName||"Learn more"]}):null]},e.id)})})}K.propTypes={isOpen:$().bool.isRequired,onClose:$().func.isRequired,onSuccess:$().func};let L={claude:"claudeAutoPing",codex:"codexAutoPing"};function J(){let e,t=(0,l.useParams)(),s=(0,l.useRouter)(),r=t.id,{getCaps:x}=(0,w.y)(),[u,h]=(0,a.useState)([]),[f,y]=(0,a.useState)(!0),[g,b]=(0,a.useState)(null),[N,A]=(0,a.useState)([]),[$,O]=(0,a.useState)(!1),[E,I]=(0,a.useState)(!1),[R,q]=(0,a.useState)(void 0),[M,J]=(0,a.useState)(!1),[W,B]=(0,a.useState)(!1),[H,V]=(0,a.useState)(""),[G,Q]=(0,a.useState)(!1),[Z,Y]=(0,a.useState)(!1),[X,ee]=(0,a.useState)(!1),[et,es]=(0,a.useState)(!1),[ei,ea]=(0,a.useState)(null),[el,er]=(0,a.useState)({}),[en,eo]=(0,a.useState)([]),[ed,ec]=(0,a.useState)(!1),[em,ep]=(0,a.useState)({}),[ex,eu]=(0,a.useState)(""),[eh,ef]=(0,a.useState)(()=>new Set),[ey,eg]=(0,a.useState)(!1),[eb,ev]=(0,a.useState)([]),[ej,ew]=(0,a.useState)("__none__"),[ek,eN]=(0,a.useState)(!1),[eC,eS]=(0,a.useState)(null),[eA,e$]=(0,a.useState)(""),[eT,eO]=(0,a.useState)("auto"),[eP,eE]=(0,a.useState)({enabled:!1,connections:{}}),[eI,eD]=(0,a.useState)([]),[eR,eU]=(0,a.useState)([]),[e_,ez]=(0,a.useState)([]),[eq,eK]=(0,a.useState)([]),[eM,eF]=(0,a.useState)(null),[eL,eJ]=(0,a.useState)(!1),[eW,eB]=(0,a.useState)(!1),[eH,eV]=(0,a.useState)(!1),[eG,eQ]=(0,a.useState)(null),[eZ,eY]=(0,a.useState)({}),[eX,e0]=(0,a.useState)(null),e1=(0,a.useRef)(!1),[e2,e5]=(0,a.useState)(!1),{copied:e3,copy:e4}=(0,j.C)(),e6="ag_risk_confirmed",e8=()=>{O(!0)},e7=()=>{"antigravity"===r&&"true"!==window.localStorage.getItem(e6)?eJ(!0):ta?e8():(V(""),B(!0))},e9=()=>{V(""),B(!0)},te=e=>{q(e),J(!0)},tt=()=>{if(m.br[r]){m.V8&&te(void 0);return}ta?e7():e9()},ts=g?{id:g.id,name:g.name||("anthropic-compatible"===g.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===g.type?"#16a34a":"#10A37F",textIcon:"anthropic-compatible"===g.type?"AC":"OC",apiType:g.apiType,baseUrl:g.baseUrl,type:g.type}:m.zN[r]||m.fg[r]||m.IS[r]||m.nJ[r]||m.br[r],ti=ts?.authModes||[],ta=!!m.zN[r]||!!m.IS[r]||ti.includes("oauth"),tl=!!m.fg[r]||ti.includes("apikey"),tr=!!m.IS[r]?.noAuth,tn=(0,p.KC)(r),to="cursor"===r&&eR.length>0?eR:tn,td=(0,m.wG)(r),tc=(0,m.mq)(r),tm=(0,m.gb)(r),tp=tc||tm,tx=!tp&&ta&&tl,tu="xai"===r?"Grok Build OAuth":"grok-cli"===r?"Grok CLI Device Login":"kimi"===r?"Kimi Coding OAuth":"OAuth",th="xai"===r?"xAI API Key":"kimi"===r?"Kimi API Key":"API Key",tf=e=>{if(!eT||"auto"===eT)return null;let t=v(r,e);return t&&t.includes(eT)?eT:null},ty=tp?r:td,tg=(()=>{let e=new Set,t=new Set,s=s=>{if(!s||t.has(s))return;t.add(s);let i=v(r,s);i&&i.forEach(t=>{"none"!==t&&e.add(t)})};for(let e of to)s(e.id);for(let e of e_)s(e.id);for(let e of en)e.providerAlias===ty&&"llm"===(e.kind||e.type||"llm")&&s(e.id);return e.size?["auto",...e]:null})(),tb=tp?g?.prefix||r:td,tv=(0,a.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ty)}`,{cache:"no-store"}),t=await e.json();e.ok&&eK(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[ty]),tj=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:ty,ids:[e]})})).ok&&await tv()}catch(e){console.log("Error disabling model:",e)}},tw=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ty)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tv()}catch(e){console.log("Error enabling model:",e)}},tk=async e=>{e.length&&eF({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eF(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:ty,ids:e})})).ok&&await tv()}catch(e){console.log("Error disabling all models:",e)}}})},tN=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ty)}`,{method:"DELETE"})).ok&&await tv()}catch(e){console.log("Error enabling all models:",e)}},tC=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&er(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),tS=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&eo(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,a.useEffect)(()=>{"kilocode"===r&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&ez(e.models)}).catch(()=>{})},[r]);let tA=(0,a.useCallback)(async()=>{try{let[e,t,s,i]=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"})]),a=await e.json(),l=await t.json(),n=await s.json(),o=i.ok?await i.json():{};if(e.ok){let e=(a.connections||[]).filter(e=>e.provider===r);h(e)}s.ok&&A(n.proxyPools||[]);let d=(o.providerStrategies||{})[r]||{};eS(d.fallbackStrategy||null),e$(null!=d.stickyRoundRobinLimit?String(d.stickyRoundRobinLimit):"1");let c=(o.providerThinking||{})[r]||{};eO(c.mode||"auto");let m=L[r],p=m&&o[m]||{};if(eE({enabled:!0===p.enabled,connections:p.connections||{}}),t.ok){let e=(l.nodes||[]).find(e=>e.id===r)||null;if(!e&&tp)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===r)||null))break}b(e)}}catch(e){console.log("Error fetching connections:",e)}finally{y(!1)}},[r,tp]),t$=async e=>{try{let t=await fetch(`/api/provider-nodes/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(b(s.node),await tA(),ee(!1))}catch(e){console.log("Error updating provider node:",e)}},tT=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),i=(s.ok?await s.json():{}).providerStrategies||{},a={};e&&(a.fallbackStrategy=e),"round-robin"===e&&""!==t&&(a.stickyRoundRobinLimit=Number(t)||3);let l={...i};0===Object.keys(a).length?delete l[r]:l[r]=a,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})})}catch(e){console.log("Error saving provider strategy:",e)}},tO=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?s[r]={mode:e}:delete s[r],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:s})})}catch(e){console.log("Error saving thinking config:",e)}},tP=async e=>{let t=L[r];if(t){eE(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:e})})}catch(e){console.log("Error saving auto-ping config:",e)}}};(0,a.useEffect)(()=>{tA(),tC(),tS(),tv()},[tA,tC,tS,tv]),(0,a.useEffect)(()=>{if("cursor"!==r)return void eU([]);let e=u.find(e=>!1!==e.isActive);if(!e?.id)return void eU([]);let t=!1;return fetch(`/api/providers/${e.id}/models`,{cache:"no-store"}).then(async e=>({ok:e.ok,data:await e.json()})).then(({ok:e,data:s})=>{!t&&e&&Array.isArray(s.models)&&s.models.length>0&&eU(s.models)}).catch(()=>{}),()=>{t=!0}},[r,u]),(0,a.useEffect)(()=>{let e=(m.zN[r]||m.fg[r]||m.IS[r]||m.nJ[r])?.modelsFetcher;e&&C(e).then(eD)},[r]);let tE=async(e,t,s=td)=>{let i=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:i,alias:t})});if(e.ok)await tC();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tI=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tC()}catch(e){console.log("Error deleting alias:",e)}},tD=async(e,t="llm",s=ty)=>{try{let i=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:s,id:e,type:t})});if(i.ok)await tS(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await i.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},tR=async(e,t="llm",s=ty)=>{try{let i=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${i}`,{method:"DELETE"})).ok&&(await tS(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},tU=async()=>{if(e2)return;let e=u.find(e=>!1!==e.isActive);if(!e)return void alert((0,k.Tl)("Please add an active Qoder connection first"));e5(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,k.Tl)("Failed to fetch models"));let i=s.models||[];if(0===i.length)return void alert((0,k.Tl)("No models returned"));let a=0;for(let e of i){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,"");en.some(e=>e.providerAlias===ty&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(el).includes(`${ty}/${s}`)||(await tD(s,"llm",ty),a+=1)}0===a?alert((0,k.Tl)("All models already exist, no new models added")):alert((0,k.Tl)("Successfully added")+` ${a} `+(0,k.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,k.Tl)("Error fetching models")+": "+e.message)}finally{e5(!1)}},t_=async()=>{if(eW||0===u.length)return;let e=Object.fromEntries(u.map(e=>[e.id,{state:"queued",error:null}]));e1.current=!1,eB(!0),eV(!1),eQ(null),eY(e),e0({total:u.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,s=0;try{for(let e=0;e<u.length;e+=1){if(e1.current){e0({total:u.length,completed:e,passed:t,failed:s,stopped:!0});break}let i=u[e];eQ(i.id),eY(e=>({...e,[i.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${i.id}/test`,{method:"POST"}),a=await e.json(),l=!!a.valid;l?t+=1:s+=1,eY(e=>({...e,[i.id]:{state:l?"success":"failed",error:l?null:a.error||null}}))}catch(e){s+=1,eY(t=>({...t,[i.id]:{state:"failed",error:e.message||"Test failed"}}))}e0({total:u.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<u.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{eQ(null),eB(!1),eV(!1),e1.current=!1}},tz=async e=>{eF({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eF(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&h(t=>t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tq=()=>{tA(),O(!1)},tK=async()=>{await tA()},tM=async e=>{V("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tA(),B(!1);return}V(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),V("Failed to save connection")}},tF=async e=>{try{(await fetch(`/api/providers/${ei.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tA(),Y(!1))}catch(e){console.log("Error updating connection:",e)}},tL=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&h(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},tJ=async(e,t)=>{let s=[...u];[s[e],s[t]]=[s[t],s[e]],h(s);try{await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch(e){console.log("Error swapping priority:",e),await tA()}},tW=u.filter(e=>eb.includes(e.id)),tB=u.length>0&&eb.length===u.length;(0,a.useEffect)(()=>{ev(e=>e.filter(e=>u.some(t=>t.id===e)))},[u]),(()=>{if(0===tW.length)return;let e=new Set(tW.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=N.find(e=>e.id===t);return s?.name}})();let tH=()=>{ek||es(!1)},tV=async e=>{eN(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:i}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:i})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await tA(),es(!1)}finally{eN(!1)}},tG=e=>tV(u.map(t=>({connectionId:t.id,proxyPoolId:e}))),tQ=(0,i.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:u.map((e,t)=>{let s;return(0,i.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,i.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,i.jsx)("input",{type:"checkbox",checked:(s=e.id,eb.includes(s)),onChange:()=>{var t;return t=e.id,void ev(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"h-4 w-4 border-gray-300 text-primary focus:ring-primary"})}),(0,i.jsx)("div",{className:"flex-1 min-w-0",children:(0,i.jsx)(D,{connection:e,proxyPools:N,isOAuth:ta,isFirst:0===t,isLast:t===u.length-1,onMoveUp:()=>tJ(t,t-1),onMoveDown:()=>tJ(t,t+1),onToggleActive:t=>tL(e.id,t),autoPing:L[r]&&"oauth"===e.authType?{on:!0===eP.connections[e.id],onToggle:t=>{var s;return s=e.id,void tP({...eP,connections:{...eP.connections,[s]:t}})},provider:r}:null,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&h(s=>s.map(s=>s.id===e.id?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{ea(e),Y(!0)},onRenew:"cookie"===e.authType&&m.V8?()=>te(e.id):void 0,onDelete:()=>tz(e.id),oneByOneStatus:eZ[e.id]||null})})]},e.id)})}),tZ=N.filter(e=>!0===e.isActive),tY=(0,i.jsx)(c.aF,{isOpen:et,onClose:tH,title:`Apply Proxy (${u.length} connections)`,children:(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsxs)("div",{className:"flex flex-col",children:[(0,i.jsxs)("button",{onClick:()=>{let e=N.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):tV(u.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:ek||0===tZ.length,className:"flex items-center gap-2 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,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,i.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,i.jsxs)("button",{onClick:()=>tG(null),disabled:ek,className:"flex items-center gap-2 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,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,i.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),N.map(e=>(0,i.jsxs)("button",{onClick:()=>tG(e.id),disabled:ek||!0!==e.isActive,className:"flex items-center gap-2 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,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,i.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,i.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),ek&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,i.jsx)(c.$n,{onClick:tH,variant:"ghost",fullWidth:!0,disabled:ek,children:"Cancel"})]})}),tX=async e=>{if(!eh.has(e)){ef(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${ty}/${e}`})}),s=await t.json();ep(t=>({...t,[e]:s.ok?"ok":"error"})),eu(s.ok?"":s.error||"Model not reachable")}catch{ep(t=>({...t,[e]:"error"})),eu("Network error")}finally{ef(t=>{let s=new Set(t);return s.delete(e),s})}}};if(f)return(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsx)(c.Qv,{}),(0,i.jsx)(c.Qv,{})]});if(!ts)return(0,i.jsxs)("div",{className:"text-center py-20",children:[(0,i.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,i.jsx)(n(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let t0=()=>tc&&ts.apiType?"responses"===ts.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":tm?"/providers/anthropic-m.png":(0,d.HY)(ts.id);return(0,i.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)(n(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,i.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,i.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center ",style:{backgroundColor:`${ts.color}15`},children:ed||!t0()?(0,i.jsx)("span",{className:"text-sm font-bold",style:{color:ts.color},children:ts.textIcon||ts.id.slice(0,2).toUpperCase()}):(0,i.jsx)(o.default,{src:t0(),alt:ts.name,width:48,height:48,className:"max-h-12 max-w-12 object-contain",sizes:"48px",onError:()=>{(0,d.Kw)(ts.id),ec(!0)},loading:"lazy",decoding:"async"})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,i.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:ts.name}),(ts.notice?.apiKeyUrl||ts.notice?.signupUrl||ts.website)&&(0,i.jsxs)("a",{href:ts.notice?.apiKeyUrl||ts.notice?.signupUrl||ts.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),ts.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,i.jsxs)("p",{className:"text-text-muted",children:[u.length," connection",1===u.length?"":"s"]})]})]})]}),ts.deprecated&&(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-yellow-500/10 border border-yellow-500/30",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,i.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:ts.deprecationNotice})]}),ts.notice?.text&&!ts.deprecated&&(0,i.jsxs)("div",{className:"flex flex-col gap-2 border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,i.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:ts.notice.text}),ts.notice.apiKeyUrl&&(0,i.jsx)("a",{href:ts.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center 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 →"})]}),"agentrouter"===r&&(0,i.jsx)(c.Zp,{children:(0,i.jsx)("div",{className:"flex min-h-28 items-center justify-center border border-dashed border-border bg-black/[0.015] px-5 py-6 text-center dark:bg-white/[0.015]",children:(0,i.jsxs)("div",{children:[(0,i.jsx)("span",{className:"material-symbols-outlined mb-2 block text-[24px] text-text-muted",children:"data_array"}),(0,i.jsx)("h2",{className:"font-semibold",children:"Embeddings"}),(0,i.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Coming soon"})]})})}),tp&&g&&(0,i.jsx)(c.Zp,{children:(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:tm?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,i.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[tm?"Messages API":"responses"===g.apiType?"Responses API":"Chat Completions"," \xb7 ",(g.baseUrl||"").replace(/\/$/,""),"/",tm?"messages":"responses"===g.apiType?"responses":"chat/completions"]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,i.jsx)(c.$n,{size:"sm",icon:"add",onClick:()=>{V(""),B(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>ee(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eF({title:"Delete Compatible Node",message:`Delete this ${tm?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eF(null);try{(await fetch(`/api/provider-nodes/${r}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),(0,i.jsx)(F,{providerId:r}),tr?(0,i.jsx)(c.gw,{providerId:r}):(0,i.jsxs)(c.Zp,{children:[(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,i.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[u.length>0&&N.length>0&&(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>es(!0),children:"Apply Proxy"}),u.length>0&&(0,i.jsxs)(i.Fragment,{children:[eb.length>0&&(0,i.jsxs)(c.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let e=eb.length;0!==e&&eF({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{eF(null);let e=0,t=[...eb];for(let s of t)try{(await fetch(`/api/providers/${s}`,{method:"DELETE"})).ok||(e+=1)}catch(t){console.log("Error deleting connection:",t),e+=1}h(e=>e.filter(e=>!t.includes(e.id))),ev([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:["Delete Selected (",eb.length,")"]}),(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:t_,disabled:eW,children:eW?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eW&&(0,i.jsx)(c.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eW&&(e1.current=!0,eV(!0))},disabled:eH,children:eH?"Stopping...":"Stop"})]}),(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,i.jsx)(c.lM,{checked:"round-robin"===eC,onChange:e=>{let t=e?"round-robin":null,s=e?eA||"1":eA;e&&!eA&&e$("1"),eS(t),tT(t,s)}}),"round-robin"===eC&&(0,i.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,i.jsx)("input",{type:"number",min:1,value:eA,onChange:e=>{var t;e$(t=e.target.value),tT("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border bg-background focus:outline-none focus:border-primary"})]})]})]})]}),0===u.length?(0,i.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:ta?"lock":"key"})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tx&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",tu," or ",th,"."]})]})]}),(0,i.jsx)("div",{className:"flex gap-2",children:tx?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:e7,children:tu}),(0,i.jsx)(c.$n,{size:"sm",icon:"key",onClick:e9,children:th})]}):(0,i.jsxs)(i.Fragment,{children:[!tp&&"iflow"===r&&(0,i.jsx)(c.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>I(!0),children:"Cookie"}),"codex"===r&&(0,i.jsx)(c.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>Q(!0),children:(0,k.Tl)("Bulk Add")}),(!m.br[r]||m.V8)&&(0,i.jsx)(c.$n,{size:"sm",icon:"add",onClick:tt,children:tp?"Add API Key":"iflow"===r?"OAuth":m.br[r]?"Sign in with browser":"Add Connection"})]})})]}):(0,i.jsxs)(i.Fragment,{children:[eX&&(0,i.jsx)("div",{className:"mb-4 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,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,i.jsxs)("span",{children:["Total: ",eX.total]}),(0,i.jsxs)("span",{children:["Completed: ",eX.completed]}),(0,i.jsxs)("span",{children:["Passed: ",eX.passed]}),(0,i.jsxs)("span",{children:["Failed: ",eX.failed]}),eX.stopped&&(0,i.jsx)("span",{className:"text-green-600 dark:text-green-400",children:"Stopped"}),eW&&eG&&(0,i.jsxs)("span",{children:["Running: ",u.find(e=>e.id===eG)?.name||eG]})]})}),u.length>0&&(0,i.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,i.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,i.jsx)("input",{type:"checkbox",checked:tB,onChange:()=>{tB?ev([]):ev(u.map(e=>e.id))},className:"h-3.5 w-3.5 border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),tQ,!tp&&(0,i.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:[m.br[r]&&m.V8&&(0,i.jsx)(c.$n,{size:"sm",icon:"login",onClick:()=>te(void 0),className:"w-full sm:w-auto",children:"Sign in with browser"}),"iflow"===r&&(0,i.jsx)(c.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>I(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===r&&(0,i.jsx)(c.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>Q(!0),title:(0,k.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,k.Tl)("Bulk Add")}),tx?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:e7,className:"w-full sm:w-auto",children:tu}),(0,i.jsx)(c.$n,{size:"sm",icon:"key",onClick:e9,className:"w-full sm:w-auto",children:th})]}):!m.br[r]&&(0,i.jsx)(c.$n,{size:"sm",icon:"add",onClick:tt,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,i.jsxs)(c.Zp,{children:[(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),tg&&(0,i.jsx)("select",{value:eT,onChange:e=>{var t;eO(t=e.target.value),tO(t)},title:"Appends (level) suffix to copied model names",className:" border border-border bg-background px-2 py-1 text-xs focus:border-primary focus:outline-none",children:tg.map(e=>(0,i.jsx)("option",{value:e,children:`Thinking: ${e.charAt(0).toUpperCase()+e.slice(1)}`},e))})]}),!tp&&(e=[...to,...e_.filter(e=>!to.some(t=>t.id===e.id))].filter(e=>{let t=(0,p.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!eq.includes(e)),(0,i.jsxs)("div",{className:"flex gap-2",children:[eq.length>0&&(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tN,children:"Active All"}),e.length>0&&(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>tk(e),children:"Disable All"})]}))]}),!!ex&&(0,i.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:ex}),(()=>{let e,t,s;if(tp)return(0,i.jsx)(P,{providerStorageAlias:ty,providerDisplayAlias:tb,modelAliases:el,customModels:en,copied:e3,onCopy:e4,onSetAlias:tE,onDeleteAlias:tI,onAddCustomModel:e=>tD(e,"llm",ty),onDeleteCustomModel:e=>tR(e,"llm",ty),connections:u,isAnthropic:tm});let a=[...to,...e_.filter(e=>!to.some(t=>t.id===e.id))].filter(e=>{let t=(0,p.CP)(e);return!t||"llm"===t}),l=new Set(eq),n=a.filter(e=>!l.has(e.id)),o=a.filter(e=>l.has(e.id)),d=S({customModels:en,modelAliases:el,providerAlias:ty,builtInModels:to,type:"llm"});return(0,i.jsxs)("div",{className:"flex flex-wrap gap-3",children:[d.map(e=>(0,i.jsx)(T,{model:{id:e.id,name:e.name},fullModel:`${tb}/${e.id}`,alias:e.alias,copied:e3,onCopy:e4,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?tR(e.id,"llm",ty):tI(e.alias)},testStatus:em[e.id],onTest:u.length>0||tr?()=>tX(e.id):void 0,isTesting:eh.has(e.id),isCustom:!0,isFree:!1,caps:x(`${r}/${e.id}`),thinkingSuffix:tf(e.id)},`${e.source}-${e.fullModel}`)),n.map(e=>{let t=`${ty}/${e.id}`,s=`${r}/${e.id}`,a=Object.entries(el).find(([,e])=>e===t||e===s)?.[0];return(0,i.jsx)(T,{model:e,fullModel:`${tb}/${e.id}`,alias:a,copied:e3,onCopy:e4,onSetAlias:t=>tE(e.id,t,ty),onDeleteAlias:()=>tI(a),testStatus:em[e.id],onTest:u.length>0||tr?()=>tX(e.id):void 0,isTesting:eh.has(e.id),isFree:e.isFree,onDisable:()=>tj(e.id),caps:x(`${r}/${e.id}`),thinkingSuffix:tf(e.id)},e.id)}),(0,i.jsxs)("button",{onClick:()=>eg(!0),className:"flex w-full items-center justify-center gap-1.5 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,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"qoder"===r&&u.some(e=>!1!==e.isActive)&&(0,i.jsxs)("button",{onClick:tU,disabled:e2,className:"flex w-full items-center justify-center gap-1.5 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,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:e2?{animation:"spin 1s linear infinite"}:void 0,children:e2?"progress_activity":"download"}),e2?(0,k.Tl)("Fetching..."):(0,k.Tl)("Fetch Qoder Models")]}),eI.length>0&&(e=new Set([...Object.values(el),...d.map(e=>e.fullModel)]),t=new Set(to.map(e=>e.id)),0===(s=eI.filter(s=>!e.has(`${ty}/${s.id}`)&&!t.has(s.id))).length?null:(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,i.jsxs)("button",{onClick:async()=>{await tD(e.id,"llm",ty)},className:"flex items-center gap-1 px-2.5 py-1.5 border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),o.length>0&&(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",o.length,"):"]}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,i.jsxs)("button",{onClick:()=>tw(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 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,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),tY,"kiro"===r?(0,i.jsx)(c.Mh,{isOpen:$,providerInfo:ts,onSuccess:tq,onClose:()=>O(!1)}):"cursor"===r?(0,i.jsx)(c.G9,{isOpen:$,onSuccess:tq,onClose:()=>O(!1)}):"gitlab"===r?(0,i.jsx)(c.vj,{isOpen:$,providerInfo:ts,onSuccess:tq,onClose:()=>O(!1)}):(0,i.jsx)(c.LF,{isOpen:$,provider:r,providerInfo:ts,onSuccess:tq,onClose:()=>O(!1)}),"iflow"===r&&(0,i.jsx)(c.vE,{isOpen:E,onSuccess:()=>{tA(),I(!1)},onClose:()=>I(!1)}),m.br[r]&&m.V8&&(0,i.jsx)(c.E0,{isOpen:M,provider:r,connectionId:R,onSuccess:tK,onManual:e=>{if(J(!1),q(void 0),e){let t=u.find(t=>t.id===e);t&&(ea(t),Y(!0));return}e9()},onClose:()=>{J(!1),q(void 0)}}),(0,i.jsx)(U,{isOpen:W,provider:r,providerName:ts.name,isCompatible:tp,isAnthropic:tm,authType:ts?.authType,authHint:ts?.authHint,website:ts?.website,proxyPools:N,error:H,existingNames:u.map(e=>e.name).filter(Boolean),onSave:tM,onBulkDone:tA,onClose:()=>{V(""),B(!1)}}),(0,i.jsx)(c.wI,{isOpen:Z,connection:ei,proxyPools:N,onSave:tF,onClose:()=>Y(!1)}),tp&&(0,i.jsx)(_,{isOpen:X,node:g,onSave:t$,onClose:()=>ee(!1),isAnthropic:tm}),!tp&&(0,i.jsx)(z,{isOpen:ey,providerAlias:ty,providerDisplayAlias:tb,onSave:async e=>{await tD(e,"llm",ty),eg(!1)},onClose:()=>eg(!1)}),"codex"===r&&(0,i.jsx)(K,{isOpen:G,onClose:()=>Q(!1),onSuccess:tA}),(0,i.jsx)(c.uo,{isOpen:eL,onClose:()=>eJ(!1),onConfirm:()=>{(window.localStorage.setItem(e6,"true"),eJ(!1),ta)?e8():e9()},title:"Risk Notice",message:ts?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,i.jsx)(c.uo,{isOpen:!!eM,onClose:()=>eF(null),onConfirm:eM?.onConfirm,title:eM?.title||"Confirm",message:eM?.message,variant:"danger"})]})}},70217:(e,t,s)=>{"use strict";function i(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"error"===t||"expired"===t||"unavailable"===t?"error":"default"}s.d(t,{g:()=>i})}},e=>{e.O(0,[8500,3959,5772,1321,7451,5497,8441,3794,7358],()=>e(e.s=14297)),_N_E=e.O()}]);
12
+ ]`;function K({isOpen:e,onClose:t,onSuccess:s}){let[l,n]=(0,a.useState)(""),[r,o]=(0,a.useState)(!1),[d,m]=(0,a.useState)(""),[p,x]=(0,a.useState)(null),u=()=>{r||(n(""),m(""),x(null),t())},h=async()=>{var e;let t;m(""),x(null);let i=l.trim();if(!i)return;try{t=JSON.parse(i)}catch(e){m(`${(0,k.Tl)("Invalid JSON")}: ${e.message}`);return}let a=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!a||0===a.length)return void m((0,k.Tl)("No accounts found in input"));o(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:a})}),t=await e.json();if(!e.ok)return void m(t?.error||`Request failed: ${e.status}`);x(t),t.success>0&&"function"==typeof s&&s()}catch(e){m(e.message||(0,k.Tl)("Request failed"))}finally{o(!1)}},f=p?.results?.filter(e=>!e.ok)||[];return(0,i.jsx)(c.aF,{isOpen:e,title:(0,k.Tl)("Bulk Add Codex Accounts"),onClose:u,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:(0,k.Tl)("Paste an array of codex account JSON objects. Each must include accessToken (and ideally refreshToken, idToken).")}),(0,i.jsx)("textarea",{className:"w-full border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:q,value:l,onChange:e=>n(e.target.value),disabled:r}),d&&(0,i.jsx)("p",{className:"text-xs text-red-500 break-words",children:d}),p&&(0,i.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,i.jsxs)("div",{className:`text-sm font-medium ${p.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",p.success," ",(0,k.Tl)("added"),p.failed>0?`, ✗ ${p.failed} ${(0,k.Tl)("failed")}`:""]}),f.length>0&&(0,i.jsx)("ul",{className:" border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:f.map(e=>(0,i.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(c.$n,{onClick:h,fullWidth:!0,disabled:r||!l.trim(),children:r?(0,k.Tl)("Importing..."):(0,k.Tl)("Import All")}),(0,i.jsx)(c.$n,{onClick:u,variant:"ghost",fullWidth:!0,disabled:r,children:(0,k.Tl)("Close")})]})]})})}function M({banner:e}){let t=e.displayName||"Banner";if("image"===e.mediaKind)return(0,i.jsx)("img",{src:e.mediaContent,alt:t,loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",className:"block max-h-64 w-full object-contain",onError:e=>{e.currentTarget.style.display="none"}});if("youtube"===e.mediaKind)return(0,i.jsx)("iframe",{src:`https://www.youtube-nocookie.com/embed/${e.mediaContent}`,title:t,className:"block aspect-video w-full",sandbox:"allow-scripts allow-same-origin allow-presentation",allow:"encrypted-media; picture-in-picture",referrerPolicy:"strict-origin-when-cross-origin",loading:"lazy",allowFullScreen:!0});let s=/^\s*<(!doctype|html)\b/i.test(e.mediaContent)?e.mediaContent:`<style>html,body{margin:0;padding:0;overflow:hidden}</style>${e.mediaContent}`;return(0,i.jsx)("iframe",{srcDoc:s,title:t,className:"block h-56 w-full",sandbox:"",referrerPolicy:"no-referrer"})}function F({providerId:e}){let[t,s]=(0,a.useState)([]);return((0,a.useEffect)(()=>{if(!e)return;let t=!1;return fetch(`/api/embedding-banners?provider_id=${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{t||s(Array.isArray(e?.banners)?e.banners:[])}).catch(()=>{}),()=>{t=!0}},[e]),0===t.length)?null:(0,i.jsx)(i.Fragment,{children:t.map(e=>{let t=(0,i.jsx)(M,{banner:e});return(0,i.jsxs)(c.Zp,{padding:"none",className:"w-full min-w-0 overflow-hidden",children:[e.href&&"image"===e.mediaKind?(0,i.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"block",children:t}):t,e.href&&"image"!==e.mediaKind?(0,i.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 border-t border-border-subtle px-3 py-2 text-xs text-text-muted hover:underline",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"open_in_new"}),e.displayName||"Learn more"]}):null]},e.id)})})}K.propTypes={isOpen:$().bool.isRequired,onClose:$().func.isRequired,onSuccess:$().func};let L={claude:"claudeAutoPing",codex:"codexAutoPing"};function J(){let e,t=(0,l.useParams)(),s=(0,l.useRouter)(),n=t.id,{getCaps:x}=(0,w.y)(),[u,h]=(0,a.useState)([]),[f,y]=(0,a.useState)(!0),[g,b]=(0,a.useState)(null),[N,A]=(0,a.useState)([]),[$,O]=(0,a.useState)(!1),[E,I]=(0,a.useState)(!1),[R,q]=(0,a.useState)(void 0),[M,J]=(0,a.useState)(!1),[W,B]=(0,a.useState)(!1),[H,V]=(0,a.useState)(""),[G,Q]=(0,a.useState)(!1),[Z,Y]=(0,a.useState)(!1),[X,ee]=(0,a.useState)(!1),[et,es]=(0,a.useState)(!1),[ei,ea]=(0,a.useState)(null),[el,en]=(0,a.useState)({}),[er,eo]=(0,a.useState)([]),[ed,ec]=(0,a.useState)(!1),[em,ep]=(0,a.useState)({}),[ex,eu]=(0,a.useState)(""),[eh,ef]=(0,a.useState)(()=>new Set),[ey,eg]=(0,a.useState)(!1),[eb,ev]=(0,a.useState)([]),[ej,ew]=(0,a.useState)("__none__"),[ek,eN]=(0,a.useState)(!1),[eC,eS]=(0,a.useState)(null),[eA,e$]=(0,a.useState)(""),[eT,eO]=(0,a.useState)("auto"),[eP,eE]=(0,a.useState)({enabled:!1,connections:{}}),[eI,eD]=(0,a.useState)([]),[eR,eU]=(0,a.useState)([]),[e_,ez]=(0,a.useState)([]),[eq,eK]=(0,a.useState)([]),[eM,eF]=(0,a.useState)(null),[eL,eJ]=(0,a.useState)(!1),[eW,eB]=(0,a.useState)(!1),[eH,eV]=(0,a.useState)(!1),[eG,eQ]=(0,a.useState)(null),[eZ,eY]=(0,a.useState)({}),[eX,e0]=(0,a.useState)(null),e1=(0,a.useRef)(!1),[e2,e5]=(0,a.useState)(!1),{copied:e3,copy:e4}=(0,j.C)(),e6="ag_risk_confirmed",e8=()=>{O(!0)},e7=()=>{"antigravity"===n&&"true"!==window.localStorage.getItem(e6)?eJ(!0):ta?e8():(V(""),B(!0))},e9=()=>{V(""),B(!0)},te=e=>{q(e),J(!0)},tt=()=>{if(m.br[n]){m.V8&&te(void 0);return}ta?e7():e9()},ts=g?{id:g.id,name:g.name||("anthropic-compatible"===g.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===g.type?"#16a34a":"#10A37F",textIcon:"anthropic-compatible"===g.type?"AC":"OC",apiType:g.apiType,baseUrl:g.baseUrl,type:g.type}:m.zN[n]||m.fg[n]||m.IS[n]||m.nJ[n]||m.br[n],ti=ts?.authModes||[],ta=!!m.zN[n]||!!m.IS[n]||ti.includes("oauth"),tl=!!m.fg[n]||ti.includes("apikey"),tn=!!m.IS[n]?.noAuth,tr=(0,p.KC)(n),to="cursor"===n&&eR.length>0?eR:tr,td=(0,m.wG)(n),tc=(0,m.mq)(n),tm=(0,m.gb)(n),tp=tc||tm,tx=!tp&&ta&&tl,tu="xai"===n?"Grok Build OAuth":"grok-cli"===n?"Grok CLI Device Login":"kimi"===n?"Kimi Coding OAuth":"OAuth",th="xai"===n?"xAI API Key":"kimi"===n?"Kimi API Key":"API Key",tf=e=>{if(!eT||"auto"===eT)return null;let t=v(n,e);return t&&t.includes(eT)?eT:null},ty=tp?n:td,tg=(()=>{let e=new Set,t=new Set,s=s=>{if(!s||t.has(s))return;t.add(s);let i=v(n,s);i&&i.forEach(t=>{"none"!==t&&e.add(t)})};for(let e of to)s(e.id);for(let e of e_)s(e.id);for(let e of er)e.providerAlias===ty&&"llm"===(e.kind||e.type||"llm")&&s(e.id);return e.size?["auto",...e]:null})(),tb=tp?g?.prefix||n:td,tv=(0,a.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ty)}`,{cache:"no-store"}),t=await e.json();e.ok&&eK(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[ty]),tj=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:ty,ids:[e]})})).ok&&await tv()}catch(e){console.log("Error disabling model:",e)}},tw=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ty)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tv()}catch(e){console.log("Error enabling model:",e)}},tk=async e=>{e.length&&eF({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eF(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:ty,ids:e})})).ok&&await tv()}catch(e){console.log("Error disabling all models:",e)}}})},tN=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ty)}`,{method:"DELETE"})).ok&&await tv()}catch(e){console.log("Error enabling all models:",e)}},tC=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&en(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),tS=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&eo(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,a.useEffect)(()=>{"kilocode"===n&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&ez(e.models)}).catch(()=>{})},[n]);let tA=(0,a.useCallback)(async()=>{try{let[e,t,s,i]=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"})]),a=await e.json(),l=await t.json(),r=await s.json(),o=i.ok?await i.json():{};if(e.ok){let e=(a.connections||[]).filter(e=>e.provider===n);h(e)}s.ok&&A(r.proxyPools||[]);let d=(o.providerStrategies||{})[n]||{};eS(d.fallbackStrategy||null),e$(null!=d.stickyRoundRobinLimit?String(d.stickyRoundRobinLimit):"1");let c=(o.providerThinking||{})[n]||{};eO(c.mode||"auto");let m=L[n],p=m&&o[m]||{};if(eE({enabled:!0===p.enabled,connections:p.connections||{}}),t.ok){let e=(l.nodes||[]).find(e=>e.id===n)||null;if(!e&&tp)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===n)||null))break}b(e)}}catch(e){console.log("Error fetching connections:",e)}finally{y(!1)}},[n,tp]),t$=async e=>{try{let t=await fetch(`/api/provider-nodes/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(b(s.node),await tA(),ee(!1))}catch(e){console.log("Error updating provider node:",e)}},tT=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),i=(s.ok?await s.json():{}).providerStrategies||{},a={};e&&(a.fallbackStrategy=e),"round-robin"===e&&""!==t&&(a.stickyRoundRobinLimit=Number(t)||3);let l={...i};0===Object.keys(a).length?delete l[n]:l[n]=a,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})})}catch(e){console.log("Error saving provider strategy:",e)}},tO=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?s[n]={mode:e}:delete s[n],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:s})})}catch(e){console.log("Error saving thinking config:",e)}},tP=async e=>{let t=L[n];if(t){eE(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:e})})}catch(e){console.log("Error saving auto-ping config:",e)}}};(0,a.useEffect)(()=>{tA(),tC(),tS(),tv()},[tA,tC,tS,tv]),(0,a.useEffect)(()=>{if("cursor"!==n)return void eU([]);let e=u.find(e=>!1!==e.isActive);if(!e?.id)return void eU([]);let t=!1;return fetch(`/api/providers/${e.id}/models`,{cache:"no-store"}).then(async e=>({ok:e.ok,data:await e.json()})).then(({ok:e,data:s})=>{!t&&e&&Array.isArray(s.models)&&s.models.length>0&&eU(s.models)}).catch(()=>{}),()=>{t=!0}},[n,u]),(0,a.useEffect)(()=>{let e=(m.zN[n]||m.fg[n]||m.IS[n]||m.nJ[n])?.modelsFetcher;e&&C(e).then(eD)},[n]);let tE=async(e,t,s=td)=>{let i=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:i,alias:t})});if(e.ok)await tC();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tI=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tC()}catch(e){console.log("Error deleting alias:",e)}},tD=async(e,t="llm",s=ty)=>{try{let i=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:s,id:e,type:t})});if(i.ok)await tS(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await i.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},tR=async(e,t="llm",s=ty)=>{try{let i=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${i}`,{method:"DELETE"})).ok&&(await tS(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},tU=async()=>{if(e2)return;let e=u.find(e=>!1!==e.isActive);if(!e)return void alert((0,k.Tl)("Please add an active Qoder connection first"));e5(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,k.Tl)("Failed to fetch models"));let i=s.models||[];if(0===i.length)return void alert((0,k.Tl)("No models returned"));let a=0;for(let e of i){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,"");er.some(e=>e.providerAlias===ty&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(el).includes(`${ty}/${s}`)||(await tD(s,"llm",ty),a+=1)}0===a?alert((0,k.Tl)("All models already exist, no new models added")):alert((0,k.Tl)("Successfully added")+` ${a} `+(0,k.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,k.Tl)("Error fetching models")+": "+e.message)}finally{e5(!1)}},t_=async()=>{if(eW||0===u.length)return;let e=Object.fromEntries(u.map(e=>[e.id,{state:"queued",error:null}]));e1.current=!1,eB(!0),eV(!1),eQ(null),eY(e),e0({total:u.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,s=0;try{for(let e=0;e<u.length;e+=1){if(e1.current){e0({total:u.length,completed:e,passed:t,failed:s,stopped:!0});break}let i=u[e];eQ(i.id),eY(e=>({...e,[i.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${i.id}/test`,{method:"POST"}),a=await e.json(),l=!!a.valid;l?t+=1:s+=1,eY(e=>({...e,[i.id]:{state:l?"success":"failed",error:l?null:a.error||null}}))}catch(e){s+=1,eY(t=>({...t,[i.id]:{state:"failed",error:e.message||"Test failed"}}))}e0({total:u.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<u.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{eQ(null),eB(!1),eV(!1),e1.current=!1}},tz=async e=>{eF({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eF(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&h(t=>t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tq=()=>{tA(),O(!1)},tK=async()=>{await tA()},tM=async e=>{V("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tA(),B(!1);return}V(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),V("Failed to save connection")}},tF=async e=>{try{(await fetch(`/api/providers/${ei.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tA(),Y(!1))}catch(e){console.log("Error updating connection:",e)}},tL=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&h(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},tJ=async(e,t)=>{let s=[...u];[s[e],s[t]]=[s[t],s[e]],h(s);try{await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch(e){console.log("Error swapping priority:",e),await tA()}},tW=u.filter(e=>eb.includes(e.id)),tB=u.length>0&&eb.length===u.length;(0,a.useEffect)(()=>{ev(e=>e.filter(e=>u.some(t=>t.id===e)))},[u]),(()=>{if(0===tW.length)return;let e=new Set(tW.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=N.find(e=>e.id===t);return s?.name}})();let tH=()=>{ek||es(!1)},tV=async e=>{eN(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:i}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:i})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await tA(),es(!1)}finally{eN(!1)}},tG=e=>tV(u.map(t=>({connectionId:t.id,proxyPoolId:e}))),tQ=(0,i.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:u.map((e,t)=>{let s;return(0,i.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,i.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,i.jsx)("input",{type:"checkbox",checked:(s=e.id,eb.includes(s)),onChange:()=>{var t;return t=e.id,void ev(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"h-4 w-4 border-gray-300 text-primary focus:ring-primary"})}),(0,i.jsx)("div",{className:"flex-1 min-w-0",children:(0,i.jsx)(D,{connection:e,proxyPools:N,isOAuth:ta,isFirst:0===t,isLast:t===u.length-1,onMoveUp:()=>tJ(t,t-1),onMoveDown:()=>tJ(t,t+1),onToggleActive:t=>tL(e.id,t),autoPing:L[n]&&"oauth"===e.authType?{on:!0===eP.connections[e.id],onToggle:t=>{var s;return s=e.id,void tP({...eP,connections:{...eP.connections,[s]:t}})},provider:n}:null,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&h(s=>s.map(s=>s.id===e.id?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{ea(e),Y(!0)},onRenew:"cookie"===e.authType&&m.V8?()=>te(e.id):void 0,onDelete:()=>tz(e.id),oneByOneStatus:eZ[e.id]||null})})]},e.id)})}),tZ=N.filter(e=>!0===e.isActive),tY=(0,i.jsx)(c.aF,{isOpen:et,onClose:tH,title:`Apply Proxy (${u.length} connections)`,children:(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsxs)("div",{className:"flex flex-col",children:[(0,i.jsxs)("button",{onClick:()=>{let e=N.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):tV(u.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:ek||0===tZ.length,className:"flex items-center gap-2 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,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,i.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,i.jsxs)("button",{onClick:()=>tG(null),disabled:ek,className:"flex items-center gap-2 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,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,i.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),N.map(e=>(0,i.jsxs)("button",{onClick:()=>tG(e.id),disabled:ek||!0!==e.isActive,className:"flex items-center gap-2 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,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,i.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,i.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),ek&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,i.jsx)(c.$n,{onClick:tH,variant:"ghost",fullWidth:!0,disabled:ek,children:"Cancel"})]})}),tX=async e=>{if(!eh.has(e)){ef(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${ty}/${e}`})}),s=await t.json();ep(t=>({...t,[e]:s.ok?"ok":"error"})),eu(s.ok?"":s.error||"Model not reachable")}catch{ep(t=>({...t,[e]:"error"})),eu("Network error")}finally{ef(t=>{let s=new Set(t);return s.delete(e),s})}}};if(f)return(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsx)(c.Qv,{}),(0,i.jsx)(c.Qv,{})]});if(!ts)return(0,i.jsxs)("div",{className:"text-center py-20",children:[(0,i.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,i.jsx)(r(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let t0=()=>tc&&ts.apiType?"responses"===ts.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":tm?"/providers/anthropic-m.png":(0,d.HY)(ts.id);return(0,i.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)(r(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,i.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,i.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center ",style:{backgroundColor:`${ts.color}15`},children:ed||!t0()?(0,i.jsx)("span",{className:"text-sm font-bold",style:{color:ts.color},children:ts.textIcon||ts.id.slice(0,2).toUpperCase()}):(0,i.jsx)(o.default,{src:t0(),alt:ts.name,width:48,height:48,className:"max-h-12 max-w-12 object-contain",sizes:"48px",onError:()=>{(0,d.Kw)(ts.id),ec(!0)},loading:"lazy",decoding:"async"})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,i.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:ts.name}),(ts.notice?.apiKeyUrl||ts.notice?.signupUrl||ts.website)&&(0,i.jsxs)("a",{href:ts.notice?.apiKeyUrl||ts.notice?.signupUrl||ts.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),ts.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,i.jsxs)("p",{className:"text-text-muted",children:[u.length," connection",1===u.length?"":"s"]})]})]})]}),ts.deprecated&&(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-yellow-500/10 border border-yellow-500/30",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,i.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:ts.deprecationNotice})]}),ts.notice?.text&&!ts.deprecated&&(0,i.jsxs)("div",{className:"flex flex-col gap-2 border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,i.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:ts.notice.text}),ts.notice.apiKeyUrl&&(0,i.jsx)("a",{href:ts.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center 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 →"})]}),tp&&g&&(0,i.jsx)(c.Zp,{children:(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:tm?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,i.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[tm?"Messages API":"responses"===g.apiType?"Responses API":"Chat Completions"," \xb7 ",(g.baseUrl||"").replace(/\/$/,""),"/",tm?"messages":"responses"===g.apiType?"responses":"chat/completions"]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,i.jsx)(c.$n,{size:"sm",icon:"add",onClick:()=>{V(""),B(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>ee(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eF({title:"Delete Compatible Node",message:`Delete this ${tm?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eF(null);try{(await fetch(`/api/provider-nodes/${n}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),(0,i.jsx)(F,{providerId:n}),tn?(0,i.jsx)(c.gw,{providerId:n}):(0,i.jsxs)(c.Zp,{children:[(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,i.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[u.length>0&&N.length>0&&(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>es(!0),children:"Apply Proxy"}),u.length>0&&(0,i.jsxs)(i.Fragment,{children:[eb.length>0&&(0,i.jsxs)(c.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let e=eb.length;0!==e&&eF({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{eF(null);let e=0,t=[...eb];for(let s of t)try{(await fetch(`/api/providers/${s}`,{method:"DELETE"})).ok||(e+=1)}catch(t){console.log("Error deleting connection:",t),e+=1}h(e=>e.filter(e=>!t.includes(e.id))),ev([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:["Delete Selected (",eb.length,")"]}),(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:t_,disabled:eW,children:eW?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eW&&(0,i.jsx)(c.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eW&&(e1.current=!0,eV(!0))},disabled:eH,children:eH?"Stopping...":"Stop"})]}),(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,i.jsx)(c.lM,{checked:"round-robin"===eC,onChange:e=>{let t=e?"round-robin":null,s=e?eA||"1":eA;e&&!eA&&e$("1"),eS(t),tT(t,s)}}),"round-robin"===eC&&(0,i.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,i.jsx)("input",{type:"number",min:1,value:eA,onChange:e=>{var t;e$(t=e.target.value),tT("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border bg-background focus:outline-none focus:border-primary"})]})]})]})]}),0===u.length?(0,i.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:ta?"lock":"key"})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tx&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",tu," or ",th,"."]})]})]}),(0,i.jsx)("div",{className:"flex gap-2",children:tx?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:e7,children:tu}),(0,i.jsx)(c.$n,{size:"sm",icon:"key",onClick:e9,children:th})]}):(0,i.jsxs)(i.Fragment,{children:[!tp&&"iflow"===n&&(0,i.jsx)(c.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>I(!0),children:"Cookie"}),"codex"===n&&(0,i.jsx)(c.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>Q(!0),children:(0,k.Tl)("Bulk Add")}),(!m.br[n]||m.V8)&&(0,i.jsx)(c.$n,{size:"sm",icon:"add",onClick:tt,children:tp?"Add API Key":"iflow"===n?"OAuth":m.br[n]?"Sign in with browser":"Add Connection"})]})})]}):(0,i.jsxs)(i.Fragment,{children:[eX&&(0,i.jsx)("div",{className:"mb-4 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,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,i.jsxs)("span",{children:["Total: ",eX.total]}),(0,i.jsxs)("span",{children:["Completed: ",eX.completed]}),(0,i.jsxs)("span",{children:["Passed: ",eX.passed]}),(0,i.jsxs)("span",{children:["Failed: ",eX.failed]}),eX.stopped&&(0,i.jsx)("span",{className:"text-green-600 dark:text-green-400",children:"Stopped"}),eW&&eG&&(0,i.jsxs)("span",{children:["Running: ",u.find(e=>e.id===eG)?.name||eG]})]})}),u.length>0&&(0,i.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,i.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,i.jsx)("input",{type:"checkbox",checked:tB,onChange:()=>{tB?ev([]):ev(u.map(e=>e.id))},className:"h-3.5 w-3.5 border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),tQ,!tp&&(0,i.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:[m.br[n]&&m.V8&&(0,i.jsx)(c.$n,{size:"sm",icon:"login",onClick:()=>te(void 0),className:"w-full sm:w-auto",children:"Sign in with browser"}),"iflow"===n&&(0,i.jsx)(c.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>I(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===n&&(0,i.jsx)(c.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>Q(!0),title:(0,k.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,k.Tl)("Bulk Add")}),tx?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:e7,className:"w-full sm:w-auto",children:tu}),(0,i.jsx)(c.$n,{size:"sm",icon:"key",onClick:e9,className:"w-full sm:w-auto",children:th})]}):!m.br[n]&&(0,i.jsx)(c.$n,{size:"sm",icon:"add",onClick:tt,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,i.jsxs)(c.Zp,{children:[(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),tg&&(0,i.jsx)("select",{value:eT,onChange:e=>{var t;eO(t=e.target.value),tO(t)},title:"Appends (level) suffix to copied model names",className:" border border-border bg-background px-2 py-1 text-xs focus:border-primary focus:outline-none",children:tg.map(e=>(0,i.jsx)("option",{value:e,children:`Thinking: ${e.charAt(0).toUpperCase()+e.slice(1)}`},e))})]}),!tp&&(e=[...to,...e_.filter(e=>!to.some(t=>t.id===e.id))].filter(e=>{let t=(0,p.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!eq.includes(e)),(0,i.jsxs)("div",{className:"flex gap-2",children:[eq.length>0&&(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tN,children:"Active All"}),e.length>0&&(0,i.jsx)(c.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>tk(e),children:"Disable All"})]}))]}),!!ex&&(0,i.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:ex}),(()=>{let e,t,s;if(tp)return(0,i.jsx)(P,{providerStorageAlias:ty,providerDisplayAlias:tb,modelAliases:el,customModels:er,copied:e3,onCopy:e4,onSetAlias:tE,onDeleteAlias:tI,onAddCustomModel:e=>tD(e,"llm",ty),onDeleteCustomModel:e=>tR(e,"llm",ty),connections:u,isAnthropic:tm});let a=[...to,...e_.filter(e=>!to.some(t=>t.id===e.id))].filter(e=>{let t=(0,p.CP)(e);return!t||"llm"===t}),l=new Set(eq),r=a.filter(e=>!l.has(e.id)),o=a.filter(e=>l.has(e.id)),d=S({customModels:er,modelAliases:el,providerAlias:ty,builtInModels:to,type:"llm"});return(0,i.jsxs)("div",{className:"flex flex-wrap gap-3",children:[d.map(e=>(0,i.jsx)(T,{model:{id:e.id,name:e.name},fullModel:`${tb}/${e.id}`,alias:e.alias,copied:e3,onCopy:e4,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?tR(e.id,"llm",ty):tI(e.alias)},testStatus:em[e.id],onTest:u.length>0||tn?()=>tX(e.id):void 0,isTesting:eh.has(e.id),isCustom:!0,isFree:!1,caps:x(`${n}/${e.id}`),thinkingSuffix:tf(e.id)},`${e.source}-${e.fullModel}`)),r.map(e=>{let t=`${ty}/${e.id}`,s=`${n}/${e.id}`,a=Object.entries(el).find(([,e])=>e===t||e===s)?.[0];return(0,i.jsx)(T,{model:e,fullModel:`${tb}/${e.id}`,alias:a,copied:e3,onCopy:e4,onSetAlias:t=>tE(e.id,t,ty),onDeleteAlias:()=>tI(a),testStatus:em[e.id],onTest:u.length>0||tn?()=>tX(e.id):void 0,isTesting:eh.has(e.id),isFree:e.isFree,onDisable:()=>tj(e.id),caps:x(`${n}/${e.id}`),thinkingSuffix:tf(e.id)},e.id)}),(0,i.jsxs)("button",{onClick:()=>eg(!0),className:"flex w-full items-center justify-center gap-1.5 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,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"qoder"===n&&u.some(e=>!1!==e.isActive)&&(0,i.jsxs)("button",{onClick:tU,disabled:e2,className:"flex w-full items-center justify-center gap-1.5 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,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:e2?{animation:"spin 1s linear infinite"}:void 0,children:e2?"progress_activity":"download"}),e2?(0,k.Tl)("Fetching..."):(0,k.Tl)("Fetch Qoder Models")]}),eI.length>0&&(e=new Set([...Object.values(el),...d.map(e=>e.fullModel)]),t=new Set(to.map(e=>e.id)),0===(s=eI.filter(s=>!e.has(`${ty}/${s.id}`)&&!t.has(s.id))).length?null:(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,i.jsxs)("button",{onClick:async()=>{await tD(e.id,"llm",ty)},className:"flex items-center gap-1 px-2.5 py-1.5 border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),o.length>0&&(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",o.length,"):"]}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,i.jsxs)("button",{onClick:()=>tw(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 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,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),tY,"kiro"===n?(0,i.jsx)(c.Mh,{isOpen:$,providerInfo:ts,onSuccess:tq,onClose:()=>O(!1)}):"cursor"===n?(0,i.jsx)(c.G9,{isOpen:$,onSuccess:tq,onClose:()=>O(!1)}):"gitlab"===n?(0,i.jsx)(c.vj,{isOpen:$,providerInfo:ts,onSuccess:tq,onClose:()=>O(!1)}):(0,i.jsx)(c.LF,{isOpen:$,provider:n,providerInfo:ts,onSuccess:tq,onClose:()=>O(!1)}),"iflow"===n&&(0,i.jsx)(c.vE,{isOpen:E,onSuccess:()=>{tA(),I(!1)},onClose:()=>I(!1)}),m.br[n]&&m.V8&&(0,i.jsx)(c.E0,{isOpen:M,provider:n,connectionId:R,onSuccess:tK,onManual:e=>{if(J(!1),q(void 0),e){let t=u.find(t=>t.id===e);t&&(ea(t),Y(!0));return}e9()},onClose:()=>{J(!1),q(void 0)}}),(0,i.jsx)(U,{isOpen:W,provider:n,providerName:ts.name,isCompatible:tp,isAnthropic:tm,authType:ts?.authType,authHint:ts?.authHint,website:ts?.website,proxyPools:N,error:H,existingNames:u.map(e=>e.name).filter(Boolean),onSave:tM,onBulkDone:tA,onClose:()=>{V(""),B(!1)}}),(0,i.jsx)(c.wI,{isOpen:Z,connection:ei,proxyPools:N,onSave:tF,onClose:()=>Y(!1)}),tp&&(0,i.jsx)(_,{isOpen:X,node:g,onSave:t$,onClose:()=>ee(!1),isAnthropic:tm}),!tp&&(0,i.jsx)(z,{isOpen:ey,providerAlias:ty,providerDisplayAlias:tb,onSave:async e=>{await tD(e,"llm",ty),eg(!1)},onClose:()=>eg(!1)}),"codex"===n&&(0,i.jsx)(K,{isOpen:G,onClose:()=>Q(!1),onSuccess:tA}),(0,i.jsx)(c.uo,{isOpen:eL,onClose:()=>eJ(!1),onConfirm:()=>{(window.localStorage.setItem(e6,"true"),eJ(!1),ta)?e8():e9()},title:"Risk Notice",message:ts?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,i.jsx)(c.uo,{isOpen:!!eM,onClose:()=>eF(null),onConfirm:eM?.onConfirm,title:eM?.title||"Confirm",message:eM?.message,variant:"danger"})]})}},70217:(e,t,s)=>{"use strict";function i(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"error"===t||"expired"===t||"unavailable"===t?"error":"default"}s.d(t,{g:()=>i})}},e=>{e.O(0,[8500,3959,5772,1321,7451,5497,8441,3794,7358],()=>e(e.s=14297)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{17794:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,78914,23)),Promise.resolve().then(n.t.bind(n,5887,23)),Promise.resolve().then(n.t.bind(n,51743,23)),Promise.resolve().then(n.bind(n,94635)),Promise.resolve().then(n.bind(n,35983)),Promise.resolve().then(n.bind(n,79472)),Promise.resolve().then(n.bind(n,83614)),Promise.resolve().then(n.bind(n,21110))},35983:(e,t,n)=>{"use strict";n.d(t,{E:()=>o,default:()=>s});var r=n(95155),a=n(12115),i=n(73321);let o=(0,a.createContext)({enabled:!1,installationId:null});function s({children:e}){let t=(0,i.usePathname)(),[n,l]=(0,a.useState)({enabled:!1,installationId:null});(0,a.useEffect)(()=>{let e=!1;return"/dashboard"===t||t?.startsWith("/dashboard/")?(fetch("/api/analytics/installation",{cache:"no-store"}).then(e=>e.ok?e.json():{enabled:!1}).then(t=>{e||t?.enabled!==!0||"string"!=typeof t.installationId||l({enabled:!0,installationId:t.installationId})}).catch(()=>{}),()=>{e=!0}):(l({enabled:!1,installationId:null}),()=>{e=!0})},[t]);let u=(0,a.useMemo)(()=>n,[n]);return(0,r.jsx)(o.Provider,{value:u,children:e})}},51743:()=>{},79472:(e,t,n)=>{"use strict";n.d(t,{default:()=>d});var r=n(95155),a=n(12115),i=n(73321),o=n(65596),s=n(35983),l=n(90620);let u="G-8M7E9HNBRK";function d({children:e}){let t=(0,i.usePathname)(),{enabled:n,installationId:c}=(0,a.useContext)(s.E),p=(0,a.useRef)(!1),_=(0,a.useRef)(null),h=(0,a.useRef)(!1),f=(0,a.useCallback)(()=>{!n||!c||!t||["/api","/v1","/v1beta","/codex","/responses"].some(e=>t===e||t?.startsWith(`${e}/`))||_.current===t||(u&&!window.__polyrouterGaInitialized&&(window.dataLayer=window.dataLayer||[],window.gtag=window.gtag||function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",u,{cookie_domain:"none",send_page_view:!1}),window.__polyrouterGaInitialized=!0),window.gtag("config",u,{user_id:c,cookie_domain:"none",send_page_view:!1}),h.current||(window.gtag("event","polyrouter_dashboard_opened",{send_to:u,...function({appVersion:e}){return{event_source:"local_dashboard",telemetry_identity:"installation",..."string"==typeof e&&e?{app_version:e}:{}}}({appVersion:l.vQ.version})}),h.current=!0),window.gtag("event","page_view",{send_to:u,...function({pathname:e,origin:t,title:n}){let r="string"==typeof e&&e.startsWith("/")?e:"/",a=function(e,t){if(!e)return null;try{let n=new URL(e,t);if("http:"!==n.protocol&&"https:"!==n.protocol)return null;return`${n.origin}${n.pathname}`}catch{return null}}(r,t);return{page_location:a||r,page_path:a?new URL(a).pathname:r,..."string"==typeof n&&n?{page_title:n}:{}}}({pathname:t,origin:window.location.origin,title:document.title})}),_.current=t)},[n,c,t]);return((0,a.useEffect)(()=>{u&&p.current&&f()},[f]),u)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.default,{src:`https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(u)}`,strategy:"afterInteractive",onLoad:()=>{p.current=!0,f()}}),e]}):e}},83614:(e,t,n)=>{"use strict";n.d(t,{default:()=>d});var r=n(12115),a=n(73321),i=n(32535),o=n(35983),s=n(90620);function l(e,t){if(!e)return null;try{let n=new URL(e,t);if("http:"!==n.protocol&&"https:"!==n.protocol)return null;return`${n.origin}${n.pathname}`}catch{return null}}let u="phc_uB4N3AQKkjTQrRFASmFkK55hR8YCoGbDYAZYThaGiNRQ";function d({children:e}){let t=(0,a.usePathname)(),{enabled:n,installationId:c}=(0,r.useContext)(o.E),p=(0,r.useRef)(!1),_=(0,r.useRef)(!1);return(0,r.useEffect)(()=>{!u||!n||!c||!t||["/api","/v1","/v1beta","/codex","/responses"].some(e=>t===e||t?.startsWith(`${e}/`))||(p.current=!!u&&!i.Ay.__loaded&&(i.Ay.init(u,{api_host:"https://us.i.posthog.com",capture_pageview:!1,capture_pageleave:!1,autocapture:!0,disable_session_recording:!0,mask_all_text:!0,mask_all_element_attributes:!0,advanced_disable_decide:!0}),!0)||i.Ay.__loaded,p.current&&(i.Ay.identify(c,{telemetry_identity:"installation"}),_.current||(i.Ay.capture("polyrouter_dashboard_opened",function({appVersion:e}){return{event_source:"local_dashboard",telemetry_identity:"installation",..."string"==typeof e&&e?{app_version:e}:{}}}({appVersion:s.vQ.version})),_.current=!0),i.Ay.capture("$pageview",function({pathname:e,origin:t,referrer:n}){let r="string"==typeof e&&e.startsWith("/")?e:"/",a=l(r,t),i=l(n);return{$current_url:a||r,...i?{$referrer:i}:{}}}({pathname:t,origin:window.location.origin,referrer:document.referrer}))))},[n,c,t]),e}},94635:(e,t,n)=>{"use strict";n.d(t,{RuntimeI18nProvider:()=>s});var r=n(95155),a=n(12115),i=n(73321),o=n(73006);function s({children:e}){let t=(0,i.usePathname)();return(0,a.useEffect)(()=>{(0,o.FE)()},[]),(0,a.useEffect)(()=>{t&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{(0,o.wn)()})})},[t]),(0,r.jsx)(r.Fragment,{children:e})}}},e=>{e.O(0,[1716,3334,8229,4024,1321,8441,3794,7358],()=>e(e.s=17794)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{17794:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,78914,23)),Promise.resolve().then(n.t.bind(n,5887,23)),Promise.resolve().then(n.t.bind(n,51743,23)),Promise.resolve().then(n.bind(n,94635)),Promise.resolve().then(n.bind(n,35983)),Promise.resolve().then(n.bind(n,79472)),Promise.resolve().then(n.bind(n,83614)),Promise.resolve().then(n.bind(n,21110))},35983:(e,t,n)=>{"use strict";n.d(t,{E:()=>o,default:()=>s});var r=n(95155),a=n(12115),i=n(73321);let o=(0,a.createContext)({enabled:!1,installationId:null});function s({children:e}){let t=(0,i.usePathname)(),[n,l]=(0,a.useState)({enabled:!1,installationId:null});(0,a.useEffect)(()=>{let e=!1;return"/dashboard"===t||t?.startsWith("/dashboard/")?(fetch("/api/analytics/installation",{cache:"no-store"}).then(e=>e.ok?e.json():{enabled:!1}).then(t=>{e||t?.enabled!==!0||"string"!=typeof t.installationId||l({enabled:!0,installationId:t.installationId})}).catch(()=>{}),()=>{e=!0}):(l({enabled:!1,installationId:null}),()=>{e=!0})},[t]);let u=(0,a.useMemo)(()=>n,[n]);return(0,r.jsx)(o.Provider,{value:u,children:e})}},51743:()=>{},79472:(e,t,n)=>{"use strict";n.d(t,{default:()=>d});var r=n(95155),a=n(12115),i=n(73321),o=n(65596),s=n(35983),l=n(90620);let u="G-8M7E9HNBRK";function d({children:e}){let t=(0,i.usePathname)(),{enabled:n,installationId:c}=(0,a.useContext)(s.E),p=(0,a.useRef)(!1),_=(0,a.useRef)(null),h=(0,a.useRef)(!1),f=(0,a.useCallback)(()=>{!n||!c||!t||["/api","/v1","/v1beta","/codex","/responses"].some(e=>t===e||t?.startsWith(`${e}/`))||_.current===t||(u&&!window.__polyrouterGaInitialized&&(window.dataLayer=window.dataLayer||[],window.gtag=window.gtag||function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",u,{cookie_domain:"none",send_page_view:!1}),window.__polyrouterGaInitialized=!0),window.gtag("config",u,{user_id:c,cookie_domain:"none",send_page_view:!1}),h.current||(window.gtag("event","polyrouter_dashboard_opened",{send_to:u,...function({appVersion:e}){return{event_source:"local_dashboard",telemetry_identity:"installation",..."string"==typeof e&&e?{app_version:e}:{}}}({appVersion:l.vQ.version})}),h.current=!0),window.gtag("event","page_view",{send_to:u,...function({pathname:e,origin:t,title:n}){let r="string"==typeof e&&e.startsWith("/")?e:"/",a=function(e,t){if(!e)return null;try{let n=new URL(e,t);if("http:"!==n.protocol&&"https:"!==n.protocol)return null;return`${n.origin}${n.pathname}`}catch{return null}}(r,t);return{page_location:a||r,page_path:a?new URL(a).pathname:r,..."string"==typeof n&&n?{page_title:n}:{}}}({pathname:t,origin:window.location.origin,title:document.title})}),_.current=t)},[n,c,t]);return((0,a.useEffect)(()=>{u&&p.current&&f()},[f]),u)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.default,{src:`https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(u)}`,strategy:"afterInteractive",onLoad:()=>{p.current=!0,f()}}),e]}):e}},83614:(e,t,n)=>{"use strict";n.d(t,{default:()=>d});var r=n(12115),a=n(73321),i=n(56122),o=n(35983),s=n(90620);function l(e,t){if(!e)return null;try{let n=new URL(e,t);if("http:"!==n.protocol&&"https:"!==n.protocol)return null;return`${n.origin}${n.pathname}`}catch{return null}}let u="phc_uB4N3AQKkjTQrRFASmFkK55hR8YCoGbDYAZYThaGiNRQ";function d({children:e}){let t=(0,a.usePathname)(),{enabled:n,installationId:c}=(0,r.useContext)(o.E),p=(0,r.useRef)(!1),_=(0,r.useRef)(!1);return(0,r.useEffect)(()=>{!u||!n||!c||!t||["/api","/v1","/v1beta","/codex","/responses"].some(e=>t===e||t?.startsWith(`${e}/`))||(p.current=!!u&&!i.Ay.__loaded&&(i.Ay.init(u,{api_host:"https://us.i.posthog.com",capture_pageview:!1,capture_pageleave:!1,autocapture:!0,disable_session_recording:!0,mask_all_text:!0,mask_all_element_attributes:!0,advanced_disable_decide:!0}),!0)||i.Ay.__loaded,p.current&&(i.Ay.identify(c,{telemetry_identity:"installation"}),_.current||(i.Ay.capture("polyrouter_dashboard_opened",function({appVersion:e}){return{event_source:"local_dashboard",telemetry_identity:"installation",..."string"==typeof e&&e?{app_version:e}:{}}}({appVersion:s.vQ.version})),_.current=!0),i.Ay.capture("$pageview",function({pathname:e,origin:t,referrer:n}){let r="string"==typeof e&&e.startsWith("/")?e:"/",a=l(r,t),i=l(n);return{$current_url:a||r,...i?{$referrer:i}:{}}}({pathname:t,origin:window.location.origin,referrer:document.referrer}))))},[n,c,t]),e}},94635:(e,t,n)=>{"use strict";n.d(t,{RuntimeI18nProvider:()=>s});var r=n(95155),a=n(12115),i=n(73321),o=n(73006);function s({children:e}){let t=(0,i.usePathname)();return(0,a.useEffect)(()=>{(0,o.FE)()},[]),(0,a.useEffect)(()=>{t&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{(0,o.wn)()})})},[t]),(0,r.jsx)(r.Fragment,{children:e})}}},e=>{e.O(0,[1716,3334,9432,4024,1321,8441,3794,7358],()=>e(e.s=17794)),_N_E=e.O()}]);