9router 0.4.5 → 0.4.8

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 (690) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +6 -2
  3. package/app/.next/build-manifest.json +2 -2
  4. package/app/.next/prerender-manifest.json +24 -0
  5. package/app/.next/routes-manifest.json +26 -0
  6. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js +2 -2
  7. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  9. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +2 -2
  10. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +2 -2
  13. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js +2 -2
  16. package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  18. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +2 -2
  19. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  20. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  21. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +14 -12
  22. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  23. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  24. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +2 -2
  25. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  26. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  27. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page.js +5 -0
  28. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page.js.nft.json +1 -0
  29. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page_client-reference-manifest.js +1 -0
  30. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js +2 -0
  31. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -0
  32. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -0
  33. package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js +2 -2
  34. package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  35. package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  36. package/app/.next/server/app/(dashboard)/dashboard/page.js +2 -2
  37. package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  38. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  39. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +2 -2
  40. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  41. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  42. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  43. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  44. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  45. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +2 -2
  46. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  47. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  48. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +2 -2
  49. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  50. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  51. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +3 -3
  52. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  53. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  54. package/app/.next/server/app/(dashboard)/dashboard/quota/page.js +2 -2
  55. package/app/.next/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  56. package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  57. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +2 -2
  58. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  59. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  60. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +2 -2
  61. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  62. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  63. package/app/.next/server/app/_global-error/page.js +2 -2
  64. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  65. package/app/.next/server/app/_global-error.html +1 -1
  66. package/app/.next/server/app/_global-error.rsc +1 -1
  67. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  68. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  69. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  70. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  71. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  72. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  73. package/app/.next/server/app/_not-found/page.js +2 -2
  74. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  75. package/app/.next/server/app/_not-found.html +1 -1
  76. package/app/.next/server/app/_not-found.rsc +4 -4
  77. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
  78. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  79. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
  80. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  81. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  82. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  83. package/app/.next/server/app/api/auth/login/route.js +1 -1
  84. package/app/.next/server/app/api/auth/logout/route.js +1 -1
  85. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  86. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
  87. package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
  88. package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
  89. package/app/.next/server/app/api/cli-tools/copilot-settings/route.js +1 -1
  90. package/app/.next/server/app/api/cli-tools/droid-settings/route.js +1 -1
  91. package/app/.next/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  92. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  93. package/app/.next/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  94. package/app/.next/server/app/api/cloud/auth/route.js +1 -1
  95. package/app/.next/server/app/api/cloud/credentials/update/route.js +1 -1
  96. package/app/.next/server/app/api/cloud/model/resolve/route.js +1 -1
  97. package/app/.next/server/app/api/cloud/models/alias/route.js +1 -1
  98. package/app/.next/server/app/api/combos/[id]/route.js +1 -1
  99. package/app/.next/server/app/api/combos/route.js +1 -1
  100. package/app/.next/server/app/api/health/route.js +1 -1
  101. package/app/.next/server/app/api/init/route.js +1 -1
  102. package/app/.next/server/app/api/keys/[id]/route.js +1 -1
  103. package/app/.next/server/app/api/keys/route.js +1 -1
  104. package/app/.next/server/app/api/locale/route.js +1 -1
  105. package/app/.next/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  106. package/app/.next/server/app/api/media-providers/tts/voices/route.js +1 -1
  107. package/app/.next/server/app/api/models/alias/route.js +1 -1
  108. package/app/.next/server/app/api/models/availability/route.js +1 -1
  109. package/app/.next/server/app/api/models/custom/route.js +1 -1
  110. package/app/.next/server/app/api/models/route.js +1 -1
  111. package/app/.next/server/app/api/models/test/route.js +1 -1
  112. package/app/.next/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  113. package/app/.next/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  114. package/app/.next/server/app/api/oauth/cursor/auto-import/route.js +2 -2
  115. package/app/.next/server/app/api/oauth/cursor/import/route.js +1 -1
  116. package/app/.next/server/app/api/oauth/gitlab/pat/route.js +1 -1
  117. package/app/.next/server/app/api/oauth/iflow/cookie/route.js +1 -1
  118. package/app/.next/server/app/api/oauth/kiro/auto-import/route.js +1 -1
  119. package/app/.next/server/app/api/oauth/kiro/import/route.js +1 -1
  120. package/app/.next/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  121. package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  122. package/app/.next/server/app/api/pricing/route.js +1 -1
  123. package/app/.next/server/app/api/provider-nodes/[id]/route.js +1 -1
  124. package/app/.next/server/app/api/provider-nodes/route.js +1 -1
  125. package/app/.next/server/app/api/provider-nodes/validate/route.js +1 -1
  126. package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
  127. package/app/.next/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  128. package/app/.next/server/app/api/providers/[id]/route.js +1 -1
  129. package/app/.next/server/app/api/providers/[id]/test/route.js +1 -1
  130. package/app/.next/server/app/api/providers/[id]/test-models/route.js +1 -1
  131. package/app/.next/server/app/api/providers/client/route.js +1 -1
  132. package/app/.next/server/app/api/providers/client/route.js.nft.json +1 -1
  133. package/app/.next/server/app/api/providers/kilo/free-models/route.js +1 -1
  134. package/app/.next/server/app/api/providers/route.js +1 -1
  135. package/app/.next/server/app/api/providers/suggested-models/route.js +1 -1
  136. package/app/.next/server/app/api/providers/test-batch/route.js +1 -1
  137. package/app/.next/server/app/api/providers/validate/route.js +1 -1
  138. package/app/.next/server/app/api/proxy-pools/[id]/route.js +1 -1
  139. package/app/.next/server/app/api/proxy-pools/[id]/test/route.js +1 -1
  140. package/app/.next/server/app/api/proxy-pools/route.js +1 -1
  141. package/app/.next/server/app/api/proxy-pools/vercel-deploy/route.js +2 -2
  142. package/app/.next/server/app/api/settings/database/route.js +1 -1
  143. package/app/.next/server/app/api/settings/proxy-test/route.js +1 -1
  144. package/app/.next/server/app/api/settings/require-login/route.js +1 -1
  145. package/app/.next/server/app/api/settings/route.js +1 -1
  146. package/app/.next/server/app/api/shutdown/route.js +1 -1
  147. package/app/.next/server/app/api/tags/route.js +1 -1
  148. package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
  149. package/app/.next/server/app/api/translator/console-logs/stream/route.js +2 -2
  150. package/app/.next/server/app/api/translator/load/route.js +1 -1
  151. package/app/.next/server/app/api/translator/save/route.js +1 -1
  152. package/app/.next/server/app/api/translator/send/route.js +1 -1
  153. package/app/.next/server/app/api/translator/translate/route.js +1 -1
  154. package/app/.next/server/app/api/tunnel/disable/route.js +1 -1
  155. package/app/.next/server/app/api/tunnel/enable/route.js +1 -1
  156. package/app/.next/server/app/api/tunnel/status/route.js +1 -1
  157. package/app/.next/server/app/api/tunnel/tailscale-check/route.js +3 -3
  158. package/app/.next/server/app/api/tunnel/tailscale-disable/route.js +1 -1
  159. package/app/.next/server/app/api/tunnel/tailscale-enable/route.js +1 -1
  160. package/app/.next/server/app/api/tunnel/tailscale-install/route.js +1 -1
  161. package/app/.next/server/app/api/tunnel/tailscale-login/route.js +3 -3
  162. package/app/.next/server/app/api/tunnel/tailscale-start-daemon/route.js +2 -2
  163. package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
  164. package/app/.next/server/app/api/usage/chart/route.js +1 -1
  165. package/app/.next/server/app/api/usage/history/route.js +1 -1
  166. package/app/.next/server/app/api/usage/providers/route.js +1 -1
  167. package/app/.next/server/app/api/usage/request-details/route.js +1 -1
  168. package/app/.next/server/app/api/usage/request-logs/route.js +1 -1
  169. package/app/.next/server/app/api/usage/stats/route.js +1 -1
  170. package/app/.next/server/app/api/usage/stream/route.js +2 -2
  171. package/app/.next/server/app/api/v1/api/chat/route.js +1 -1
  172. package/app/.next/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  173. package/app/.next/server/app/api/v1/audio/speech/route.js +1 -1
  174. package/app/.next/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  175. package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
  176. package/app/.next/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  177. package/app/.next/server/app/api/v1/embeddings/route.js +1 -1
  178. package/app/.next/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  179. package/app/.next/server/app/api/v1/images/generations/route.js +4 -1
  180. package/app/.next/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  181. package/app/.next/server/app/api/v1/messages/count_tokens/route.js +1 -1
  182. package/app/.next/server/app/api/v1/messages/route.js +1 -1
  183. package/app/.next/server/app/api/v1/messages/route.js.nft.json +1 -1
  184. package/app/.next/server/app/api/v1/models/route.js +1 -1
  185. package/app/.next/server/app/api/v1/responses/compact/route.js +1 -1
  186. package/app/.next/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  187. package/app/.next/server/app/api/v1/responses/route.js +1 -1
  188. package/app/.next/server/app/api/v1/responses/route.js.nft.json +1 -1
  189. package/app/.next/server/app/api/v1/route.js +1 -1
  190. package/app/.next/server/app/api/v1/search/route.js +1 -0
  191. package/app/.next/server/app/api/v1/search/route.js.nft.json +1 -0
  192. package/app/.next/server/app/api/v1/search/route_client-reference-manifest.js +1 -0
  193. package/app/.next/server/app/api/v1/web/fetch/route.js +1 -0
  194. package/app/.next/server/app/api/v1/web/fetch/route.js.nft.json +1 -0
  195. package/app/.next/server/app/api/v1/web/fetch/route_client-reference-manifest.js +1 -0
  196. package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
  197. package/app/.next/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  198. package/app/.next/server/app/api/v1beta/models/route.js +1 -1
  199. package/app/.next/server/app/api/version/route.js +1 -1
  200. package/app/.next/server/app/api/version/update/route.js +1 -1
  201. package/app/.next/server/app/callback/page.js +2 -2
  202. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  203. package/app/.next/server/app/callback.html +1 -1
  204. package/app/.next/server/app/callback.rsc +4 -4
  205. package/app/.next/server/app/callback.segments/_full.segment.rsc +4 -4
  206. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  207. package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
  208. package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
  209. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  210. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  211. package/app/.next/server/app/dashboard/basic-chat.html +1 -1
  212. package/app/.next/server/app/dashboard/basic-chat.rsc +6 -6
  213. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  214. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  215. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  216. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  217. package/app/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
  218. package/app/.next/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  219. package/app/.next/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
  220. package/app/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  221. package/app/.next/server/app/dashboard/cli-tools.html +1 -1
  222. package/app/.next/server/app/dashboard/cli-tools.rsc +6 -6
  223. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  224. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  225. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  226. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  227. package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  228. package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  229. package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
  230. package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  231. package/app/.next/server/app/dashboard/combos.html +1 -1
  232. package/app/.next/server/app/dashboard/combos.rsc +6 -6
  233. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  234. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  235. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  236. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  237. package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
  238. package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  239. package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
  240. package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  241. package/app/.next/server/app/dashboard/endpoint.html +1 -1
  242. package/app/.next/server/app/dashboard/endpoint.rsc +6 -6
  243. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  244. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  245. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  246. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  247. package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
  248. package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  249. package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
  250. package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  251. package/app/.next/server/app/dashboard/media-providers/web.html +1 -0
  252. package/app/.next/server/app/dashboard/media-providers/web.meta +18 -0
  253. package/app/.next/server/app/dashboard/media-providers/web.rsc +27 -0
  254. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +9 -0
  255. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +5 -0
  256. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +5 -0
  257. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +5 -0
  258. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +6 -0
  259. package/app/.next/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +27 -0
  260. package/app/.next/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +6 -0
  261. package/app/.next/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +9 -0
  262. package/app/.next/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +6 -0
  263. package/app/.next/server/app/dashboard/mitm.html +1 -1
  264. package/app/.next/server/app/dashboard/mitm.rsc +6 -6
  265. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  266. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  267. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  268. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  269. package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  270. package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  271. package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
  272. package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  273. package/app/.next/server/app/dashboard/profile.html +1 -1
  274. package/app/.next/server/app/dashboard/profile.rsc +6 -6
  275. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  276. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  277. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  278. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  279. package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
  280. package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  281. package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
  282. package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  283. package/app/.next/server/app/dashboard/providers/new.html +1 -1
  284. package/app/.next/server/app/dashboard/providers/new.rsc +6 -6
  285. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  286. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  287. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  288. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  289. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  290. package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
  291. package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  292. package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
  293. package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  294. package/app/.next/server/app/dashboard/providers.html +1 -1
  295. package/app/.next/server/app/dashboard/providers.rsc +6 -6
  296. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  297. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  298. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  299. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  300. package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
  301. package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  302. package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
  303. package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  304. package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
  305. package/app/.next/server/app/dashboard/proxy-pools.rsc +6 -6
  306. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  307. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  308. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  309. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  310. package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
  311. package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  312. package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
  313. package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  314. package/app/.next/server/app/dashboard/quota.html +2 -2
  315. package/app/.next/server/app/dashboard/quota.rsc +7 -7
  316. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  317. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  318. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  319. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  320. package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
  321. package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  322. package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
  323. package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  324. package/app/.next/server/app/dashboard/settings/pricing/page.js +2 -2
  325. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  326. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  327. package/app/.next/server/app/dashboard/settings/pricing.rsc +4 -4
  328. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  329. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  330. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  331. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  332. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  333. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  334. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  335. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  336. package/app/.next/server/app/dashboard/translator.html +1 -1
  337. package/app/.next/server/app/dashboard/translator.rsc +6 -6
  338. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  339. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  340. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  341. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  342. package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
  343. package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  344. package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
  345. package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  346. package/app/.next/server/app/dashboard/usage.html +1 -1
  347. package/app/.next/server/app/dashboard/usage.rsc +6 -6
  348. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  349. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  350. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  351. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  352. package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
  353. package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  354. package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
  355. package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  356. package/app/.next/server/app/dashboard.html +1 -1
  357. package/app/.next/server/app/dashboard.rsc +6 -6
  358. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  359. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  360. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  361. package/app/.next/server/app/dashboard.segments/_full.segment.rsc +6 -6
  362. package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  363. package/app/.next/server/app/dashboard.segments/_index.segment.rsc +4 -4
  364. package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  365. package/app/.next/server/app/favicon.ico/route.js +1 -1
  366. package/app/.next/server/app/index.html +1 -1
  367. package/app/.next/server/app/index.rsc +4 -4
  368. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  369. package/app/.next/server/app/index.segments/_full.segment.rsc +4 -4
  370. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  371. package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
  372. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  373. package/app/.next/server/app/landing/page.js +2 -2
  374. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  375. package/app/.next/server/app/landing.html +1 -1
  376. package/app/.next/server/app/landing.rsc +4 -4
  377. package/app/.next/server/app/landing.segments/_full.segment.rsc +4 -4
  378. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  379. package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
  380. package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
  381. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  382. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  383. package/app/.next/server/app/login/page.js +2 -2
  384. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  385. package/app/.next/server/app/login.html +1 -1
  386. package/app/.next/server/app/login.rsc +5 -5
  387. package/app/.next/server/app/login.segments/_full.segment.rsc +5 -5
  388. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  389. package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
  390. package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  391. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  392. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  393. package/app/.next/server/app/manifest.webmanifest/route.js +2 -2
  394. package/app/.next/server/app/page.js +2 -2
  395. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  396. package/app/.next/server/app-paths-manifest.json +6 -2
  397. package/app/.next/server/chunks/1301.js +1 -0
  398. package/app/.next/server/chunks/1389.js +1 -1
  399. package/app/.next/server/chunks/1574.js +1 -1
  400. package/app/.next/server/chunks/1578.js +1 -1
  401. package/app/.next/server/chunks/2049.js +1 -1
  402. package/app/.next/server/chunks/253.js +1 -1
  403. package/app/.next/server/chunks/2947.js +1 -1
  404. package/app/.next/server/chunks/3774.js +2 -2
  405. package/app/.next/server/chunks/450.js +3 -3
  406. package/app/.next/server/chunks/5221.js +1 -0
  407. package/app/.next/server/chunks/6288.js +7 -7
  408. package/app/.next/server/chunks/6379.js +2 -2
  409. package/app/.next/server/chunks/6560.js +1 -0
  410. package/app/.next/server/chunks/6762.js +2 -2
  411. package/app/.next/server/chunks/7770.js +1 -1
  412. package/app/.next/server/chunks/8035.js +1 -1
  413. package/app/.next/server/chunks/8202.js +14 -14
  414. package/app/.next/server/chunks/8513.js +2 -2
  415. package/app/.next/server/chunks/9534.js +1 -0
  416. package/app/.next/server/chunks/9737.js +1 -1
  417. package/app/.next/server/chunks/9939.js +1 -0
  418. package/app/.next/server/middleware-build-manifest.js +1 -1
  419. package/app/.next/server/middleware.js +1 -1
  420. package/app/.next/server/pages/404.html +1 -1
  421. package/app/.next/server/pages/500.html +1 -1
  422. package/app/.next/static/5EH48iik3Xr5bo5JjHKBf/_buildManifest.js +1 -0
  423. package/app/.next/static/chunks/4156-1f56c7a3aae06a55.js +7 -0
  424. package/app/.next/static/chunks/{4380-f83b90c5cb45f40b.js → 4380-a1b3532b40aa042e.js} +4 -4
  425. package/app/.next/static/chunks/505-3b8738c74c561d3c.js +1 -0
  426. package/app/.next/static/chunks/8035-25d56a91f807bef3.js +3 -0
  427. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/{page-fcb74a9294486c9a.js → page-e6de48be0a07b12f.js} +1 -1
  428. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-b983df0546f58fc3.js +53 -0
  429. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-1cd57da85dc9a5a0.js +1 -0
  430. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page-55f152f000244dfd.js +4 -0
  431. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-c02c96576b763028.js +1 -0
  432. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-0a4d03fd9b812949.js +1 -0
  433. package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-bd3385cc5ab746eb.js +1 -0
  434. package/app/.next/static/chunks/app/(dashboard)/layout-2b41c9c888e0223f.js +1 -0
  435. package/app/.next/static/chunks/app/_global-error/page-d05c42dc5814fed2.js +1 -0
  436. package/app/.next/static/chunks/app/api/auth/login/route-d05c42dc5814fed2.js +1 -0
  437. package/app/.next/static/chunks/app/api/auth/logout/route-d05c42dc5814fed2.js +1 -0
  438. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-d05c42dc5814fed2.js +1 -0
  439. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-d05c42dc5814fed2.js +1 -0
  440. package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-d05c42dc5814fed2.js +1 -0
  441. package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-d05c42dc5814fed2.js +1 -0
  442. package/app/.next/static/chunks/app/api/cli-tools/copilot-settings/route-d05c42dc5814fed2.js +1 -0
  443. package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-d05c42dc5814fed2.js +1 -0
  444. package/app/.next/static/chunks/app/api/cli-tools/hermes-settings/route-d05c42dc5814fed2.js +1 -0
  445. package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-d05c42dc5814fed2.js +1 -0
  446. package/app/.next/static/chunks/app/api/cli-tools/opencode-settings/route-d05c42dc5814fed2.js +1 -0
  447. package/app/.next/static/chunks/app/api/cloud/auth/route-d05c42dc5814fed2.js +1 -0
  448. package/app/.next/static/chunks/app/api/cloud/credentials/update/route-d05c42dc5814fed2.js +1 -0
  449. package/app/.next/static/chunks/app/api/cloud/model/resolve/route-d05c42dc5814fed2.js +1 -0
  450. package/app/.next/static/chunks/app/api/cloud/models/alias/route-d05c42dc5814fed2.js +1 -0
  451. package/app/.next/static/chunks/app/api/combos/[id]/route-d05c42dc5814fed2.js +1 -0
  452. package/app/.next/static/chunks/app/api/combos/route-d05c42dc5814fed2.js +1 -0
  453. package/app/.next/static/chunks/app/api/health/route-d05c42dc5814fed2.js +1 -0
  454. package/app/.next/static/chunks/app/api/init/route-d05c42dc5814fed2.js +1 -0
  455. package/app/.next/static/chunks/app/api/keys/[id]/route-d05c42dc5814fed2.js +1 -0
  456. package/app/.next/static/chunks/app/api/keys/route-d05c42dc5814fed2.js +1 -0
  457. package/app/.next/static/chunks/app/api/locale/route-d05c42dc5814fed2.js +1 -0
  458. package/app/.next/static/chunks/app/api/media-providers/tts/elevenlabs/voices/route-d05c42dc5814fed2.js +1 -0
  459. package/app/.next/static/chunks/app/api/media-providers/tts/voices/route-d05c42dc5814fed2.js +1 -0
  460. package/app/.next/static/chunks/app/api/models/alias/route-d05c42dc5814fed2.js +1 -0
  461. package/app/.next/static/chunks/app/api/models/availability/route-d05c42dc5814fed2.js +1 -0
  462. package/app/.next/static/chunks/app/api/models/custom/route-d05c42dc5814fed2.js +1 -0
  463. package/app/.next/static/chunks/app/api/models/route-d05c42dc5814fed2.js +1 -0
  464. package/app/.next/static/chunks/app/api/models/test/route-d05c42dc5814fed2.js +1 -0
  465. package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-d05c42dc5814fed2.js +1 -0
  466. package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-d05c42dc5814fed2.js +1 -0
  467. package/app/.next/static/chunks/app/api/oauth/cursor/import/route-d05c42dc5814fed2.js +1 -0
  468. package/app/.next/static/chunks/app/api/oauth/gitlab/pat/route-d05c42dc5814fed2.js +1 -0
  469. package/app/.next/static/chunks/app/api/oauth/iflow/cookie/route-d05c42dc5814fed2.js +1 -0
  470. package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-d05c42dc5814fed2.js +1 -0
  471. package/app/.next/static/chunks/app/api/oauth/kiro/import/route-d05c42dc5814fed2.js +1 -0
  472. package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-d05c42dc5814fed2.js +1 -0
  473. package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-d05c42dc5814fed2.js +1 -0
  474. package/app/.next/static/chunks/app/api/pricing/route-d05c42dc5814fed2.js +1 -0
  475. package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-d05c42dc5814fed2.js +1 -0
  476. package/app/.next/static/chunks/app/api/provider-nodes/route-d05c42dc5814fed2.js +1 -0
  477. package/app/.next/static/chunks/app/api/provider-nodes/validate/route-d05c42dc5814fed2.js +1 -0
  478. package/app/.next/static/chunks/app/api/providers/[id]/models/route-d05c42dc5814fed2.js +1 -0
  479. package/app/.next/static/chunks/app/api/providers/[id]/route-d05c42dc5814fed2.js +1 -0
  480. package/app/.next/static/chunks/app/api/providers/[id]/test/route-d05c42dc5814fed2.js +1 -0
  481. package/app/.next/static/chunks/app/api/providers/[id]/test-models/route-d05c42dc5814fed2.js +1 -0
  482. package/app/.next/static/chunks/app/api/providers/client/route-d05c42dc5814fed2.js +1 -0
  483. package/app/.next/static/chunks/app/api/providers/kilo/free-models/route-d05c42dc5814fed2.js +1 -0
  484. package/app/.next/static/chunks/app/api/providers/route-d05c42dc5814fed2.js +1 -0
  485. package/app/.next/static/chunks/app/api/providers/suggested-models/route-d05c42dc5814fed2.js +1 -0
  486. package/app/.next/static/chunks/app/api/providers/test-batch/route-d05c42dc5814fed2.js +1 -0
  487. package/app/.next/static/chunks/app/api/providers/validate/route-d05c42dc5814fed2.js +1 -0
  488. package/app/.next/static/chunks/app/api/proxy-pools/[id]/route-d05c42dc5814fed2.js +1 -0
  489. package/app/.next/static/chunks/app/api/proxy-pools/[id]/test/route-d05c42dc5814fed2.js +1 -0
  490. package/app/.next/static/chunks/app/api/proxy-pools/route-d05c42dc5814fed2.js +1 -0
  491. package/app/.next/static/chunks/app/api/proxy-pools/vercel-deploy/route-d05c42dc5814fed2.js +1 -0
  492. package/app/.next/static/chunks/app/api/settings/database/route-d05c42dc5814fed2.js +1 -0
  493. package/app/.next/static/chunks/app/api/settings/proxy-test/route-d05c42dc5814fed2.js +1 -0
  494. package/app/.next/static/chunks/app/api/settings/require-login/route-d05c42dc5814fed2.js +1 -0
  495. package/app/.next/static/chunks/app/api/settings/route-d05c42dc5814fed2.js +1 -0
  496. package/app/.next/static/chunks/app/api/shutdown/route-d05c42dc5814fed2.js +1 -0
  497. package/app/.next/static/chunks/app/api/tags/route-d05c42dc5814fed2.js +1 -0
  498. package/app/.next/static/chunks/app/api/translator/console-logs/route-d05c42dc5814fed2.js +1 -0
  499. package/app/.next/static/chunks/app/api/translator/console-logs/stream/route-d05c42dc5814fed2.js +1 -0
  500. package/app/.next/static/chunks/app/api/translator/load/route-d05c42dc5814fed2.js +1 -0
  501. package/app/.next/static/chunks/app/api/translator/save/route-d05c42dc5814fed2.js +1 -0
  502. package/app/.next/static/chunks/app/api/translator/send/route-d05c42dc5814fed2.js +1 -0
  503. package/app/.next/static/chunks/app/api/translator/translate/route-d05c42dc5814fed2.js +1 -0
  504. package/app/.next/static/chunks/app/api/tunnel/disable/route-d05c42dc5814fed2.js +1 -0
  505. package/app/.next/static/chunks/app/api/tunnel/enable/route-d05c42dc5814fed2.js +1 -0
  506. package/app/.next/static/chunks/app/api/tunnel/status/route-d05c42dc5814fed2.js +1 -0
  507. package/app/.next/static/chunks/app/api/tunnel/tailscale-check/route-d05c42dc5814fed2.js +1 -0
  508. package/app/.next/static/chunks/app/api/tunnel/tailscale-disable/route-d05c42dc5814fed2.js +1 -0
  509. package/app/.next/static/chunks/app/api/tunnel/tailscale-enable/route-d05c42dc5814fed2.js +1 -0
  510. package/app/.next/static/chunks/app/api/tunnel/tailscale-install/route-d05c42dc5814fed2.js +1 -0
  511. package/app/.next/static/chunks/app/api/tunnel/tailscale-login/route-d05c42dc5814fed2.js +1 -0
  512. package/app/.next/static/chunks/app/api/tunnel/tailscale-start-daemon/route-d05c42dc5814fed2.js +1 -0
  513. package/app/.next/static/chunks/app/api/usage/[connectionId]/route-d05c42dc5814fed2.js +1 -0
  514. package/app/.next/static/chunks/app/api/usage/chart/route-d05c42dc5814fed2.js +1 -0
  515. package/app/.next/static/chunks/app/api/usage/history/route-d05c42dc5814fed2.js +1 -0
  516. package/app/.next/static/chunks/app/api/usage/providers/route-d05c42dc5814fed2.js +1 -0
  517. package/app/.next/static/chunks/app/api/usage/request-details/route-d05c42dc5814fed2.js +1 -0
  518. package/app/.next/static/chunks/app/api/usage/request-logs/route-d05c42dc5814fed2.js +1 -0
  519. package/app/.next/static/chunks/app/api/usage/stats/route-d05c42dc5814fed2.js +1 -0
  520. package/app/.next/static/chunks/app/api/usage/stream/route-d05c42dc5814fed2.js +1 -0
  521. package/app/.next/static/chunks/app/api/v1/api/chat/route-d05c42dc5814fed2.js +1 -0
  522. package/app/.next/static/chunks/app/api/v1/audio/speech/route-d05c42dc5814fed2.js +1 -0
  523. package/app/.next/static/chunks/app/api/v1/chat/completions/route-d05c42dc5814fed2.js +1 -0
  524. package/app/.next/static/chunks/app/api/v1/embeddings/route-d05c42dc5814fed2.js +1 -0
  525. package/app/.next/static/chunks/app/api/v1/images/generations/route-d05c42dc5814fed2.js +1 -0
  526. package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-d05c42dc5814fed2.js +1 -0
  527. package/app/.next/static/chunks/app/api/v1/messages/route-d05c42dc5814fed2.js +1 -0
  528. package/app/.next/static/chunks/app/api/v1/models/route-d05c42dc5814fed2.js +1 -0
  529. package/app/.next/static/chunks/app/api/v1/responses/compact/route-d05c42dc5814fed2.js +1 -0
  530. package/app/.next/static/chunks/app/api/v1/responses/route-d05c42dc5814fed2.js +1 -0
  531. package/app/.next/static/chunks/app/api/v1/route-d05c42dc5814fed2.js +1 -0
  532. package/app/.next/static/chunks/app/api/v1/search/route-d05c42dc5814fed2.js +1 -0
  533. package/app/.next/static/chunks/app/api/v1/web/fetch/route-d05c42dc5814fed2.js +1 -0
  534. package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-d05c42dc5814fed2.js +1 -0
  535. package/app/.next/static/chunks/app/api/v1beta/models/route-d05c42dc5814fed2.js +1 -0
  536. package/app/.next/static/chunks/app/api/version/route-d05c42dc5814fed2.js +1 -0
  537. package/app/.next/static/chunks/app/api/version/update/route-d05c42dc5814fed2.js +1 -0
  538. package/app/.next/static/chunks/app/manifest.webmanifest/route-d05c42dc5814fed2.js +1 -0
  539. package/app/.next/static/chunks/app/page-d05c42dc5814fed2.js +1 -0
  540. package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-d05c42dc5814fed2.js +1 -0
  541. package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-d05c42dc5814fed2.js +1 -0
  542. package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-d05c42dc5814fed2.js +1 -0
  543. package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-d05c42dc5814fed2.js +1 -0
  544. package/app/.next/static/css/7d19c5a9e0755804.css +1 -0
  545. package/app/package.json +1 -1
  546. package/app/public/providers/azure.png +0 -0
  547. package/app/public/providers/blackbox.png +0 -0
  548. package/app/public/providers/brave-search.png +0 -0
  549. package/app/public/providers/byteplus.png +0 -0
  550. package/app/public/providers/exa.png +0 -0
  551. package/app/public/providers/firecrawl.png +0 -0
  552. package/app/public/providers/google-pse.png +0 -0
  553. package/app/public/providers/grok-web.png +0 -0
  554. package/app/public/providers/jina-reader.png +0 -0
  555. package/app/public/providers/linkup.png +0 -0
  556. package/app/public/providers/perplexity-web.png +0 -0
  557. package/app/public/providers/searchapi.png +0 -0
  558. package/app/public/providers/searxng.png +0 -0
  559. package/app/public/providers/serper.png +0 -0
  560. package/app/public/providers/tavily.png +0 -0
  561. package/app/public/providers/youcom.png +0 -0
  562. package/app/src/lib/updater/updater.js +25 -2
  563. package/app/src/mitm/server.js +27 -18
  564. package/cli.js +101 -29
  565. package/package.json +1 -1
  566. package/src/cli/menus/cliTools.js +161 -5
  567. package/src/cli/menus/settings.js +108 -31
  568. package/src/cli/utils/modelSelector.js +7 -4
  569. package/app/.next/server/chunks/3030.js +0 -1
  570. package/app/.next/server/chunks/3159.js +0 -1
  571. package/app/.next/server/chunks/4627.js +0 -1
  572. package/app/.next/server/chunks/9981.js +0 -1
  573. package/app/.next/static/T4TJnw8mEQRV7kCiZc6uW/_buildManifest.js +0 -1
  574. package/app/.next/static/chunks/4156-9fae73e0d4b47725.js +0 -7
  575. package/app/.next/static/chunks/505-8e6a8e785c4531e1.js +0 -1
  576. package/app/.next/static/chunks/8035-428a74e5524d6927.js +0 -3
  577. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-446fb4958f931207.js +0 -51
  578. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-7b7477044f123993.js +0 -1
  579. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-77016ac325d94df5.js +0 -1
  580. package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-394a2f89caf8c08f.js +0 -1
  581. package/app/.next/static/chunks/app/(dashboard)/layout-380c1f4327a2a3bc.js +0 -1
  582. package/app/.next/static/chunks/app/_global-error/page-a91eafdb46715e00.js +0 -1
  583. package/app/.next/static/chunks/app/api/auth/login/route-a91eafdb46715e00.js +0 -1
  584. package/app/.next/static/chunks/app/api/auth/logout/route-a91eafdb46715e00.js +0 -1
  585. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-a91eafdb46715e00.js +0 -1
  586. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-a91eafdb46715e00.js +0 -1
  587. package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-a91eafdb46715e00.js +0 -1
  588. package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-a91eafdb46715e00.js +0 -1
  589. package/app/.next/static/chunks/app/api/cli-tools/copilot-settings/route-a91eafdb46715e00.js +0 -1
  590. package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-a91eafdb46715e00.js +0 -1
  591. package/app/.next/static/chunks/app/api/cli-tools/hermes-settings/route-a91eafdb46715e00.js +0 -1
  592. package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-a91eafdb46715e00.js +0 -1
  593. package/app/.next/static/chunks/app/api/cli-tools/opencode-settings/route-a91eafdb46715e00.js +0 -1
  594. package/app/.next/static/chunks/app/api/cloud/auth/route-a91eafdb46715e00.js +0 -1
  595. package/app/.next/static/chunks/app/api/cloud/credentials/update/route-a91eafdb46715e00.js +0 -1
  596. package/app/.next/static/chunks/app/api/cloud/model/resolve/route-a91eafdb46715e00.js +0 -1
  597. package/app/.next/static/chunks/app/api/cloud/models/alias/route-a91eafdb46715e00.js +0 -1
  598. package/app/.next/static/chunks/app/api/combos/[id]/route-a91eafdb46715e00.js +0 -1
  599. package/app/.next/static/chunks/app/api/combos/route-a91eafdb46715e00.js +0 -1
  600. package/app/.next/static/chunks/app/api/health/route-a91eafdb46715e00.js +0 -1
  601. package/app/.next/static/chunks/app/api/init/route-a91eafdb46715e00.js +0 -1
  602. package/app/.next/static/chunks/app/api/keys/[id]/route-a91eafdb46715e00.js +0 -1
  603. package/app/.next/static/chunks/app/api/keys/route-a91eafdb46715e00.js +0 -1
  604. package/app/.next/static/chunks/app/api/locale/route-a91eafdb46715e00.js +0 -1
  605. package/app/.next/static/chunks/app/api/media-providers/tts/elevenlabs/voices/route-a91eafdb46715e00.js +0 -1
  606. package/app/.next/static/chunks/app/api/media-providers/tts/voices/route-a91eafdb46715e00.js +0 -1
  607. package/app/.next/static/chunks/app/api/models/alias/route-a91eafdb46715e00.js +0 -1
  608. package/app/.next/static/chunks/app/api/models/availability/route-a91eafdb46715e00.js +0 -1
  609. package/app/.next/static/chunks/app/api/models/custom/route-a91eafdb46715e00.js +0 -1
  610. package/app/.next/static/chunks/app/api/models/route-a91eafdb46715e00.js +0 -1
  611. package/app/.next/static/chunks/app/api/models/test/route-a91eafdb46715e00.js +0 -1
  612. package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-a91eafdb46715e00.js +0 -1
  613. package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-a91eafdb46715e00.js +0 -1
  614. package/app/.next/static/chunks/app/api/oauth/cursor/import/route-a91eafdb46715e00.js +0 -1
  615. package/app/.next/static/chunks/app/api/oauth/gitlab/pat/route-a91eafdb46715e00.js +0 -1
  616. package/app/.next/static/chunks/app/api/oauth/iflow/cookie/route-a91eafdb46715e00.js +0 -1
  617. package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-a91eafdb46715e00.js +0 -1
  618. package/app/.next/static/chunks/app/api/oauth/kiro/import/route-a91eafdb46715e00.js +0 -1
  619. package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-a91eafdb46715e00.js +0 -1
  620. package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-a91eafdb46715e00.js +0 -1
  621. package/app/.next/static/chunks/app/api/pricing/route-a91eafdb46715e00.js +0 -1
  622. package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-a91eafdb46715e00.js +0 -1
  623. package/app/.next/static/chunks/app/api/provider-nodes/route-a91eafdb46715e00.js +0 -1
  624. package/app/.next/static/chunks/app/api/provider-nodes/validate/route-a91eafdb46715e00.js +0 -1
  625. package/app/.next/static/chunks/app/api/providers/[id]/models/route-a91eafdb46715e00.js +0 -1
  626. package/app/.next/static/chunks/app/api/providers/[id]/route-a91eafdb46715e00.js +0 -1
  627. package/app/.next/static/chunks/app/api/providers/[id]/test/route-a91eafdb46715e00.js +0 -1
  628. package/app/.next/static/chunks/app/api/providers/[id]/test-models/route-a91eafdb46715e00.js +0 -1
  629. package/app/.next/static/chunks/app/api/providers/client/route-a91eafdb46715e00.js +0 -1
  630. package/app/.next/static/chunks/app/api/providers/kilo/free-models/route-a91eafdb46715e00.js +0 -1
  631. package/app/.next/static/chunks/app/api/providers/route-a91eafdb46715e00.js +0 -1
  632. package/app/.next/static/chunks/app/api/providers/suggested-models/route-a91eafdb46715e00.js +0 -1
  633. package/app/.next/static/chunks/app/api/providers/test-batch/route-a91eafdb46715e00.js +0 -1
  634. package/app/.next/static/chunks/app/api/providers/validate/route-a91eafdb46715e00.js +0 -1
  635. package/app/.next/static/chunks/app/api/proxy-pools/[id]/route-a91eafdb46715e00.js +0 -1
  636. package/app/.next/static/chunks/app/api/proxy-pools/[id]/test/route-a91eafdb46715e00.js +0 -1
  637. package/app/.next/static/chunks/app/api/proxy-pools/route-a91eafdb46715e00.js +0 -1
  638. package/app/.next/static/chunks/app/api/proxy-pools/vercel-deploy/route-a91eafdb46715e00.js +0 -1
  639. package/app/.next/static/chunks/app/api/settings/database/route-a91eafdb46715e00.js +0 -1
  640. package/app/.next/static/chunks/app/api/settings/proxy-test/route-a91eafdb46715e00.js +0 -1
  641. package/app/.next/static/chunks/app/api/settings/require-login/route-a91eafdb46715e00.js +0 -1
  642. package/app/.next/static/chunks/app/api/settings/route-a91eafdb46715e00.js +0 -1
  643. package/app/.next/static/chunks/app/api/shutdown/route-a91eafdb46715e00.js +0 -1
  644. package/app/.next/static/chunks/app/api/tags/route-a91eafdb46715e00.js +0 -1
  645. package/app/.next/static/chunks/app/api/translator/console-logs/route-a91eafdb46715e00.js +0 -1
  646. package/app/.next/static/chunks/app/api/translator/console-logs/stream/route-a91eafdb46715e00.js +0 -1
  647. package/app/.next/static/chunks/app/api/translator/load/route-a91eafdb46715e00.js +0 -1
  648. package/app/.next/static/chunks/app/api/translator/save/route-a91eafdb46715e00.js +0 -1
  649. package/app/.next/static/chunks/app/api/translator/send/route-a91eafdb46715e00.js +0 -1
  650. package/app/.next/static/chunks/app/api/translator/translate/route-a91eafdb46715e00.js +0 -1
  651. package/app/.next/static/chunks/app/api/tunnel/disable/route-a91eafdb46715e00.js +0 -1
  652. package/app/.next/static/chunks/app/api/tunnel/enable/route-a91eafdb46715e00.js +0 -1
  653. package/app/.next/static/chunks/app/api/tunnel/status/route-a91eafdb46715e00.js +0 -1
  654. package/app/.next/static/chunks/app/api/tunnel/tailscale-check/route-a91eafdb46715e00.js +0 -1
  655. package/app/.next/static/chunks/app/api/tunnel/tailscale-disable/route-a91eafdb46715e00.js +0 -1
  656. package/app/.next/static/chunks/app/api/tunnel/tailscale-enable/route-a91eafdb46715e00.js +0 -1
  657. package/app/.next/static/chunks/app/api/tunnel/tailscale-install/route-a91eafdb46715e00.js +0 -1
  658. package/app/.next/static/chunks/app/api/tunnel/tailscale-login/route-a91eafdb46715e00.js +0 -1
  659. package/app/.next/static/chunks/app/api/tunnel/tailscale-start-daemon/route-a91eafdb46715e00.js +0 -1
  660. package/app/.next/static/chunks/app/api/usage/[connectionId]/route-a91eafdb46715e00.js +0 -1
  661. package/app/.next/static/chunks/app/api/usage/chart/route-a91eafdb46715e00.js +0 -1
  662. package/app/.next/static/chunks/app/api/usage/history/route-a91eafdb46715e00.js +0 -1
  663. package/app/.next/static/chunks/app/api/usage/providers/route-a91eafdb46715e00.js +0 -1
  664. package/app/.next/static/chunks/app/api/usage/request-details/route-a91eafdb46715e00.js +0 -1
  665. package/app/.next/static/chunks/app/api/usage/request-logs/route-a91eafdb46715e00.js +0 -1
  666. package/app/.next/static/chunks/app/api/usage/stats/route-a91eafdb46715e00.js +0 -1
  667. package/app/.next/static/chunks/app/api/usage/stream/route-a91eafdb46715e00.js +0 -1
  668. package/app/.next/static/chunks/app/api/v1/api/chat/route-a91eafdb46715e00.js +0 -1
  669. package/app/.next/static/chunks/app/api/v1/audio/speech/route-a91eafdb46715e00.js +0 -1
  670. package/app/.next/static/chunks/app/api/v1/chat/completions/route-a91eafdb46715e00.js +0 -1
  671. package/app/.next/static/chunks/app/api/v1/embeddings/route-a91eafdb46715e00.js +0 -1
  672. package/app/.next/static/chunks/app/api/v1/images/generations/route-a91eafdb46715e00.js +0 -1
  673. package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-a91eafdb46715e00.js +0 -1
  674. package/app/.next/static/chunks/app/api/v1/messages/route-a91eafdb46715e00.js +0 -1
  675. package/app/.next/static/chunks/app/api/v1/models/route-a91eafdb46715e00.js +0 -1
  676. package/app/.next/static/chunks/app/api/v1/responses/compact/route-a91eafdb46715e00.js +0 -1
  677. package/app/.next/static/chunks/app/api/v1/responses/route-a91eafdb46715e00.js +0 -1
  678. package/app/.next/static/chunks/app/api/v1/route-a91eafdb46715e00.js +0 -1
  679. package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-a91eafdb46715e00.js +0 -1
  680. package/app/.next/static/chunks/app/api/v1beta/models/route-a91eafdb46715e00.js +0 -1
  681. package/app/.next/static/chunks/app/api/version/route-a91eafdb46715e00.js +0 -1
  682. package/app/.next/static/chunks/app/api/version/update/route-a91eafdb46715e00.js +0 -1
  683. package/app/.next/static/chunks/app/manifest.webmanifest/route-a91eafdb46715e00.js +0 -1
  684. package/app/.next/static/chunks/app/page-a91eafdb46715e00.js +0 -1
  685. package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-a91eafdb46715e00.js +0 -1
  686. package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-a91eafdb46715e00.js +0 -1
  687. package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-a91eafdb46715e00.js +0 -1
  688. package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-a91eafdb46715e00.js +0 -1
  689. package/app/.next/static/css/7ba68f4fd52a1ae0.css +0 -1
  690. /package/app/.next/static/{T4TJnw8mEQRV7kCiZc6uW → 5EH48iik3Xr5bo5JjHKBf}/_ssgManifest.js +0 -0
@@ -1,5 +1,5 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4380],{7127:(e,t,s)=>{s.d(t,{Tk:()=>o,Ah:()=>d,a7:()=>g,ZM:()=>x,RF:()=>u,gY:()=>w,tA:()=>b,kn:()=>j,yZ:()=>m,qO:()=>f});var l=s(73365),a=s(1521),r=s(74156),i=s(58872);let n=s(89651).env.NEXT_PUBLIC_CLOUD_URL;function o({tool:e,isExpanded:t,onToggle:s,activeProviders:d,modelMappings:c,onModelMappingChange:x,baseUrl:m,hasActiveProviders:p,apiKeys:u,cloudEnabled:h,initialStatus:g}){let f,y,b,[j,N]=(0,a.useState)(g||null),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)(!1),[A,E]=(0,a.useState)(null),[M,O]=(0,a.useState)(!1),[I,R]=(0,a.useState)(!1),[P,T]=(0,a.useState)(null),[$,U]=(0,a.useState)(""),[K,L]=(0,a.useState)({}),[z,D]=(0,a.useState)(!1),[F,H]=(0,a.useState)(""),[B,q]=(0,a.useState)(!1),W=(0,a.useRef)(!1),G=(()=>{if(!j?.installed)return null;let e=j.settings?.env?.ANTHROPIC_BASE_URL;if(!e)return"not_configured";let t=e.includes("localhost")||e.includes("127.0.0.1"),s=h&&n&&e.startsWith(n),l=m&&e.startsWith(m);return t||s||l?"configured":"other"})();(0,a.useEffect)(()=>{u?.length>0&&!$&&U(u[0].key)},[u,$]),(0,a.useEffect)(()=>{g&&N(g)},[g]),(0,a.useEffect)(()=>{t&&!j&&(Y(),Z()),t&&Z()},[t]),(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{q(!!e.ccFilterNaming)}).catch(()=>{})},[]);let J=async e=>{let t=e.target.checked;q(t),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:t})}).catch(()=>{})},Z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&L(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(j?.installed&&!W.current){W.current=!0;let t=j.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&x(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&u?.some(e=>e.key===s)&&U(s)}},[j,u,e.defaultModels,x]);let Y=async()=>{w(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();N(t)}catch(e){N({installed:!1,error:e.message})}finally{w(!1)}},V=()=>{let e=F||m;return e.endsWith("/v1")?e:`${e}/v1`},X=async()=>{C(!0),E(null);try{let t={ANTHROPIC_BASE_URL:V()},s=$?.trim()||(u?.length>0?u[0].key:null)||(h?null:"sk_9router");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=c[e.alias];s&&e.envKey&&(t[e.envKey]=s)});let l=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})}),a=await l.json();l.ok?(E({type:"success",text:"Settings applied successfully!"}),N(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t}}))):E({type:"error",text:a.error||"Failed to apply settings"})}catch(e){E({type:"error",text:e.message})}finally{C(!1)}},Q=async()=>{_(!0),E(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(E({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>x(e.alias,e.defaultValue||"")),U("")):E({type:"error",text:s.error||"Failed to reset settings"})}catch(e){E({type:"error",text:e.message})}finally{_(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/claude.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[v&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude CLI..."})]}),!v&&j&&!j.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>D(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>O(!M),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:M?"expand_less":"help"}),M?"Hide":"How to Install"]})]})]}),M&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!v&&j?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[j?.settings?.env?.ANTHROPIC_BASE_URL&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:j.settings.env.ANTHROPIC_BASE_URL})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(f=F||m).endsWith("/v1")?f:`${f}/v1`,onChange:e=>H(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),F&&F!==m&&(0,l.jsx)("button",{onClick:()=>H(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),u.length>0?(0,l.jsx)("select",{value:$,onChange:e=>U(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:u.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:h?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:c[e.alias]||"",onChange:t=>x(e.alias,t.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>{T(e.alias),R(!0)},disabled:!p,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${p?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),c[e.alias]&&(0,l.jsx)("button",{onClick:()=>x(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias)),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Filter naming"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:B,onChange:J,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"})]}),(0,l.jsx)(r.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),A&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,l.jsx)("span",{children:A.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:X,disabled:!p,loading:k,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Q,disabled:!j?.has9Router,loading:S,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>D(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:I,onClose:()=>R(!1),onSelect:e=>{P&&x(P,e.value)},selectedModel:P?c[P]:null,activeProviders:d,modelAliases:K,title:`Select model for ${P}`}),(0,l.jsx)(r.uR,{isOpen:z,onClose:()=>D(!1),title:"Claude CLI - Manual Configuration",configs:(y=$&&$.trim()?$:h?"<API_KEY_FROM_DASHBOARD>":"sk_9router",b={ANTHROPIC_BASE_URL:V(),ANTHROPIC_AUTH_TOKEN:y},e.defaultModels.forEach(e=>{let t=c[e.alias];t&&e.envKey&&(b[e.envKey]=t)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:b},null,2)}])})]})}function d({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:c,cloudEnabled:x,initialStatus:m}){let p,u,h,g,[f,y]=(0,a.useState)(m||null),[b,j]=(0,a.useState)(!1),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),[_,A]=(0,a.useState)(!1),[E,M]=(0,a.useState)(""),[O,I]=(0,a.useState)(""),[R,P]=(0,a.useState)(""),[T,$]=(0,a.useState)(!1),[U,K]=(0,a.useState)(!1),[L,z]=(0,a.useState)({}),[D,F]=(0,a.useState)(!1),[H,B]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!E&&M(o[0].key)},[o,E]),(0,a.useEffect)(()=>{m&&y(m)},[m]),(0,a.useEffect)(()=>{t&&!f&&(J(),q()),t&&q()},[t]);let q=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&z(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(f?.config){let e=f.config.match(/^model\s*=\s*"([^"]+)"/m);e&&I(e[1]);let t=f.config.match(/\[agents\.subagent\]\s*\n\s*model\s*=\s*"([^"]+)"/m);t&&P(t[1])}},[f]);let W=f?.installed?f.config?f.config.includes(n)||f.config.includes("localhost")||f.config.includes("127.0.0.1")?"configured":"other":"not_configured":null,G=()=>{let e=H||`${n}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},J=async()=>{j(!0);try{let e=await fetch("/api/cli-tools/codex-settings"),t=await e.json();y(t)}catch(e){y({installed:!1,error:e.message})}finally{j(!1)}},Z=async()=>{v(!0),S(null);try{let e=E&&E.trim()||x?E:"sk_9router",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:G(),apiKey:e,model:O,subagentModel:R||O})}),s=await t.json();t.ok?(S({type:"success",text:"Settings applied successfully!"}),J()):S({type:"error",text:s.error||"Failed to apply settings"})}catch(e){S({type:"error",text:e.message})}finally{v(!1)}},Y=async()=>{k(!0),S(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(S({type:"success",text:"Settings reset successfully!"}),I(""),P(""),J()):S({type:"error",text:t.error||"Failed to reset settings"})}catch(e){S({type:"error",text:e.message})}finally{k(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/codex.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[b&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Codex CLI..."})]}),!b&&f&&!f.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>F(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>A(!_),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:_?"expand_less":"help"}),_?"Hide":"How to Install"]})]})]}),_&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,l.jsx)("div",{className:"pt-2 border-t border-border",children:(0,l.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," with ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!b&&f?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[f?.config&&((u=(p=f.config.match(/base_url\s*=\s*"([^"]+)"/))?p[1]:null)?(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:u})]}):null),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:H||`${n}/v1`,onChange:e=>B(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),H&&H!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>B(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),o.length>0?(0,l.jsx)("select",{value:E,onChange:e=>M(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:O,onChange:e=>I(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>$(!0),disabled:!c?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${c?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),O&&(0,l.jsx)("button",{onClick:()=>I(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Subagent Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:R,onChange:e=>P(e.target.value),placeholder:O||"provider/model-id (defaults to main model)",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>K(!0),disabled:!c?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${c?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),R&&(0,l.jsx)("button",{onClick:()=>P(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),C&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===C.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===C.type?"check_circle":"error"}),(0,l.jsx)("span",{children:C.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:Z,disabled:!E&&x&&o.length>0||!O,loading:N,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Y,disabled:w,loading:w,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>F(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:T,onClose:()=>$(!1),onSelect:e=>{I(e.value),R||P(e.value),$(!1)},selectedModel:O,activeProviders:c,modelAliases:L,title:"Select Model for Codex"}),(0,l.jsx)(r.rq,{isOpen:U,onClose:()=>K(!1),onSelect:e=>{P(e.value),K(!1)},selectedModel:R,activeProviders:c,modelAliases:L,title:"Select Subagent Model for Codex"}),(0,l.jsx)(r.uR,{isOpen:D,onClose:()=>F(!1),title:"Codex CLI - Manual Configuration",configs:(h=E&&E.trim()?E:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",g=R||O,[{filename:"~/.codex/config.toml",content:`# 9Router Configuration for Codex CLI
2
- model = "${O}"
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4380],{7127:(e,t,s)=>{s.d(t,{Tk:()=>o,Ah:()=>d,a7:()=>g,ZM:()=>x,RF:()=>u,gY:()=>k,tA:()=>b,kn:()=>N,yZ:()=>m,qO:()=>f});var l=s(73365),a=s(1521),r=s(74156),i=s(58872);let n=s(89651).env.NEXT_PUBLIC_CLOUD_URL;function o({tool:e,isExpanded:t,onToggle:s,activeProviders:d,modelMappings:c,onModelMappingChange:x,baseUrl:m,hasActiveProviders:p,apiKeys:u,cloudEnabled:h,initialStatus:g}){let f,y,b,[j,N]=(0,a.useState)(g||null),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)(!1),[A,E]=(0,a.useState)(null),[O,M]=(0,a.useState)(!1),[I,R]=(0,a.useState)(!1),[T,P]=(0,a.useState)(null),[$,L]=(0,a.useState)(""),[U,K]=(0,a.useState)({}),[z,D]=(0,a.useState)(!1),[F,H]=(0,a.useState)(""),[B,q]=(0,a.useState)(!1),W=(0,a.useRef)(!1),G=(()=>{if(!j?.installed)return null;let e=j.settings?.env?.ANTHROPIC_BASE_URL;if(!e)return"not_configured";let t=e.includes("localhost")||e.includes("127.0.0.1"),s=h&&n&&e.startsWith(n),l=m&&e.startsWith(m);return t||s||l?"configured":"other"})();(0,a.useEffect)(()=>{u?.length>0&&!$&&L(u[0].key)},[u,$]),(0,a.useEffect)(()=>{g&&N(g)},[g]),(0,a.useEffect)(()=>{t&&!j&&(Y(),Z()),t&&Z()},[t]),(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{q(!!e.ccFilterNaming)}).catch(()=>{})},[]);let J=async e=>{let t=e.target.checked;q(t),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:t})}).catch(()=>{})},Z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&K(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(j?.installed&&!W.current){W.current=!0;let t=j.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&x(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&u?.some(e=>e.key===s)&&L(s)}},[j,u,e.defaultModels,x]);let Y=async()=>{w(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();N(t)}catch(e){N({installed:!1,error:e.message})}finally{w(!1)}},V=()=>{let e=F||m;return e.endsWith("/v1")?e:`${e}/v1`},X=async()=>{C(!0),E(null);try{let t={ANTHROPIC_BASE_URL:V()},s=$?.trim()||(u?.length>0?u[0].key:null)||(h?null:"sk_9router");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=c[e.alias];s&&e.envKey&&(t[e.envKey]=s)});let l=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})}),a=await l.json();l.ok?(E({type:"success",text:"Settings applied successfully!"}),N(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t}}))):E({type:"error",text:a.error||"Failed to apply settings"})}catch(e){E({type:"error",text:e.message})}finally{C(!1)}},Q=async()=>{_(!0),E(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(E({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>x(e.alias,e.defaultValue||"")),L("")):E({type:"error",text:s.error||"Failed to reset settings"})}catch(e){E({type:"error",text:e.message})}finally{_(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/claude.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===G&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[v&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude CLI..."})]}),!v&&j&&!j.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>D(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>M(!O),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:O?"expand_less":"help"}),O?"Hide":"How to Install"]})]})]}),O&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!v&&j?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[j?.settings?.env?.ANTHROPIC_BASE_URL&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:j.settings.env.ANTHROPIC_BASE_URL})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(f=F||m).endsWith("/v1")?f:`${f}/v1`,onChange:e=>H(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),F&&F!==m&&(0,l.jsx)("button",{onClick:()=>H(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),u.length>0?(0,l.jsx)("select",{value:$,onChange:e=>L(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:u.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:h?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:c[e.alias]||"",onChange:t=>x(e.alias,t.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>{P(e.alias),R(!0)},disabled:!p,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${p?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),c[e.alias]&&(0,l.jsx)("button",{onClick:()=>x(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias)),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Filter naming"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:B,onChange:J,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"})]}),(0,l.jsx)(r.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),A&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,l.jsx)("span",{children:A.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:X,disabled:!p,loading:k,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Q,disabled:!j?.has9Router,loading:S,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>D(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:I,onClose:()=>R(!1),onSelect:e=>{T&&x(T,e.value)},selectedModel:T?c[T]:null,activeProviders:d,modelAliases:U,title:`Select model for ${T}`}),(0,l.jsx)(r.uR,{isOpen:z,onClose:()=>D(!1),title:"Claude CLI - Manual Configuration",configs:(y=$&&$.trim()?$:h?"<API_KEY_FROM_DASHBOARD>":"sk_9router",b={ANTHROPIC_BASE_URL:V(),ANTHROPIC_AUTH_TOKEN:y},e.defaultModels.forEach(e=>{let t=c[e.alias];t&&e.envKey&&(b[e.envKey]=t)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:b},null,2)}])})]})}function d({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:c,cloudEnabled:x,initialStatus:m}){let p,u,h,g,[f,y]=(0,a.useState)(m||null),[b,j]=(0,a.useState)(!1),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),[_,A]=(0,a.useState)(!1),[E,O]=(0,a.useState)(""),[M,I]=(0,a.useState)(""),[R,T]=(0,a.useState)(""),[P,$]=(0,a.useState)(!1),[L,U]=(0,a.useState)(!1),[K,z]=(0,a.useState)({}),[D,F]=(0,a.useState)(!1),[H,B]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!E&&O(o[0].key)},[o,E]),(0,a.useEffect)(()=>{m&&y(m)},[m]),(0,a.useEffect)(()=>{t&&!f&&(J(),q()),t&&q()},[t]);let q=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&z(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(f?.config){let e=f.config.match(/^model\s*=\s*"([^"]+)"/m);e&&I(e[1]);let t=f.config.match(/\[agents\.subagent\]\s*\n\s*model\s*=\s*"([^"]+)"/m);t&&T(t[1])}},[f]);let W=f?.installed?f.config?f.config.includes(n)||f.config.includes("localhost")||f.config.includes("127.0.0.1")?"configured":"other":"not_configured":null,G=()=>{let e=H||`${n}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},J=async()=>{j(!0);try{let e=await fetch("/api/cli-tools/codex-settings"),t=await e.json();y(t)}catch(e){y({installed:!1,error:e.message})}finally{j(!1)}},Z=async()=>{v(!0),S(null);try{let e=E&&E.trim()||x?E:"sk_9router",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:G(),apiKey:e,model:M,subagentModel:R||M})}),s=await t.json();t.ok?(S({type:"success",text:"Settings applied successfully!"}),J()):S({type:"error",text:s.error||"Failed to apply settings"})}catch(e){S({type:"error",text:e.message})}finally{v(!1)}},Y=async()=>{k(!0),S(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(S({type:"success",text:"Settings reset successfully!"}),I(""),T(""),J()):S({type:"error",text:t.error||"Failed to reset settings"})}catch(e){S({type:"error",text:e.message})}finally{k(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/codex.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[b&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Codex CLI..."})]}),!b&&f&&!f.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>F(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>A(!_),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:_?"expand_less":"help"}),_?"Hide":"How to Install"]})]})]}),_&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,l.jsx)("div",{className:"pt-2 border-t border-border",children:(0,l.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," with ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!b&&f?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[f?.config&&((u=(p=f.config.match(/base_url\s*=\s*"([^"]+)"/))?p[1]:null)?(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:u})]}):null),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:H||`${n}/v1`,onChange:e=>B(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),H&&H!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>B(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),o.length>0?(0,l.jsx)("select",{value:E,onChange:e=>O(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:M,onChange:e=>I(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>$(!0),disabled:!c?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${c?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),M&&(0,l.jsx)("button",{onClick:()=>I(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Subagent Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:R,onChange:e=>T(e.target.value),placeholder:M||"provider/model-id (defaults to main model)",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>U(!0),disabled:!c?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${c?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),R&&(0,l.jsx)("button",{onClick:()=>T(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),C&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===C.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===C.type?"check_circle":"error"}),(0,l.jsx)("span",{children:C.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:Z,disabled:!E&&x&&o.length>0||!M,loading:N,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Y,disabled:w,loading:w,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>F(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:P,onClose:()=>$(!1),onSelect:e=>{I(e.value),R||T(e.value),$(!1)},selectedModel:M,activeProviders:c,modelAliases:K,title:"Select Model for Codex"}),(0,l.jsx)(r.rq,{isOpen:L,onClose:()=>U(!1),onSelect:e=>{T(e.value),U(!1)},selectedModel:R,activeProviders:c,modelAliases:K,title:"Select Subagent Model for Codex"}),(0,l.jsx)(r.uR,{isOpen:D,onClose:()=>F(!1),title:"Codex CLI - Manual Configuration",configs:(h=E&&E.trim()?E:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",g=R||M,[{filename:"~/.codex/config.toml",content:`# 9Router Configuration for Codex CLI
2
+ model = "${M}"
3
3
  model_provider = "9router"
4
4
 
5
5
  [model_providers.9router]
@@ -9,12 +9,12 @@ wire_api = "responses"
9
9
 
10
10
  [agents.subagent]
11
11
  model = "${g}"
12
- `},{filename:"~/.codex/auth.json",content:JSON.stringify({auth_mode:"apikey",OPENAI_API_KEY:h},null,2)}])})]})}let c=s(89651).env.NEXT_PUBLIC_CLOUD_URL;function x({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:m,cloudEnabled:p,initialStatus:u}){let h,g,f,y,[b,j]=(0,a.useState)(u||null),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),[_,A]=(0,a.useState)(null),[E,M]=(0,a.useState)(""),[O,I]=(0,a.useState)([]),[R,P]=(0,a.useState)(""),[T,$]=(0,a.useState)(!1),[U,K]=(0,a.useState)({}),[L,z]=(0,a.useState)(!1),[D,F]=(0,a.useState)(!1),[H,B]=(0,a.useState)(""),q=(0,a.useRef)(!1),W=(()=>{if(!b?.installed)return null;let e=b.settings?.customModels?.find(e=>e.id?.startsWith("custom:9Router"));if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=p&&c&&e.baseUrl?.startsWith(c),l=n&&e.baseUrl?.startsWith(n);return t||s||l?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!E&&M(d[0].key)},[d,E]),(0,a.useEffect)(()=>{u&&j(u)},[u]),(0,a.useEffect)(()=>{t&&!b&&(J(),G()),t&&G()},[t]);let G=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&K(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(b?.installed&&!q.current){q.current=!0;let e=(b.settings?.customModels||[]).filter(e=>e.id?.startsWith("custom:9Router")).sort((e,t)=>(e.index||0)-(t.index||0)).map(e=>e.model);if(e.length>0)I(e);else{let e=b.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);e?.model&&I([e.model])}}},[b]);let J=async()=>{v(!0);try{let e=await fetch("/api/cli-tools/droid-settings"),t=await e.json();j(t)}catch(e){j({installed:!1,error:e.message})}finally{v(!1)}},Z=()=>{let e=H||n;return e.endsWith("/v1")?e:`${e}/v1`},Y=()=>{let e=R.trim();!e||O.includes(e)||(I(t=>[...t,e]),P(""))},V=async()=>{k(!0),A(null);try{let e=E?.trim()||(d?.length>0?d[0].key:null)||(p?null:"sk_9router"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Z(),apiKey:e,models:O,activeModel:O[0]||""})}),s=await t.json();t.ok?(A({type:"success",text:"Settings applied successfully!"}),J()):A({type:"error",text:s.error||"Failed to apply settings"})}catch(e){A({type:"error",text:e.message})}finally{k(!1)}},X=async()=>{S(!0),A(null);try{let e=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),t=await e.json();e.ok?(A({type:"success",text:"Settings reset successfully!"}),I([]),J()):A({type:"error",text:t.error||"Failed to reset settings"})}catch(e){A({type:"error",text:e.message})}finally{S(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/droid.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[N&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!N&&b&&!b.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>z(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>F(!D),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:D?"expand_less":"help"}),D?"Hide":"How to Install"]})]})]}),D&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"curl -fsSL https://app.factory.ai/cli | sh"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"droid"})," to verify."]})]})]})]}),!N&&b?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[b?.settings?.customModels?.find(e=>e.id?.startsWith("custom:9Router"))?.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:b.settings.customModels.find(e=>e.id?.startsWith("custom:9Router")).baseUrl})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(h=H||n).endsWith("/v1")?h:`${h}/v1`,onChange:e=>B(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),H&&H!==n&&(0,l.jsx)("button",{onClick:()=>B(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:E,onChange:e=>M(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:p?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:["Models ",O.length>0&&(0,l.jsxs)("span",{className:"text-primary",children:["(",O.length,")"]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col gap-1",children:[O.length>0&&(0,l.jsx)("div",{className:"flex flex-col gap-0.5 mb-1",children:O.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-bg-secondary rounded border border-border",children:[(0,l.jsx)("span",{className:"flex-1 text-xs font-mono truncate",children:e}),(0,l.jsx)("button",{onClick:()=>I(t=>t.filter(t=>t!==e)),className:"text-text-muted hover:text-red-500 transition-colors shrink-0",title:"Remove",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e))}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("input",{type:"text",value:R,onChange:e=>P(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Y())},placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>$(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs shrink-0 ${o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),(0,l.jsx)("button",{onClick:Y,disabled:!R.trim(),className:"px-2 py-1.5 rounded border bg-surface border-border hover:border-primary text-xs shrink-0 disabled:opacity-50",title:"Add model",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"})})]})]})]})]}),_&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===_.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===_.type?"check_circle":"error"}),(0,l.jsx)("span",{children:_.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:V,disabled:0===O.length,loading:w,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:X,disabled:!b?.has9Router,loading:C,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>z(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:T,onClose:()=>$(!1),onSelect:e=>{!e.value||O.includes(e.value)||(I(t=>[...t,e.value]),$(!1))},selectedModel:null,activeProviders:m,modelAliases:U,title:"Select Model for Factory Droid"}),(0,l.jsx)(r.uR,{isOpen:L,onClose:()=>z(!1),title:"Factory Droid - Manual Configuration",configs:(g=E&&E.trim()?E:p?"<API_KEY_FROM_DASHBOARD>":"sk_9router",f={customModels:O.map((e,t)=>({model:e,id:`custom:9Router-${t}`,index:t,baseUrl:Z(),apiKey:g,displayName:e,maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}))},y="u">typeof navigator&&navigator.platform,[{filename:y?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(f,null,2)}])})]})}function m({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:c,cloudEnabled:x,initialStatus:p}){let u,h,[g,f]=(0,a.useState)(p||null),[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),[S,_]=(0,a.useState)(""),[A,E]=(0,a.useState)(""),[M,O]=(0,a.useState)({}),[I,R]=(0,a.useState)(null),[P,T]=(0,a.useState)(!1),[$,U]=(0,a.useState)({}),[K,L]=(0,a.useState)(!1),[z,D]=(0,a.useState)(""),F=(0,a.useRef)(!1),H=(()=>{if(!g?.installed)return null;let e=g.settings?.models?.providers?.["9router"];if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1")||e.baseUrl?.includes("0.0.0.0"),s=n&&e.baseUrl?.startsWith(n);return t||s?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!S&&_(d[0].key)},[d,S]),(0,a.useEffect)(()=>{p&&f(p)},[p]),(0,a.useEffect)(()=>{t&&!g&&(q(),B()),t&&B()},[t]);let B=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&U(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(g?.installed&&!F.current){F.current=!0;let e=g.settings?.models?.providers?.["9router"];if(e){let t=g.settings?.agents?.defaults?.model?.primary;t&&E(t.replace("9router/","")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&_(e.apiKey)}let t=g.agents||[],s={};t.forEach(e=>{e.currentModel&&(s[e.id]=e.currentModel)}),O(s)}},[g,d]);let q=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/openclaw-settings"),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},W=()=>window.location.origin.replace("://localhost","://127.0.0.1"),G=()=>{let e=z||W();return e.endsWith("/v1")?e:`${e}/v1`},J=async()=>{N(!0),C(null);try{let e=S?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:G(),apiKey:e,model:A,agentModels:M})}),s=await t.json();t.ok?(C({type:"success",text:"Settings applied successfully!"}),q()):C({type:"error",text:s.error||"Failed to apply settings"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},Z=async()=>{w(!0),C(null);try{let e=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:"Settings reset successfully!"}),E(""),_(""),q()):C({type:"error",text:t.error||"Failed to reset settings"})}catch(e){C({type:"error",text:e.message})}finally{w(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/openclaw.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===H&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===H&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===H&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!y&&g&&!g.installed&&(0,l.jsx)("div",{className:"flex flex-col gap-4",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>L(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!y&&g?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[g?.settings?.models?.providers?.["9router"]?.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:g.settings.models.providers["9router"].baseUrl})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(u=z||W()).endsWith("/v1")?u:`${u}/v1`,onChange:e=>D(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),z&&z!==n&&(0,l.jsx)("button",{onClick:()=>D(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:S,onChange:e=>_(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Default Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:A,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>{R(null),T(!0)},disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(g.agents||[]).filter(e=>e.agentDir).map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-4",children:[(0,l.jsxs)("span",{className:"w-32 shrink-0 text-xs text-primary text-right truncate",title:e.name||e.id,children:["Agent ",e.name||e.id]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:M[e.id]||"",onChange:t=>O(s=>({...s,[e.id]:t.target.value})),placeholder:`default (${A||"provider/model-id"})`,className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>{R(e.id),T(!0)},disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),M[e.id]&&(0,l.jsx)("button",{onClick:()=>O(t=>({...t,[e.id]:""})),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.id))]}),k&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===k.type?"check_circle":"error"}),(0,l.jsx)("span",{children:k.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:J,disabled:!A,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Z,disabled:!g?.has9Router,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>L(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:P,onClose:()=>T(!1),onSelect:e=>{I?(O(t=>({...t,[I]:e.value})),R(null)):E(e.value),T(!1)},selectedModel:A,activeProviders:c,modelAliases:$,title:"Select Model for Open Claw"}),(0,l.jsx)(r.uR,{isOpen:K,onClose:()=>L(!1),title:"Open Claw - Manual Configuration",configs:(h=S&&S.trim()?S:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`9router/${A||"provider/model-id"}`}}},models:{providers:{"9router":{baseUrl:G(),apiKey:h,api:"openai-completions",models:[{id:A||"provider/model-id",name:(A||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}let p="/api/cli-tools/hermes-settings";function u({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:c,cloudEnabled:x,initialStatus:m}){let h,[g,f]=(0,a.useState)(m||null),[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),[S,_]=(0,a.useState)(""),[A,E]=(0,a.useState)(""),[M,O]=(0,a.useState)(!1),[I,R]=(0,a.useState)({}),[P,T]=(0,a.useState)(!1),[$,U]=(0,a.useState)(""),K=(0,a.useRef)(!1),L=(()=>{if(!g?.installed)return null;let e=g.settings?.model;if(!e?.base_url)return"not_configured";let t=/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(e.base_url),s=n&&e.base_url.startsWith(n);return t||s?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!S&&_(d[0].key)},[d,S]),(0,a.useEffect)(()=>{m&&f(m)},[m]),(0,a.useEffect)(()=>{t&&!g&&(D(),z()),t&&z()},[t]);let z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&R(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(g?.installed&&!K.current){K.current=!0;let e=g.settings?.model;e?.default&&E(e.default)}},[g]);let D=async()=>{b(!0);try{let e=await fetch(p),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},F=()=>{let e=$||window.location.origin.replace("://localhost","://127.0.0.1");return e.endsWith("/v1")?e:`${e}/v1`},H=async()=>{N(!0),C(null);try{let e=S?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch(p,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:F(),apiKey:e,model:A})}),s=await t.json();t.ok?(C({type:"success",text:"Settings applied successfully!"}),D()):C({type:"error",text:s.error||"Failed to apply settings"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},B=async()=>{w(!0),C(null);try{let e=await fetch(p,{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:"Settings reset successfully!"}),E(""),D()):C({type:"error",text:t.error||"Failed to reset settings"})}catch(e){C({type:"error",text:e.message})}finally{w(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/hermes.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===L&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===L&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===L&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Hermes Agent..."})]}),!y&&g&&!g.installed&&(0,l.jsx)("div",{className:"flex flex-col gap-4",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Hermes Agent not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Install: curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash"})]})]}),(0,l.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>T(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!y&&g?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[g?.settings?.model?.base_url&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:g.settings.model.base_url})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:F(),onChange:e=>U(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),$&&$!==n&&(0,l.jsx)("button",{onClick:()=>U(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:S,onChange:e=>_(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Default Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:A,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>O(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),k&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===k.type?"check_circle":"error"}),(0,l.jsx)("span",{children:k.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:H,disabled:!A,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:B,disabled:!g?.has9Router,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>T(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:M,onClose:()=>O(!1),onSelect:e=>{E(e.value),O(!1)},selectedModel:A,activeProviders:c,modelAliases:I,title:"Select Model for Hermes Agent"}),(0,l.jsx)(r.uR,{isOpen:P,onClose:()=>T(!1),title:"Hermes Agent - Manual Configuration",configs:(h=S&&S.trim()?S:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.hermes/config.yaml",content:`model:
12
+ `},{filename:"~/.codex/auth.json",content:JSON.stringify({auth_mode:"apikey",OPENAI_API_KEY:h},null,2)}])})]})}let c=s(89651).env.NEXT_PUBLIC_CLOUD_URL;function x({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:m,cloudEnabled:p,initialStatus:u}){let h,g,f,y,[b,j]=(0,a.useState)(u||null),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),[_,A]=(0,a.useState)(null),[E,O]=(0,a.useState)(""),[M,I]=(0,a.useState)([]),[R,T]=(0,a.useState)(""),[P,$]=(0,a.useState)(!1),[L,U]=(0,a.useState)({}),[K,z]=(0,a.useState)(!1),[D,F]=(0,a.useState)(!1),[H,B]=(0,a.useState)(""),q=(0,a.useRef)(!1),W=(()=>{if(!b?.installed)return null;let e=b.settings?.customModels?.find(e=>e.id?.startsWith("custom:9Router"));if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=p&&c&&e.baseUrl?.startsWith(c),l=n&&e.baseUrl?.startsWith(n);return t||s||l?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!E&&O(d[0].key)},[d,E]),(0,a.useEffect)(()=>{u&&j(u)},[u]),(0,a.useEffect)(()=>{t&&!b&&(J(),G()),t&&G()},[t]);let G=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&U(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(b?.installed&&!q.current){q.current=!0;let e=(b.settings?.customModels||[]).filter(e=>e.id?.startsWith("custom:9Router")).sort((e,t)=>(e.index||0)-(t.index||0)).map(e=>e.model);if(e.length>0)I(e);else{let e=b.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);e?.model&&I([e.model])}}},[b]);let J=async()=>{v(!0);try{let e=await fetch("/api/cli-tools/droid-settings"),t=await e.json();j(t)}catch(e){j({installed:!1,error:e.message})}finally{v(!1)}},Z=()=>{let e=H||n;return e.endsWith("/v1")?e:`${e}/v1`},Y=()=>{let e=R.trim();!e||M.includes(e)||(I(t=>[...t,e]),T(""))},V=async()=>{k(!0),A(null);try{let e=E?.trim()||(d?.length>0?d[0].key:null)||(p?null:"sk_9router"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Z(),apiKey:e,models:M,activeModel:M[0]||""})}),s=await t.json();t.ok?(A({type:"success",text:"Settings applied successfully!"}),J()):A({type:"error",text:s.error||"Failed to apply settings"})}catch(e){A({type:"error",text:e.message})}finally{k(!1)}},X=async()=>{S(!0),A(null);try{let e=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),t=await e.json();e.ok?(A({type:"success",text:"Settings reset successfully!"}),I([]),J()):A({type:"error",text:t.error||"Failed to reset settings"})}catch(e){A({type:"error",text:e.message})}finally{S(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/droid.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[N&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!N&&b&&!b.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>z(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>F(!D),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:D?"expand_less":"help"}),D?"Hide":"How to Install"]})]})]}),D&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"curl -fsSL https://app.factory.ai/cli | sh"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"droid"})," to verify."]})]})]})]}),!N&&b?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[b?.settings?.customModels?.find(e=>e.id?.startsWith("custom:9Router"))?.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:b.settings.customModels.find(e=>e.id?.startsWith("custom:9Router")).baseUrl})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(h=H||n).endsWith("/v1")?h:`${h}/v1`,onChange:e=>B(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),H&&H!==n&&(0,l.jsx)("button",{onClick:()=>B(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:E,onChange:e=>O(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:p?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:["Models ",M.length>0&&(0,l.jsxs)("span",{className:"text-primary",children:["(",M.length,")"]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col gap-1",children:[M.length>0&&(0,l.jsx)("div",{className:"flex flex-col gap-0.5 mb-1",children:M.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-bg-secondary rounded border border-border",children:[(0,l.jsx)("span",{className:"flex-1 text-xs font-mono truncate",children:e}),(0,l.jsx)("button",{onClick:()=>I(t=>t.filter(t=>t!==e)),className:"text-text-muted hover:text-red-500 transition-colors shrink-0",title:"Remove",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e))}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("input",{type:"text",value:R,onChange:e=>T(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Y())},placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>$(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs shrink-0 ${o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),(0,l.jsx)("button",{onClick:Y,disabled:!R.trim(),className:"px-2 py-1.5 rounded border bg-surface border-border hover:border-primary text-xs shrink-0 disabled:opacity-50",title:"Add model",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"})})]})]})]})]}),_&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===_.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===_.type?"check_circle":"error"}),(0,l.jsx)("span",{children:_.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:V,disabled:0===M.length,loading:w,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:X,disabled:!b?.has9Router,loading:C,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>z(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:P,onClose:()=>$(!1),onSelect:e=>{!e.value||M.includes(e.value)||(I(t=>[...t,e.value]),$(!1))},selectedModel:null,activeProviders:m,modelAliases:L,title:"Select Model for Factory Droid"}),(0,l.jsx)(r.uR,{isOpen:K,onClose:()=>z(!1),title:"Factory Droid - Manual Configuration",configs:(g=E&&E.trim()?E:p?"<API_KEY_FROM_DASHBOARD>":"sk_9router",f={customModels:M.map((e,t)=>({model:e,id:`custom:9Router-${t}`,index:t,baseUrl:Z(),apiKey:g,displayName:e,maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}))},y="u">typeof navigator&&navigator.platform,[{filename:y?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(f,null,2)}])})]})}function m({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:c,cloudEnabled:x,initialStatus:p}){let u,h,[g,f]=(0,a.useState)(p||null),[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),[S,_]=(0,a.useState)(""),[A,E]=(0,a.useState)(""),[O,M]=(0,a.useState)({}),[I,R]=(0,a.useState)(null),[T,P]=(0,a.useState)(!1),[$,L]=(0,a.useState)({}),[U,K]=(0,a.useState)(!1),[z,D]=(0,a.useState)(""),F=(0,a.useRef)(!1),H=(()=>{if(!g?.installed)return null;let e=g.settings?.models?.providers?.["9router"];if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1")||e.baseUrl?.includes("0.0.0.0"),s=n&&e.baseUrl?.startsWith(n);return t||s?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!S&&_(d[0].key)},[d,S]),(0,a.useEffect)(()=>{p&&f(p)},[p]),(0,a.useEffect)(()=>{t&&!g&&(q(),B()),t&&B()},[t]);let B=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&L(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(g?.installed&&!F.current){F.current=!0;let e=g.settings?.models?.providers?.["9router"];if(e){let t=g.settings?.agents?.defaults?.model?.primary;t&&E(t.replace("9router/","")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&_(e.apiKey)}let t=g.agents||[],s={};t.forEach(e=>{e.currentModel&&(s[e.id]=e.currentModel)}),M(s)}},[g,d]);let q=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/openclaw-settings"),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},W=()=>window.location.origin.replace("://localhost","://127.0.0.1"),G=()=>{let e=z||W();return e.endsWith("/v1")?e:`${e}/v1`},J=async()=>{N(!0),C(null);try{let e=S?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:G(),apiKey:e,model:A,agentModels:O})}),s=await t.json();t.ok?(C({type:"success",text:"Settings applied successfully!"}),q()):C({type:"error",text:s.error||"Failed to apply settings"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},Z=async()=>{w(!0),C(null);try{let e=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:"Settings reset successfully!"}),E(""),_(""),q()):C({type:"error",text:t.error||"Failed to reset settings"})}catch(e){C({type:"error",text:e.message})}finally{w(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/openclaw.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===H&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===H&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===H&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!y&&g&&!g.installed&&(0,l.jsx)("div",{className:"flex flex-col gap-4",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>K(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!y&&g?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[g?.settings?.models?.providers?.["9router"]?.baseUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:g.settings.models.providers["9router"].baseUrl})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(u=z||W()).endsWith("/v1")?u:`${u}/v1`,onChange:e=>D(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),z&&z!==n&&(0,l.jsx)("button",{onClick:()=>D(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:S,onChange:e=>_(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Default Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:A,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>{R(null),P(!0)},disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(g.agents||[]).filter(e=>e.agentDir).map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-4",children:[(0,l.jsxs)("span",{className:"w-32 shrink-0 text-xs text-primary text-right truncate",title:e.name||e.id,children:["Agent ",e.name||e.id]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:O[e.id]||"",onChange:t=>M(s=>({...s,[e.id]:t.target.value})),placeholder:`default (${A||"provider/model-id"})`,className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>{R(e.id),P(!0)},disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),O[e.id]&&(0,l.jsx)("button",{onClick:()=>M(t=>({...t,[e.id]:""})),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.id))]}),k&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===k.type?"check_circle":"error"}),(0,l.jsx)("span",{children:k.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:J,disabled:!A,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:Z,disabled:!g?.has9Router,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>K(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:T,onClose:()=>P(!1),onSelect:e=>{I?(M(t=>({...t,[I]:e.value})),R(null)):E(e.value),P(!1)},selectedModel:A,activeProviders:c,modelAliases:$,title:"Select Model for Open Claw"}),(0,l.jsx)(r.uR,{isOpen:U,onClose:()=>K(!1),title:"Open Claw - Manual Configuration",configs:(h=S&&S.trim()?S:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`9router/${A||"provider/model-id"}`}}},models:{providers:{"9router":{baseUrl:G(),apiKey:h,api:"openai-completions",models:[{id:A||"provider/model-id",name:(A||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}let p="/api/cli-tools/hermes-settings";function u({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:c,cloudEnabled:x,initialStatus:m}){let h,[g,f]=(0,a.useState)(m||null),[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),[S,_]=(0,a.useState)(""),[A,E]=(0,a.useState)(""),[O,M]=(0,a.useState)(!1),[I,R]=(0,a.useState)({}),[T,P]=(0,a.useState)(!1),[$,L]=(0,a.useState)(""),U=(0,a.useRef)(!1),K=(()=>{if(!g?.installed)return null;let e=g.settings?.model;if(!e?.base_url)return"not_configured";let t=/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(e.base_url),s=n&&e.base_url.startsWith(n);return t||s?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!S&&_(d[0].key)},[d,S]),(0,a.useEffect)(()=>{m&&f(m)},[m]),(0,a.useEffect)(()=>{t&&!g&&(D(),z()),t&&z()},[t]);let z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&R(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(g?.installed&&!U.current){U.current=!0;let e=g.settings?.model;e?.default&&E(e.default)}},[g]);let D=async()=>{b(!0);try{let e=await fetch(p),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},F=()=>{let e=$||window.location.origin.replace("://localhost","://127.0.0.1");return e.endsWith("/v1")?e:`${e}/v1`},H=async()=>{N(!0),C(null);try{let e=S?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch(p,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:F(),apiKey:e,model:A})}),s=await t.json();t.ok?(C({type:"success",text:"Settings applied successfully!"}),D()):C({type:"error",text:s.error||"Failed to apply settings"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},B=async()=>{w(!0),C(null);try{let e=await fetch(p,{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:"Settings reset successfully!"}),E(""),D()):C({type:"error",text:t.error||"Failed to reset settings"})}catch(e){C({type:"error",text:e.message})}finally{w(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/hermes.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===K&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===K&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===K&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Hermes Agent..."})]}),!y&&g&&!g.installed&&(0,l.jsx)("div",{className:"flex flex-col gap-4",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Hermes Agent not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Install: curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash"})]})]}),(0,l.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>P(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!y&&g?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[g?.settings?.model?.base_url&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:g.settings.model.base_url})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:F(),onChange:e=>L(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),$&&$!==n&&(0,l.jsx)("button",{onClick:()=>L(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:S,onChange:e=>_(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Default Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:A,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>M(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),k&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===k.type?"check_circle":"error"}),(0,l.jsx)("span",{children:k.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:H,disabled:!A,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:B,disabled:!g?.has9Router,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>P(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:O,onClose:()=>M(!1),onSelect:e=>{E(e.value),M(!1)},selectedModel:A,activeProviders:c,modelAliases:I,title:"Select Model for Hermes Agent"}),(0,l.jsx)(r.uR,{isOpen:T,onClose:()=>P(!1),title:"Hermes Agent - Manual Configuration",configs:(h=S&&S.trim()?S:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.hermes/config.yaml",content:`model:
13
13
  default: "${A||"provider/model-id"}"
14
14
  provider: "custom"
15
15
  base_url: "${F()}"
16
16
  `},{filename:"~/.hermes/.env",content:`OPENAI_API_KEY=${h}
17
- `}])})]})}var h=s(96459);function g({toolId:e,tool:t,isExpanded:s,onToggle:n,baseUrl:o,apiKeys:d,activeProviders:c=[],cloudEnabled:x=!1,tunnelEnabled:m=!1}){let[p,u]=(0,a.useState)(null),[f,y]=(0,a.useState)(!1),[b,j]=(0,a.useState)(""),[N,v]=(0,a.useState)(()=>d?.length>0?d[0].key:""),w=e=>{let t=N&&N.trim()?N:x?"your-api-key":"sk_9router",s=o||"http://localhost:20128",l=s.endsWith("/v1")?s:`${s}/v1`;return e.replace(/\{\{baseUrl\}\}/g,l).replace(/\{\{apiKey\}\}/g,t).replace(/\{\{model\}\}/g,b||"provider/model-id")},{copy:k}=(0,h.C)(),C=async(e,t)=>{await k(w(e),`toolcard-${t}`),u(t),setTimeout(()=>u(null),2e3)},S=c.length>0,_=()=>(!t.requiresExternalUrl||!!x||!!m)&&(!t.requiresCloud||!!x);return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:n,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:t.image?(0,l.jsx)(i.default,{src:t.image,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}}):t.icon?(0,l.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:t.color},children:t.icon}):(0,l.jsx)(i.default,{src:`/providers/${e}.png`,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:t.name}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:t.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,l.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:t.guideSteps?(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[t.notes&&0!==t.notes.length?(0,l.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:t.notes.map((e,t)=>{if("cloudCheck"===e.type&&(x||m))return null;let s="warning"===e.type,a="cloudCheck"===e.type&&!x&&!m,r="bg-blue-500/10 border-blue-500/30",i="text-blue-600 dark:text-blue-400",n="text-blue-500",o="info";return s?(r="bg-yellow-500/10 border-yellow-500/30",i="text-yellow-600 dark:text-yellow-400",n="text-yellow-500",o="warning"):a&&(r="bg-red-500/10 border-red-500/30",i="text-red-600 dark:text-red-400",n="text-red-500",o="error"),(0,l.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${r}`,children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-lg ${n}`,children:o}),(0,l.jsx)("p",{className:`text-sm ${i}`,children:e.text})]},t)})}):null,_()&&t.guideSteps.map(e=>(0,l.jsxs)("div",{className:"flex items-start gap-4",children:[(0,l.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:t.color},children:e.step}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"font-medium text-text",children:e.title}),e.desc&&(0,l.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:e.desc}),"apiKeySelector"===e.type&&(0,l.jsx)("div",{className:"mt-2 flex items-center gap-2",children:d&&d.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("select",{value:N,onChange:e=>v(e.target.value),className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}),(0,l.jsx)("button",{onClick:()=>C(N,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===p?"check":"content_copy"})})]}):(0,l.jsx)("span",{className:"text-sm text-text-muted",children:x?"No API keys - Create one in Keys page":"sk_9router"})}),"modelSelector"===e.type&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("input",{type:"text",value:b,onChange:e=>j(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>y(!0),disabled:!S,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${S?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),b&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{onClick:()=>C(b,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===p?"check":"content_copy"})}),(0,l.jsx)("button",{onClick:()=>j(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),e.value&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:w(e.value)}),e.copyable&&(0,l.jsx)("button",{onClick:()=>C(e.value,`${e.step}-${e.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:p===`${e.step}-${e.title}`?"check":"content_copy"})})]})]})]},e.step)),_()&&t.codeBlock&&(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:t.codeBlock.language}),(0,l.jsxs)("button",{onClick:()=>C(t.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===p?"check":"content_copy"}),"codeblock"===p?"Copied!":"Copy"]})]}),(0,l.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,l.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:w(t.codeBlock.code)})})]})]}):(0,l.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,l.jsx)(r.rq,{isOpen:f,onClose:()=>y(!1),onSelect:e=>{j(e.value)},selectedModel:b,activeProviders:c,title:"Select Model"})]})}function f({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d,cloudEnabled:c,initialStatus:x}){let m,p,u,h,g,[y,b]=(0,a.useState)(x||null),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)(null),[A,E]=(0,a.useState)(!1),[M,O]=(0,a.useState)(""),[I,R]=(0,a.useState)(""),[P,T]=(0,a.useState)(""),[$,U]=(0,a.useState)(!1),[K,L]=(0,a.useState)(!1),[z,D]=(0,a.useState)({}),[F,H]=(0,a.useState)(!1),[B,q]=(0,a.useState)(""),[W,G]=(0,a.useState)([]),[J,Z]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!M&&O(o[0].key)},[o,M]),(0,a.useEffect)(()=>{x&&b(x)},[x]),(0,a.useEffect)(()=>{t&&!y&&(Q(),Y()),t&&Y()},[t]),(0,a.useEffect)(()=>{y?.opencode?.models&&G(y.opencode.models),y?.opencode?.activeModel&&Z(y.opencode.activeModel),y?.config?.agent?.explorer?.model?.startsWith("9router/")&&T(y.config.agent.explorer.model.replace("9router/",""))},[y]);let Y=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&D(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}},V=(()=>{if(!y?.installed)return null;if(!y.config)return"not_configured";let e=y.config?.provider?.["9router"]?.options?.baseURL||"",t=e.includes("localhost")||e.includes("127.0.0.1");return y.has9Router&&(t||e.includes(n))?"configured":y.has9Router?"other":"not_configured"})(),X=()=>{let e=B||n;return e.endsWith("/v1")?e:`${e}/v1`},Q=async()=>{N(!0);try{let e=await fetch("/api/cli-tools/opencode-settings"),t=await e.json();b(t)}catch(e){b({installed:!1,error:e.message})}finally{N(!1)}},ee=async()=>{w(!0),_(null);try{let e=M&&M.trim()||c?M:"sk_9router",t=await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:X(),apiKey:e,models:W,activeModel:""===J?"":J||W[0],subagentModel:P})}),s=await t.json();t.ok?(_({type:"success",text:"Settings applied successfully!"}),Q()):_({type:"error",text:s.error||"Failed to apply settings"})}catch(e){_({type:"error",text:e.message})}finally{w(!1)}},et=async()=>{C(!0),_(null);try{let e=await fetch("/api/cli-tools/opencode-settings",{method:"DELETE"}),t=await e.json();e.ok?(_({type:"success",text:"Settings reset successfully!"}),R(""),T(""),G([]),Z(""),Q()):_({type:"error",text:t.error||"Failed to reset settings"})}catch(e){_({type:"error",text:e.message})}finally{C(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/opencode.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===V&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===V&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===V&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking OpenCode CLI..."})]}),!j&&y&&!y.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"OpenCode CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>H(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>E(!A),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:A?"expand_less":"help"}),A?"Hide":"How to Install"]})]})]}),A&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g opencode-ai"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"opencode"})," to verify."]})]})]})]}),!j&&y?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[y?.config?.provider?.["9router"]?.options?.baseURL&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:y.config.provider["9router"].options.baseURL})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:B||`${n}/v1`,onChange:e=>q(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),B&&B!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>q(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),o.length>0?(0,l.jsx)("select",{value:M,onChange:e=>O(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:c?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-start gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Models"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,l.jsx)("div",{className:"flex flex-wrap gap-1.5 min-h-[28px] px-2 py-1.5 bg-surface rounded border border-border",children:0===W.length?(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected"}):W.map(e=>(0,l.jsxs)("span",{onClick:async()=>{if(e===J)try{(await fetch("/api/cli-tools/opencode-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({clearActiveModel:!0})})).ok&&(Z(""),Q())}catch(e){console.log("Error clearing active model:",e)}else Z(e)},className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs cursor-pointer transition-colors ${e===J?"bg-primary/10 text-primary border border-primary":"bg-black/5 dark:bg-white/5 text-text-muted border border-transparent hover:border-border"}`,title:e===J?"Click to clear active model":"Click to set as active",children:[e===J&&(0,l.jsx)("span",{className:"material-symbols-outlined text-[10px]",children:"star"}),e,(0,l.jsx)("button",{onClick:async t=>{t.stopPropagation();try{if((await fetch(`/api/cli-tools/opencode-settings?model=${encodeURIComponent(e)}`,{method:"DELETE"})).ok){let t=W.filter(t=>t!==e);G(t),J===e&&Z(""),Q()}}catch(e){console.log("Error removing model:",e)}},className:"ml-0.5 hover:text-red-500",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e))}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("button",{onClick:()=>U(!0),disabled:!d?.length,className:`px-2 py-1 rounded border text-xs transition-colors ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Add Model"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:W.length>0&&J?(0,l.jsxs)(l.Fragment,{children:["Active: ",(0,l.jsx)("span",{className:"text-primary",children:J})]}):W.length>0?(0,l.jsx)("span",{className:"text-yellow-500",children:"Click a model to set/clear active"}):"Select models to add"})]})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Subagent Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:P,onChange:e=>T(e.target.value),placeholder:I||"provider/model-id (defaults to main model)",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>L(!0),disabled:!d?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),P&&(0,l.jsx)("button",{onClick:()=>T(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),S&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===S.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===S.type?"check_circle":"error"}),(0,l.jsx)("span",{children:S.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:ee,disabled:0===W.length,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:et,disabled:!y.has9Router,loading:k,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>H(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:$,onClose:()=>U(!1),onSelect:e=>{!W.includes(e.value)&&(G([...W,e.value]),J||Z(e.value)),U(!1)},selectedModel:null,activeProviders:d,modelAliases:z,title:"Add Model for OpenCode"}),(0,l.jsx)(r.rq,{isOpen:K,onClose:()=>L(!1),onSelect:e=>{T(e.value),L(!1)},selectedModel:P,activeProviders:d,modelAliases:z,title:"Select Subagent Model for OpenCode"}),(0,l.jsx)(r.uR,{isOpen:F,onClose:()=>H(!1),title:"OpenCode - Manual Configuration",configs:(m=M&&M.trim()?M:c?"<API_KEY_FROM_DASHBOARD>":"sk_9router",p=W.length>0?W:["provider/model-id"],u=J||W[0]||p[0],h=P||u,g={},p.forEach(e=>{g[e]={name:e}}),[{filename:"~/.config/opencode/opencode.json",content:JSON.stringify({provider:{"9router":{npm:"@ai-sdk/openai-compatible",options:{baseURL:X(),apiKey:m},models:g}},model:`9router/${u}`,agent:{explorer:{description:"Fast explorer subagent for codebase exploration",mode:"subagent",model:`9router/${h}`}}},null,2)}])})]})}let y="http://localhost:20128";function b({apiKeys:e,cloudEnabled:t,onStatusChange:s}){let[i,n]=(0,a.useState)(null),[o,d]=(0,a.useState)(!1),[c,x]=(0,a.useState)(!1),[m,p]=(0,a.useState)(""),[u,h]=(0,a.useState)(""),[g,f]=(0,a.useState)(null),[j,N]=(0,a.useState)(null),[v,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(y),S="u">typeof navigator&&navigator.userAgent?.includes("Windows"),_=i?.isAdmin!==!1;(0,a.useEffect)(()=>{e?.length>0&&!u&&h(e[0].key)},[e,u]),(0,a.useEffect)(()=>{A()},[]);let A=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();n(t),t.mitmRouterBaseUrl&&C(t.mitmRouterBaseUrl),s?.(t)}}catch{n({running:!1,certExists:!1,dnsStatus:{}})}},E=e=>{w(null),S||i?.hasCachedPassword?M(e,""):(f(e),x(!0),N(null))},M=async(s,l)=>{d(!0),w(null);try{let a;if("trust-cert"===s)a=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:l})});else if("start"===s){let s=u?.trim()||(e?.length>0?e[0].key:null)||(t?null:"sk_9router");a=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:s,sudoPassword:l,mitmRouterBaseUrl:k.trim()||y})})}else a=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:l})});if(!a.ok){let e=await a.json().catch(()=>({}));w(e.error||`Failed to ${s} MITM server`);return}x(!1),p(""),await A()}catch(e){w(e.message||"Network error")}finally{d(!1),f(null)}},O=()=>{m.trim()?M(g,m):N("Sudo password is required")},I=i?.running;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,l.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),I?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Running"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,l.jsx)("div",{className:"flex items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:i?.certExists},{label:"Trusted",ok:i?.certTrusted},{label:"Server",ok:I}].map(({label:e,ok:t})=>(0,l.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${t?"text-green-600":"text-text-muted"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:t?"check_circle":"cancel"}),e]},e))})]}),(0,l.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from 9Router"]}),(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Antigravity/Copilot IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → 9Router → response to Antigravity/Copilot"]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"9Router Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:k,onChange:e=>C(e.target.value),placeholder:y,disabled:I,className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]}),!I&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),e?.length>0?(0,l.jsx)("select",{value:u,onChange:e=>h(e.target.value),className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded text-xs border border-border text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50",children:e.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted",children:t?"No API keys — create one in Keys page":"sk_9router (default)"})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap","data-i18n-skip":"true",children:[i?.certExists&&!i?.certTrusted&&(0,l.jsxs)("button",{onClick:()=>E("trust-cert"),disabled:o,className:"px-4 py-1.5 rounded-lg bg-yellow-500/10 border border-yellow-500/30 text-yellow-600 font-medium text-xs flex items-center gap-1.5 hover:bg-yellow-500/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),I?(0,l.jsxs)("button",{onClick:()=>E("stop"),disabled:o,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,l.jsxs)("button",{onClick:()=>E("start"),disabled:o||S&&!_,className:"px-4 py-1.5 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-xs flex items-center gap-1.5 hover:bg-primary/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),I&&(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),v&&(0,l.jsxs)("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5 shrink-0",children:"error"}),(0,l.jsx)("span",{children:v})]}),S&&!_&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 border border-red-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"shield_lock"}),(0,l.jsx)("span",{children:"Administrator required — restart 9Router as Administrator to use MITM"})]})]})}),c&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:m,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"!==e.key||o||O()}}),j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:j})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{x(!1),p(""),N(null)},disabled:o,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:O,loading:o,children:"Confirm"})]})]})})]})}function j({tool:e,isExpanded:t,onToggle:s,serverRunning:n,dnsActive:o,hasCachedPassword:d,apiKeys:c,activeProviders:x,hasActiveProviders:m,modelAliases:p={},cloudEnabled:u,onDnsChange:h}){let[g,f]=(0,a.useState)(!1),[y,b]=(0,a.useState)(null),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(""),[C,S]=(0,a.useState)(null),[_,A]=(0,a.useState)(null),[E,M]=(0,a.useState)({}),[O,I]=(0,a.useState)(!1),[R,P]=(0,a.useState)(null),T="u">typeof navigator&&navigator.userAgent?.includes("Windows");(0,a.useEffect)(()=>{t&&$()},[t]);let $=async()=>{try{let t=await fetch(`/api/cli-tools/antigravity-mitm/alias?tool=${e.id}`);if(t.ok){let e=await t.json();Object.keys(e.aliases||{}).length>0&&M(e.aliases)}}catch{}},U=(0,a.useCallback)(async t=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,mappings:t})})}catch{}},[e.id]),K=(e,t)=>{M(s=>({...s,[e]:t}))},L=()=>{if(!n)return;let e=o?"disable":"enable";T||d?z(e,""):(S(e),v(!0),A(null))},z=async(t,s)=>{f(!0),b(null);try{let l=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,action:t,sudoPassword:s})}),a=await l.json();if(!l.ok)throw Error(a.error||"Failed to toggle DNS");"enable"===t&&b(`Restart ${e.name} to apply changes`),v(!1),k(""),h?.(a)}catch{}finally{f(!1),S(null)}},D=()=>{w.trim()?z(C,w):A("Sudo password is required")};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),n?o?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Active"}):(0,l.jsx)(r.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,l.jsxs)("p",{className:"text-xs text-text-muted",children:["Intercept ",e.name," requests via MITM proxy"]})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,l.jsxs)("p",{children:["Toggle DNS to redirect ",e.name," traffic through 9Router via MITM."]}),!o&&(0,l.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),e.defaultModels?.length>0&&(0,l.jsx)("div",{className:"flex flex-col gap-2",children:e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-36 shrink-0 text-xs font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:E[e.alias]||"",onChange:t=>K(e.alias,t.target.value),onBlur:t=>{var s,l;return s=e.alias,l=t.target.value,void U({...E,[s]:l})},placeholder:"provider/model-id",disabled:!o,className:`flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 ${!o?"opacity-50 cursor-not-allowed":""}`}),(0,l.jsx)("button",{onClick:()=>{P(e.alias),I(!0)},disabled:!m||!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 ${m&&o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),E[e.alias]&&(0,l.jsx)("button",{onClick:()=>{K(e.alias,""),U({...E,[e.alias]:""})},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias))}),e.defaultModels?.length===0&&(0,l.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 items-start",children:[o?(0,l.jsxs)("button",{onClick:L,disabled:!n||g,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,l.jsxs)("button",{onClick:L,disabled:!n||g,className:"px-4 py-1.5 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-xs flex items-center gap-1.5 hover:bg-primary/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start DNS"]}),y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs text-amber-500",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,l.jsx)("span",{children:y})]})]})]})]}),N&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:w,onChange:e=>k(e.target.value),onKeyDown:e=>{"Enter"!==e.key||g||D()}}),_&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:_})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{v(!1),k(""),A(null)},disabled:g,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:D,loading:g,children:"Confirm"})]})]})}),(0,l.jsx)(r.rq,{isOpen:O,onClose:()=>I(!1),onSelect:e=>{if(!R||e.isPlaceholder)return;let t={...E,[R]:e.value};M(t),U(t)},selectedModel:R?E[R]:null,activeProviders:x,modelAliases:p,title:`Select model for ${R}`})]})}var N=s(99568),v=s.n(N);function w({tool:e}){return(0,l.jsx)(v(),{href:"/dashboard/mitm",className:"block",children:(0,l.jsx)(r.Zp,{padding:"sm",className:"overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded-full",children:"MITM"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"chevron_right"})]})})})}},97990:(e,t,s)=>{s.d(t,{dM:()=>a,wn:()=>l});let l={antigravity:{id:"antigravity",name:"Antigravity",image:"/providers/antigravity.png",color:"#4285F4",description:"Google Antigravity IDE with MITM",configType:"mitm",mitmDomain:"daily-cloudcode-pa.googleapis.com",modelAliases:["claude-opus-4-6-thinking","claude-sonnet-4-6","gemini-3-flash","gpt-oss-120b-medium","gemini-3-pro-high","gemini-3-pro-low"],defaultModels:[{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro High",alias:"gemini-3.1-pro-high"},{id:"gemini-3.1-pro-low",name:"Gemini 3.1 Pro Low",alias:"gemini-3.1-pro-low"},{id:"gemini-3-flash",name:"Gemini 3 Flash",alias:"gemini-3-flash"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"claude-sonnet-4-6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",alias:"claude-opus-4-6-thinking"},{id:"gpt-oss-120b-medium",name:"GPT OSS 120B Medium",alias:"gpt-oss-120b-medium"}]},copilot:{id:"copilot",name:"GitHub Copilot",image:"/providers/copilot.png",color:"#1F6FEB",description:"GitHub Copilot IDE with MITM",configType:"mitm",mitmDomain:"api.individual.githubcopilot.com",modelAliases:["gpt-4o-mini","claude-haiku-4.5","gpt-4o","gpt-5-mini"],defaultModels:[{id:"gpt-4o",name:"GPT-4o",alias:"gpt-4o"},{id:"gpt-4.1",name:"GPT-4.1",alias:"gpt-4.1"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"}]},kiro:{id:"kiro",name:"Kiro",image:"/providers/kiro.png",color:"#FF6B00",description:"Kiro IDE with MITM",configType:"mitm",mitmDomain:"q.us-east-1.amazonaws.com",defaultModels:[{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",alias:"claude-sonnet-4.5"},{id:"claude-sonnet-4",name:"Claude Sonnet 4",alias:"claude-sonnet-4"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"},{id:"deepseek-3.2",name:"DeepSeek 3.2",alias:"deepseek-3.2"},{id:"minimax-m2.1",name:"MiniMax M2.1",alias:"minimax-m2.1"},{id:"simple-task",name:"Qwen3 Coder Next",alias:"simple-task"}]}},a={claude:{id:"claude",name:"Claude Code",icon:"terminal",color:"#D97757",description:"Anthropic Claude Code CLI",configType:"env",envVars:{baseUrl:"ANTHROPIC_BASE_URL",model:"ANTHROPIC_MODEL",opusModel:"ANTHROPIC_DEFAULT_OPUS_MODEL",sonnetModel:"ANTHROPIC_DEFAULT_SONNET_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-4-6"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-4-6"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},openclaw:{id:"openclaw",name:"Open Claw",image:"/providers/openclaw.png",color:"#FF6B35",description:"Open Claw AI Assistant",configType:"custom"},codex:{id:"codex",name:"OpenAI Codex CLI",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},opencode:{id:"opencode",name:"OpenCode",image:"/providers/opencode.png",color:"#E87040",description:"OpenCode AI Terminal Assistant",configType:"custom"},droid:{id:"droid",name:"Factory Droid",image:"/providers/droid.png",color:"#00D4FF",description:"Factory Droid AI Assistant",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresExternalUrl:!0,notes:[{type:"warning",text:"Requires Cursor Pro account to use this feature."},{type:"cloudCheck",text:"Cursor routes requests through its own server, so local endpoint is not supported. Please enable Tunnel or Cloud Endpoint in Settings."}],guideSteps:[{step:1,title:"Open Settings",desc:"Go to Settings → Models"},{step:2,title:"Enable OpenAI API",desc:'Enable "OpenAI API key" option'},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Add Custom Model",desc:'Click "View All Model" → "Add Custom Model"'},{step:6,title:"Select Model",type:"modelSelector"}]},cline:{id:"cline",name:"Cline",image:"/providers/cline.png",color:"#00D1B2",description:"Cline AI Coding Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Cline Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},kilo:{id:"kilo",name:"Kilo Code",image:"/providers/kilocode.png",color:"#FF6B6B",description:"Kilo Code AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Kilo Code Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},roo:{id:"roo",name:"Roo",image:"/providers/roo.png",color:"#FF6B6B",description:"Roo AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Roo Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → Ollama"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Config",desc:"Open Continue configuration file"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Model",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Add the following configuration to your models array:"}],codeBlock:{language:"json",code:`{
17
+ `}])})]})}var h=s(96459);function g({toolId:e,tool:t,isExpanded:s,onToggle:n,baseUrl:o,apiKeys:d,activeProviders:c=[],cloudEnabled:x=!1,tunnelEnabled:m=!1}){let[p,u]=(0,a.useState)(null),[f,y]=(0,a.useState)(!1),[b,j]=(0,a.useState)(""),[N,v]=(0,a.useState)(()=>d?.length>0?d[0].key:""),w=e=>{let t=N&&N.trim()?N:x?"your-api-key":"sk_9router",s=o||"http://localhost:20128",l=s.endsWith("/v1")?s:`${s}/v1`;return e.replace(/\{\{baseUrl\}\}/g,l).replace(/\{\{apiKey\}\}/g,t).replace(/\{\{model\}\}/g,b||"provider/model-id")},{copy:k}=(0,h.C)(),C=async(e,t)=>{await k(w(e),`toolcard-${t}`),u(t),setTimeout(()=>u(null),2e3)},S=c.length>0,_=()=>(!t.requiresExternalUrl||!!x||!!m)&&(!t.requiresCloud||!!x);return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:n,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:t.image?(0,l.jsx)(i.default,{src:t.image,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}}):t.icon?(0,l.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:t.color},children:t.icon}):(0,l.jsx)(i.default,{src:`/providers/${e}.png`,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:t.name}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:t.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,l.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:t.guideSteps?(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[t.notes&&0!==t.notes.length?(0,l.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:t.notes.map((e,t)=>{if("cloudCheck"===e.type&&(x||m))return null;let s="warning"===e.type,a="cloudCheck"===e.type&&!x&&!m,r="bg-blue-500/10 border-blue-500/30",i="text-blue-600 dark:text-blue-400",n="text-blue-500",o="info";return s?(r="bg-yellow-500/10 border-yellow-500/30",i="text-yellow-600 dark:text-yellow-400",n="text-yellow-500",o="warning"):a&&(r="bg-red-500/10 border-red-500/30",i="text-red-600 dark:text-red-400",n="text-red-500",o="error"),(0,l.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${r}`,children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-lg ${n}`,children:o}),(0,l.jsx)("p",{className:`text-sm ${i}`,children:e.text})]},t)})}):null,_()&&t.guideSteps.map(e=>(0,l.jsxs)("div",{className:"flex items-start gap-4",children:[(0,l.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:t.color},children:e.step}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"font-medium text-text",children:e.title}),e.desc&&(0,l.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:e.desc}),"apiKeySelector"===e.type&&(0,l.jsx)("div",{className:"mt-2 flex items-center gap-2",children:d&&d.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("select",{value:N,onChange:e=>v(e.target.value),className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}),(0,l.jsx)("button",{onClick:()=>C(N,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===p?"check":"content_copy"})})]}):(0,l.jsx)("span",{className:"text-sm text-text-muted",children:x?"No API keys - Create one in Keys page":"sk_9router"})}),"modelSelector"===e.type&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("input",{type:"text",value:b,onChange:e=>j(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>y(!0),disabled:!S,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${S?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),b&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{onClick:()=>C(b,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===p?"check":"content_copy"})}),(0,l.jsx)("button",{onClick:()=>j(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),e.value&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:w(e.value)}),e.copyable&&(0,l.jsx)("button",{onClick:()=>C(e.value,`${e.step}-${e.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:p===`${e.step}-${e.title}`?"check":"content_copy"})})]})]})]},e.step)),_()&&t.codeBlock&&(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:t.codeBlock.language}),(0,l.jsxs)("button",{onClick:()=>C(t.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===p?"check":"content_copy"}),"codeblock"===p?"Copied!":"Copy"]})]}),(0,l.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,l.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:w(t.codeBlock.code)})})]})]}):(0,l.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,l.jsx)(r.rq,{isOpen:f,onClose:()=>y(!1),onSelect:e=>{j(e.value)},selectedModel:b,activeProviders:c,title:"Select Model"})]})}function f({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d,cloudEnabled:c,initialStatus:x}){let m,p,u,h,g,[y,b]=(0,a.useState)(x||null),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)(null),[A,E]=(0,a.useState)(!1),[O,M]=(0,a.useState)(""),[I,R]=(0,a.useState)(""),[T,P]=(0,a.useState)(""),[$,L]=(0,a.useState)(!1),[U,K]=(0,a.useState)(!1),[z,D]=(0,a.useState)({}),[F,H]=(0,a.useState)(!1),[B,q]=(0,a.useState)(""),[W,G]=(0,a.useState)([]),[J,Z]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!O&&M(o[0].key)},[o,O]),(0,a.useEffect)(()=>{x&&b(x)},[x]),(0,a.useEffect)(()=>{t&&!y&&(Q(),Y()),t&&Y()},[t]),(0,a.useEffect)(()=>{y?.opencode?.models&&G(y.opencode.models),y?.opencode?.activeModel&&Z(y.opencode.activeModel),y?.config?.agent?.explorer?.model?.startsWith("9router/")&&P(y.config.agent.explorer.model.replace("9router/",""))},[y]);let Y=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&D(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}},V=(()=>{if(!y?.installed)return null;if(!y.config)return"not_configured";let e=y.config?.provider?.["9router"]?.options?.baseURL||"",t=e.includes("localhost")||e.includes("127.0.0.1");return y.has9Router&&(t||e.includes(n))?"configured":y.has9Router?"other":"not_configured"})(),X=()=>{let e=B||n;return e.endsWith("/v1")?e:`${e}/v1`},Q=async()=>{N(!0);try{let e=await fetch("/api/cli-tools/opencode-settings"),t=await e.json();b(t)}catch(e){b({installed:!1,error:e.message})}finally{N(!1)}},ee=async()=>{w(!0),_(null);try{let e=O&&O.trim()||c?O:"sk_9router",t=await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:X(),apiKey:e,models:W,activeModel:""===J?"":J||W[0],subagentModel:T})}),s=await t.json();t.ok?(_({type:"success",text:"Settings applied successfully!"}),Q()):_({type:"error",text:s.error||"Failed to apply settings"})}catch(e){_({type:"error",text:e.message})}finally{w(!1)}},et=async()=>{C(!0),_(null);try{let e=await fetch("/api/cli-tools/opencode-settings",{method:"DELETE"}),t=await e.json();e.ok?(_({type:"success",text:"Settings reset successfully!"}),R(""),P(""),G([]),Z(""),Q()):_({type:"error",text:t.error||"Failed to reset settings"})}catch(e){_({type:"error",text:e.message})}finally{C(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/opencode.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===V&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===V&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===V&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking OpenCode CLI..."})]}),!j&&y&&!y.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"OpenCode CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>H(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>E(!A),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:A?"expand_less":"help"}),A?"Hide":"How to Install"]})]})]}),A&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g opencode-ai"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"opencode"})," to verify."]})]})]})]}),!j&&y?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[y?.config?.provider?.["9router"]?.options?.baseURL&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:y.config.provider["9router"].options.baseURL})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:B||`${n}/v1`,onChange:e=>q(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),B&&B!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>q(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),o.length>0?(0,l.jsx)("select",{value:O,onChange:e=>M(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:c?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"flex items-start gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Models"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,l.jsx)("div",{className:"flex flex-wrap gap-1.5 min-h-[28px] px-2 py-1.5 bg-surface rounded border border-border",children:0===W.length?(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected"}):W.map(e=>(0,l.jsxs)("span",{onClick:async()=>{if(e===J)try{(await fetch("/api/cli-tools/opencode-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({clearActiveModel:!0})})).ok&&(Z(""),Q())}catch(e){console.log("Error clearing active model:",e)}else Z(e)},className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs cursor-pointer transition-colors ${e===J?"bg-primary/10 text-primary border border-primary":"bg-black/5 dark:bg-white/5 text-text-muted border border-transparent hover:border-border"}`,title:e===J?"Click to clear active model":"Click to set as active",children:[e===J&&(0,l.jsx)("span",{className:"material-symbols-outlined text-[10px]",children:"star"}),e,(0,l.jsx)("button",{onClick:async t=>{t.stopPropagation();try{if((await fetch(`/api/cli-tools/opencode-settings?model=${encodeURIComponent(e)}`,{method:"DELETE"})).ok){let t=W.filter(t=>t!==e);G(t),J===e&&Z(""),Q()}}catch(e){console.log("Error removing model:",e)}},className:"ml-0.5 hover:text-red-500",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e))}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("button",{onClick:()=>L(!0),disabled:!d?.length,className:`px-2 py-1 rounded border text-xs transition-colors ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Add Model"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:W.length>0&&J?(0,l.jsxs)(l.Fragment,{children:["Active: ",(0,l.jsx)("span",{className:"text-primary",children:J})]}):W.length>0?(0,l.jsx)("span",{className:"text-yellow-500",children:"Click a model to set/clear active"}):"Select models to add"})]})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Subagent Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:T,onChange:e=>P(e.target.value),placeholder:I||"provider/model-id (defaults to main model)",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>K(!0),disabled:!d?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),T&&(0,l.jsx)("button",{onClick:()=>P(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),S&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===S.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===S.type?"check_circle":"error"}),(0,l.jsx)("span",{children:S.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:ee,disabled:0===W.length,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:et,disabled:!y.has9Router,loading:k,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>H(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:$,onClose:()=>L(!1),onSelect:e=>{!W.includes(e.value)&&(G([...W,e.value]),J||Z(e.value)),L(!1)},selectedModel:null,activeProviders:d,modelAliases:z,title:"Add Model for OpenCode"}),(0,l.jsx)(r.rq,{isOpen:U,onClose:()=>K(!1),onSelect:e=>{P(e.value),K(!1)},selectedModel:T,activeProviders:d,modelAliases:z,title:"Select Subagent Model for OpenCode"}),(0,l.jsx)(r.uR,{isOpen:F,onClose:()=>H(!1),title:"OpenCode - Manual Configuration",configs:(m=O&&O.trim()?O:c?"<API_KEY_FROM_DASHBOARD>":"sk_9router",p=W.length>0?W:["provider/model-id"],u=J||W[0]||p[0],h=T||u,g={},p.forEach(e=>{g[e]={name:e}}),[{filename:"~/.config/opencode/opencode.json",content:JSON.stringify({provider:{"9router":{npm:"@ai-sdk/openai-compatible",options:{baseURL:X(),apiKey:m},models:g}},model:`9router/${u}`,agent:{explorer:{description:"Fast explorer subagent for codebase exploration",mode:"subagent",model:`9router/${h}`}}},null,2)}])})]})}let y="http://localhost:20128";function b({apiKeys:e,cloudEnabled:t,onStatusChange:s}){let[i,n]=(0,a.useState)(null),[o,d]=(0,a.useState)(!1),[c,x]=(0,a.useState)(!1),[m,p]=(0,a.useState)(""),[u,h]=(0,a.useState)(""),[g,f]=(0,a.useState)(null),[j,N]=(0,a.useState)(null),[v,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(y),S="u">typeof navigator&&navigator.userAgent?.includes("Windows"),_=i?.isAdmin!==!1;(0,a.useEffect)(()=>{e?.length>0&&!u&&h(e[0].key)},[e,u]),(0,a.useEffect)(()=>{A()},[]);let A=async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();n(t),t.mitmRouterBaseUrl&&C(t.mitmRouterBaseUrl),s?.(t)}}catch{n({running:!1,certExists:!1,dnsStatus:{}})}},E=e=>{w(null),S||i?.hasCachedPassword?O(e,""):(f(e),x(!0),N(null))},O=async(s,l)=>{d(!0),w(null);try{let a;if("trust-cert"===s)a=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:l})});else if("start"===s){let s=u?.trim()||(e?.length>0?e[0].key:null)||(t?null:"sk_9router");a=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:s,sudoPassword:l,mitmRouterBaseUrl:k.trim()||y})})}else a=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:l})});if(!a.ok){let e=await a.json().catch(()=>({}));w(e.error||`Failed to ${s} MITM server`);return}x(!1),p(""),await A()}catch(e){w(e.message||"Network error")}finally{d(!1),f(null)}},M=()=>{m.trim()?O(g,m):N("Sudo password is required")},I=i?.running;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,l.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),I?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Running"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,l.jsx)("div",{className:"flex items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:i?.certExists},{label:"Trusted",ok:i?.certTrusted},{label:"Server",ok:I}].map(({label:e,ok:t})=>(0,l.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${t?"text-green-600":"text-text-muted"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:t?"check_circle":"cancel"}),e]},e))})]}),(0,l.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from 9Router"]}),(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Antigravity/Copilot IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → 9Router → response to Antigravity/Copilot"]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"9Router Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:k,onChange:e=>C(e.target.value),placeholder:y,disabled:I,className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]}),!I&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",list:"mitm-api-keys",value:u,onChange:e=>h(e.target.value),placeholder:t?"Enter or pick API key":"sk_9router (default)",className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50"}),e?.length>0&&(0,l.jsx)("datalist",{id:"mitm-api-keys",children:e.map(e=>(0,l.jsx)("option",{value:e.key,children:e.name||e.key},e.id))})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap","data-i18n-skip":"true",children:[i?.certExists&&!i?.certTrusted&&(0,l.jsxs)("button",{onClick:()=>E("trust-cert"),disabled:o,className:"px-4 py-1.5 rounded-lg bg-yellow-500/10 border border-yellow-500/30 text-yellow-600 font-medium text-xs flex items-center gap-1.5 hover:bg-yellow-500/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),I?(0,l.jsxs)("button",{onClick:()=>E("stop"),disabled:o,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,l.jsxs)("button",{onClick:()=>E("start"),disabled:o||S&&!_,className:"px-4 py-1.5 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-xs flex items-center gap-1.5 hover:bg-primary/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),I&&(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),v&&(0,l.jsxs)("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5 shrink-0",children:"error"}),(0,l.jsx)("span",{children:v})]}),S&&!_&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 border border-red-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"shield_lock"}),(0,l.jsx)("span",{children:"Administrator required — restart 9Router as Administrator to use MITM"})]})]})}),c&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:m,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"!==e.key||o||M()}}),j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:j})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{x(!1),p(""),N(null)},disabled:o,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:M,loading:o,children:"Confirm"})]})]})})]})}var j=s(45727);function N({tool:e,isExpanded:t,onToggle:s,serverRunning:n,dnsActive:o,hasCachedPassword:d,apiKeys:c,activeProviders:x,hasActiveProviders:m,modelAliases:p={},cloudEnabled:u,onDnsChange:h}){let[g,f]=(0,a.useState)(!1),[y,b]=(0,a.useState)(null),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(""),[S,_]=(0,a.useState)(null),[A,E]=(0,a.useState)(null),[O,M]=(0,a.useState)({}),[I,R]=(0,a.useState)(!1),[T,P]=(0,a.useState)(null),$=j.TOOL_HOSTS[e.id]??[],L="u">typeof navigator&&navigator.userAgent?.includes("Windows");(0,a.useEffect)(()=>{t&&U()},[t]);let U=async()=>{try{let t=await fetch(`/api/cli-tools/antigravity-mitm/alias?tool=${e.id}`);if(t.ok){let e=await t.json();Object.keys(e.aliases||{}).length>0&&M(e.aliases)}}catch{}},K=(0,a.useCallback)(async t=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,mappings:t})})}catch{}},[e.id]),z=(e,t)=>{M(s=>({...s,[e]:t}))},D=()=>{if(!n)return;let e=o?"disable":"enable";L||d?F(e,""):(_(e),w(!0),E(null))},F=async(t,s)=>{f(!0),b(null);try{let l=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,action:t,sudoPassword:s})}),a=await l.json();if(!l.ok)throw Error(a.error||"Failed to toggle DNS");"enable"===t&&b(`Restart ${e.name} to apply changes`),w(!1),C(""),h?.(a)}catch{}finally{f(!1),_(null)}},H=()=>{k.trim()?F(S,k):E("Sudo password is required")};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),n?o?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Active"}):(0,l.jsx)(r.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,l.jsxs)("p",{className:"text-xs text-text-muted",children:["Intercept ",e.name," requests via MITM proxy"]})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[$.length>0&&(0,l.jsxs)("div",{className:"mt-2 rounded-md border border-border bg-surface/50 px-2 py-1.5",children:[(0,l.jsx)("p",{className:"text-[10px] font-medium tracking-wide text-text-main/80 mb-1",children:"Edit hosts file manually to add the following entries:"}),(0,l.jsx)("ul",{className:"list-none space-y-0.5 font-mono text-[10px] text-text-muted break-all",children:$.map(e=>(0,l.jsxs)("li",{children:["127.0.0.1 ",e]},e))})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,l.jsxs)("p",{children:["Toggle DNS to redirect ",e.name," traffic through 9Router via MITM."]}),!o&&(0,l.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),e.defaultModels?.length>0&&(0,l.jsx)("div",{className:"flex flex-col gap-2",children:e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-36 shrink-0 text-xs font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:O[e.alias]||"",onChange:t=>z(e.alias,t.target.value),onBlur:t=>{var s,l;return s=e.alias,l=t.target.value,void K({...O,[s]:l})},placeholder:"provider/model-id",disabled:!o,className:`flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 ${!o?"opacity-50 cursor-not-allowed":""}`}),(0,l.jsx)("button",{onClick:()=>{P(e.alias),R(!0)},disabled:!m||!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 ${m&&o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),O[e.alias]&&(0,l.jsx)("button",{onClick:()=>{z(e.alias,""),K({...O,[e.alias]:""})},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias))}),e.defaultModels?.length===0&&(0,l.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 items-start",children:[o?(0,l.jsxs)("button",{onClick:D,disabled:!n||g,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,l.jsxs)("button",{onClick:D,disabled:!n||g,className:"px-4 py-1.5 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-xs flex items-center gap-1.5 hover:bg-primary/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start DNS"]}),y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs text-amber-500",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,l.jsx)("span",{children:y})]})]})]})]}),v&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:k,onChange:e=>C(e.target.value),onKeyDown:e=>{"Enter"!==e.key||g||H()}}),A&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:A})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{w(!1),C(""),E(null)},disabled:g,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:H,loading:g,children:"Confirm"})]})]})}),(0,l.jsx)(r.rq,{isOpen:I,onClose:()=>R(!1),onSelect:e=>{if(!T||e.isPlaceholder)return;let t={...O,[T]:e.value};M(t),K(t)},selectedModel:T?O[T]:null,activeProviders:x,modelAliases:p,title:`Select model for ${T}`})]})}var v=s(99568),w=s.n(v);function k({tool:e}){return(0,l.jsx)(w(),{href:"/dashboard/mitm",className:"block",children:(0,l.jsx)(r.Zp,{padding:"sm",className:"overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded-full",children:"MITM"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"chevron_right"})]})})})}},45727:e=>{e.exports={TOOL_HOSTS:{antigravity:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],copilot:["api.individual.githubcopilot.com"],kiro:["q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"],cursor:["api2.cursor.sh"]}}},97990:(e,t,s)=>{s.d(t,{dM:()=>a,wn:()=>l});let l={antigravity:{id:"antigravity",name:"Antigravity",image:"/providers/antigravity.png",color:"#4285F4",description:"Google Antigravity IDE with MITM",configType:"mitm",mitmDomain:"daily-cloudcode-pa.googleapis.com",modelAliases:["claude-opus-4-6-thinking","claude-sonnet-4-6","gemini-3-flash","gpt-oss-120b-medium","gemini-3-pro-high","gemini-3-pro-low"],defaultModels:[{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro High",alias:"gemini-3.1-pro-high"},{id:"gemini-3.1-pro-low",name:"Gemini 3.1 Pro Low",alias:"gemini-3.1-pro-low"},{id:"gemini-3-flash",name:"Gemini 3 Flash",alias:"gemini-3-flash"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"claude-sonnet-4-6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",alias:"claude-opus-4-6-thinking"},{id:"gpt-oss-120b-medium",name:"GPT OSS 120B Medium",alias:"gpt-oss-120b-medium"}]},copilot:{id:"copilot",name:"GitHub Copilot",image:"/providers/copilot.png",color:"#1F6FEB",description:"GitHub Copilot IDE with MITM",configType:"mitm",mitmDomain:"api.individual.githubcopilot.com",modelAliases:["gpt-4o-mini","claude-haiku-4.5","gpt-4o","gpt-5-mini"],defaultModels:[{id:"gpt-4o",name:"GPT-4o",alias:"gpt-4o"},{id:"gpt-4.1",name:"GPT-4.1",alias:"gpt-4.1"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"}]},kiro:{id:"kiro",name:"Kiro",image:"/providers/kiro.png",color:"#FF6B00",description:"Kiro IDE with MITM",configType:"mitm",mitmDomain:"q.us-east-1.amazonaws.com",defaultModels:[{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",alias:"claude-sonnet-4.5"},{id:"claude-sonnet-4",name:"Claude Sonnet 4",alias:"claude-sonnet-4"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"},{id:"deepseek-3.2",name:"DeepSeek 3.2",alias:"deepseek-3.2"},{id:"minimax-m2.1",name:"MiniMax M2.1",alias:"minimax-m2.1"},{id:"simple-task",name:"Qwen3 Coder Next",alias:"simple-task"}]}},a={claude:{id:"claude",name:"Claude Code",icon:"terminal",color:"#D97757",description:"Anthropic Claude Code CLI",configType:"env",envVars:{baseUrl:"ANTHROPIC_BASE_URL",model:"ANTHROPIC_MODEL",opusModel:"ANTHROPIC_DEFAULT_OPUS_MODEL",sonnetModel:"ANTHROPIC_DEFAULT_SONNET_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-4-6"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-4-6"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},openclaw:{id:"openclaw",name:"Open Claw",image:"/providers/openclaw.png",color:"#FF6B35",description:"Open Claw AI Assistant",configType:"custom"},codex:{id:"codex",name:"OpenAI Codex CLI",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},opencode:{id:"opencode",name:"OpenCode",image:"/providers/opencode.png",color:"#E87040",description:"OpenCode AI Terminal Assistant",configType:"custom"},droid:{id:"droid",name:"Factory Droid",image:"/providers/droid.png",color:"#00D4FF",description:"Factory Droid AI Assistant",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresExternalUrl:!0,notes:[{type:"warning",text:"Requires Cursor Pro account to use this feature."},{type:"cloudCheck",text:"Cursor routes requests through its own server, so local endpoint is not supported. Please enable Tunnel or Cloud Endpoint in Settings."}],guideSteps:[{step:1,title:"Open Settings",desc:"Go to Settings → Models"},{step:2,title:"Enable OpenAI API",desc:'Enable "OpenAI API key" option'},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Add Custom Model",desc:'Click "View All Model" → "Add Custom Model"'},{step:6,title:"Select Model",type:"modelSelector"}]},cline:{id:"cline",name:"Cline",image:"/providers/cline.png",color:"#00D1B2",description:"Cline AI Coding Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Cline Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},kilo:{id:"kilo",name:"Kilo Code",image:"/providers/kilocode.png",color:"#FF6B6B",description:"Kilo Code AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Kilo Code Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},roo:{id:"roo",name:"Roo",image:"/providers/roo.png",color:"#FF6B6B",description:"Roo AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Roo Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → Ollama"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Config",desc:"Open Continue configuration file"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Model",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Add the following configuration to your models array:"}],codeBlock:{language:"json",code:`{
18
18
  "apiBase": "{{baseUrl}}",
19
19
  "title": "{{model}}",
20
20
  "model": "{{model}}",