vansrouter 0.91.61 → 0.91.85

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 (1249) hide show
  1. package/README.md +73 -1
  2. package/app/.next-cli-build/BUILD_ID +1 -1
  3. package/app/.next-cli-build/app-path-routes-manifest.json +16 -14
  4. package/app/.next-cli-build/build-manifest.json +3 -3
  5. package/app/.next-cli-build/prerender-manifest.json +3 -3
  6. package/app/.next-cli-build/react-loadable-manifest.json +7 -7
  7. package/app/.next-cli-build/required-server-files.json +2 -1
  8. package/app/.next-cli-build/routes-manifest.json +12 -0
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +2 -2
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +2 -2
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +2 -2
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +2 -2
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +2 -2
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +2 -2
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +14 -10
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +2 -2
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +3 -3
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +2 -2
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +2 -2
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +2 -2
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +2 -2
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +6 -6
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +2 -2
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +2 -2
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-fitness/page.js +2 -2
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-fitness/page.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-fitness/page_client-reference-manifest.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +4 -4
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +2 -2
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +2 -2
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +2 -2
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +2 -2
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +2 -2
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  78. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +2 -2
  79. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  80. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  81. package/app/.next-cli-build/server/app/_global-error/page.js +3 -3
  82. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  83. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  84. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  85. package/app/.next-cli-build/server/app/_global-error.rsc +2 -2
  86. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +2 -2
  87. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  88. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  89. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  90. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  91. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +2 -2
  92. package/app/.next-cli-build/server/app/_not-found/page.js +2 -2
  93. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  95. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  96. package/app/.next-cli-build/server/app/_not-found.rsc +5 -5
  97. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +5 -5
  98. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  99. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +5 -5
  100. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  101. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  102. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +3 -3
  103. package/app/.next-cli-build/server/app/api/auth/check/route.js +1 -1
  104. package/app/.next-cli-build/server/app/api/auth/check/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/auth/login/route.js +1 -1
  106. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/auth/logout/route.js +1 -1
  108. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js +1 -1
  110. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js +1 -1
  112. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js +1 -1
  114. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js +1 -1
  116. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/auth/status/route.js +1 -1
  118. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -30
  120. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  126. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
  128. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +2 -2
  130. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js +2 -2
  132. package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  134. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  136. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
  138. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  140. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  142. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
  144. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
  146. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +1 -1
  148. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  150. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +1 -1
  152. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +2 -2
  154. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  155. package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js +45 -0
  156. package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js.nft.json +1 -0
  157. package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route_client-reference-manifest.js +1 -0
  158. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +1 -25
  159. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +3 -3
  161. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  163. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +3 -3
  165. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  167. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  169. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
  171. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +2 -2
  173. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
  175. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/combos/presets/route.js +1 -1
  177. package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/combos/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/headroom/extras/route.js +1 -1
  181. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js +1 -1
  183. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  184. package/app/.next-cli-build/server/app/api/headroom/restart/route.js +1 -1
  185. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  186. package/app/.next-cli-build/server/app/api/headroom/start/route.js +1 -1
  187. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/headroom/status/route.js +1 -1
  189. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  190. package/app/.next-cli-build/server/app/api/headroom/stop/route.js +1 -1
  191. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  192. package/app/.next-cli-build/server/app/api/health/route.js +1 -1
  193. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  194. package/app/.next-cli-build/server/app/api/init/route.js +1 -1
  195. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  196. package/app/.next-cli-build/server/app/api/keys/[id]/route.js +1 -1
  197. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/keys/route.js +1 -1
  199. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/locale/route.js +1 -1
  201. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js +2 -2
  203. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js +2 -2
  205. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
  207. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  209. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
  211. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js +1 -1
  213. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  215. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/models/alias/route.js +1 -1
  217. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/models/availability/route.js +1 -1
  219. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js +1 -1
  221. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  223. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/models/disabled/route.js +1 -1
  225. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  227. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  229. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  230. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  231. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  232. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  233. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  234. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  235. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js +2 -2
  237. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  239. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js +1 -1
  241. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js +1 -1
  243. package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js +1 -1
  245. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  247. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js +1 -1
  249. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  250. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  251. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js +1 -1
  253. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  255. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  257. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js +2 -2
  259. package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js +1 -1
  261. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/pricing/route.js +1 -1
  263. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js +1 -1
  265. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  267. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js +2 -2
  269. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  270. package/app/.next-cli-build/server/app/api/providers/[id]/gcp-projects/route.js +1 -1
  271. package/app/.next-cli-build/server/app/api/providers/[id]/gcp-projects/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  273. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js +1 -1
  275. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
  276. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  277. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  278. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  279. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  280. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  281. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/providers/bulk/route.js +1 -1
  283. package/app/.next-cli-build/server/app/api/providers/bulk/route.js.nft.json +1 -1
  284. package/app/.next-cli-build/server/app/api/providers/circuit-breakers/[name]/reset/route.js +1 -1
  285. package/app/.next-cli-build/server/app/api/providers/circuit-breakers/[name]/reset/route.js.nft.json +1 -1
  286. package/app/.next-cli-build/server/app/api/providers/circuit-breakers/route.js +1 -1
  287. package/app/.next-cli-build/server/app/api/providers/circuit-breakers/route.js.nft.json +1 -1
  288. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  289. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  290. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js +1 -1
  291. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  292. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  293. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  294. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js +2 -2
  295. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  296. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  297. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  298. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  299. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  300. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/fitness/clear/route.js +1 -1
  301. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/fitness/clear/route.js.nft.json +1 -1
  302. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js +1 -1
  303. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  304. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js +1 -1
  305. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  306. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js +3 -3
  307. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  308. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js +3 -3
  309. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  310. package/app/.next-cli-build/server/app/api/proxy-pools/fitness/clear-all/route.js +1 -1
  311. package/app/.next-cli-build/server/app/api/proxy-pools/fitness/clear-all/route.js.nft.json +1 -1
  312. package/app/.next-cli-build/server/app/api/proxy-pools/fitness/route.js +1 -1
  313. package/app/.next-cli-build/server/app/api/proxy-pools/fitness/route.js.nft.json +1 -1
  314. package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js +68 -0
  315. package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js.nft.json +1 -0
  316. package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route_client-reference-manifest.js +1 -0
  317. package/app/.next-cli-build/server/app/api/proxy-pools/route.js +1 -1
  318. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  319. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js +3 -3
  320. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  321. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js +2 -2
  322. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  323. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js +2 -2
  324. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  325. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js +2 -2
  326. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  327. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js +2 -2
  328. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  329. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js +2 -2
  330. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  331. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js +2 -2
  332. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  333. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js +2 -2
  334. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  335. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js +2 -2
  336. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  337. package/app/.next-cli-build/server/app/api/ready/route.js +1 -1
  338. package/app/.next-cli-build/server/app/api/ready/route.js.nft.json +1 -1
  339. package/app/.next-cli-build/server/app/api/settings/database/route.js +1 -1
  340. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  341. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js +1 -1
  342. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  343. package/app/.next-cli-build/server/app/api/settings/require-login/route.js +1 -1
  344. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  345. package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  346. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  347. package/app/.next-cli-build/server/app/api/shutdown/route.js +1 -1
  348. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  349. package/app/.next-cli-build/server/app/api/tags/route.js +1 -1
  350. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  351. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  352. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  353. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
  354. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  355. package/app/.next-cli-build/server/app/api/translator/load/route.js +1 -1
  356. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  357. package/app/.next-cli-build/server/app/api/translator/save/route.js +1 -1
  358. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  359. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  360. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  361. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  362. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  363. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js +1 -1
  364. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  365. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js +1 -1
  366. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  367. package/app/.next-cli-build/server/app/api/tunnel/status/route.js +1 -1
  368. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  369. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js +1 -1
  370. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  371. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js +1 -1
  372. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  373. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js +1 -1
  374. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  375. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +3 -3
  376. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  377. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  378. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
  379. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  380. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  381. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  382. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  383. package/app/.next-cli-build/server/app/api/usage/chart/route.js +1 -1
  384. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  385. package/app/.next-cli-build/server/app/api/usage/history/route.js +1 -1
  386. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  387. package/app/.next-cli-build/server/app/api/usage/logs/route.js +1 -1
  388. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  389. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  390. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  391. package/app/.next-cli-build/server/app/api/usage/request-details/[id]/route.js +1 -1
  392. package/app/.next-cli-build/server/app/api/usage/request-details/[id]/route.js.nft.json +1 -1
  393. package/app/.next-cli-build/server/app/api/usage/request-details/route.js +1 -1
  394. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  395. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js +1 -1
  396. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  397. package/app/.next-cli-build/server/app/api/usage/stats/route.js +1 -1
  398. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  399. package/app/.next-cli-build/server/app/api/usage/stream/route.js +2 -2
  400. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  401. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  402. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  403. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  404. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  405. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  406. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  407. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  408. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  409. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  410. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  411. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  412. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  413. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +2 -2
  414. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  415. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js +1 -1
  416. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  417. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  418. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  419. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
  420. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  421. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  422. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  423. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  424. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  425. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  426. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  427. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  428. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  429. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  430. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  431. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  432. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  433. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  434. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  435. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  436. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  437. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  438. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  439. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  440. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  441. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  442. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  443. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  444. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  445. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  446. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  447. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  448. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  449. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  450. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  451. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  452. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  453. package/app/.next-cli-build/server/app/callback/page.js +2 -2
  454. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  455. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  456. package/app/.next-cli-build/server/app/callback.html +1 -1
  457. package/app/.next-cli-build/server/app/callback.rsc +5 -5
  458. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +5 -5
  459. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  460. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +5 -5
  461. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +3 -3
  462. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  463. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  464. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  465. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +7 -7
  466. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  467. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  468. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  469. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  470. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
  471. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  472. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +5 -5
  473. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +3 -3
  474. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  475. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +8 -8
  476. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  477. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  478. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  479. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  480. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +8 -8
  481. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  482. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +5 -5
  483. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +3 -3
  484. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  485. package/app/.next-cli-build/server/app/dashboard/combos.rsc +7 -7
  486. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  487. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  488. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  489. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  490. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +7 -7
  491. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  492. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +5 -5
  493. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +3 -3
  494. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  495. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +8 -8
  496. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  497. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  498. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  499. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  500. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +8 -8
  501. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  502. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +5 -5
  503. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +3 -3
  504. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  505. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +7 -7
  506. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  507. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  508. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  509. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  510. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  511. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +7 -7
  512. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  513. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +5 -5
  514. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +3 -3
  515. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  516. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +7 -7
  517. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  518. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  519. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  520. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  521. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +7 -7
  522. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  523. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +5 -5
  524. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +3 -3
  525. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  526. package/app/.next-cli-build/server/app/dashboard/profile.rsc +7 -7
  527. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  528. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  529. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  530. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  531. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +7 -7
  532. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  533. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +5 -5
  534. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +3 -3
  535. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  536. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +7 -7
  537. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  538. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  539. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  540. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  541. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  542. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
  543. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  544. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +5 -5
  545. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +3 -3
  546. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  547. package/app/.next-cli-build/server/app/dashboard/providers.rsc +7 -7
  548. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  549. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  550. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  551. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  552. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +7 -7
  553. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  554. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +5 -5
  555. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +3 -3
  556. package/app/.next-cli-build/server/app/dashboard/proxy-fitness.html +1 -1
  557. package/app/.next-cli-build/server/app/dashboard/proxy-fitness.rsc +7 -7
  558. package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/!KGRhc2hib2FyZCk/dashboard/proxy-fitness/__PAGE__.segment.rsc +2 -2
  559. package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/!KGRhc2hib2FyZCk/dashboard/proxy-fitness.segment.rsc +1 -1
  560. package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  561. package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  562. package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/_full.segment.rsc +7 -7
  563. package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/_head.segment.rsc +1 -1
  564. package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/_index.segment.rsc +5 -5
  565. package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/_tree.segment.rsc +3 -3
  566. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  567. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +7 -7
  568. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  569. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  570. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  571. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  572. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +7 -7
  573. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  574. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +5 -5
  575. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +3 -3
  576. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  577. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +7 -7
  578. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
  579. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
  580. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  581. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  582. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +7 -7
  583. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
  584. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +5 -5
  585. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +3 -3
  586. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  587. package/app/.next-cli-build/server/app/dashboard/quota.rsc +10 -10
  588. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +4 -4
  589. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  590. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  591. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  592. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +10 -10
  593. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  594. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +5 -5
  595. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +3 -3
  596. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +2 -2
  597. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  598. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  599. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  600. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +5 -5
  601. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +5 -5
  602. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  603. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +5 -5
  604. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +3 -3
  605. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  606. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  607. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  608. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  609. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  610. package/app/.next-cli-build/server/app/dashboard/skills.rsc +7 -7
  611. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  612. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  613. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  614. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  615. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +7 -7
  616. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  617. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +5 -5
  618. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +3 -3
  619. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  620. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +7 -7
  621. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
  622. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
  623. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  624. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  625. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +7 -7
  626. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
  627. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +5 -5
  628. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +3 -3
  629. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  630. package/app/.next-cli-build/server/app/dashboard/translator.rsc +7 -7
  631. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  632. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  633. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  634. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  635. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +7 -7
  636. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  637. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +5 -5
  638. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +3 -3
  639. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  640. package/app/.next-cli-build/server/app/dashboard/usage.rsc +7 -7
  641. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  642. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  643. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  644. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  645. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
  646. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  647. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +5 -5
  648. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +3 -3
  649. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  650. package/app/.next-cli-build/server/app/dashboard.rsc +7 -7
  651. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  652. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  653. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  654. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +7 -7
  655. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  656. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +5 -5
  657. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +3 -3
  658. package/app/.next-cli-build/server/app/favicon.ico/route.js +1 -1
  659. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  660. package/app/.next-cli-build/server/app/landing/page.js +2 -2
  661. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  662. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  663. package/app/.next-cli-build/server/app/landing.html +1 -1
  664. package/app/.next-cli-build/server/app/landing.rsc +6 -6
  665. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +6 -6
  666. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  667. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +5 -5
  668. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +3 -3
  669. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
  670. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  671. package/app/.next-cli-build/server/app/login/page.js +2 -2
  672. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  673. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  674. package/app/.next-cli-build/server/app/login.html +1 -1
  675. package/app/.next-cli-build/server/app/login.rsc +6 -6
  676. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +6 -6
  677. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  678. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +5 -5
  679. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +3 -3
  680. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  681. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  682. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js +1 -1
  683. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  684. package/app/.next-cli-build/server/app/masuk/page.js +2 -2
  685. package/app/.next-cli-build/server/app/masuk/page.js.nft.json +1 -1
  686. package/app/.next-cli-build/server/app/masuk/page_client-reference-manifest.js +1 -1
  687. package/app/.next-cli-build/server/app-paths-manifest.json +16 -14
  688. package/app/.next-cli-build/server/chunks/1253.js +1 -1
  689. package/app/.next-cli-build/server/chunks/{6415.js → 1328.js} +2 -2
  690. package/app/.next-cli-build/server/chunks/1685.js +3 -3
  691. package/app/.next-cli-build/server/chunks/1691.js +1 -0
  692. package/app/.next-cli-build/server/chunks/1693.js +8 -8
  693. package/app/.next-cli-build/server/chunks/2098.js +7 -0
  694. package/app/.next-cli-build/server/chunks/224.js +1 -1
  695. package/app/.next-cli-build/server/chunks/2247.js +46 -0
  696. package/app/.next-cli-build/server/chunks/228.js +1 -1
  697. package/app/.next-cli-build/server/chunks/2365.js +1 -1
  698. package/app/.next-cli-build/server/chunks/2445.js +1 -1
  699. package/app/.next-cli-build/server/chunks/2525.js +1 -0
  700. package/app/.next-cli-build/server/chunks/2557.js +6 -6
  701. package/app/.next-cli-build/server/chunks/2732.js +1 -1
  702. package/app/.next-cli-build/server/chunks/2741.js +29 -21
  703. package/app/.next-cli-build/server/chunks/2764.js +1 -0
  704. package/app/.next-cli-build/server/chunks/2994.js +1 -1
  705. package/app/.next-cli-build/server/chunks/3059.js +7 -0
  706. package/app/.next-cli-build/server/chunks/3280.js +7 -0
  707. package/app/.next-cli-build/server/chunks/3519.js +1 -1
  708. package/app/.next-cli-build/server/chunks/3650.js +1 -0
  709. package/app/.next-cli-build/server/chunks/3712.js +1 -1
  710. package/app/.next-cli-build/server/chunks/3750.js +1 -1
  711. package/app/.next-cli-build/server/chunks/4043.js +1 -1
  712. package/app/.next-cli-build/server/chunks/4105.js +1 -1
  713. package/app/.next-cli-build/server/chunks/4121.js +1 -1
  714. package/app/.next-cli-build/server/chunks/4574.js +10 -10
  715. package/app/.next-cli-build/server/chunks/4836.js +1 -1
  716. package/app/.next-cli-build/server/chunks/4855.js +1 -0
  717. package/app/.next-cli-build/server/chunks/506.js +1 -1
  718. package/app/.next-cli-build/server/chunks/5302.js +1 -0
  719. package/app/.next-cli-build/server/chunks/5376.js +1 -0
  720. package/app/.next-cli-build/server/chunks/634.js +1 -0
  721. package/app/.next-cli-build/server/chunks/6385.js +1 -1
  722. package/app/.next-cli-build/server/chunks/6723.js +1 -1
  723. package/app/.next-cli-build/server/chunks/7010.js +1 -1
  724. package/app/.next-cli-build/server/chunks/7074.js +2 -2
  725. package/app/.next-cli-build/server/chunks/7104.js +1 -1
  726. package/app/.next-cli-build/server/chunks/7656.js +2 -2
  727. package/app/.next-cli-build/server/chunks/7863.js +1 -1
  728. package/app/.next-cli-build/server/chunks/7950.js +1 -1
  729. package/app/.next-cli-build/server/chunks/8104.js +1 -0
  730. package/app/.next-cli-build/server/chunks/8413.js +1 -1
  731. package/app/.next-cli-build/server/chunks/{4004.js → 8729.js} +2 -2
  732. package/app/.next-cli-build/server/chunks/88.js +1 -1
  733. package/app/.next-cli-build/server/chunks/883.js +1 -1
  734. package/app/.next-cli-build/server/chunks/9404.js +1 -1
  735. package/app/.next-cli-build/server/chunks/9462.js +1 -1
  736. package/app/.next-cli-build/server/chunks/9536.js +1 -1
  737. package/app/.next-cli-build/server/chunks/9813.js +1 -1
  738. package/app/.next-cli-build/server/chunks/9974.js +1 -1
  739. package/app/.next-cli-build/server/chunks/9984.js +1 -0
  740. package/app/.next-cli-build/server/instrumentation.js +1 -1
  741. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  742. package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
  743. package/app/.next-cli-build/server/middleware.js +1 -1
  744. package/app/.next-cli-build/server/pages/404.html +1 -1
  745. package/app/.next-cli-build/server/pages/500.html +1 -1
  746. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  747. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  748. package/app/.next-cli-build/static/DsIP1InInSX1jxI1CwKX9/_buildManifest.js +1 -0
  749. package/app/.next-cli-build/static/chunks/2884.1ee037d127ecd60f.js +1 -0
  750. package/app/.next-cli-build/static/chunks/3257.e1e47662cfe81b1a.js +1 -0
  751. package/app/.next-cli-build/static/chunks/3657.c58fec9fff675721.js +1 -0
  752. package/app/.next-cli-build/static/chunks/{3809.780748bcfda54fd7.js → 3809.48b8b386bff490fa.js} +1 -1
  753. package/app/.next-cli-build/static/chunks/4385-24249afd9e192496.js +1 -0
  754. package/app/.next-cli-build/static/chunks/{5882-ad13c7cf39f40b42.js → 5882-1249cbe42852fd96.js} +28 -20
  755. package/app/.next-cli-build/static/chunks/736-5c250610e5716d32.js +1 -0
  756. package/app/.next-cli-build/static/chunks/7811.b41ad2c055232420.js +7 -0
  757. package/app/.next-cli-build/static/chunks/8914-12040f56b4d23373.js +27 -0
  758. package/app/.next-cli-build/static/chunks/{9131-ca795c21a2cb139e.js → 9131-d37a1bf502688d4e.js} +1 -1
  759. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-db17236a5b2183ab.js +1 -0
  760. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-7a18b45a954e3c68.js +67 -0
  761. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-5c2b1dad82e86562.js → page-56e6b4ed4f8c5bd1.js} +1 -1
  762. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-a6d3f510934cc6a5.js +27 -0
  763. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-176606799cc947aa.js +4 -0
  764. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-85770718a5ce696c.js +1 -0
  765. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-4f70cffad890fc5b.js +1 -0
  766. package/app/.next-cli-build/static/chunks/app/_global-error/page-e678b3a246de17ed.js +1 -0
  767. package/app/.next-cli-build/static/chunks/app/api/auth/check/route-e678b3a246de17ed.js +1 -0
  768. package/app/.next-cli-build/static/chunks/app/api/auth/login/route-e678b3a246de17ed.js +1 -0
  769. package/app/.next-cli-build/static/chunks/app/api/auth/logout/route-e678b3a246de17ed.js +1 -0
  770. package/app/.next-cli-build/static/chunks/app/api/auth/oidc/callback/route-e678b3a246de17ed.js +1 -0
  771. package/app/.next-cli-build/static/chunks/app/api/auth/oidc/start/route-e678b3a246de17ed.js +1 -0
  772. package/app/.next-cli-build/static/chunks/app/api/auth/oidc/test/route-e678b3a246de17ed.js +1 -0
  773. package/app/.next-cli-build/static/chunks/app/api/auth/reset-password/route-e678b3a246de17ed.js +1 -0
  774. package/app/.next-cli-build/static/chunks/app/api/auth/status/route-e678b3a246de17ed.js +1 -0
  775. package/app/.next-cli-build/static/chunks/app/api/cli-tools/all-statuses/route-e678b3a246de17ed.js +1 -0
  776. package/app/.next-cli-build/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-e678b3a246de17ed.js +1 -0
  777. package/app/.next-cli-build/static/chunks/app/api/cli-tools/antigravity-mitm/route-e678b3a246de17ed.js +1 -0
  778. package/app/.next-cli-build/static/chunks/app/api/cli-tools/claude-settings/route-e678b3a246de17ed.js +1 -0
  779. package/app/.next-cli-build/static/chunks/app/api/cli-tools/cline-settings/route-e678b3a246de17ed.js +1 -0
  780. package/app/.next-cli-build/static/chunks/app/api/cli-tools/codewhale-settings/route-e678b3a246de17ed.js +1 -0
  781. package/app/.next-cli-build/static/chunks/app/api/cli-tools/codex-profiles/route-e678b3a246de17ed.js +1 -0
  782. package/app/.next-cli-build/static/chunks/app/api/cli-tools/codex-settings/route-e678b3a246de17ed.js +1 -0
  783. package/app/.next-cli-build/static/chunks/app/api/cli-tools/copilot-settings/route-e678b3a246de17ed.js +1 -0
  784. package/app/.next-cli-build/static/chunks/app/api/cli-tools/cowork-mcp-registry/route-e678b3a246de17ed.js +1 -0
  785. package/app/.next-cli-build/static/chunks/app/api/cli-tools/cowork-mcp-tools/route-e678b3a246de17ed.js +1 -0
  786. package/app/.next-cli-build/static/chunks/app/api/cli-tools/cowork-settings/route-e678b3a246de17ed.js +1 -0
  787. package/app/.next-cli-build/static/chunks/app/api/cli-tools/crush-settings/route-e678b3a246de17ed.js +1 -0
  788. package/app/.next-cli-build/static/chunks/app/api/cli-tools/deepseek-tui-settings/route-e678b3a246de17ed.js +1 -0
  789. package/app/.next-cli-build/static/chunks/app/api/cli-tools/devin-settings/route-e678b3a246de17ed.js +1 -0
  790. package/app/.next-cli-build/static/chunks/app/api/cli-tools/droid-settings/route-e678b3a246de17ed.js +1 -0
  791. package/app/.next-cli-build/static/chunks/app/api/cli-tools/forge-settings/route-e678b3a246de17ed.js +1 -0
  792. package/app/.next-cli-build/static/chunks/app/api/cli-tools/grok-build-settings/route-e678b3a246de17ed.js +1 -0
  793. package/app/.next-cli-build/static/chunks/app/api/cli-tools/hermes-profiles/route-e678b3a246de17ed.js +1 -0
  794. package/app/.next-cli-build/static/chunks/app/api/cli-tools/hermes-settings/route-e678b3a246de17ed.js +1 -0
  795. package/app/.next-cli-build/static/chunks/app/api/cli-tools/jcode-settings/route-e678b3a246de17ed.js +1 -0
  796. package/app/.next-cli-build/static/chunks/app/api/cli-tools/kilo-settings/route-e678b3a246de17ed.js +1 -0
  797. package/app/.next-cli-build/static/chunks/app/api/cli-tools/omp-settings/route-e678b3a246de17ed.js +1 -0
  798. package/app/.next-cli-build/static/chunks/app/api/cli-tools/openclaw-settings/route-e678b3a246de17ed.js +1 -0
  799. package/app/.next-cli-build/static/chunks/app/api/cli-tools/opencode-settings/route-e678b3a246de17ed.js +1 -0
  800. package/app/.next-cli-build/static/chunks/app/api/cli-tools/pi-settings/route-e678b3a246de17ed.js +1 -0
  801. package/app/.next-cli-build/static/chunks/app/api/cli-tools/smelt-settings/route-e678b3a246de17ed.js +1 -0
  802. package/app/.next-cli-build/static/chunks/app/api/combos/[id]/route-e678b3a246de17ed.js +1 -0
  803. package/app/.next-cli-build/static/chunks/app/api/combos/presets/route-e678b3a246de17ed.js +1 -0
  804. package/app/.next-cli-build/static/chunks/app/api/combos/route-e678b3a246de17ed.js +1 -0
  805. package/app/.next-cli-build/static/chunks/app/api/headroom/extras/route-e678b3a246de17ed.js +1 -0
  806. package/app/.next-cli-build/static/chunks/app/api/headroom/proxy/[...path]/route-e678b3a246de17ed.js +1 -0
  807. package/app/.next-cli-build/static/chunks/app/api/headroom/restart/route-e678b3a246de17ed.js +1 -0
  808. package/app/.next-cli-build/static/chunks/app/api/headroom/start/route-e678b3a246de17ed.js +1 -0
  809. package/app/.next-cli-build/static/chunks/app/api/headroom/status/route-e678b3a246de17ed.js +1 -0
  810. package/app/.next-cli-build/static/chunks/app/api/headroom/stop/route-e678b3a246de17ed.js +1 -0
  811. package/app/.next-cli-build/static/chunks/app/api/health/route-e678b3a246de17ed.js +1 -0
  812. package/app/.next-cli-build/static/chunks/app/api/init/route-e678b3a246de17ed.js +1 -0
  813. package/app/.next-cli-build/static/chunks/app/api/keys/[id]/route-e678b3a246de17ed.js +1 -0
  814. package/app/.next-cli-build/static/chunks/app/api/keys/route-e678b3a246de17ed.js +1 -0
  815. package/app/.next-cli-build/static/chunks/app/api/locale/route-e678b3a246de17ed.js +1 -0
  816. package/app/.next-cli-build/static/chunks/app/api/mcp/[plugin]/message/route-e678b3a246de17ed.js +1 -0
  817. package/app/.next-cli-build/static/chunks/app/api/mcp/[plugin]/sse/route-e678b3a246de17ed.js +1 -0
  818. package/app/.next-cli-build/static/chunks/app/api/media-providers/tts/deepgram/voices/route-e678b3a246de17ed.js +1 -0
  819. package/app/.next-cli-build/static/chunks/app/api/media-providers/tts/elevenlabs/voices/route-e678b3a246de17ed.js +1 -0
  820. package/app/.next-cli-build/static/chunks/app/api/media-providers/tts/inworld/voices/route-e678b3a246de17ed.js +1 -0
  821. package/app/.next-cli-build/static/chunks/app/api/media-providers/tts/minimax/voices/route-e678b3a246de17ed.js +1 -0
  822. package/app/.next-cli-build/static/chunks/app/api/media-providers/tts/voices/route-e678b3a246de17ed.js +1 -0
  823. package/app/.next-cli-build/static/chunks/app/api/models/alias/route-e678b3a246de17ed.js +1 -0
  824. package/app/.next-cli-build/static/chunks/app/api/models/availability/route-e678b3a246de17ed.js +1 -0
  825. package/app/.next-cli-build/static/chunks/app/api/models/catalog-sync/route-e678b3a246de17ed.js +1 -0
  826. package/app/.next-cli-build/static/chunks/app/api/models/custom/route-e678b3a246de17ed.js +1 -0
  827. package/app/.next-cli-build/static/chunks/app/api/models/disabled/route-e678b3a246de17ed.js +1 -0
  828. package/app/.next-cli-build/static/chunks/app/api/models/route-e678b3a246de17ed.js +1 -0
  829. package/app/.next-cli-build/static/chunks/app/api/models/test/route-e678b3a246de17ed.js +1 -0
  830. package/app/.next-cli-build/static/chunks/app/api/oauth/[provider]/[action]/route-e678b3a246de17ed.js +1 -0
  831. package/app/.next-cli-build/static/chunks/app/api/oauth/codex/bulk-import/route-e678b3a246de17ed.js +1 -0
  832. package/app/.next-cli-build/static/chunks/app/api/oauth/codex/import-token/route-e678b3a246de17ed.js +1 -0
  833. package/app/.next-cli-build/static/chunks/app/api/oauth/cursor/auto-import/route-e678b3a246de17ed.js +1 -0
  834. package/app/.next-cli-build/static/chunks/app/api/oauth/cursor/import/route-e678b3a246de17ed.js +1 -0
  835. package/app/.next-cli-build/static/chunks/app/api/oauth/gitlab/pat/route-e678b3a246de17ed.js +1 -0
  836. package/app/.next-cli-build/static/chunks/app/api/oauth/grok-cli/bulk-import/route-e678b3a246de17ed.js +1 -0
  837. package/app/.next-cli-build/static/chunks/app/api/oauth/iflow/cookie/route-e678b3a246de17ed.js +1 -0
  838. package/app/.next-cli-build/static/chunks/app/api/oauth/kiro/api-key/route-e678b3a246de17ed.js +1 -0
  839. package/app/.next-cli-build/static/chunks/app/api/oauth/kiro/auto-import/route-e678b3a246de17ed.js +1 -0
  840. package/app/.next-cli-build/static/chunks/app/api/oauth/kiro/import/route-e678b3a246de17ed.js +1 -0
  841. package/app/.next-cli-build/static/chunks/app/api/oauth/kiro/import-cli-proxy/route-e678b3a246de17ed.js +1 -0
  842. package/app/.next-cli-build/static/chunks/app/api/oauth/kiro/social-authorize/route-e678b3a246de17ed.js +1 -0
  843. package/app/.next-cli-build/static/chunks/app/api/oauth/kiro/social-exchange/route-e678b3a246de17ed.js +1 -0
  844. package/app/.next-cli-build/static/chunks/app/api/oauth/zed/auto-import/route-e678b3a246de17ed.js +1 -0
  845. package/app/.next-cli-build/static/chunks/app/api/oauth/zed/import/route-e678b3a246de17ed.js +1 -0
  846. package/app/.next-cli-build/static/chunks/app/api/pricing/route-e678b3a246de17ed.js +1 -0
  847. package/app/.next-cli-build/static/chunks/app/api/provider-nodes/[id]/route-e678b3a246de17ed.js +1 -0
  848. package/app/.next-cli-build/static/chunks/app/api/provider-nodes/route-e678b3a246de17ed.js +1 -0
  849. package/app/.next-cli-build/static/chunks/app/api/provider-nodes/validate/route-e678b3a246de17ed.js +1 -0
  850. package/app/.next-cli-build/static/chunks/app/api/providers/[id]/gcp-projects/route-e678b3a246de17ed.js +1 -0
  851. package/app/.next-cli-build/static/chunks/app/api/providers/[id]/models/route-e678b3a246de17ed.js +1 -0
  852. package/app/.next-cli-build/static/chunks/app/api/providers/[id]/overrides/route-e678b3a246de17ed.js +1 -0
  853. package/app/.next-cli-build/static/chunks/app/api/providers/[id]/route-e678b3a246de17ed.js +1 -0
  854. package/app/.next-cli-build/static/chunks/app/api/providers/[id]/test/route-e678b3a246de17ed.js +1 -0
  855. package/app/.next-cli-build/static/chunks/app/api/providers/[id]/test-models/route-e678b3a246de17ed.js +1 -0
  856. package/app/.next-cli-build/static/chunks/app/api/providers/bulk/route-e678b3a246de17ed.js +1 -0
  857. package/app/.next-cli-build/static/chunks/app/api/providers/circuit-breakers/[name]/reset/route-e678b3a246de17ed.js +1 -0
  858. package/app/.next-cli-build/static/chunks/app/api/providers/circuit-breakers/route-e678b3a246de17ed.js +1 -0
  859. package/app/.next-cli-build/static/chunks/app/api/providers/client/route-e678b3a246de17ed.js +1 -0
  860. package/app/.next-cli-build/static/chunks/app/api/providers/kilo/free-models/route-e678b3a246de17ed.js +1 -0
  861. package/app/.next-cli-build/static/chunks/app/api/providers/route-e678b3a246de17ed.js +1 -0
  862. package/app/.next-cli-build/static/chunks/app/api/providers/suggested-models/route-e678b3a246de17ed.js +1 -0
  863. package/app/.next-cli-build/static/chunks/app/api/providers/test-batch/route-e678b3a246de17ed.js +1 -0
  864. package/app/.next-cli-build/static/chunks/app/api/providers/validate/route-e678b3a246de17ed.js +1 -0
  865. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/[id]/fitness/clear/route-e678b3a246de17ed.js +1 -0
  866. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/[id]/route-e678b3a246de17ed.js +1 -0
  867. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/[id]/test/route-e678b3a246de17ed.js +1 -0
  868. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/cloudflare-deploy/route-e678b3a246de17ed.js +1 -0
  869. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/deno-deploy/route-e678b3a246de17ed.js +1 -0
  870. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/fitness/clear-all/route-e678b3a246de17ed.js +1 -0
  871. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/fitness/route-e678b3a246de17ed.js +1 -0
  872. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/netlify-deploy/route-e678b3a246de17ed.js +1 -0
  873. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/route-e678b3a246de17ed.js +1 -0
  874. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/vercel-deploy/route-e678b3a246de17ed.js +1 -0
  875. package/app/.next-cli-build/static/chunks/app/api/pxpipe/health/route-e678b3a246de17ed.js +1 -0
  876. package/app/.next-cli-build/static/chunks/app/api/pxpipe/install/route-e678b3a246de17ed.js +1 -0
  877. package/app/.next-cli-build/static/chunks/app/api/pxpipe/logs/route-e678b3a246de17ed.js +1 -0
  878. package/app/.next-cli-build/static/chunks/app/api/pxpipe/restart/route-e678b3a246de17ed.js +1 -0
  879. package/app/.next-cli-build/static/chunks/app/api/pxpipe/start/route-e678b3a246de17ed.js +1 -0
  880. package/app/.next-cli-build/static/chunks/app/api/pxpipe/stats/route-e678b3a246de17ed.js +1 -0
  881. package/app/.next-cli-build/static/chunks/app/api/pxpipe/status/route-e678b3a246de17ed.js +1 -0
  882. package/app/.next-cli-build/static/chunks/app/api/pxpipe/stop/route-e678b3a246de17ed.js +1 -0
  883. package/app/.next-cli-build/static/chunks/app/api/ready/route-e678b3a246de17ed.js +1 -0
  884. package/app/.next-cli-build/static/chunks/app/api/settings/database/route-e678b3a246de17ed.js +1 -0
  885. package/app/.next-cli-build/static/chunks/app/api/settings/proxy-test/route-e678b3a246de17ed.js +1 -0
  886. package/app/.next-cli-build/static/chunks/app/api/settings/require-login/route-e678b3a246de17ed.js +1 -0
  887. package/app/.next-cli-build/static/chunks/app/api/settings/route-e678b3a246de17ed.js +1 -0
  888. package/app/.next-cli-build/static/chunks/app/api/shutdown/route-e678b3a246de17ed.js +1 -0
  889. package/app/.next-cli-build/static/chunks/app/api/tags/route-e678b3a246de17ed.js +1 -0
  890. package/app/.next-cli-build/static/chunks/app/api/translator/console-logs/route-e678b3a246de17ed.js +1 -0
  891. package/app/.next-cli-build/static/chunks/app/api/translator/console-logs/stream/route-e678b3a246de17ed.js +1 -0
  892. package/app/.next-cli-build/static/chunks/app/api/translator/load/route-e678b3a246de17ed.js +1 -0
  893. package/app/.next-cli-build/static/chunks/app/api/translator/save/route-e678b3a246de17ed.js +1 -0
  894. package/app/.next-cli-build/static/chunks/app/api/translator/send/route-e678b3a246de17ed.js +1 -0
  895. package/app/.next-cli-build/static/chunks/app/api/translator/translate/route-e678b3a246de17ed.js +1 -0
  896. package/app/.next-cli-build/static/chunks/app/api/tunnel/disable/route-e678b3a246de17ed.js +1 -0
  897. package/app/.next-cli-build/static/chunks/app/api/tunnel/enable/route-e678b3a246de17ed.js +1 -0
  898. package/app/.next-cli-build/static/chunks/app/api/tunnel/status/route-e678b3a246de17ed.js +1 -0
  899. package/app/.next-cli-build/static/chunks/app/api/tunnel/tailscale-check/route-e678b3a246de17ed.js +1 -0
  900. package/app/.next-cli-build/static/chunks/app/api/tunnel/tailscale-disable/route-e678b3a246de17ed.js +1 -0
  901. package/app/.next-cli-build/static/chunks/app/api/tunnel/tailscale-enable/route-e678b3a246de17ed.js +1 -0
  902. package/app/.next-cli-build/static/chunks/app/api/tunnel/tailscale-install/route-e678b3a246de17ed.js +1 -0
  903. package/app/.next-cli-build/static/chunks/app/api/usage/[connectionId]/claude-reset/route-e678b3a246de17ed.js +1 -0
  904. package/app/.next-cli-build/static/chunks/app/api/usage/[connectionId]/codex-reset-credits/route-e678b3a246de17ed.js +1 -0
  905. package/app/.next-cli-build/static/chunks/app/api/usage/[connectionId]/route-e678b3a246de17ed.js +1 -0
  906. package/app/.next-cli-build/static/chunks/app/api/usage/chart/route-e678b3a246de17ed.js +1 -0
  907. package/app/.next-cli-build/static/chunks/app/api/usage/history/route-e678b3a246de17ed.js +1 -0
  908. package/app/.next-cli-build/static/chunks/app/api/usage/logs/route-e678b3a246de17ed.js +1 -0
  909. package/app/.next-cli-build/static/chunks/app/api/usage/providers/route-e678b3a246de17ed.js +1 -0
  910. package/app/.next-cli-build/static/chunks/app/api/usage/request-details/[id]/route-e678b3a246de17ed.js +1 -0
  911. package/app/.next-cli-build/static/chunks/app/api/usage/request-details/route-e678b3a246de17ed.js +1 -0
  912. package/app/.next-cli-build/static/chunks/app/api/usage/request-logs/route-e678b3a246de17ed.js +1 -0
  913. package/app/.next-cli-build/static/chunks/app/api/usage/stats/route-e678b3a246de17ed.js +1 -0
  914. package/app/.next-cli-build/static/chunks/app/api/usage/stream/route-e678b3a246de17ed.js +1 -0
  915. package/app/.next-cli-build/static/chunks/app/api/v1/api/chat/route-e678b3a246de17ed.js +1 -0
  916. package/app/.next-cli-build/static/chunks/app/api/v1/audio/speech/route-e678b3a246de17ed.js +1 -0
  917. package/app/.next-cli-build/static/chunks/app/api/v1/audio/transcriptions/route-e678b3a246de17ed.js +1 -0
  918. package/app/.next-cli-build/static/chunks/app/api/v1/audio/voices/route-e678b3a246de17ed.js +1 -0
  919. package/app/.next-cli-build/static/chunks/app/api/v1/chat/completions/route-e678b3a246de17ed.js +1 -0
  920. package/app/.next-cli-build/static/chunks/app/api/v1/embeddings/route-e678b3a246de17ed.js +1 -0
  921. package/app/.next-cli-build/static/chunks/app/api/v1/images/generations/route-e678b3a246de17ed.js +1 -0
  922. package/app/.next-cli-build/static/chunks/app/api/v1/messages/count_tokens/route-e678b3a246de17ed.js +1 -0
  923. package/app/.next-cli-build/static/chunks/app/api/v1/messages/route-e678b3a246de17ed.js +1 -0
  924. package/app/.next-cli-build/static/chunks/app/api/v1/models/[kind]/route-e678b3a246de17ed.js +1 -0
  925. package/app/.next-cli-build/static/chunks/app/api/v1/models/info/route-e678b3a246de17ed.js +1 -0
  926. package/app/.next-cli-build/static/chunks/app/api/v1/models/route-e678b3a246de17ed.js +1 -0
  927. package/app/.next-cli-build/static/chunks/app/api/v1/responses/compact/route-e678b3a246de17ed.js +1 -0
  928. package/app/.next-cli-build/static/chunks/app/api/v1/responses/route-e678b3a246de17ed.js +1 -0
  929. package/app/.next-cli-build/static/chunks/app/api/v1/route-e678b3a246de17ed.js +1 -0
  930. package/app/.next-cli-build/static/chunks/app/api/v1/search/route-e678b3a246de17ed.js +1 -0
  931. package/app/.next-cli-build/static/chunks/app/api/v1/videos/[id]/route-e678b3a246de17ed.js +1 -0
  932. package/app/.next-cli-build/static/chunks/app/api/v1/videos/edits/route-e678b3a246de17ed.js +1 -0
  933. package/app/.next-cli-build/static/chunks/app/api/v1/videos/extensions/route-e678b3a246de17ed.js +1 -0
  934. package/app/.next-cli-build/static/chunks/app/api/v1/videos/generations/route-e678b3a246de17ed.js +1 -0
  935. package/app/.next-cli-build/static/chunks/app/api/v1/web/fetch/route-e678b3a246de17ed.js +1 -0
  936. package/app/.next-cli-build/static/chunks/app/api/v1beta/models/[...path]/route-e678b3a246de17ed.js +1 -0
  937. package/app/.next-cli-build/static/chunks/app/api/v1beta/models/route-e678b3a246de17ed.js +1 -0
  938. package/app/.next-cli-build/static/chunks/app/api/version/route-e678b3a246de17ed.js +1 -0
  939. package/app/.next-cli-build/static/chunks/app/api/version/shutdown/route-e678b3a246de17ed.js +1 -0
  940. package/app/.next-cli-build/static/chunks/app/api/version/update/route-e678b3a246de17ed.js +1 -0
  941. package/app/.next-cli-build/static/chunks/app/landing/page-7f14f0bddc45bdc9.js +1 -0
  942. package/app/.next-cli-build/static/chunks/app/{layout-b5046cc0c299e73f.js → layout-1c5098d9c2c6039d.js} +1 -1
  943. package/app/.next-cli-build/static/chunks/app/manifest.webmanifest/route-e678b3a246de17ed.js +1 -0
  944. package/app/.next-cli-build/static/chunks/app/masuk/{page-3089e3164a6e20b3.js → page-f5cec60052c94296.js} +1 -1
  945. package/app/.next-cli-build/static/chunks/next/dist/client/components/builtin/app-error-e678b3a246de17ed.js +1 -0
  946. package/app/.next-cli-build/static/chunks/next/dist/client/components/builtin/forbidden-e678b3a246de17ed.js +1 -0
  947. package/app/.next-cli-build/static/chunks/next/dist/client/components/builtin/not-found-e678b3a246de17ed.js +1 -0
  948. package/app/.next-cli-build/static/chunks/next/dist/client/components/builtin/unauthorized-e678b3a246de17ed.js +1 -0
  949. package/app/.next-cli-build/static/chunks/{webpack-899bd95751864579.js → webpack-619acf270537f5d4.js} +1 -1
  950. package/app/.next-cli-build/static/css/918f11e454be0692.css +1 -0
  951. package/app/.next-cli-build/static/css/{3746f81686a64e69.css → 952cbb175c54324c.css} +1 -1
  952. package/app/_nm/@aws-sdk/credential-providers/dist-cjs/index.js +284 -0
  953. package/app/_nm/@aws-sdk/credential-providers/dist-cjs/loadSts-C4jOcYxJ.js +3 -0
  954. package/app/_nm/@aws-sdk/credential-providers/package.json +85 -0
  955. package/app/package.json +4 -4
  956. package/app/public/providers/bedrock-xai.png +0 -0
  957. package/app/public/providers/bedrock.png +0 -0
  958. package/app/public/providers/nous.png +0 -0
  959. package/app/server.js +1 -1
  960. package/app/src/app/(dashboard)/dashboard/cli-tools/components/ClaudeToolCard.js +40 -11
  961. package/app/src/app/(dashboard)/dashboard/cli-tools/components/HermesToolCard.js +316 -92
  962. package/app/src/app/(dashboard)/dashboard/combos/page.js +1 -1
  963. package/app/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.js +23 -21
  964. package/app/src/app/(dashboard)/dashboard/media-providers/[kind]/[id]/components/SttExampleCard.js +77 -1
  965. package/app/src/app/(dashboard)/dashboard/media-providers/[kind]/[id]/components/TtsExampleCard.js +17 -2
  966. package/app/src/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  967. package/app/src/app/(dashboard)/dashboard/providers/[id]/AddApiKeyModal.js +88 -8
  968. package/app/src/app/(dashboard)/dashboard/providers/[id]/AutoPingScheduleModal.js +189 -0
  969. package/app/src/app/(dashboard)/dashboard/providers/[id]/ConnectionRow.js +72 -22
  970. package/app/src/app/(dashboard)/dashboard/providers/[id]/ModelRow.js +43 -41
  971. package/app/src/app/(dashboard)/dashboard/providers/[id]/page.js +27 -6
  972. package/app/src/app/(dashboard)/dashboard/proxy-pools/RelayDeployModal.js +109 -0
  973. package/app/src/app/(dashboard)/dashboard/proxy-pools/page.js +144 -167
  974. package/app/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/QuotaTable.js +39 -8
  975. package/app/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.js +32 -5
  976. package/app/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/utils.js +79 -2
  977. package/app/src/app/api/cli-tools/hermes-profiles/route.js +17 -0
  978. package/app/src/app/api/cli-tools/hermes-settings/hermesProfiles.js +136 -0
  979. package/app/src/app/api/cli-tools/hermes-settings/hermesYaml.js +265 -0
  980. package/app/src/app/api/cli-tools/hermes-settings/route.js +270 -149
  981. package/app/src/app/api/oauth/[provider]/[action]/route.js +2 -1
  982. package/app/src/app/api/providers/[id]/models/route.js +98 -16
  983. package/app/src/app/api/providers/[id]/route.js +14 -17
  984. package/app/src/app/api/providers/[id]/test/oauthTestConfig.js +152 -0
  985. package/app/src/app/api/providers/[id]/test/testUtils.js +65 -152
  986. package/app/src/app/api/providers/route.js +12 -7
  987. package/app/src/app/api/providers/suggested-models/filters.js +30 -3
  988. package/app/src/app/api/providers/suggested-models/route.js +3 -1
  989. package/app/src/app/api/providers/validate/route.js +30 -1
  990. package/app/src/app/api/proxy-pools/[id]/route.js +1 -1
  991. package/app/src/app/api/proxy-pools/[id]/test/route.js +1 -1
  992. package/app/src/app/api/proxy-pools/netlify-deploy/route.js +146 -0
  993. package/app/src/app/api/proxy-pools/route.js +1 -1
  994. package/app/src/lib/db/repos/nodesRepo.js +5 -0
  995. package/app/src/lib/db/repos/usageRepo.js +14 -10
  996. package/app/src/lib/network/connectionProxy.js +2 -2
  997. package/app/src/lib/network/netlifyRelay.js +212 -0
  998. package/app/src/lib/oauth/constants/oauth.js +12 -0
  999. package/app/src/lib/oauth/providers/index.js +8 -0
  1000. package/app/src/lib/oauth/providers/minimax-code-global.js +4 -0
  1001. package/app/src/lib/oauth/providers/minimax-code-shared.js +149 -0
  1002. package/app/src/lib/oauth/providers/minimax-code.js +4 -0
  1003. package/app/src/lib/oauth/providers/nous.js +110 -0
  1004. package/app/src/lib/providerConnectionResponse.js +16 -0
  1005. package/app/src/mitm/server.js +10 -10
  1006. package/app/src/shared/components/Button.js +4 -3
  1007. package/app/src/shared/components/ComboFormModal.js +8 -0
  1008. package/app/src/shared/components/EditConnectionModal.js +83 -2
  1009. package/app/src/shared/components/Header.js +9 -7
  1010. package/app/src/shared/components/ModelSelectModal.js +281 -59
  1011. package/app/src/shared/components/OAuthModal.js +9 -1
  1012. package/app/src/shared/components/Sidebar.js +10 -8
  1013. package/app/src/shared/components/Tooltip.js +33 -15
  1014. package/app/src/shared/components/UsageStats.js +2 -2
  1015. package/app/src/shared/constants/cliTools.js +22 -9
  1016. package/app/src/shared/constants/config.js +2 -2
  1017. package/app/src/shared/constants/providers.js +6 -0
  1018. package/app/src/shared/constants/ttsProviders.js +6 -0
  1019. package/app/src/shared/services/initializeApp.js +6 -2
  1020. package/app/src/shared/services/quotaAutoPing.js +57 -25
  1021. package/app/src/shared/services/quotaPingSchedule.js +158 -0
  1022. package/app/src/shared/utils/connectionStatus.js +23 -0
  1023. package/app/src/shared/utils/index.js +1 -0
  1024. package/app/src/shared/utils/modelSearchFilter.js +184 -0
  1025. package/app/src/shared/utils/providerIcon.js +4 -0
  1026. package/app/src/sse/handlers/imageGeneration.js +41 -3
  1027. package/app/src/sse/services/allowedModels.js +45 -15
  1028. package/app/src/sse/services/antigravityQuota.js +201 -2
  1029. package/app/src/sse/services/auth.js +26 -8
  1030. package/app/src/sse/services/tokenRefresh.js +5 -0
  1031. package/cli.js +16 -0
  1032. package/package.json +1 -1
  1033. package/src/cli/api/client.js +17 -4
  1034. package/src/cli/commands/connect.js +156 -16
  1035. package/src/cli/commands/connectTools.js +228 -8
  1036. package/src/cli/commands/show.js +101 -0
  1037. package/src/cli/menus/cliTools.js +116 -17
  1038. package/src/cli/menus/combos.js +9 -2
  1039. package/src/cli/menus/providers.js +8 -0
  1040. package/src/cli/utils/comboModelId.js +10 -0
  1041. package/app/.next-cli-build/server/chunks/3180.js +0 -1
  1042. package/app/.next-cli-build/server/chunks/3811.js +0 -1
  1043. package/app/.next-cli-build/server/chunks/3946.js +0 -1
  1044. package/app/.next-cli-build/server/chunks/4684.js +0 -1
  1045. package/app/.next-cli-build/server/chunks/499.js +0 -7
  1046. package/app/.next-cli-build/server/chunks/5296.js +0 -1
  1047. package/app/.next-cli-build/server/chunks/5300.js +0 -1
  1048. package/app/.next-cli-build/server/chunks/5538.js +0 -1
  1049. package/app/.next-cli-build/server/chunks/5598.js +0 -1
  1050. package/app/.next-cli-build/server/chunks/7901.js +0 -1
  1051. package/app/.next-cli-build/server/chunks/8156.js +0 -1
  1052. package/app/.next-cli-build/server/chunks/9306.js +0 -1
  1053. package/app/.next-cli-build/server/chunks/9614.js +0 -7
  1054. package/app/.next-cli-build/server/chunks/9987.js +0 -1
  1055. package/app/.next-cli-build/static/chunks/2884.c2828a385eb15374.js +0 -1
  1056. package/app/.next-cli-build/static/chunks/3257.d85ea7c5fb00c4ad.js +0 -1
  1057. package/app/.next-cli-build/static/chunks/3657.512c2a8e4d8a3378.js +0 -1
  1058. package/app/.next-cli-build/static/chunks/4385-b922404bb5a03104.js +0 -1
  1059. package/app/.next-cli-build/static/chunks/736-496a2f3435a2f07b.js +0 -1
  1060. package/app/.next-cli-build/static/chunks/8914-3f7d0c3f2382c240.js +0 -27
  1061. package/app/.next-cli-build/static/chunks/9078.179627baa7e71262.js +0 -7
  1062. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-dda2267e5dd24d67.js +0 -1
  1063. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-6da24c5f5e4a614b.js +0 -63
  1064. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-0cec5002922a16be.js +0 -27
  1065. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-3d608f55f979c3a3.js +0 -4
  1066. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-a9d4f81863886751.js +0 -1
  1067. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-4df24bf4c7a1dd93.js +0 -1
  1068. package/app/.next-cli-build/static/chunks/app/_global-error/page-f2541f892f6e4aef.js +0 -1
  1069. package/app/.next-cli-build/static/chunks/app/api/auth/check/route-f2541f892f6e4aef.js +0 -1
  1070. package/app/.next-cli-build/static/chunks/app/api/auth/login/route-f2541f892f6e4aef.js +0 -1
  1071. package/app/.next-cli-build/static/chunks/app/api/auth/logout/route-f2541f892f6e4aef.js +0 -1
  1072. package/app/.next-cli-build/static/chunks/app/api/auth/oidc/callback/route-f2541f892f6e4aef.js +0 -1
  1073. package/app/.next-cli-build/static/chunks/app/api/auth/oidc/start/route-f2541f892f6e4aef.js +0 -1
  1074. package/app/.next-cli-build/static/chunks/app/api/auth/oidc/test/route-f2541f892f6e4aef.js +0 -1
  1075. package/app/.next-cli-build/static/chunks/app/api/auth/reset-password/route-f2541f892f6e4aef.js +0 -1
  1076. package/app/.next-cli-build/static/chunks/app/api/auth/status/route-f2541f892f6e4aef.js +0 -1
  1077. package/app/.next-cli-build/static/chunks/app/api/cli-tools/all-statuses/route-f2541f892f6e4aef.js +0 -1
  1078. package/app/.next-cli-build/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-f2541f892f6e4aef.js +0 -1
  1079. package/app/.next-cli-build/static/chunks/app/api/cli-tools/antigravity-mitm/route-f2541f892f6e4aef.js +0 -1
  1080. package/app/.next-cli-build/static/chunks/app/api/cli-tools/claude-settings/route-f2541f892f6e4aef.js +0 -1
  1081. package/app/.next-cli-build/static/chunks/app/api/cli-tools/cline-settings/route-f2541f892f6e4aef.js +0 -1
  1082. package/app/.next-cli-build/static/chunks/app/api/cli-tools/codewhale-settings/route-f2541f892f6e4aef.js +0 -1
  1083. package/app/.next-cli-build/static/chunks/app/api/cli-tools/codex-profiles/route-f2541f892f6e4aef.js +0 -1
  1084. package/app/.next-cli-build/static/chunks/app/api/cli-tools/codex-settings/route-f2541f892f6e4aef.js +0 -1
  1085. package/app/.next-cli-build/static/chunks/app/api/cli-tools/copilot-settings/route-f2541f892f6e4aef.js +0 -1
  1086. package/app/.next-cli-build/static/chunks/app/api/cli-tools/cowork-mcp-registry/route-f2541f892f6e4aef.js +0 -1
  1087. package/app/.next-cli-build/static/chunks/app/api/cli-tools/cowork-mcp-tools/route-f2541f892f6e4aef.js +0 -1
  1088. package/app/.next-cli-build/static/chunks/app/api/cli-tools/cowork-settings/route-f2541f892f6e4aef.js +0 -1
  1089. package/app/.next-cli-build/static/chunks/app/api/cli-tools/crush-settings/route-f2541f892f6e4aef.js +0 -1
  1090. package/app/.next-cli-build/static/chunks/app/api/cli-tools/deepseek-tui-settings/route-f2541f892f6e4aef.js +0 -1
  1091. package/app/.next-cli-build/static/chunks/app/api/cli-tools/devin-settings/route-f2541f892f6e4aef.js +0 -1
  1092. package/app/.next-cli-build/static/chunks/app/api/cli-tools/droid-settings/route-f2541f892f6e4aef.js +0 -1
  1093. package/app/.next-cli-build/static/chunks/app/api/cli-tools/forge-settings/route-f2541f892f6e4aef.js +0 -1
  1094. package/app/.next-cli-build/static/chunks/app/api/cli-tools/grok-build-settings/route-f2541f892f6e4aef.js +0 -1
  1095. package/app/.next-cli-build/static/chunks/app/api/cli-tools/hermes-settings/route-f2541f892f6e4aef.js +0 -1
  1096. package/app/.next-cli-build/static/chunks/app/api/cli-tools/jcode-settings/route-f2541f892f6e4aef.js +0 -1
  1097. package/app/.next-cli-build/static/chunks/app/api/cli-tools/kilo-settings/route-f2541f892f6e4aef.js +0 -1
  1098. package/app/.next-cli-build/static/chunks/app/api/cli-tools/omp-settings/route-f2541f892f6e4aef.js +0 -1
  1099. package/app/.next-cli-build/static/chunks/app/api/cli-tools/openclaw-settings/route-f2541f892f6e4aef.js +0 -1
  1100. package/app/.next-cli-build/static/chunks/app/api/cli-tools/opencode-settings/route-f2541f892f6e4aef.js +0 -1
  1101. package/app/.next-cli-build/static/chunks/app/api/cli-tools/pi-settings/route-f2541f892f6e4aef.js +0 -1
  1102. package/app/.next-cli-build/static/chunks/app/api/cli-tools/smelt-settings/route-f2541f892f6e4aef.js +0 -1
  1103. package/app/.next-cli-build/static/chunks/app/api/combos/[id]/route-f2541f892f6e4aef.js +0 -1
  1104. package/app/.next-cli-build/static/chunks/app/api/combos/presets/route-f2541f892f6e4aef.js +0 -1
  1105. package/app/.next-cli-build/static/chunks/app/api/combos/route-f2541f892f6e4aef.js +0 -1
  1106. package/app/.next-cli-build/static/chunks/app/api/headroom/extras/route-f2541f892f6e4aef.js +0 -1
  1107. package/app/.next-cli-build/static/chunks/app/api/headroom/proxy/[...path]/route-f2541f892f6e4aef.js +0 -1
  1108. package/app/.next-cli-build/static/chunks/app/api/headroom/restart/route-f2541f892f6e4aef.js +0 -1
  1109. package/app/.next-cli-build/static/chunks/app/api/headroom/start/route-f2541f892f6e4aef.js +0 -1
  1110. package/app/.next-cli-build/static/chunks/app/api/headroom/status/route-f2541f892f6e4aef.js +0 -1
  1111. package/app/.next-cli-build/static/chunks/app/api/headroom/stop/route-f2541f892f6e4aef.js +0 -1
  1112. package/app/.next-cli-build/static/chunks/app/api/health/route-f2541f892f6e4aef.js +0 -1
  1113. package/app/.next-cli-build/static/chunks/app/api/init/route-f2541f892f6e4aef.js +0 -1
  1114. package/app/.next-cli-build/static/chunks/app/api/keys/[id]/route-f2541f892f6e4aef.js +0 -1
  1115. package/app/.next-cli-build/static/chunks/app/api/keys/route-f2541f892f6e4aef.js +0 -1
  1116. package/app/.next-cli-build/static/chunks/app/api/locale/route-f2541f892f6e4aef.js +0 -1
  1117. package/app/.next-cli-build/static/chunks/app/api/mcp/[plugin]/message/route-f2541f892f6e4aef.js +0 -1
  1118. package/app/.next-cli-build/static/chunks/app/api/mcp/[plugin]/sse/route-f2541f892f6e4aef.js +0 -1
  1119. package/app/.next-cli-build/static/chunks/app/api/media-providers/tts/deepgram/voices/route-f2541f892f6e4aef.js +0 -1
  1120. package/app/.next-cli-build/static/chunks/app/api/media-providers/tts/elevenlabs/voices/route-f2541f892f6e4aef.js +0 -1
  1121. package/app/.next-cli-build/static/chunks/app/api/media-providers/tts/inworld/voices/route-f2541f892f6e4aef.js +0 -1
  1122. package/app/.next-cli-build/static/chunks/app/api/media-providers/tts/minimax/voices/route-f2541f892f6e4aef.js +0 -1
  1123. package/app/.next-cli-build/static/chunks/app/api/media-providers/tts/voices/route-f2541f892f6e4aef.js +0 -1
  1124. package/app/.next-cli-build/static/chunks/app/api/models/alias/route-f2541f892f6e4aef.js +0 -1
  1125. package/app/.next-cli-build/static/chunks/app/api/models/availability/route-f2541f892f6e4aef.js +0 -1
  1126. package/app/.next-cli-build/static/chunks/app/api/models/catalog-sync/route-f2541f892f6e4aef.js +0 -1
  1127. package/app/.next-cli-build/static/chunks/app/api/models/custom/route-f2541f892f6e4aef.js +0 -1
  1128. package/app/.next-cli-build/static/chunks/app/api/models/disabled/route-f2541f892f6e4aef.js +0 -1
  1129. package/app/.next-cli-build/static/chunks/app/api/models/route-f2541f892f6e4aef.js +0 -1
  1130. package/app/.next-cli-build/static/chunks/app/api/models/test/route-f2541f892f6e4aef.js +0 -1
  1131. package/app/.next-cli-build/static/chunks/app/api/oauth/[provider]/[action]/route-f2541f892f6e4aef.js +0 -1
  1132. package/app/.next-cli-build/static/chunks/app/api/oauth/codex/bulk-import/route-f2541f892f6e4aef.js +0 -1
  1133. package/app/.next-cli-build/static/chunks/app/api/oauth/codex/import-token/route-f2541f892f6e4aef.js +0 -1
  1134. package/app/.next-cli-build/static/chunks/app/api/oauth/cursor/auto-import/route-f2541f892f6e4aef.js +0 -1
  1135. package/app/.next-cli-build/static/chunks/app/api/oauth/cursor/import/route-f2541f892f6e4aef.js +0 -1
  1136. package/app/.next-cli-build/static/chunks/app/api/oauth/gitlab/pat/route-f2541f892f6e4aef.js +0 -1
  1137. package/app/.next-cli-build/static/chunks/app/api/oauth/grok-cli/bulk-import/route-f2541f892f6e4aef.js +0 -1
  1138. package/app/.next-cli-build/static/chunks/app/api/oauth/iflow/cookie/route-f2541f892f6e4aef.js +0 -1
  1139. package/app/.next-cli-build/static/chunks/app/api/oauth/kiro/api-key/route-f2541f892f6e4aef.js +0 -1
  1140. package/app/.next-cli-build/static/chunks/app/api/oauth/kiro/auto-import/route-f2541f892f6e4aef.js +0 -1
  1141. package/app/.next-cli-build/static/chunks/app/api/oauth/kiro/import/route-f2541f892f6e4aef.js +0 -1
  1142. package/app/.next-cli-build/static/chunks/app/api/oauth/kiro/import-cli-proxy/route-f2541f892f6e4aef.js +0 -1
  1143. package/app/.next-cli-build/static/chunks/app/api/oauth/kiro/social-authorize/route-f2541f892f6e4aef.js +0 -1
  1144. package/app/.next-cli-build/static/chunks/app/api/oauth/kiro/social-exchange/route-f2541f892f6e4aef.js +0 -1
  1145. package/app/.next-cli-build/static/chunks/app/api/oauth/zed/auto-import/route-f2541f892f6e4aef.js +0 -1
  1146. package/app/.next-cli-build/static/chunks/app/api/oauth/zed/import/route-f2541f892f6e4aef.js +0 -1
  1147. package/app/.next-cli-build/static/chunks/app/api/pricing/route-f2541f892f6e4aef.js +0 -1
  1148. package/app/.next-cli-build/static/chunks/app/api/provider-nodes/[id]/route-f2541f892f6e4aef.js +0 -1
  1149. package/app/.next-cli-build/static/chunks/app/api/provider-nodes/route-f2541f892f6e4aef.js +0 -1
  1150. package/app/.next-cli-build/static/chunks/app/api/provider-nodes/validate/route-f2541f892f6e4aef.js +0 -1
  1151. package/app/.next-cli-build/static/chunks/app/api/providers/[id]/gcp-projects/route-f2541f892f6e4aef.js +0 -1
  1152. package/app/.next-cli-build/static/chunks/app/api/providers/[id]/models/route-f2541f892f6e4aef.js +0 -1
  1153. package/app/.next-cli-build/static/chunks/app/api/providers/[id]/overrides/route-f2541f892f6e4aef.js +0 -1
  1154. package/app/.next-cli-build/static/chunks/app/api/providers/[id]/route-f2541f892f6e4aef.js +0 -1
  1155. package/app/.next-cli-build/static/chunks/app/api/providers/[id]/test/route-f2541f892f6e4aef.js +0 -1
  1156. package/app/.next-cli-build/static/chunks/app/api/providers/[id]/test-models/route-f2541f892f6e4aef.js +0 -1
  1157. package/app/.next-cli-build/static/chunks/app/api/providers/bulk/route-f2541f892f6e4aef.js +0 -1
  1158. package/app/.next-cli-build/static/chunks/app/api/providers/circuit-breakers/[name]/reset/route-f2541f892f6e4aef.js +0 -1
  1159. package/app/.next-cli-build/static/chunks/app/api/providers/circuit-breakers/route-f2541f892f6e4aef.js +0 -1
  1160. package/app/.next-cli-build/static/chunks/app/api/providers/client/route-f2541f892f6e4aef.js +0 -1
  1161. package/app/.next-cli-build/static/chunks/app/api/providers/kilo/free-models/route-f2541f892f6e4aef.js +0 -1
  1162. package/app/.next-cli-build/static/chunks/app/api/providers/route-f2541f892f6e4aef.js +0 -1
  1163. package/app/.next-cli-build/static/chunks/app/api/providers/suggested-models/route-f2541f892f6e4aef.js +0 -1
  1164. package/app/.next-cli-build/static/chunks/app/api/providers/test-batch/route-f2541f892f6e4aef.js +0 -1
  1165. package/app/.next-cli-build/static/chunks/app/api/providers/validate/route-f2541f892f6e4aef.js +0 -1
  1166. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/[id]/fitness/clear/route-f2541f892f6e4aef.js +0 -1
  1167. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/[id]/route-f2541f892f6e4aef.js +0 -1
  1168. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/[id]/test/route-f2541f892f6e4aef.js +0 -1
  1169. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/cloudflare-deploy/route-f2541f892f6e4aef.js +0 -1
  1170. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/deno-deploy/route-f2541f892f6e4aef.js +0 -1
  1171. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/fitness/clear-all/route-f2541f892f6e4aef.js +0 -1
  1172. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/fitness/route-f2541f892f6e4aef.js +0 -1
  1173. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/route-f2541f892f6e4aef.js +0 -1
  1174. package/app/.next-cli-build/static/chunks/app/api/proxy-pools/vercel-deploy/route-f2541f892f6e4aef.js +0 -1
  1175. package/app/.next-cli-build/static/chunks/app/api/pxpipe/health/route-f2541f892f6e4aef.js +0 -1
  1176. package/app/.next-cli-build/static/chunks/app/api/pxpipe/install/route-f2541f892f6e4aef.js +0 -1
  1177. package/app/.next-cli-build/static/chunks/app/api/pxpipe/logs/route-f2541f892f6e4aef.js +0 -1
  1178. package/app/.next-cli-build/static/chunks/app/api/pxpipe/restart/route-f2541f892f6e4aef.js +0 -1
  1179. package/app/.next-cli-build/static/chunks/app/api/pxpipe/start/route-f2541f892f6e4aef.js +0 -1
  1180. package/app/.next-cli-build/static/chunks/app/api/pxpipe/stats/route-f2541f892f6e4aef.js +0 -1
  1181. package/app/.next-cli-build/static/chunks/app/api/pxpipe/status/route-f2541f892f6e4aef.js +0 -1
  1182. package/app/.next-cli-build/static/chunks/app/api/pxpipe/stop/route-f2541f892f6e4aef.js +0 -1
  1183. package/app/.next-cli-build/static/chunks/app/api/ready/route-f2541f892f6e4aef.js +0 -1
  1184. package/app/.next-cli-build/static/chunks/app/api/settings/database/route-f2541f892f6e4aef.js +0 -1
  1185. package/app/.next-cli-build/static/chunks/app/api/settings/proxy-test/route-f2541f892f6e4aef.js +0 -1
  1186. package/app/.next-cli-build/static/chunks/app/api/settings/require-login/route-f2541f892f6e4aef.js +0 -1
  1187. package/app/.next-cli-build/static/chunks/app/api/settings/route-f2541f892f6e4aef.js +0 -1
  1188. package/app/.next-cli-build/static/chunks/app/api/shutdown/route-f2541f892f6e4aef.js +0 -1
  1189. package/app/.next-cli-build/static/chunks/app/api/tags/route-f2541f892f6e4aef.js +0 -1
  1190. package/app/.next-cli-build/static/chunks/app/api/translator/console-logs/route-f2541f892f6e4aef.js +0 -1
  1191. package/app/.next-cli-build/static/chunks/app/api/translator/console-logs/stream/route-f2541f892f6e4aef.js +0 -1
  1192. package/app/.next-cli-build/static/chunks/app/api/translator/load/route-f2541f892f6e4aef.js +0 -1
  1193. package/app/.next-cli-build/static/chunks/app/api/translator/save/route-f2541f892f6e4aef.js +0 -1
  1194. package/app/.next-cli-build/static/chunks/app/api/translator/send/route-f2541f892f6e4aef.js +0 -1
  1195. package/app/.next-cli-build/static/chunks/app/api/translator/translate/route-f2541f892f6e4aef.js +0 -1
  1196. package/app/.next-cli-build/static/chunks/app/api/tunnel/disable/route-f2541f892f6e4aef.js +0 -1
  1197. package/app/.next-cli-build/static/chunks/app/api/tunnel/enable/route-f2541f892f6e4aef.js +0 -1
  1198. package/app/.next-cli-build/static/chunks/app/api/tunnel/status/route-f2541f892f6e4aef.js +0 -1
  1199. package/app/.next-cli-build/static/chunks/app/api/tunnel/tailscale-check/route-f2541f892f6e4aef.js +0 -1
  1200. package/app/.next-cli-build/static/chunks/app/api/tunnel/tailscale-disable/route-f2541f892f6e4aef.js +0 -1
  1201. package/app/.next-cli-build/static/chunks/app/api/tunnel/tailscale-enable/route-f2541f892f6e4aef.js +0 -1
  1202. package/app/.next-cli-build/static/chunks/app/api/tunnel/tailscale-install/route-f2541f892f6e4aef.js +0 -1
  1203. package/app/.next-cli-build/static/chunks/app/api/usage/[connectionId]/claude-reset/route-f2541f892f6e4aef.js +0 -1
  1204. package/app/.next-cli-build/static/chunks/app/api/usage/[connectionId]/codex-reset-credits/route-f2541f892f6e4aef.js +0 -1
  1205. package/app/.next-cli-build/static/chunks/app/api/usage/[connectionId]/route-f2541f892f6e4aef.js +0 -1
  1206. package/app/.next-cli-build/static/chunks/app/api/usage/chart/route-f2541f892f6e4aef.js +0 -1
  1207. package/app/.next-cli-build/static/chunks/app/api/usage/history/route-f2541f892f6e4aef.js +0 -1
  1208. package/app/.next-cli-build/static/chunks/app/api/usage/logs/route-f2541f892f6e4aef.js +0 -1
  1209. package/app/.next-cli-build/static/chunks/app/api/usage/providers/route-f2541f892f6e4aef.js +0 -1
  1210. package/app/.next-cli-build/static/chunks/app/api/usage/request-details/[id]/route-f2541f892f6e4aef.js +0 -1
  1211. package/app/.next-cli-build/static/chunks/app/api/usage/request-details/route-f2541f892f6e4aef.js +0 -1
  1212. package/app/.next-cli-build/static/chunks/app/api/usage/request-logs/route-f2541f892f6e4aef.js +0 -1
  1213. package/app/.next-cli-build/static/chunks/app/api/usage/stats/route-f2541f892f6e4aef.js +0 -1
  1214. package/app/.next-cli-build/static/chunks/app/api/usage/stream/route-f2541f892f6e4aef.js +0 -1
  1215. package/app/.next-cli-build/static/chunks/app/api/v1/api/chat/route-f2541f892f6e4aef.js +0 -1
  1216. package/app/.next-cli-build/static/chunks/app/api/v1/audio/speech/route-f2541f892f6e4aef.js +0 -1
  1217. package/app/.next-cli-build/static/chunks/app/api/v1/audio/transcriptions/route-f2541f892f6e4aef.js +0 -1
  1218. package/app/.next-cli-build/static/chunks/app/api/v1/audio/voices/route-f2541f892f6e4aef.js +0 -1
  1219. package/app/.next-cli-build/static/chunks/app/api/v1/chat/completions/route-f2541f892f6e4aef.js +0 -1
  1220. package/app/.next-cli-build/static/chunks/app/api/v1/embeddings/route-f2541f892f6e4aef.js +0 -1
  1221. package/app/.next-cli-build/static/chunks/app/api/v1/images/generations/route-f2541f892f6e4aef.js +0 -1
  1222. package/app/.next-cli-build/static/chunks/app/api/v1/messages/count_tokens/route-f2541f892f6e4aef.js +0 -1
  1223. package/app/.next-cli-build/static/chunks/app/api/v1/messages/route-f2541f892f6e4aef.js +0 -1
  1224. package/app/.next-cli-build/static/chunks/app/api/v1/models/[kind]/route-f2541f892f6e4aef.js +0 -1
  1225. package/app/.next-cli-build/static/chunks/app/api/v1/models/info/route-f2541f892f6e4aef.js +0 -1
  1226. package/app/.next-cli-build/static/chunks/app/api/v1/models/route-f2541f892f6e4aef.js +0 -1
  1227. package/app/.next-cli-build/static/chunks/app/api/v1/responses/compact/route-f2541f892f6e4aef.js +0 -1
  1228. package/app/.next-cli-build/static/chunks/app/api/v1/responses/route-f2541f892f6e4aef.js +0 -1
  1229. package/app/.next-cli-build/static/chunks/app/api/v1/route-f2541f892f6e4aef.js +0 -1
  1230. package/app/.next-cli-build/static/chunks/app/api/v1/search/route-f2541f892f6e4aef.js +0 -1
  1231. package/app/.next-cli-build/static/chunks/app/api/v1/videos/[id]/route-f2541f892f6e4aef.js +0 -1
  1232. package/app/.next-cli-build/static/chunks/app/api/v1/videos/edits/route-f2541f892f6e4aef.js +0 -1
  1233. package/app/.next-cli-build/static/chunks/app/api/v1/videos/extensions/route-f2541f892f6e4aef.js +0 -1
  1234. package/app/.next-cli-build/static/chunks/app/api/v1/videos/generations/route-f2541f892f6e4aef.js +0 -1
  1235. package/app/.next-cli-build/static/chunks/app/api/v1/web/fetch/route-f2541f892f6e4aef.js +0 -1
  1236. package/app/.next-cli-build/static/chunks/app/api/v1beta/models/[...path]/route-f2541f892f6e4aef.js +0 -1
  1237. package/app/.next-cli-build/static/chunks/app/api/v1beta/models/route-f2541f892f6e4aef.js +0 -1
  1238. package/app/.next-cli-build/static/chunks/app/api/version/route-f2541f892f6e4aef.js +0 -1
  1239. package/app/.next-cli-build/static/chunks/app/api/version/shutdown/route-f2541f892f6e4aef.js +0 -1
  1240. package/app/.next-cli-build/static/chunks/app/api/version/update/route-f2541f892f6e4aef.js +0 -1
  1241. package/app/.next-cli-build/static/chunks/app/landing/page-ef06aab3fafceba8.js +0 -1
  1242. package/app/.next-cli-build/static/chunks/app/manifest.webmanifest/route-f2541f892f6e4aef.js +0 -1
  1243. package/app/.next-cli-build/static/chunks/next/dist/client/components/builtin/app-error-f2541f892f6e4aef.js +0 -1
  1244. package/app/.next-cli-build/static/chunks/next/dist/client/components/builtin/forbidden-f2541f892f6e4aef.js +0 -1
  1245. package/app/.next-cli-build/static/chunks/next/dist/client/components/builtin/not-found-f2541f892f6e4aef.js +0 -1
  1246. package/app/.next-cli-build/static/chunks/next/dist/client/components/builtin/unauthorized-f2541f892f6e4aef.js +0 -1
  1247. package/app/.next-cli-build/static/css/037a51fb3aab0cf1.css +0 -1
  1248. package/app/.next-cli-build/static/dE8a3jeu028Mjv0t38rwl/_buildManifest.js +0 -1
  1249. /package/app/.next-cli-build/static/{dE8a3jeu028Mjv0t38rwl → DsIP1InInSX1jxI1CwKX9}/_ssgManifest.js +0 -0
@@ -1,39 +1,47 @@
1
- "use strict";exports.id=2741,exports.ids=[2741],exports.modules={55009:(a,b,c)=>{c.d(b,{y:()=>f});var d=c(71183),e=c(48444);function f(){let[a,b]=(0,d.useState)(()=>({})),[c,f]=(0,d.useState)(()=>({}));return{getCaps:(0,d.useCallback)(b=>(function(a,b,c){if(!c)return null;if(a[c])return a[c];let d=c.includes("/")?c.slice(c.indexOf("/")+1):c;if(b[d])return b[d];let f=c.includes("/")?c.slice(0,c.indexOf("/")):null,g=(0,e.nl)(f,d);return{vision:g.vision,search:g.search,reasoning:g.reasoning,contextWindow:g.contextWindow,maxOutput:g.maxOutput}})(a,c,b),[a,c])}}},61126:a=>{a.exports={TOOL_HOSTS:{antigravity:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],copilot:["api.individual.githubcopilot.com"],kiro:["runtime.us-east-1.kiro.dev","q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"],cursor:["api2.cursor.sh"]}}},92741:(a,b,c)=>{c.d(b,{Tk:()=>B,aG:()=>ag,Ah:()=>H,h1:()=>af,Q6:()=>ad,lF:()=>ak,a7:()=>X,ZM:()=>K,WE:()=>ax,E_:()=>at,RF:()=>S,mW:()=>an,c9:()=>ah,tA:()=>aA,kn:()=>aF,yZ:()=>N,qO:()=>$});var d=c(66238),e=c(71183);let f=a=>a?.endsWith("/v1")?a:`${a}/v1`;function g(a,b){switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}}let h=function({apiKeys:a,baseUrl:b,cloudEnabled:c,initialStatus:d,isExpanded:h,onToggle:i,statusEndpoint:j,getDefaultBaseUrl:k=f,getInitialApiKey:l}){let[m,n]=(0,e.useReducer)(g,{status:d||null,checking:!1,applying:!1,restoring:!1,message:null}),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)({}),[s,t]=(0,e.useState)(""),u=(0,e.useRef)(!!d),v=(0,e.useRef)(!1),w=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&r(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),x=(0,e.useCallback)(async()=>{n({type:"CHECK_START"});try{let a=await fetch(j,{cache:"no-store"}),b=await a.json();n({type:"CHECK_DONE",data:b})}catch(a){n({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[j]),y=(0,e.useCallback)(async()=>{u.current||(u.current=!0,await x()),v.current||(v.current=!0,await w())},[x,w]),z=(0,e.useCallback)(()=>{h||y(),i()},[h,y,i]),A=o??(l?l(m.status,a):a?.length>0?a[0].key:""),B=(0,e.useCallback)(()=>{let a=(s||k(b)).replace(/\/+$/,"");return a.endsWith("/v1")?a:`${a}/v1`},[b,s,k]),C=(0,e.useCallback)(()=>s||k(b),[b,s,k]);return{...m,dispatch:n,checkStatus:x,customBaseUrl:s,fetchModelAliases:w,getDisplayUrl:C,getEffectiveBaseUrl:B,handleToggle:z,initializeCard:y,modelAliases:q,selectedApiKey:A,setCustomBaseUrl:t,setSelectedApiKey:p}};var i=c(40228),j=c(15901),k=c(13717);let l=a=>(a||"").replace(/\/+$/,"");function m(){return[]}function n(a){}function o(a,b){let c=l(a);if(!c)return null;let d=m(),e=d.find(a=>l(a.baseUrl)===c);if(e&&!b)return e.name;let f=(b||function(a){try{return new URL(a).host}catch{return a}}(c)).trim();return f?(n([...d.filter(a=>a.name!==f&&l(a.baseUrl)!==c),{name:f,baseUrl:c}].sort((a,b)=>a.name.localeCompare(b.name))),f):null}let p="__custom__",q="__save__";function r({value:a,onChange:b,requiresExternalUrl:c=!1,tunnelEnabled:f=!1,tunnelPublicUrl:g="",tailscaleEnabled:h=!1,tailscaleUrl:i="",cloudEnabled:j=!1,cloudUrl:l="",withV1:n=!0,currentUrl:s=""}){let[t,u]=(0,e.useState)(m),[v,w]=(0,e.useState)(!0),[x,y]=(0,e.useState)(""),[z,A]=(0,e.useState)("");(0,e.useRef)(!1),(0,e.useRef)("");let B=(0,e.useRef)(""),C=(0,e.useMemo)(()=>(({requiresExternalUrl:a,tunnelEnabled:b,tunnelPublicUrl:c,tailscaleEnabled:d,tailscaleUrl:e,cloudEnabled:f,cloudUrl:g,savedPresets:h,withV1:i})=>{let j=[],l=a=>{let b;return i?(b=(a||"").replace(/\/+$/,""))?/\/v1$/.test(b)?b:`${b}/v1`:"":(a||"").replace(/\/+$/,"")};if(!a){let a=l(`http://127.0.0.1:${k.h0.appPort}`);j.push({value:"local",label:a,url:a})}if(b&&c){let a=l(c);j.push({value:"tunnel",label:a,url:a})}if(d&&e){let a=l(e);j.push({value:"tailscale",label:a,url:a})}if(f&&g){let a=l(g);j.push({value:"cloud",label:a,url:a})}return h.forEach(a=>{j.push({value:`saved:${a.name}`,label:a.baseUrl,url:a.baseUrl,saved:!0})}),j.push({value:p,label:"Custom URL...",url:""}),j})({requiresExternalUrl:c,tunnelEnabled:f,tunnelPublicUrl:g,tailscaleEnabled:h,tailscaleUrl:i,cloudEnabled:j,cloudUrl:l,savedPresets:t,withV1:n}),[c,f,g,h,i,j,l,t,n]),D=x.startsWith("saved:"),E=x===p,F=E&&(z||"").trim().length>0;return(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("select",{value:x,onChange:c=>{let d=c.target.value;if(d===q){let b=(a||"").trim();if(!b)return;let c=b;try{c=new URL(b).host}catch{}let d=window.prompt("Save endpoint as:",c),e=d?.trim()?o(b,d.trim()):null;e&&y(`saved:${e}`);return}if(y(d),d===p){A(""),b("");return}let e=C.find(a=>a.value===d);e&&b(e.url)},className:"flex-1 min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[C.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value)),F&&(0,d.jsx)("option",{value:q,children:"+ Save current as..."})]}),D&&(0,d.jsx)("button",{type:"button",onClick:()=>{var a;if(!x.startsWith("saved:"))return;a=x.slice(6),m().filter(b=>b.name!==a),A("");let c=C.find(a=>a.value!==p&&a.value!==x);c?(y(c.value),b(c.url)):(y(p),b(""))},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors shrink-0",title:"Delete saved endpoint",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]}),E&&(0,d.jsx)("input",{type:"text",value:z,onChange:a=>{let c=a.target.value;B.current=c,A(c),b(c)},placeholder:n?"https://example.com/v1":"https://example.com",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"})]})}let s="__custom__",t=[];function u({value:a,onChange:b,apiKeys:c=t,cloudEnabled:f=!1,className:g=""}){let h=!c.some(b=>b.key===a)&&""!==a,[i,j]=(0,e.useState)(()=>a?c.some(b=>b.key===a)?a:s:c.length>0?c[0].key:s),[k,l]=(0,e.useState)(h?a:"");return 0===c.length&&i!==s&&i!==s?(0,d.jsx)("span",{className:`min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5 ${g}`,children:f?"No API keys - Create one in Keys page":"sk_9router (default)"}):(0,d.jsxs)("div",{className:`flex flex-col gap-1.5 ${g}`,children:[(0,d.jsxs)("select",{value:i,onChange:a=>{let c=a.target.value;j(c),c===s?(l(""),b("")):b(c)},className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[c.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id)),(0,d.jsx)("option",{value:s,children:"Custom..."})]}),i===s&&(0,d.jsx)("input",{type:"text",value:k,onChange:a=>{let c=a.target.value;l(c),b(c)},placeholder:"sk-...","aria-label":"Custom API key",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"})]})}let v=a=>(a||"").replace(/\/+$/,"");function w(a,b={}){if(!a)return!1;let c=v(a),{tunnelPublicUrl:d,tailscaleUrl:e,cloudUrl:f}=b;return!!(/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(c)||d&&c.startsWith(v(d))||e&&c.startsWith(v(e))||f&&c.startsWith(v(f)))}let x=/\[1m\]$/i,y=process.env.NEXT_PUBLIC_CLOUD_URL,z=[{label:"Default",value:""},{label:"200K",value:"198000"},{label:"300K",value:"298000"},{label:"500K",value:"498000"},{label:"700K",value:"698000"}];function A({applying:a,apiKeys:b,autoCompactWindow:c,ccFilterNaming:e,checkingClaude:f,cloudEnabled:g,claudeStatus:h,customBaseUrl:j,getDisplayUrl:k,handleApplySettings:l,handleCcFilterNamingToggle:m,handleOneMContextToggle:n,handleResetSettings:o,hasActiveProviders:p,message:q,modelMappings:s,onAutoCompactWindowChange:t,onModelMappingChange:v,oneMContext:w,openModelSelector:x,restoring:y,selectedApiKey:B,setCustomBaseUrl:C,setSelectedApiKey:D,setShowInstallGuide:E,setShowManualConfigModal:F,showInstallGuide:G,tailscaleEnabled:H,tailscaleUrl:I,tool:J,tunnelEnabled:K,tunnelPublicUrl:L}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[f&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Claude CLI..."})]}),!f&&h&&!h.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansAI is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(i.Button,{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,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>E(!G),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:G?"expand_less":"help"}),G?"Hide":"How to Install"]})]})]}),G&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,d.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,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!f&&h?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:h?.settings?.env?.ANTHROPIC_BASE_URL||"",value:j||k(),onChange:C,requiresExternalUrl:J.requiresExternalUrl,tunnelEnabled:K,tunnelPublicUrl:L,tailscaleEnabled:H,tailscaleUrl:I})]}),h?.settings?.env?.ANTHROPIC_BASE_URL&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:h.settings.env.ANTHROPIC_BASE_URL})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:B,onChange:D,apiKeys:b,cloudEnabled:g})]}),J.defaultModels.map(a=>(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:a.name}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:s[a.alias]||"",onChange:b=>v(a.alias,b.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),s[a.alias]&&(0,d.jsx)("button",{type:"button",onClick:()=>v(a.alias,""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>x(a.alias),disabled:!p,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${p?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]},a.alias)),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Auto-compact"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("select",{value:c,onChange:a=>t(a.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:z.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.label))})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"1M context"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,d.jsx)("input",{type:"checkbox",checked:w,onChange:n,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Append [1m] to the model name"}),(0,d.jsx)(i.Tooltip,{text:"Claude Code otherwise assumes a 200K window, which clamps the auto-compact window above. Applied to every mapped model — only enable it for models that really accept 1M.",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Filter naming"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,d.jsx)("input",{type:"checkbox",checked:e,onChange:m,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"}),(0,d.jsx)(i.Tooltip,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]})]}),q&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===q.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===q.type?"check_circle":"error"}),(0,d.jsx)("span",{children:q.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:l,disabled:!p,loading:a,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:o,disabled:!h?.hasVansRoute,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>F(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function B({tool:a,isExpanded:b,onToggle:c,activeProviders:f,modelMappings:g,onModelMappingChange:k,baseUrl:l,hasActiveProviders:m,apiKeys:n,cloudEnabled:o,initialStatus:p,tunnelEnabled:q,tunnelPublicUrl:r,tailscaleEnabled:s,tailscaleUrl:t}){let u,v,{status:z,checking:C,applying:D,restoring:E,message:F,dispatch:G,customBaseUrl:H,getDisplayUrl:I,getEffectiveBaseUrl:J,handleToggle:K,modelAliases:L,selectedApiKey:M,setCustomBaseUrl:N,setSelectedApiKey:O}=h({apiKeys:n,baseUrl:l,cloudEnabled:o,initialStatus:p,isExpanded:b,onToggle:c,statusEndpoint:"/api/cli-tools/claude-settings",getInitialApiKey:(a,b)=>{let c=a?.settings?.env?.ANTHROPIC_AUTH_TOKEN;return c&&b?.some(a=>a.key===c)?c:b?.[0]?.key||""}}),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(null),[V,W]=(0,e.useState)(!1),[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(null);(0,e.useRef)(!1);let _=Z??z?.settings?.env?.CLAUDE_CODE_AUTO_COMPACT_WINDOW??"",aa=a.defaultModels.some(a=>g[a.alias]?.endsWith("[1m]")),ab=(()=>{if(!z?.installed)return null;let a=z.settings?.env?.ANTHROPIC_BASE_URL;return a?w(a,{tunnelPublicUrl:r,tailscaleUrl:t,cloudUrl:o?y:null})?"configured":"other":"not_configured"})(),ac=async a=>{let b=a.target.checked;Y(b),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:b})}).catch(()=>{})},ad=async()=>{G({type:"APPLY_START"});try{let b={ANTHROPIC_BASE_URL:J()},c=M?.trim()||(n?.length>0?n[0].key:null)||(o?null:"sk_VansRoute");c&&(b.ANTHROPIC_AUTH_TOKEN=c),a.defaultModels.forEach(a=>{let c=g[a.alias];c&&a.envKey&&(b[a.envKey]=c)}),_&&(b.CLAUDE_CODE_AUTO_COMPACT_WINDOW=_);let d=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:b,autoCompactWindow:_})}),e=await d.json();d.ok?(G({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),G({type:"CHECK_DONE",data:{...z,hasBackup:!0,settings:{...z?.settings,env:b}}})):G({type:"APPLY_DONE",message:{type:"error",text:e.error||"Failed to apply settings"}})}catch(a){G({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},ae=async()=>{G({type:"RESTORE_START"});try{let b=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),c=await b.json();b.ok?(G({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),a.defaultModels.forEach(a=>k(a.alias,a.defaultValue||"")),O(""),$("")):G({type:"RESTORE_DONE",message:{type:"error",text:c.error||"Failed to reset settings"}})}catch(a){G({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:K,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/claude.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===ab&&(0,d.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"===ab&&(0,d.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"===ab&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(A,{applying:D,apiKeys:n,autoCompactWindow:_,ccFilterNaming:X,checkingClaude:C,cloudEnabled:o,claudeStatus:z,customBaseUrl:H,getDisplayUrl:I,handleApplySettings:ad,handleCcFilterNamingToggle:ac,handleOneMContextToggle:b=>{let c=b.target.checked;a.defaultModels.forEach(a=>{let b=g[a.alias];if(!b)return;let{model:d}=function(a){if("string"!=typeof a)return{model:a,contextMarker:null};let b=a.trim(),c=b.match(x);return c?{model:b.slice(0,-c[0].length),contextMarker:c[0].slice(1,-1).toLowerCase()}:{model:a,contextMarker:null}}(b);k(a.alias,c?`${d}[1m]`:d)})},handleResetSettings:ae,hasActiveProviders:m,message:F,modelMappings:g,onAutoCompactWindowChange:$,onModelMappingChange:k,oneMContext:aa,openModelSelector:a=>{U(a),S(!0)},restoring:E,selectedApiKey:M,setCustomBaseUrl:N,setSelectedApiKey:O,setShowInstallGuide:Q,setShowManualConfigModal:W,showInstallGuide:P,tailscaleEnabled:s,tailscaleUrl:t,tool:a,tunnelEnabled:q,tunnelPublicUrl:r}),(0,d.jsx)(i.ModelSelectModal,{isOpen:R,onClose:()=>S(!1),onSelect:a=>{T&&k(T,a.value)},selectedModel:T?g[T]:null,activeProviders:f,modelAliases:L,title:`Select model for ${T}`}),(0,d.jsx)(i.ManualConfigModal,{isOpen:V,onClose:()=>W(!1),title:"Claude CLI - Manual Configuration",configs:(u=M&&M.trim()?M:o?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",v={ANTHROPIC_BASE_URL:J(),ANTHROPIC_AUTH_TOKEN:u},a.defaultModels.forEach(a=>{let b=g[a.alias];b&&a.envKey&&(v[a.envKey]=b)}),_&&(v.CLAUDE_CODE_AUTO_COMPACT_WINDOW=_),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:v},null,2)}])})]})}let C=(a,b)=>{let c=a.match(RegExp(`^\\s*${b}\\s*=\\s*(["'])([^\\n]*?)\\1\\s*(?:#.*)?$`));return c?c[2]:""};function D(a){if("string"!=typeof a)return{baseUrl:"",apiKey:""};let b=a.split(/\r?\n/),c="",d=!0;for(let a of b){if(/^\s*\[/.test(a)){d=!1;continue}d&&(c=C(a,"model_provider")||c)}if(!c)return{baseUrl:"",apiKey:""};let e=`model_providers.${c}`,f=!1,g=!1,h="",i="";for(let a of b){let b=a.match(/^\s*\[\s*([^\]]+?)\s*\]\s*(?:#.*)?$/);if(b){f=b[1]===e,g=b[1]===`${e}.http_headers`;continue}if(f&&(h=C(a,"base_url")||h),g){let b=C(a,"Authorization").match(/^Bearer\s+(.+)$/i);i=b?b[1]:i}}return{baseUrl:h,apiKey:i}}var E=c(95988);function F({activeProviders:a,modelAliases:b}){let[c,f]=(0,e.useState)([]),[g,h]=(0,e.useState)(""),[j,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(null),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(""),v=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/cli-tools/codex-profiles",{cache:"no-store"}),b=await a.json();a.ok&&f(b.profiles||[])}catch(a){console.log("Error fetching codex profiles:",a)}},[]),w=a=>{let b="string"==typeof a?a:a?.value||a?.id;b&&(k(b),h(function(a,b=[]){if(!a||"string"!=typeof a)return"model";let c="",d=a.trim();"config"===(c=(c=d.includes("/")?d.split("/")[0].toLowerCase().replace(/[^a-z0-9_-]/g,""):d.toLowerCase().replace(/[^a-z0-9_-]/g,"")).replace(/^[-_]+|[-_]+$/g,"")||"model")&&(c="model-config");let e=c,f=2;for(;b.includes(e);)e=`${c}-${f}`,f++;return e}("object"==typeof a&&a?.provider?a.provider:b.includes("/")?b.split("/")[0]:b,c.map(a=>a.name))))},x=async()=>{let a=g.trim().toLowerCase().replace(/[^a-z0-9_-]/g,""),b=j.trim();if(a&&b){o(!0),u("");try{let c=await fetch("/api/cli-tools/codex-profiles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a,model:b})}),d=await c.json();c.ok?(h(""),k(""),v()):u(d.error||"Failed to add model")}catch(a){u(a.message)}finally{o(!1)}}},y=async a=>{q(a);try{(await fetch("/api/cli-tools/codex-profiles",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a})})).ok&&v()}catch(a){console.log("Error deleting codex profile:",a)}finally{q(null)}},z=async a=>{try{await navigator.clipboard.writeText(a),s(a),setTimeout(()=>s(""),2e3)}catch(a){console.log("Copy failed",a)}};return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("span",{className:"text-xs font-semibold text-text-main flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"layers"}),"Additional Models"]}),c.length>0&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 bg-primary/10 text-primary text-[10px] font-medium rounded-full",children:c.length})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 p-2.5 bg-surface/40 border border-border rounded-lg",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-[10rem_1fr_auto_auto] sm:items-center",children:[(0,d.jsx)("input",{type:"text",value:g,onChange:a=>h(a.target.value.toLowerCase().replace(/[^a-z0-9_-]/g,"")),placeholder:"Alias (e.g. claude)",className:"w-full min-w-0 px-2.5 py-1.5 bg-surface rounded border border-border text-xs font-mono focus:outline-none focus:ring-1 focus:ring-primary/50",onKeyDown:a=>"Enter"===a.key&&x()}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:j,onChange:a=>w(a.target.value),placeholder:"provider/model-id",className:"w-full min-w-0 pl-2.5 pr-7 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50",onKeyDown:a=>"Enter"===a.key&&x()}),j&&(0,d.jsx)("button",{onClick:()=>{k(""),h("")},className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>m(!0),disabled:!a?.length,className:`w-full sm:w-auto rounded border px-2.5 py-1.5 text-xs transition-colors whitespace-nowrap sm:shrink-0 ${a?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:x,disabled:!g.trim()||!j.trim()||n,loading:n,className:"!h-7.5 whitespace-nowrap",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px] mr-1",children:"add"}),"Add"]})]}),!!t&&(0,d.jsx)("p",{className:"text-[11px] text-red-500 break-words",children:t})]}),0===c.length?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center p-4 border border-dashed border-border rounded-lg text-center bg-surface/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px] text-text-muted mb-1 opacity-60",children:"terminal"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Only the main model is active. Add an alias above to configure more models for Codex CLI."})]}):(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:c.map(a=>{let b=a.model.includes("/")?a.model.split("/")[0]:a.name,c=r===a.command;return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2 p-2.5 bg-surface/50 border border-border hover:border-border-hover rounded-lg transition-colors group",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,d.jsx)("div",{className:"size-6 flex items-center justify-center shrink-0 rounded bg-black/5 dark:bg-white/5 p-0.5",children:(0,d.jsx)(E.A,{providerId:b,size:18,fallbackText:a.name.slice(0,2).toUpperCase()})}),(0,d.jsxs)("div",{className:"min-w-0 flex flex-col",children:[(0,d.jsx)("span",{className:"font-medium text-xs text-text-main truncate",children:a.name}),(0,d.jsx)("span",{className:"text-[11px] text-text-muted truncate font-mono",children:a.model})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsxs)("button",{onClick:()=>z(a.command),className:`flex items-center gap-1 px-2 py-1 rounded text-[11px] font-mono border transition-all ${c?"bg-green-500/10 border-green-500/30 text-green-600 dark:text-green-400":"bg-surface border-border text-text-muted hover:text-text-main hover:border-primary/50 cursor-pointer"}`,title:"Click to copy command",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:c?"check":"terminal"}),(0,d.jsx)("span",{className:"hidden md:inline",children:a.command}),(0,d.jsx)("span",{className:"md:hidden",children:"copy"})]}),(0,d.jsx)("button",{onClick:()=>y(a.name),disabled:p===a.name,className:"p-1 text-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity rounded",title:"Delete model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px]",children:"close"})})]})]},a.name)})}),l&&(0,d.jsx)(i.ModelSelectModal,{isOpen:l,onClose:()=>m(!1),onSelect:a=>{m(!1),w(a)},selectedModel:j,activeProviders:a,modelAliases:b,title:"Select Model for Codex CLI"})]})}function G({activeProviders:a,apiKeys:b,applying:c,checkingCodex:e,cloudEnabled:f,codexStatus:g,customBaseUrl:h,getDisplayUrl:j,handleApplySettings:k,handleResetSettings:l,message:m,modelAliases:n,restoring:o,selectedApiKey:p,selectedModel:q,setCustomBaseUrl:s,setModalOpen:t,setSelectedApiKey:v,setSelectedModel:w,setShowInstallGuide:x,setShowManualConfigModal:y,setSubagentModalOpen:z,setSubagentModel:A,showInstallGuide:B,subagentModel:C,tailscaleEnabled:E,tailscaleUrl:H,tool:I,tunnelEnabled:J,tunnelPublicUrl:K}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[e&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Codex CLI..."})]}),!e&&g&&!g.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansAI is deployed on a remote server."})]})]}),(0,d.jsx)("div",{children:(0,d.jsxs)("button",{onClick:()=>x(!B),className:"text-xs text-primary hover:underline flex items-center gap-1 cursor-pointer",children:[(0,d.jsxs)("span",{children:[B?"Hide":"Show"," installation instructions"]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-[14px] transition-transform ${B?"rotate-180":""}`,children:"expand_more"})]})})]}),B&&(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-surface-hover rounded-lg border border-border text-xs",children:[(0,d.jsx)("p",{className:"font-medium text-text-main",children:"To install Codex CLI:"}),(0,d.jsx)("pre",{className:"p-2 bg-sidebar rounded font-mono text-[11px] overflow-x-auto text-text-muted",children:"npm install -g @openai/codex"}),(0,d.jsxs)("p",{className:"text-text-muted",children:["Or follow instructions at: ",(0,d.jsx)("a",{href:"https://github.com/openai/codex",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"github.com/openai/codex"})]})]}),(0,d.jsx)("div",{className:"flex justify-end",children:(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>y(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})})]}),!e&&g?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:D(g?.config).baseUrl,value:h||j(),onChange:s,requiresExternalUrl:I.requiresExternalUrl,tunnelEnabled:J,tunnelPublicUrl:K,tailscaleEnabled:E,tailscaleUrl:H})]}),(0,d.jsx)(u,{apiKeys:b,selectedApiKey:p,onApiKeyChange:v,cloudEnabled:f}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:q,onChange:a=>w(a.target.value),placeholder:"provider/model-id","aria-label":"Model",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),(0,d.jsx)("button",{type:"button",onClick:()=>t(!0),disabled:!a?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${a?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:C,onChange:a=>A(a.target.value),placeholder:q||"provider/model-id (defaults to main model)","aria-label":"Subagent model",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),C&&(0,d.jsx)("button",{type:"button",onClick:()=>A(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>z(!0),disabled:!a?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${a?.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,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===m.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===m.type?"check_circle":"error"}),(0,d.jsx)("span",{children:m.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:k,disabled:!p&&f&&b.length>0||!q,loading:c,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:l,disabled:o,loading:o,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>y(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]}),(0,d.jsx)(F,{activeProviders:a,modelAliases:n})]})]})}function H({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:m,cloudEnabled:n,initialStatus:p,tunnelEnabled:q,tunnelPublicUrl:r,tailscaleEnabled:s,tailscaleUrl:t}){let u,v,x,{status:y,checking:z,applying:A,restoring:B,message:C,dispatch:E,checkStatus:F,customBaseUrl:I,getDisplayUrl:J,getEffectiveBaseUrl:K,handleToggle:L,modelAliases:M,selectedApiKey:N,setCustomBaseUrl:O,setSelectedApiKey:P}=h({apiKeys:g,baseUrl:f,cloudEnabled:n,initialStatus:p,isExpanded:b,onToggle:c,statusEndpoint:"/api/cli-tools/codex-settings",getInitialApiKey:(a,b)=>{let c=D(a?.config).apiKey||a?.auth?.OPENAI_API_KEY;return c&&b?.some(a=>a.key===c)?c:b?.[0]?.key||""}}),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)(null),U=S??(u=y?.config?.match(/^model\s*=\s*"([^"]+)"/m),u?.[1]||""),[V,W]=(0,e.useState)(null),X=V??(()=>{let a=y?.config?.match(/^default_subagent_model\s*=\s*"([^"]+)"/m);if(a)return a[1];let b=y?.config?.match(/\[agents\.subagent\]\s*\n\s*model\s*=\s*"([^"]+)"/m);return b?.[1]||""})(),[Y,Z]=(0,e.useState)(!1),[$,_]=(0,e.useState)(!1),[aa,ab]=(0,e.useState)(!1),ac=y?.installed?y.config?w(D(y.config).baseUrl,{tunnelPublicUrl:r,tailscaleUrl:t})?"configured":"other":"not_configured":null,ad=async()=>{E({type:"APPLY_START"});try{let a=N&&N.trim()||n?N:"sk_VansRoute",b=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:K(),apiKey:a,model:U,subagentModel:X||U})}),c=await b.json();b.ok?(!function(a,{tunnelPublicUrl:b,tailscaleUrl:c,cloudUrl:d}={}){let e=l(a);!e||[`http://127.0.0.1:${k.h0.appPort}`,b,c,d].filter(Boolean).flatMap(a=>[l(a),`${l(a)}/v1`]).includes(e)||o(e)}(K(),{tunnelPublicUrl:r,tailscaleUrl:t}),E({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),F()):E({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){E({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},ae=async()=>{E({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),b=await a.json();a.ok?(E({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),T(""),W(""),F()):E({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){E({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:L,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/codex.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===ac&&(0,d.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"===ac&&(0,d.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"===ac&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(G,{activeProviders:m,apiKeys:g,applying:A,checkingCodex:z,cloudEnabled:n,codexStatus:y,customBaseUrl:I,getDisplayUrl:J,handleApplySettings:ad,modelAliases:M,handleResetSettings:ae,message:C,restoring:B,selectedApiKey:N,selectedModel:U,setCustomBaseUrl:O,setModalOpen:Z,setSelectedApiKey:P,setSelectedModel:T,setShowInstallGuide:R,setShowManualConfigModal:ab,setSubagentModalOpen:_,setSubagentModel:W,showInstallGuide:Q,subagentModel:X,tailscaleEnabled:s,tailscaleUrl:t,tool:a,tunnelEnabled:q,tunnelPublicUrl:r}),(0,d.jsx)(i.ModelSelectModal,{isOpen:Y,onClose:()=>Z(!1),onSelect:a=>{T(a.value),X||W(a.value),Z(!1)},selectedModel:U,activeProviders:m,modelAliases:M,title:"Select Model for Codex CLI"}),(0,d.jsx)(i.ModelSelectModal,{isOpen:$,onClose:()=>_(!1),onSelect:a=>{W(a.value),_(!1)},selectedModel:X,activeProviders:m,modelAliases:M,title:"Select Subagent Model for Codex CLI"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:aa,onClose:()=>ab(!1),title:"Codex CLI - Manual Configuration",configs:(v=N&&N.trim()?N:n?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",x=X||U,[{filename:"~/.codex/config.toml",content:`# VansAI Configuration for Codex CLI
2
- model = "${U}"
1
+ "use strict";exports.id=2741,exports.ids=[2741],exports.modules={55009:(a,b,c)=>{c.d(b,{y:()=>f});var d=c(71183),e=c(48444);function f(){let[a,b]=(0,d.useState)(()=>({})),[c,f]=(0,d.useState)(()=>({}));return{getCaps:(0,d.useCallback)(b=>(function(a,b,c){if(!c)return null;if(a[c])return a[c];let d=c.includes("/")?c.slice(c.indexOf("/")+1):c;if(b[d])return b[d];let f=c.includes("/")?c.slice(0,c.indexOf("/")):null,g=(0,e.nl)(f,d);return{vision:g.vision,search:g.search,reasoning:g.reasoning,contextWindow:g.contextWindow,maxOutput:g.maxOutput}})(a,c,b),[a,c])}}},61126:a=>{a.exports={TOOL_HOSTS:{antigravity:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],copilot:["api.individual.githubcopilot.com"],kiro:["runtime.us-east-1.kiro.dev","q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"],cursor:["api2.cursor.sh"]}}},92741:(a,b,c)=>{c.d(b,{Tk:()=>C,aG:()=>ag,Ah:()=>I,h1:()=>af,Q6:()=>ad,lF:()=>ak,a7:()=>X,ZM:()=>L,WE:()=>ax,E_:()=>at,RF:()=>S,mW:()=>an,c9:()=>ah,tA:()=>aA,kn:()=>aF,yZ:()=>O,qO:()=>$});var d=c(66238),e=c(71183);let f=a=>a?.endsWith("/v1")?a:`${a}/v1`;function g(a,b){switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}}let h=function({apiKeys:a,baseUrl:b,cloudEnabled:c,initialStatus:d,isExpanded:h,onToggle:i,statusEndpoint:j,getDefaultBaseUrl:k=f,getInitialApiKey:l}){let[m,n]=(0,e.useReducer)(g,{status:d||null,checking:!1,applying:!1,restoring:!1,message:null}),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)({}),[s,t]=(0,e.useState)(""),u=(0,e.useRef)(!!d),v=(0,e.useRef)(!1),w=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&r(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),x=(0,e.useCallback)(async()=>{n({type:"CHECK_START"});try{let a=await fetch(j,{cache:"no-store"}),b=await a.json();n({type:"CHECK_DONE",data:b})}catch(a){n({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[j]),y=(0,e.useCallback)(async()=>{u.current||(u.current=!0,await x()),v.current||(v.current=!0,await w())},[x,w]),z=(0,e.useCallback)(()=>{h||y(),i()},[h,y,i]),A=o??(l?l(m.status,a):a?.length>0?a[0].key:""),B=(0,e.useCallback)(()=>{let a=(s||k(b)).replace(/\/+$/,"");return a.endsWith("/v1")?a:`${a}/v1`},[b,s,k]),C=(0,e.useCallback)(()=>s||k(b),[b,s,k]);return{...m,dispatch:n,checkStatus:x,customBaseUrl:s,fetchModelAliases:w,getDisplayUrl:C,getEffectiveBaseUrl:B,handleToggle:z,initializeCard:y,modelAliases:q,selectedApiKey:A,setCustomBaseUrl:t,setSelectedApiKey:p}};var i=c(40228),j=c(15901),k=c(13717);let l=a=>(a||"").replace(/\/+$/,"");function m(){return[]}function n(a){}function o(a,b){let c=l(a);if(!c)return null;let d=m(),e=d.find(a=>l(a.baseUrl)===c);if(e&&!b)return e.name;let f=(b||function(a){try{return new URL(a).host}catch{return a}}(c)).trim();return f?(n([...d.filter(a=>a.name!==f&&l(a.baseUrl)!==c),{name:f,baseUrl:c}].sort((a,b)=>a.name.localeCompare(b.name))),f):null}function p(a,{tunnelPublicUrl:b,tailscaleUrl:c,cloudUrl:d}={}){let e=l(a);return!e||[`http://127.0.0.1:${k.h0.appPort}`,b,c,d].filter(Boolean).flatMap(a=>[l(a),`${l(a)}/v1`]).includes(e)?null:o(e)}let q="__custom__",r="__save__";function s({value:a,onChange:b,requiresExternalUrl:c=!1,tunnelEnabled:f=!1,tunnelPublicUrl:g="",tailscaleEnabled:h=!1,tailscaleUrl:i="",cloudEnabled:j=!1,cloudUrl:l="",withV1:n=!0,currentUrl:p=""}){let[t,u]=(0,e.useState)(m),[v,w]=(0,e.useState)(!0),[x,y]=(0,e.useState)(""),[z,A]=(0,e.useState)("");(0,e.useRef)(!1),(0,e.useRef)("");let B=(0,e.useRef)(""),C=(0,e.useMemo)(()=>(({requiresExternalUrl:a,tunnelEnabled:b,tunnelPublicUrl:c,tailscaleEnabled:d,tailscaleUrl:e,cloudEnabled:f,cloudUrl:g,savedPresets:h,withV1:i})=>{let j=[],l=a=>{let b;return i?(b=(a||"").replace(/\/+$/,""))?/\/v1$/.test(b)?b:`${b}/v1`:"":(a||"").replace(/\/+$/,"")};if(!a){let a=l(`http://127.0.0.1:${k.h0.appPort}`);j.push({value:"local",label:a,url:a})}if(b&&c){let a=l(c);j.push({value:"tunnel",label:a,url:a})}if(d&&e){let a=l(e);j.push({value:"tailscale",label:a,url:a})}if(f&&g){let a=l(g);j.push({value:"cloud",label:a,url:a})}return h.forEach(a=>{j.push({value:`saved:${a.name}`,label:a.baseUrl,url:a.baseUrl,saved:!0})}),j.push({value:q,label:"Custom URL...",url:""}),j})({requiresExternalUrl:c,tunnelEnabled:f,tunnelPublicUrl:g,tailscaleEnabled:h,tailscaleUrl:i,cloudEnabled:j,cloudUrl:l,savedPresets:t,withV1:n}),[c,f,g,h,i,j,l,t,n]),D=x.startsWith("saved:"),E=x===q,F=E&&(z||"").trim().length>0;return(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("select",{value:x,onChange:c=>{let d=c.target.value;if(d===r){let b=(a||"").trim();if(!b)return;let c=b;try{c=new URL(b).host}catch{}let d=window.prompt("Save endpoint as:",c),e=d?.trim()?o(b,d.trim()):null;e&&y(`saved:${e}`);return}if(y(d),d===q){A(""),b("");return}let e=C.find(a=>a.value===d);e&&b(e.url)},className:"flex-1 min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[C.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value)),F&&(0,d.jsx)("option",{value:r,children:"+ Save current as..."})]}),D&&(0,d.jsx)("button",{type:"button",onClick:()=>{var a;if(!x.startsWith("saved:"))return;a=x.slice(6),m().filter(b=>b.name!==a),A("");let c=C.find(a=>a.value!==q&&a.value!==x);c?(y(c.value),b(c.url)):(y(q),b(""))},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors shrink-0",title:"Delete saved endpoint",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]}),E&&(0,d.jsx)("input",{type:"text",value:z,onChange:a=>{let c=a.target.value;B.current=c,A(c),b(c)},placeholder:n?"https://example.com/v1":"https://example.com",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"})]})}let t="__custom__",u=[];function v({value:a,onChange:b,apiKeys:c=u,cloudEnabled:f=!1,className:g=""}){let h=!c.some(b=>b.key===a)&&""!==a,[i,j]=(0,e.useState)(()=>a?c.some(b=>b.key===a)?a:t:c.length>0?c[0].key:t),[k,l]=(0,e.useState)(h?a:"");return 0===c.length&&i!==t&&i!==t?(0,d.jsx)("span",{className:`min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5 ${g}`,children:f?"No API keys - Create one in Keys page":"sk_9router (default)"}):(0,d.jsxs)("div",{className:`flex flex-col gap-1.5 ${g}`,children:[(0,d.jsxs)("select",{value:i,onChange:a=>{let c=a.target.value;j(c),c===t?(l(""),b("")):b(c)},className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[c.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id)),(0,d.jsx)("option",{value:t,children:"Custom..."})]}),i===t&&(0,d.jsx)("input",{type:"text",value:k,onChange:a=>{let c=a.target.value;l(c),b(c)},placeholder:"sk-...","aria-label":"Custom API key",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"})]})}let w=a=>(a||"").replace(/\/+$/,"");function x(a,b={}){if(!a)return!1;let c=w(a),{tunnelPublicUrl:d,tailscaleUrl:e,cloudUrl:f}=b;return!!(/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(c)||d&&c.startsWith(w(d))||e&&c.startsWith(w(e))||f&&c.startsWith(w(f)))}let y=/\[1m\]$/i,z=process.env.NEXT_PUBLIC_CLOUD_URL,A=[{label:"Default",value:""},{label:"200K",value:"198000"},{label:"300K",value:"298000"},{label:"500K",value:"498000"},{label:"700K",value:"698000"}];function B({applying:a,apiKeys:b,autoCompactWindow:c,ccFilterNaming:e,checkingClaude:f,cloudEnabled:g,claudeStatus:h,customBaseUrl:j,getDisplayUrl:k,handleApplySettings:l,handleCcFilterNamingToggle:m,handleOneMContextToggle:n,handleResetSettings:o,hasActiveProviders:p,message:q,modelMappings:r,onAutoCompactWindowChange:t,onModelMappingChange:u,oneMContext:w,openModelSelector:x,restoring:y,selectedApiKey:z,setCustomBaseUrl:C,setSelectedApiKey:D,setShowInstallGuide:E,setShowManualConfigModal:F,showInstallGuide:G,tailscaleEnabled:H,tailscaleUrl:I,tool:J,tunnelEnabled:K,tunnelPublicUrl:L}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[f&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Claude CLI..."})]}),!f&&h&&!h.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansAI is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(i.Button,{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,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>E(!G),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:G?"expand_less":"help"}),G?"Hide":"How to Install"]})]})]}),G&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,d.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,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!f&&h?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:h?.settings?.env?.ANTHROPIC_BASE_URL||"",value:j||k(),onChange:C,requiresExternalUrl:J.requiresExternalUrl,tunnelEnabled:K,tunnelPublicUrl:L,tailscaleEnabled:H,tailscaleUrl:I})]}),h?.settings?.env?.ANTHROPIC_BASE_URL&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:h.settings.env.ANTHROPIC_BASE_URL})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:z,onChange:D,apiKeys:b,cloudEnabled:g})]}),J.defaultModels.map(a=>(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:a.name}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,d.jsxs)("div",{className:"relative flex-1 min-w-0",children:[(0,d.jsx)("input",{type:"text",value:r[a.alias]||"",onChange:b=>u(a.alias,b.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),r[a.alias]&&(0,d.jsx)("button",{type:"button",onClick:()=>u(a.alias,""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>x(a.alias),disabled:!p,className:`rounded border px-2.5 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap shrink-0 ${p?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]})]},a.alias)),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Auto-compact"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("select",{value:c,onChange:a=>t(a.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:A.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.label))})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-1.5 sm:grid sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"1M context"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,d.jsx)("input",{type:"checkbox",checked:w,onChange:n,className:"w-3.5 h-3.5 accent-primary cursor-pointer shrink-0"}),(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Append [1m] to the model name"}),(0,d.jsx)(i.Tooltip,{text:"Claude Code otherwise assumes a 200K window, which clamps the auto-compact window above. Applied to every mapped model — only enable it for models that really accept 1M.",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-1.5 sm:grid sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Filter naming"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,d.jsx)("input",{type:"checkbox",checked:e,onChange:m,className:"w-3.5 h-3.5 accent-primary cursor-pointer shrink-0"}),(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"}),(0,d.jsx)(i.Tooltip,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]})]}),q&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===q.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===q.type?"check_circle":"error"}),(0,d.jsx)("span",{children:q.text})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:l,disabled:!p,loading:a,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:o,disabled:!h?.hasVansRoute,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>F(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function C({tool:a,isExpanded:b,onToggle:c,activeProviders:f,modelMappings:g,onModelMappingChange:k,baseUrl:l,hasActiveProviders:m,apiKeys:n,cloudEnabled:o,initialStatus:p,tunnelEnabled:q,tunnelPublicUrl:r,tailscaleEnabled:s,tailscaleUrl:t}){let u,v,{status:w,checking:A,applying:D,restoring:E,message:F,dispatch:G,customBaseUrl:H,getDisplayUrl:I,getEffectiveBaseUrl:J,handleToggle:K,modelAliases:L,selectedApiKey:M,setCustomBaseUrl:N,setSelectedApiKey:O}=h({apiKeys:n,baseUrl:l,cloudEnabled:o,initialStatus:p,isExpanded:b,onToggle:c,statusEndpoint:"/api/cli-tools/claude-settings",getInitialApiKey:(a,b)=>{let c=a?.settings?.env?.ANTHROPIC_AUTH_TOKEN;return c&&b?.some(a=>a.key===c)?c:b?.[0]?.key||""}}),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(null),[V,W]=(0,e.useState)(!1),[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(null);(0,e.useRef)(!1);let _=Z??w?.settings?.env?.CLAUDE_CODE_AUTO_COMPACT_WINDOW??"",aa=a.defaultModels.some(a=>g[a.alias]?.endsWith("[1m]")),ab=(()=>{if(!w?.installed)return null;let a=w.settings?.env?.ANTHROPIC_BASE_URL;return a?x(a,{tunnelPublicUrl:r,tailscaleUrl:t,cloudUrl:o?z:null})?"configured":"other":"not_configured"})(),ac=async a=>{let b=a.target.checked;Y(b),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:b})}).catch(()=>{})},ad=async()=>{G({type:"APPLY_START"});try{let b={ANTHROPIC_BASE_URL:J()},c=M?.trim()||(n?.length>0?n[0].key:null)||(o?null:"sk_VansRoute");c&&(b.ANTHROPIC_AUTH_TOKEN=c),a.defaultModels.forEach(a=>{let c=g[a.alias];c&&a.envKey&&(b[a.envKey]=c)}),_&&(b.CLAUDE_CODE_AUTO_COMPACT_WINDOW=_);let d=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:b,autoCompactWindow:_})}),e=await d.json();d.ok?(G({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),G({type:"CHECK_DONE",data:{...w,hasBackup:!0,settings:{...w?.settings,env:b}}})):G({type:"APPLY_DONE",message:{type:"error",text:e.error||"Failed to apply settings"}})}catch(a){G({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},ae=async()=>{G({type:"RESTORE_START"});try{let b=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),c=await b.json();b.ok?(G({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),a.defaultModels.forEach(a=>k(a.alias,a.defaultValue||"")),O(""),$("")):G({type:"RESTORE_DONE",message:{type:"error",text:c.error||"Failed to reset settings"}})}catch(a){G({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:K,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/claude.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===ab&&(0,d.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"===ab&&(0,d.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"===ab&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(B,{applying:D,apiKeys:n,autoCompactWindow:_,ccFilterNaming:X,checkingClaude:A,cloudEnabled:o,claudeStatus:w,customBaseUrl:H,getDisplayUrl:I,handleApplySettings:ad,handleCcFilterNamingToggle:ac,handleOneMContextToggle:b=>{let c=b.target.checked;a.defaultModels.forEach(a=>{let b=g[a.alias];if(!b)return;let{model:d}=function(a){if("string"!=typeof a)return{model:a,contextMarker:null};let b=a.trim(),c=b.match(y);return c?{model:b.slice(0,-c[0].length),contextMarker:c[0].slice(1,-1).toLowerCase()}:{model:a,contextMarker:null}}(b);k(a.alias,c?`${d}[1m]`:d)})},handleResetSettings:ae,hasActiveProviders:m,message:F,modelMappings:g,onAutoCompactWindowChange:$,onModelMappingChange:k,oneMContext:aa,openModelSelector:a=>{U(a),S(!0)},restoring:E,selectedApiKey:M,setCustomBaseUrl:N,setSelectedApiKey:O,setShowInstallGuide:Q,setShowManualConfigModal:W,showInstallGuide:P,tailscaleEnabled:s,tailscaleUrl:t,tool:a,tunnelEnabled:q,tunnelPublicUrl:r}),(0,d.jsx)(i.ModelSelectModal,{isOpen:R,onClose:()=>S(!1),onSelect:a=>{T&&k(T,a.value)},selectedModel:T?g[T]:null,activeProviders:f,modelAliases:L,title:`Select model for ${T}`}),(0,d.jsx)(i.ManualConfigModal,{isOpen:V,onClose:()=>W(!1),title:"Claude CLI - Manual Configuration",configs:(u=M&&M.trim()?M:o?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",v={ANTHROPIC_BASE_URL:J(),ANTHROPIC_AUTH_TOKEN:u},a.defaultModels.forEach(a=>{let b=g[a.alias];b&&a.envKey&&(v[a.envKey]=b)}),_&&(v.CLAUDE_CODE_AUTO_COMPACT_WINDOW=_),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:v},null,2)}])})]})}let D=(a,b)=>{let c=a.match(RegExp(`^\\s*${b}\\s*=\\s*(["'])([^\\n]*?)\\1\\s*(?:#.*)?$`));return c?c[2]:""};function E(a){if("string"!=typeof a)return{baseUrl:"",apiKey:""};let b=a.split(/\r?\n/),c="",d=!0;for(let a of b){if(/^\s*\[/.test(a)){d=!1;continue}d&&(c=D(a,"model_provider")||c)}if(!c)return{baseUrl:"",apiKey:""};let e=`model_providers.${c}`,f=!1,g=!1,h="",i="";for(let a of b){let b=a.match(/^\s*\[\s*([^\]]+?)\s*\]\s*(?:#.*)?$/);if(b){f=b[1]===e,g=b[1]===`${e}.http_headers`;continue}if(f&&(h=D(a,"base_url")||h),g){let b=D(a,"Authorization").match(/^Bearer\s+(.+)$/i);i=b?b[1]:i}}return{baseUrl:h,apiKey:i}}var F=c(95988);function G({activeProviders:a,modelAliases:b}){let[c,f]=(0,e.useState)([]),[g,h]=(0,e.useState)(""),[j,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(null),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(""),v=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/cli-tools/codex-profiles",{cache:"no-store"}),b=await a.json();a.ok&&f(b.profiles||[])}catch(a){console.log("Error fetching codex profiles:",a)}},[]),w=a=>{let b="string"==typeof a?a:a?.value||a?.id;b&&(k(b),h(function(a,b=[]){if(!a||"string"!=typeof a)return"model";let c="",d=a.trim();"config"===(c=(c=d.includes("/")?d.split("/")[0].toLowerCase().replace(/[^a-z0-9_-]/g,""):d.toLowerCase().replace(/[^a-z0-9_-]/g,"")).replace(/^[-_]+|[-_]+$/g,"")||"model")&&(c="model-config");let e=c,f=2;for(;b.includes(e);)e=`${c}-${f}`,f++;return e}("object"==typeof a&&a?.provider?a.provider:b.includes("/")?b.split("/")[0]:b,c.map(a=>a.name))))},x=async()=>{let a=g.trim().toLowerCase().replace(/[^a-z0-9_-]/g,""),b=j.trim();if(a&&b){o(!0),u("");try{let c=await fetch("/api/cli-tools/codex-profiles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a,model:b})}),d=await c.json();c.ok?(h(""),k(""),v()):u(d.error||"Failed to add model")}catch(a){u(a.message)}finally{o(!1)}}},y=async a=>{q(a);try{(await fetch("/api/cli-tools/codex-profiles",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a})})).ok&&v()}catch(a){console.log("Error deleting codex profile:",a)}finally{q(null)}},z=async a=>{try{await navigator.clipboard.writeText(a),s(a),setTimeout(()=>s(""),2e3)}catch(a){console.log("Copy failed",a)}};return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("span",{className:"text-xs font-semibold text-text-main flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"layers"}),"Additional Models"]}),c.length>0&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 bg-primary/10 text-primary text-[10px] font-medium rounded-full",children:c.length})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 p-2.5 bg-surface/40 border border-border rounded-lg",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-[10rem_1fr_auto_auto] sm:items-center",children:[(0,d.jsx)("input",{type:"text",value:g,onChange:a=>h(a.target.value.toLowerCase().replace(/[^a-z0-9_-]/g,"")),placeholder:"Alias (e.g. claude)",className:"w-full min-w-0 px-2.5 py-1.5 bg-surface rounded border border-border text-xs font-mono focus:outline-none focus:ring-1 focus:ring-primary/50",onKeyDown:a=>"Enter"===a.key&&x()}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:j,onChange:a=>w(a.target.value),placeholder:"provider/model-id",className:"w-full min-w-0 pl-2.5 pr-7 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50",onKeyDown:a=>"Enter"===a.key&&x()}),j&&(0,d.jsx)("button",{onClick:()=>{k(""),h("")},className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>m(!0),disabled:!a?.length,className:`w-full sm:w-auto rounded border px-2.5 py-1.5 text-xs transition-colors whitespace-nowrap sm:shrink-0 ${a?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:x,disabled:!g.trim()||!j.trim()||n,loading:n,className:"!h-7.5 whitespace-nowrap",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px] mr-1",children:"add"}),"Add"]})]}),!!t&&(0,d.jsx)("p",{className:"text-[11px] text-red-500 break-words",children:t})]}),0===c.length?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center p-4 border border-dashed border-border rounded-lg text-center bg-surface/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px] text-text-muted mb-1 opacity-60",children:"terminal"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Only the main model is active. Add an alias above to configure more models for Codex CLI."})]}):(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:c.map(a=>{let b=a.model.includes("/")?a.model.split("/")[0]:a.name,c=r===a.command;return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2 p-2.5 bg-surface/50 border border-border hover:border-border-hover rounded-lg transition-colors group",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,d.jsx)("div",{className:"size-6 flex items-center justify-center shrink-0 rounded bg-black/5 dark:bg-white/5 p-0.5",children:(0,d.jsx)(F.A,{providerId:b,size:18,fallbackText:a.name.slice(0,2).toUpperCase()})}),(0,d.jsxs)("div",{className:"min-w-0 flex flex-col",children:[(0,d.jsx)("span",{className:"font-medium text-xs text-text-main truncate",children:a.name}),(0,d.jsx)("span",{className:"text-[11px] text-text-muted truncate font-mono",children:a.model})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsxs)("button",{onClick:()=>z(a.command),className:`flex items-center gap-1 px-2 py-1 rounded text-[11px] font-mono border transition-all ${c?"bg-green-500/10 border-green-500/30 text-green-600 dark:text-green-400":"bg-surface border-border text-text-muted hover:text-text-main hover:border-primary/50 cursor-pointer"}`,title:"Click to copy command",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:c?"check":"terminal"}),(0,d.jsx)("span",{className:"hidden md:inline",children:a.command}),(0,d.jsx)("span",{className:"md:hidden",children:"copy"})]}),(0,d.jsx)("button",{onClick:()=>y(a.name),disabled:p===a.name,className:"p-1 text-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity rounded",title:"Delete model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px]",children:"close"})})]})]},a.name)})}),l&&(0,d.jsx)(i.ModelSelectModal,{isOpen:l,onClose:()=>m(!1),onSelect:a=>{m(!1),w(a)},selectedModel:j,activeProviders:a,modelAliases:b,title:"Select Model for Codex CLI"})]})}function H({activeProviders:a,apiKeys:b,applying:c,checkingCodex:e,cloudEnabled:f,codexStatus:g,customBaseUrl:h,getDisplayUrl:j,handleApplySettings:k,handleResetSettings:l,message:m,modelAliases:n,restoring:o,selectedApiKey:p,selectedModel:q,setCustomBaseUrl:r,setModalOpen:t,setSelectedApiKey:u,setSelectedModel:w,setShowInstallGuide:x,setShowManualConfigModal:y,setSubagentModalOpen:z,setSubagentModel:A,showInstallGuide:B,subagentModel:C,tailscaleEnabled:D,tailscaleUrl:F,tool:I,tunnelEnabled:J,tunnelPublicUrl:K}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[e&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Codex CLI..."})]}),!e&&g&&!g.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansAI is deployed on a remote server."})]})]}),(0,d.jsx)("div",{children:(0,d.jsxs)("button",{onClick:()=>x(!B),className:"text-xs text-primary hover:underline flex items-center gap-1 cursor-pointer",children:[(0,d.jsxs)("span",{children:[B?"Hide":"Show"," installation instructions"]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-[14px] transition-transform ${B?"rotate-180":""}`,children:"expand_more"})]})})]}),B&&(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-surface-hover rounded-lg border border-border text-xs",children:[(0,d.jsx)("p",{className:"font-medium text-text-main",children:"To install Codex CLI:"}),(0,d.jsx)("pre",{className:"p-2 bg-sidebar rounded font-mono text-[11px] overflow-x-auto text-text-muted",children:"npm install -g @openai/codex"}),(0,d.jsxs)("p",{className:"text-text-muted",children:["Or follow instructions at: ",(0,d.jsx)("a",{href:"https://github.com/openai/codex",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"github.com/openai/codex"})]})]}),(0,d.jsx)("div",{className:"flex justify-end",children:(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>y(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})})]}),!e&&g?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:E(g?.config).baseUrl,value:h||j(),onChange:r,requiresExternalUrl:I.requiresExternalUrl,tunnelEnabled:J,tunnelPublicUrl:K,tailscaleEnabled:D,tailscaleUrl:F})]}),(0,d.jsx)(v,{apiKeys:b,selectedApiKey:p,onApiKeyChange:u,cloudEnabled:f}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:q,onChange:a=>w(a.target.value),placeholder:"provider/model-id","aria-label":"Model",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),(0,d.jsx)("button",{type:"button",onClick:()=>t(!0),disabled:!a?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${a?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:C,onChange:a=>A(a.target.value),placeholder:q||"provider/model-id (defaults to main model)","aria-label":"Subagent model",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),C&&(0,d.jsx)("button",{type:"button",onClick:()=>A(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>z(!0),disabled:!a?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${a?.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,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===m.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===m.type?"check_circle":"error"}),(0,d.jsx)("span",{children:m.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:k,disabled:!p&&f&&b.length>0||!q,loading:c,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:l,disabled:o,loading:o,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>y(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]}),(0,d.jsx)(G,{activeProviders:a,modelAliases:n})]})]})}function I({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:q,tailscaleUrl:r}){let s,t,u,{status:v,checking:w,applying:y,restoring:z,message:A,dispatch:B,checkStatus:C,customBaseUrl:D,getDisplayUrl:F,getEffectiveBaseUrl:G,handleToggle:J,modelAliases:K,selectedApiKey:L,setCustomBaseUrl:M,setSelectedApiKey:N}=h({apiKeys:g,baseUrl:f,cloudEnabled:l,initialStatus:m,isExpanded:b,onToggle:c,statusEndpoint:"/api/cli-tools/codex-settings",getInitialApiKey:(a,b)=>{let c=E(a?.config).apiKey||a?.auth?.OPENAI_API_KEY;return c&&b?.some(a=>a.key===c)?c:b?.[0]?.key||""}}),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(null),S=Q??(s=v?.config?.match(/^model\s*=\s*"([^"]+)"/m),s?.[1]||""),[T,U]=(0,e.useState)(null),V=T??(()=>{let a=v?.config?.match(/^default_subagent_model\s*=\s*"([^"]+)"/m);if(a)return a[1];let b=v?.config?.match(/\[agents\.subagent\]\s*\n\s*model\s*=\s*"([^"]+)"/m);return b?.[1]||""})(),[W,X]=(0,e.useState)(!1),[Y,Z]=(0,e.useState)(!1),[$,_]=(0,e.useState)(!1),aa=v?.installed?v.config?x(E(v.config).baseUrl,{tunnelPublicUrl:o,tailscaleUrl:r})?"configured":"other":"not_configured":null,ab=async()=>{B({type:"APPLY_START"});try{let a=L&&L.trim()||l?L:"sk_VansRoute",b=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:G(),apiKey:a,model:S,subagentModel:V||S})}),c=await b.json();b.ok?(p(G(),{tunnelPublicUrl:o,tailscaleUrl:r}),B({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),C()):B({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){B({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},ac=async()=>{B({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),b=await a.json();a.ok?(B({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),R(""),U(""),C()):B({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){B({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:J,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/codex.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===aa&&(0,d.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"===aa&&(0,d.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"===aa&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(H,{activeProviders:k,apiKeys:g,applying:y,checkingCodex:w,cloudEnabled:l,codexStatus:v,customBaseUrl:D,getDisplayUrl:F,handleApplySettings:ab,modelAliases:K,handleResetSettings:ac,message:A,restoring:z,selectedApiKey:L,selectedModel:S,setCustomBaseUrl:M,setModalOpen:X,setSelectedApiKey:N,setSelectedModel:R,setShowInstallGuide:P,setShowManualConfigModal:_,setSubagentModalOpen:Z,setSubagentModel:U,showInstallGuide:O,subagentModel:V,tailscaleEnabled:q,tailscaleUrl:r,tool:a,tunnelEnabled:n,tunnelPublicUrl:o}),(0,d.jsx)(i.ModelSelectModal,{isOpen:W,onClose:()=>X(!1),onSelect:a=>{R(a.value),V||U(a.value),X(!1)},selectedModel:S,activeProviders:k,modelAliases:K,title:"Select Model for Codex CLI"}),(0,d.jsx)(i.ModelSelectModal,{isOpen:Y,onClose:()=>Z(!1),onSelect:a=>{U(a.value),Z(!1)},selectedModel:V,activeProviders:k,modelAliases:K,title:"Select Subagent Model for Codex CLI"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:$,onClose:()=>_(!1),title:"Codex CLI - Manual Configuration",configs:(t=L&&L.trim()?L:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",u=V||S,[{filename:"~/.codex/config.toml",content:`# VansAI Configuration for Codex CLI
2
+ model = "${S}"
3
3
  model_provider = "VansRoute"
4
4
 
5
5
  [model_providers.VansRoute]
6
6
  name = "VansAI"
7
- base_url = "${K()}"
7
+ base_url = "${G()}"
8
8
  wire_api = "responses"
9
9
 
10
10
  [model_providers.VansRoute.http_headers]
11
- Authorization = "Bearer ${v}"
11
+ Authorization = "Bearer ${t}"
12
12
 
13
13
  [agents]
14
- default_subagent_model = "${x}"
15
- `}])})]})}let I=process.env.NEXT_PUBLIC_CLOUD_URL;function J({addModel:a,apiKeys:b,applying:c,checkingDroid:e,cloudEnabled:f,customBaseUrl:g,droidStatus:h,getDisplayUrl:j,handleApplySettings:k,handleResetSettings:l,hasActiveProviders:m,message:n,modelInput:o,modelList:p,removeModel:q,restoring:s,selectedApiKey:t,setCustomBaseUrl:v,setModalOpen:w,setModelInput:x,setSelectedApiKey:y,setShowInstallGuide:z,setShowManualConfigModal:A,showInstallGuide:B,tailscaleEnabled:C,tailscaleUrl:D,tool:E,tunnelEnabled:F,tunnelPublicUrl:G}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[e&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!e&&h&&!h.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansAI is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>A(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>z(!B),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:B?"expand_less":"help"}),B?"Hide":"How to Install"]})]})]}),B&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,d.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,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"droid"})," to verify."]})]})]})]}),!e&&h?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:h?.settings?.baseUrl||"",value:g||j(),onChange:v,requiresExternalUrl:E.requiresExternalUrl,tunnelEnabled:F,tunnelPublicUrl:G,tailscaleEnabled:C,tailscaleUrl:D})]}),h?.settings?.customModels?.find(a=>a.id?.startsWith("custom:VansRoute"))?.baseUrl&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:h.settings.customModels.find(a=>a.id?.startsWith("custom:VansRoute")).baseUrl})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:t,onChange:y,apiKeys:b,cloudEnabled:f})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsxs)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:["Models ",p.length>0&&(0,d.jsxs)("span",{className:"text-primary",children:["(",p.length,")"]})]}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-1",children:[p.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-0.5 mb-1",children:p.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-bg-secondary rounded border border-border",children:[(0,d.jsx)("span",{className:"flex-1 text-xs font-mono truncate",children:a}),(0,d.jsx)("button",{type:"button",onClick:()=>q(a),className:"text-text-muted hover:text-red-500 transition-colors shrink-0",title:"Remove",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a))}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("input",{type:"text",value:o,onChange:a=>x(a.target.value),onKeyDown:b=>{"Enter"===b.key&&(b.preventDefault(),a())},"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),(0,d.jsx)("button",{type:"button",onClick:()=>w(!0),disabled:!m,className:`px-2 py-1.5 rounded border text-xs shrink-0 ${m?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),(0,d.jsx)("button",{type:"button",onClick:a,disabled:!o.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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"})})]})]})]})]}),n&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===n.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===n.type?"check_circle":"error"}),(0,d.jsx)("span",{children:n.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:k,disabled:0===p.length,loading:c,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:l,disabled:!h?.hasVansRoute,loading:s,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>A(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function K({tool:a,isExpanded:b,onToggle:c,baseUrl:f,hasActiveProviders:g,apiKeys:h,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let r,s,t,[u,v]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:m||null,checking:!1,applying:!1,restoring:!1,message:null}),x=u.status,y=u.checking,{applying:z,restoring:A,message:B}=u,[C,D]=(0,e.useState)(null),E=C??(h?.length>0?h[0].key:""),[F,G]=(0,e.useState)(null),H=F??(()=>{if(!x?.installed)return[];let a=(x.settings?.customModels||[]).filter(a=>a.id?.startsWith("custom:VansRoute")).sort((a,b)=>(a.index||0)-(b.index||0)).map(a=>a.model);if(a.length>0)return a;let b=x.settings?.customModels?.find(a=>"custom:VansRoute-0"===a.id);return b?.model?[b.model]:[]})(),[L,M]=(0,e.useState)(""),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)({}),[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(!1),[V,W]=(0,e.useState)(""),X=(()=>{if(!x?.installed)return null;let a=x.settings?.customModels?.find(a=>a.id?.startsWith("custom:VansRoute"));return a?w(a.baseUrl,{tunnelPublicUrl:o,tailscaleUrl:q,cloudUrl:l?I:null})?"configured":"other":"not_configured"})(),Y=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&Q(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),Z=(0,e.useCallback)(async()=>{v({type:"CHECK_START"});try{let a=await fetch("/api/cli-tools/droid-settings"),b=await a.json();v({type:"CHECK_DONE",data:b})}catch(a){v({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),$=(0,e.useRef)(!!m),_=(0,e.useRef)(!1),aa=(0,e.useCallback)(async()=>{$.current||($.current=!0,await Z()),_.current||(_.current=!0,await Y())},[Z,Y]),ab=(0,e.useCallback)(()=>{b||aa(),c()},[b,aa,c]),ac=()=>{let a=V||f;return a.endsWith("/v1")?a:`${a}/v1`},ad=async()=>{v({type:"APPLY_START"});try{let a=E?.trim()||(h?.length>0?h[0].key:null)||(l?null:"sk_VansRoute"),b=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ac(),apiKey:a,models:H,activeModel:H[0]||""})}),c=await b.json();b.ok?(v({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),Z()):v({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){v({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},ae=async()=>{v({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),b=await a.json();a.ok?(v({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),G([]),Z()):v({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){v({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:ab,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/droid.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===X&&(0,d.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"===X&&(0,d.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"===X&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(J,{addModel:()=>{let a=L.trim();!a||H.includes(a)||(G(b=>[...b,a]),M(""))},apiKeys:h,applying:z,checkingDroid:y,cloudEnabled:l,customBaseUrl:V,droidStatus:x,getDisplayUrl:()=>{let a=V||f;return a.endsWith("/v1")?a:`${a}/v1`},handleApplySettings:ad,handleResetSettings:ae,hasActiveProviders:g,message:B,modelInput:L,modelList:H,removeModel:a=>G(b=>b.filter(b=>b!==a)),restoring:A,selectedApiKey:E,setCustomBaseUrl:W,setModalOpen:O,setModelInput:M,setSelectedApiKey:D,setShowInstallGuide:U,setShowManualConfigModal:S,showInstallGuide:T,tailscaleEnabled:p,tailscaleUrl:q,tool:a,tunnelEnabled:n,tunnelPublicUrl:o}),(0,d.jsx)(i.ModelSelectModal,{isOpen:N,onClose:()=>O(!1),onSelect:a=>{!a.value||H.includes(a.value)||(G(b=>[...b,a.value]),O(!1))},selectedModel:null,activeProviders:k,modelAliases:P,title:"Select Model for Factory Droid"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:R,onClose:()=>S(!1),title:"Factory Droid - Manual Configuration",configs:(r=E&&E.trim()?E:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",s={customModels:H.map((a,b)=>({model:a,id:`custom:VansRoute-${b}`,index:b,baseUrl:ac(),apiKey:r,displayName:a,maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}))},t="u">typeof navigator&&navigator.platform,[{filename:t?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(s,null,2)}])})]})}function L(){return"http://127.0.0.1:20128"}function M({agentModels:a,apiKeys:b,applying:c,checkingOpenclaw:e,cloudEnabled:f,customBaseUrl:g,getDisplayUrl:h,handleApplySettings:j,handleResetSettings:k,hasActiveProviders:l,message:m,openclawStatus:n,restoring:o,selectedApiKey:p,selectedModel:q,setAgentModalFor:s,setAgentModels:t,setCustomBaseUrl:v,setModalOpen:w,setSelectedApiKey:x,setSelectedModel:y,setShowManualConfigModal:z,tailscaleEnabled:A,tailscaleUrl:B,tool:C,tunnelEnabled:D,tunnelPublicUrl:E}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[e&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!e&&n&&!n.installed&&(0,d.jsx)("div",{className:"flex flex-col gap-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansAI is deployed on a remote server."})]})]}),(0,d.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,d.jsxs)(i.Button,{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,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!e&&n?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:n?.settings?.models?.providers?.VansRoute?.baseUrl||"",value:g||h(),onChange:v,requiresExternalUrl:C.requiresExternalUrl,tunnelEnabled:D,tunnelPublicUrl:E,tailscaleEnabled:A,tailscaleUrl:B})]}),n?.settings?.models?.providers?.VansRoute?.baseUrl&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:n.settings.models.providers.VansRoute.baseUrl})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:p,onChange:x,apiKeys:b,cloudEnabled:f})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Default Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:q,onChange:a=>y(a.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),q&&(0,d.jsx)("button",{type:"button",onClick:()=>y(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>{s(null),w(!0)},disabled:!l,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${l?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]}),(n.agents||[]).flatMap(b=>b.agentDir?[(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-4",children:[(0,d.jsxs)("span",{className:"w-32 shrink-0 text-xs text-primary text-right truncate",title:b.name||b.id,children:["Agent ",b.name||b.id]}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:a[b.id]||"",onChange:a=>t(c=>({...c,[b.id]:a.target.value})),placeholder:`default (${q||"provider/model-id"})`,"aria-label":`Model for agent ${b.name||b.id}`,className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),a[b.id]&&(0,d.jsx)("button",{type:"button",onClick:()=>t(a=>({...a,[b.id]:""})),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>{s(b.id),w(!0)},disabled:!l,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${l?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]},b.id)]:[])]}),m&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===m.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===m.type?"check_circle":"error"}),(0,d.jsx)("span",{children:m.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:j,disabled:!q,loading:c,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:k,disabled:!n?.hasVansRoute,loading:o,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>z(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function N({tool:a,isExpanded:b,onToggle:c,baseUrl:f,hasActiveProviders:g,apiKeys:h,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let r,[s,t]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:m||null,checking:!1,applying:!1,restoring:!1,message:null}),u=s.status,v=s.checking,{applying:x,restoring:y,message:z}=s,[A,B]=(0,e.useState)(null),C=A??(h?.length>0?h[0].key:""),[D,E]=(0,e.useState)(""),[F,G]=(0,e.useState)({}),[H,I]=(0,e.useState)(null),[J,K]=(0,e.useState)(!1),[O,P]=(0,e.useState)({}),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)(""),U=(()=>{if(!u?.installed)return null;let a=u.settings?.models?.providers?.VansRoute;return a?w(a.baseUrl,{tunnelPublicUrl:o,tailscaleUrl:q})?"configured":"other":"not_configured"})(),V=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&P(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),W=(0,e.useCallback)(async()=>{t({type:"CHECK_START"});try{let a=await fetch("/api/cli-tools/openclaw-settings"),b=await a.json();t({type:"CHECK_DONE",data:b})}catch(a){t({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),X=(0,e.useRef)(!!m),Y=(0,e.useRef)(!1),Z=(0,e.useCallback)(async()=>{X.current||(X.current=!0,await W()),Y.current||(Y.current=!0,await V())},[W,V]),$=(0,e.useCallback)(()=>{b||Z(),c()},[b,Z,c]),[_,aa]=(0,e.useState)(!1);if(u?.installed&&!_){aa(!0);let a=u.settings?.models?.providers?.VansRoute;if(a){let b=u.settings?.agents?.defaults?.model?.primary;b&&!D&&E(b.replace("VansRoute/","")),a.apiKey&&h?.some(b=>b.key===a.apiKey)&&!A&&B(a.apiKey)}let b=u.agents||[],c={};b.forEach(a=>{a.currentModel&&(c[a.id]=a.currentModel)}),Object.keys(c).length>0&&G(c)}let ab=()=>{let a=S||L();return a.endsWith("/v1")?a:`${a}/v1`},ac=async()=>{t({type:"APPLY_START"});try{let a=C?.trim()||(h?.length>0?h[0].key:null)||(l?null:"sk_VansRoute"),b=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ab(),apiKey:a,model:D,agentModels:F})}),c=await b.json();b.ok?(t({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),W()):t({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){t({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},ad=async()=>{t({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),b=await a.json();a.ok?(t({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),E(""),B(""),W()):t({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){t({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:$,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/openclaw.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===U&&(0,d.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"===U&&(0,d.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"===U&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(M,{agentModels:F,apiKeys:h,applying:x,checkingOpenclaw:v,cloudEnabled:l,customBaseUrl:S,getDisplayUrl:()=>{let a=S||L();return a.endsWith("/v1")?a:`${a}/v1`},handleApplySettings:ac,handleResetSettings:ad,hasActiveProviders:g,message:z,openclawStatus:u,restoring:y,selectedApiKey:C,selectedModel:D,setAgentModalFor:I,setAgentModels:G,setCustomBaseUrl:T,setModalOpen:K,setSelectedApiKey:B,setSelectedModel:E,setShowManualConfigModal:R,tailscaleEnabled:p,tailscaleUrl:q,tool:a,tunnelEnabled:n,tunnelPublicUrl:o}),(0,d.jsx)(i.ModelSelectModal,{isOpen:J,onClose:()=>K(!1),onSelect:a=>{H?(G(b=>({...b,[H]:a.value})),I(null)):E(a.value),K(!1)},selectedModel:D,activeProviders:k,modelAliases:O,title:"Select Model for Open Claw"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:Q,onClose:()=>R(!1),title:"Open Claw - Manual Configuration",configs:(r=C&&C.trim()?C:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`VansRoute/${D||"provider/model-id"}`}}},models:{providers:{VansRoute:{baseUrl:ab(),apiKey:r,api:"openai-completions",models:[{id:D||"provider/model-id",name:(D||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}var O=c(60390);let P="/api/cli-tools/hermes-settings",Q=O.dM.hermes?.roles||[];function R(a,b){switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}}function S({tool:a,isExpanded:b,onToggle:c,baseUrl:f,hasActiveProviders:g,apiKeys:h,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let s,t,v,x,[y,z]=(0,e.useReducer)(R,{status:m||null,checking:!1,applying:!1,restoring:!1,message:null}),{status:A,checking:B,applying:C,restoring:D,message:E}=y,[F,G]=(0,e.useState)(null),H=F??(h?.length>0?h[0].key:""),[I,J]=(0,e.useState)(null),K=I??A?.settings?.model?.default??"",[L,M]=(0,e.useState)({}),[N,O]=(0,e.useState)("default"),[T,U]=(0,e.useState)(!1),[V,W]=(0,e.useState)({}),[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)("");(0,e.useRef)(!1);let _=(()=>{if(!A?.installed)return null;let a=A.settings?.model;return a?.base_url?w(a.base_url,{tunnelPublicUrl:o,tailscaleUrl:q})?"configured":"other":"not_configured"})(),aa=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&W(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),ab=(0,e.useCallback)(async()=>{z({type:"CHECK_START"});try{let a=await fetch(P),b=await a.json();z({type:"CHECK_DONE",data:b})}catch(a){z({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),ac=(0,e.useRef)(!!m),ad=(0,e.useRef)(!1),ae=(0,e.useCallback)(async()=>{ac.current||(ac.current=!0,await ab()),ad.current||(ad.current=!0,await aa())},[ab,aa]),af=(0,e.useCallback)(()=>{b||ae(),c()},[b,ae,c]),ag=()=>{let a=Z||"http://127.0.0.1:20128";return a.endsWith("/v1")?a:`${a}/v1`},ah=async()=>{z({type:"APPLY_START"});try{let a=H?.trim()||(h?.length>0?h[0].key:null)||(l?null:"sk_VansRoute"),b=await fetch(P,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ag(),apiKey:a,selections:[{role:"default",model:K},...Object.entries(L).filter(([,a])=>a?.trim()).map(([a,b])=>({role:a,model:b.trim()}))]})}),c=await b.json();b.ok?(z({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),ab()):z({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){z({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},ai=async()=>{z({type:"RESTORE_START"});try{let a=await fetch(P,{method:"DELETE"}),b=await a.json();a.ok?(z({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),J(""),M({}),ab()):z({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){z({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}},aj=a=>{O(a),U(!0)};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:af,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/hermes.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===_&&(0,d.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"===_&&(0,d.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"===_&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[B&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Hermes Agent..."})]}),!B&&A&&!A.installed&&(0,d.jsx)("div",{className:"flex flex-col gap-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Hermes Agent not detected locally"}),(0,d.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,d.jsx)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 pl-0 sm:pl-9",children:(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>Y(!0),className:"w-full sm:w-auto !bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!B&&A?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:A?.settings?.baseUrl||"",value:Z||ag(),onChange:$,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q})]}),A?.settings?.model?.base_url&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:A.settings.model.base_url})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:H,onChange:G,apiKeys:h,cloudEnabled:l})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Default Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:K,onChange:a=>J(a.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),K&&(0,d.jsx)("button",{type:"button",onClick:()=>J(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>aj("default"),disabled:!g,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${g?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]}),(0,d.jsxs)("details",{className:"group",children:[(0,d.jsxs)("summary",{className:"cursor-pointer select-none text-xs font-semibold text-text-main hover:text-primary transition-colors",children:[(0,d.jsx)("span",{className:"material-symbols-outlined align-middle text-[16px] text-text-muted group-open:rotate-90 transition-transform",children:"chevron_right"}),"Model Roles (optional)"]}),(0,d.jsxs)("div",{className:"mt-2 flex flex-col gap-1.5",children:[Q.map(a=>(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"truncate text-xs font-semibold text-text-main sm:text-right sm:text-sm",title:a.label,children:a.label}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:L[a.id]||"",onChange:b=>M(c=>({...c,[a.id]:b.target.value})),placeholder:"inherit default",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),L[a.id]&&(0,d.jsx)("button",{onClick:()=>M(b=>({...b,[a.id]:""})),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>aj(a.id),disabled:!g,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${g?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]},a.id)),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Empty roles inherit the default model."})]})]})]}),E&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===E.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===E.type?"check_circle":"error"}),(0,d.jsx)("span",{children:E.text})]}),(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:ah,disabled:!K,loading:C,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:ai,disabled:!A?.hasVansRoute,loading:D,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>Y(!0),className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),T&&(0,d.jsx)(i.ModelSelectModal,{isOpen:T,onClose:()=>U(!1),onSelect:a=>{"default"===N?J(a.value):M(b=>({...b,[N]:a.value})),U(!1)},selectedModel:"default"===N?K:L[N]||"",activeProviders:k,modelAliases:V,title:`Select Model for Hermes Agent${"default"!==N?` — ${Q.find(a=>a.id===N)?.label||N}`:""}`}),(0,d.jsx)(i.ManualConfigModal,{isOpen:X,onClose:()=>Y(!1),title:"Hermes Agent - Manual Configuration",configs:(s=H&&H.trim()?H:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",t=ag(),v=`model:
16
- default: "${K||"provider/model-id"}"
14
+ default_subagent_model = "${u}"
15
+ `}])})]})}let J=process.env.NEXT_PUBLIC_CLOUD_URL;function K({addModel:a,apiKeys:b,applying:c,checkingDroid:e,cloudEnabled:f,customBaseUrl:g,droidStatus:h,getDisplayUrl:j,handleApplySettings:k,handleResetSettings:l,hasActiveProviders:m,message:n,modelInput:o,modelList:p,removeModel:q,restoring:r,selectedApiKey:t,setCustomBaseUrl:u,setModalOpen:w,setModelInput:x,setSelectedApiKey:y,setShowInstallGuide:z,setShowManualConfigModal:A,showInstallGuide:B,tailscaleEnabled:C,tailscaleUrl:D,tool:E,tunnelEnabled:F,tunnelPublicUrl:G}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[e&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!e&&h&&!h.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansAI is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>A(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>z(!B),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:B?"expand_less":"help"}),B?"Hide":"How to Install"]})]})]}),B&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,d.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,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"droid"})," to verify."]})]})]})]}),!e&&h?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:h?.settings?.baseUrl||"",value:g||j(),onChange:u,requiresExternalUrl:E.requiresExternalUrl,tunnelEnabled:F,tunnelPublicUrl:G,tailscaleEnabled:C,tailscaleUrl:D})]}),h?.settings?.customModels?.find(a=>a.id?.startsWith("custom:VansRoute"))?.baseUrl&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:h.settings.customModels.find(a=>a.id?.startsWith("custom:VansRoute")).baseUrl})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:t,onChange:y,apiKeys:b,cloudEnabled:f})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsxs)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:["Models ",p.length>0&&(0,d.jsxs)("span",{className:"text-primary",children:["(",p.length,")"]})]}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-1",children:[p.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-0.5 mb-1",children:p.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-bg-secondary rounded border border-border",children:[(0,d.jsx)("span",{className:"flex-1 text-xs font-mono truncate",children:a}),(0,d.jsx)("button",{type:"button",onClick:()=>q(a),className:"text-text-muted hover:text-red-500 transition-colors shrink-0",title:"Remove",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a))}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("input",{type:"text",value:o,onChange:a=>x(a.target.value),onKeyDown:b=>{"Enter"===b.key&&(b.preventDefault(),a())},"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),(0,d.jsx)("button",{type:"button",onClick:()=>w(!0),disabled:!m,className:`px-2 py-1.5 rounded border text-xs shrink-0 ${m?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),(0,d.jsx)("button",{type:"button",onClick:a,disabled:!o.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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"})})]})]})]})]}),n&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===n.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===n.type?"check_circle":"error"}),(0,d.jsx)("span",{children:n.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:k,disabled:0===p.length,loading:c,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:l,disabled:!h?.hasVansRoute,loading:r,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>A(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function L({tool:a,isExpanded:b,onToggle:c,baseUrl:f,hasActiveProviders:g,apiKeys:h,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let r,s,t,[u,v]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:m||null,checking:!1,applying:!1,restoring:!1,message:null}),w=u.status,y=u.checking,{applying:z,restoring:A,message:B}=u,[C,D]=(0,e.useState)(null),E=C??(h?.length>0?h[0].key:""),[F,G]=(0,e.useState)(null),H=F??(()=>{if(!w?.installed)return[];let a=(w.settings?.customModels||[]).filter(a=>a.id?.startsWith("custom:VansRoute")).sort((a,b)=>(a.index||0)-(b.index||0)).map(a=>a.model);if(a.length>0)return a;let b=w.settings?.customModels?.find(a=>"custom:VansRoute-0"===a.id);return b?.model?[b.model]:[]})(),[I,M]=(0,e.useState)(""),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)({}),[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(!1),[V,W]=(0,e.useState)(""),X=(()=>{if(!w?.installed)return null;let a=w.settings?.customModels?.find(a=>a.id?.startsWith("custom:VansRoute"));return a?x(a.baseUrl,{tunnelPublicUrl:o,tailscaleUrl:q,cloudUrl:l?J:null})?"configured":"other":"not_configured"})(),Y=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&Q(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),Z=(0,e.useCallback)(async()=>{v({type:"CHECK_START"});try{let a=await fetch("/api/cli-tools/droid-settings"),b=await a.json();v({type:"CHECK_DONE",data:b})}catch(a){v({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),$=(0,e.useRef)(!!m),_=(0,e.useRef)(!1),aa=(0,e.useCallback)(async()=>{$.current||($.current=!0,await Z()),_.current||(_.current=!0,await Y())},[Z,Y]),ab=(0,e.useCallback)(()=>{b||aa(),c()},[b,aa,c]),ac=()=>{let a=V||f;return a.endsWith("/v1")?a:`${a}/v1`},ad=async()=>{v({type:"APPLY_START"});try{let a=E?.trim()||(h?.length>0?h[0].key:null)||(l?null:"sk_VansRoute"),b=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ac(),apiKey:a,models:H,activeModel:H[0]||""})}),c=await b.json();b.ok?(v({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),Z()):v({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){v({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},ae=async()=>{v({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),b=await a.json();a.ok?(v({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),G([]),Z()):v({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){v({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:ab,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/droid.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===X&&(0,d.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"===X&&(0,d.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"===X&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(K,{addModel:()=>{let a=I.trim();!a||H.includes(a)||(G(b=>[...b,a]),M(""))},apiKeys:h,applying:z,checkingDroid:y,cloudEnabled:l,customBaseUrl:V,droidStatus:w,getDisplayUrl:()=>{let a=V||f;return a.endsWith("/v1")?a:`${a}/v1`},handleApplySettings:ad,handleResetSettings:ae,hasActiveProviders:g,message:B,modelInput:I,modelList:H,removeModel:a=>G(b=>b.filter(b=>b!==a)),restoring:A,selectedApiKey:E,setCustomBaseUrl:W,setModalOpen:O,setModelInput:M,setSelectedApiKey:D,setShowInstallGuide:U,setShowManualConfigModal:S,showInstallGuide:T,tailscaleEnabled:p,tailscaleUrl:q,tool:a,tunnelEnabled:n,tunnelPublicUrl:o}),(0,d.jsx)(i.ModelSelectModal,{isOpen:N,onClose:()=>O(!1),onSelect:a=>{!a.value||H.includes(a.value)||(G(b=>[...b,a.value]),O(!1))},selectedModel:null,activeProviders:k,modelAliases:P,title:"Select Model for Factory Droid"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:R,onClose:()=>S(!1),title:"Factory Droid - Manual Configuration",configs:(r=E&&E.trim()?E:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",s={customModels:H.map((a,b)=>({model:a,id:`custom:VansRoute-${b}`,index:b,baseUrl:ac(),apiKey:r,displayName:a,maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}))},t="u">typeof navigator&&navigator.platform,[{filename:t?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(s,null,2)}])})]})}function M(){return"http://127.0.0.1:20128"}function N({agentModels:a,apiKeys:b,applying:c,checkingOpenclaw:e,cloudEnabled:f,customBaseUrl:g,getDisplayUrl:h,handleApplySettings:j,handleResetSettings:k,hasActiveProviders:l,message:m,openclawStatus:n,restoring:o,selectedApiKey:p,selectedModel:q,setAgentModalFor:r,setAgentModels:t,setCustomBaseUrl:u,setModalOpen:w,setSelectedApiKey:x,setSelectedModel:y,setShowManualConfigModal:z,tailscaleEnabled:A,tailscaleUrl:B,tool:C,tunnelEnabled:D,tunnelPublicUrl:E}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[e&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!e&&n&&!n.installed&&(0,d.jsx)("div",{className:"flex flex-col gap-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansAI is deployed on a remote server."})]})]}),(0,d.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,d.jsxs)(i.Button,{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,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!e&&n?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:n?.settings?.models?.providers?.VansRoute?.baseUrl||"",value:g||h(),onChange:u,requiresExternalUrl:C.requiresExternalUrl,tunnelEnabled:D,tunnelPublicUrl:E,tailscaleEnabled:A,tailscaleUrl:B})]}),n?.settings?.models?.providers?.VansRoute?.baseUrl&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:n.settings.models.providers.VansRoute.baseUrl})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:p,onChange:x,apiKeys:b,cloudEnabled:f})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Default Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:q,onChange:a=>y(a.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),q&&(0,d.jsx)("button",{type:"button",onClick:()=>y(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>{r(null),w(!0)},disabled:!l,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${l?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]}),(n.agents||[]).flatMap(b=>b.agentDir?[(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-4",children:[(0,d.jsxs)("span",{className:"w-32 shrink-0 text-xs text-primary text-right truncate",title:b.name||b.id,children:["Agent ",b.name||b.id]}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:a[b.id]||"",onChange:a=>t(c=>({...c,[b.id]:a.target.value})),placeholder:`default (${q||"provider/model-id"})`,"aria-label":`Model for agent ${b.name||b.id}`,className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),a[b.id]&&(0,d.jsx)("button",{type:"button",onClick:()=>t(a=>({...a,[b.id]:""})),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>{r(b.id),w(!0)},disabled:!l,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${l?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]},b.id)]:[])]}),m&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===m.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===m.type?"check_circle":"error"}),(0,d.jsx)("span",{children:m.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:j,disabled:!q,loading:c,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:k,disabled:!n?.hasVansRoute,loading:o,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>z(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function O({tool:a,isExpanded:b,onToggle:c,baseUrl:f,hasActiveProviders:g,apiKeys:h,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let r,[s,t]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:m||null,checking:!1,applying:!1,restoring:!1,message:null}),u=s.status,v=s.checking,{applying:w,restoring:y,message:z}=s,[A,B]=(0,e.useState)(null),C=A??(h?.length>0?h[0].key:""),[D,E]=(0,e.useState)(""),[F,G]=(0,e.useState)({}),[H,I]=(0,e.useState)(null),[J,K]=(0,e.useState)(!1),[L,P]=(0,e.useState)({}),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)(""),U=(()=>{if(!u?.installed)return null;let a=u.settings?.models?.providers?.VansRoute;return a?x(a.baseUrl,{tunnelPublicUrl:o,tailscaleUrl:q})?"configured":"other":"not_configured"})(),V=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&P(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),W=(0,e.useCallback)(async()=>{t({type:"CHECK_START"});try{let a=await fetch("/api/cli-tools/openclaw-settings"),b=await a.json();t({type:"CHECK_DONE",data:b})}catch(a){t({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),X=(0,e.useRef)(!!m),Y=(0,e.useRef)(!1),Z=(0,e.useCallback)(async()=>{X.current||(X.current=!0,await W()),Y.current||(Y.current=!0,await V())},[W,V]),$=(0,e.useCallback)(()=>{b||Z(),c()},[b,Z,c]),[_,aa]=(0,e.useState)(!1);if(u?.installed&&!_){aa(!0);let a=u.settings?.models?.providers?.VansRoute;if(a){let b=u.settings?.agents?.defaults?.model?.primary;b&&!D&&E(b.replace("VansRoute/","")),a.apiKey&&h?.some(b=>b.key===a.apiKey)&&!A&&B(a.apiKey)}let b=u.agents||[],c={};b.forEach(a=>{a.currentModel&&(c[a.id]=a.currentModel)}),Object.keys(c).length>0&&G(c)}let ab=()=>{let a=S||M();return a.endsWith("/v1")?a:`${a}/v1`},ac=async()=>{t({type:"APPLY_START"});try{let a=C?.trim()||(h?.length>0?h[0].key:null)||(l?null:"sk_VansRoute"),b=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ab(),apiKey:a,model:D,agentModels:F})}),c=await b.json();b.ok?(t({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),W()):t({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){t({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},ad=async()=>{t({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),b=await a.json();a.ok?(t({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),E(""),B(""),W()):t({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){t({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:$,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/openclaw.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===U&&(0,d.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"===U&&(0,d.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"===U&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(N,{agentModels:F,apiKeys:h,applying:w,checkingOpenclaw:v,cloudEnabled:l,customBaseUrl:S,getDisplayUrl:()=>{let a=S||M();return a.endsWith("/v1")?a:`${a}/v1`},handleApplySettings:ac,handleResetSettings:ad,hasActiveProviders:g,message:z,openclawStatus:u,restoring:y,selectedApiKey:C,selectedModel:D,setAgentModalFor:I,setAgentModels:G,setCustomBaseUrl:T,setModalOpen:K,setSelectedApiKey:B,setSelectedModel:E,setShowManualConfigModal:R,tailscaleEnabled:p,tailscaleUrl:q,tool:a,tunnelEnabled:n,tunnelPublicUrl:o}),(0,d.jsx)(i.ModelSelectModal,{isOpen:J,onClose:()=>K(!1),onSelect:a=>{H?(G(b=>({...b,[H]:a.value})),I(null)):E(a.value),K(!1)},selectedModel:D,activeProviders:k,modelAliases:L,title:"Select Model for Open Claw"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:Q,onClose:()=>R(!1),title:"Open Claw - Manual Configuration",configs:(r=C&&C.trim()?C:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`VansRoute/${D||"provider/model-id"}`}}},models:{providers:{VansRoute:{baseUrl:ab(),apiKey:r,api:"openai-completions",models:[{id:D||"provider/model-id",name:(D||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}var P=c(60390);let Q="/api/cli-tools/hermes-settings",R=P.dM.hermes?.roles||[];function S({tool:a,isExpanded:b,onToggle:c,baseUrl:f,hasActiveProviders:g,apiKeys:h,activeProviders:k,cloudEnabled:l,initialStatus:n,tunnelEnabled:o,tunnelPublicUrl:q,tailscaleEnabled:r,tailscaleUrl:t}){let u,w,y,z,A,B,[C,D]=(0,e.useState)(n||null),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(null),[M,N]=(0,e.useState)(null),O=M??h?.[0]?.key??"",[P,T]=(0,e.useState)(null),U=P??C?.settings?.model?.default??"",[V,W]=(0,e.useState)({}),[X,Y]=(0,e.useState)("default"),[Z,$]=(0,e.useState)(!1),[_,aa]=(0,e.useState)({}),[ab,ac]=(0,e.useState)(!1),[ad,ae]=(0,e.useState)(""),[af,ag]=(0,e.useState)([]),[ah,ai]=(0,e.useState)("default"),[aj,ak]=(0,e.useState)(!1),[al,am]=(0,e.useState)(""),[an,ao]=(0,e.useState)(!1),[ap,aq]=(0,e.useState)(""),ar=(0,e.useRef)(!1),as=C?.settings?.model?.base_url||"",at=(()=>{if(!C?.installed)return null;let a=C.settings?.model;return a?.base_url?x(a.base_url,{tunnelPublicUrl:q,tailscaleUrl:t})?"configured":"other":"not_configured"})(),au={configured:"bg-green-500",other:"bg-blue-500",not_configured:"bg-yellow-500"},av={configured:"Connected",other:"Other endpoint",not_configured:"Not configured"},aw=async()=>{try{let a=await fetch("/api/cli-tools/hermes-profiles"),b=await a.json();a.ok&&ag(b.profiles||[])}catch(a){console.log("Error fetching hermes profiles:",a)}},ax=async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&aa(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},ay=async a=>{try{await navigator.clipboard.writeText(a),am(a),setTimeout(()=>am(""),2e3)}catch(a){console.log("Copy failed",a)}},az=async(a=ah)=>{F(!0);try{let b=await fetch(`${Q}?profile=${encodeURIComponent(a)}`),c=await b.json();b.ok?D(c):(L({type:"error",text:c.error||"Failed to load Hermes settings"}),404===b.status&&(aw(),ai("default")))}catch(a){D({installed:!1,error:a.message})}finally{F(!1)}},aA=()=>{let a=ad||"http://127.0.0.1:20128";return a.endsWith("/v1")?a:`${a}/v1`},aB=()=>O?.trim()||(h?.length>0?h[0].key:null)||(l?null:"sk_9router"),aC=a=>"default"===a?"default profile":`profile "${a}"`,aD=async()=>{H(!0),L(null);try{let a=await fetch(Q,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:ah,baseUrl:aA(),apiKey:aB(),selections:[{role:"default",model:U},...Object.entries(V).filter(([,a])=>a?.trim()).map(([a,b])=>({role:a,model:b.trim()}))],audio:{enabled:an,model:ap.trim()}})}),b=await a.json();a.ok?(p(aA(),{tunnelPublicUrl:q,tailscaleUrl:t}),L({type:"success",text:`Settings applied to ${aC(ah)}!`}),az(),aw()):L({type:"error",text:b.error||"Failed to apply settings"})}catch(a){L({type:"error",text:a.message})}finally{H(!1)}},aE=async()=>{let a=aA();if(!(x(a,{tunnelPublicUrl:q,tailscaleUrl:t})||m().some(b=>(b.baseUrl||"").replace(/\/+$/,"")===a.replace(/\/+$/,""))))return void L({type:"error",text:`"${a}" is not a 9router endpoint. Select the local, tunnel, Tailscale or a saved 9router endpoint before applying to all profiles.`});ak(!0),L(null);try{let b=await fetch(Q,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({applyToAll:!0,baseUrl:a,apiKey:aB(),model:U})}),c=await b.json();if(b.ok&&c.bulk){p(a,{tunnelPublicUrl:q,tailscaleUrl:t});let b=(c.results||[]).filter(a=>"updated"!==a.status);if(0===b.length)L({type:"success",text:`Endpoint and API key applied to ${c.updated} profile(s).`});else{let a=b.map(a=>`${a.profile} — ${a.reason||a.status}`).join("; ");L({type:c.updated>0?"success":"error",text:`Updated ${c.updated} profile(s), skipped ${b.length}: ${a}`})}aw(),az()}else L({type:"error",text:c.error||"Failed to apply settings"})}catch(a){L({type:"error",text:a.message})}finally{ak(!1)}},aF=async()=>{J(!0),L(null);try{let a=await fetch(Q,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:ah})}),b=await a.json();a.ok?(L({type:"success",text:`Settings reset for ${aC(ah)}!`}),T(""),W({}),ao(!1),aq(""),az(),aw()):L({type:"error",text:b.error||"Failed to reset settings"})}catch(a){L({type:"error",text:a.message})}finally{J(!1)}},aG=a=>{Y(a),$(!0)};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:()=>{c(),b||(C||az(),ax(),aw())},children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/hermes.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===at&&(0,d.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"===at&&(0,d.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"===at&&(0,d.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"}),"default"!==ah&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-primary/10 text-primary rounded-full font-mono",title:"Hermes profile shown below",children:ah})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[E&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Hermes Agent..."})]}),!E&&C&&!C.installed&&(0,d.jsx)("div",{className:"flex flex-col gap-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Hermes Agent not detected locally"}),(0,d.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,d.jsx)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 pl-0 sm:pl-9",children:(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>ac(!0),className:"w-full sm:w-auto !bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!E&&C?.installed&&(0,d.jsxs)(d.Fragment,{children:[af.length>1&&(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main mr-1",children:"Profile"}),af.map(a=>{let b=a.name===ah,c=a.has9Router||a.baseUrl&&x(a.baseUrl,{tunnelPublicUrl:q,tailscaleUrl:t})?"configured":a.baseUrl?"other":"not_configured";return(0,d.jsxs)("button",{onClick:()=>{var b;(b=a.name)!==ah&&(ai(b),ar.current=!1,L(null),ae(""),ao(!1),aq(""),az(b))},title:a.isDefault?`Default profile — ${av[c]}`:`${a.command} — ${av[c]}`,className:`flex items-center gap-1.5 px-2 py-1 rounded border text-xs transition-colors ${b?"border-primary bg-primary/10 text-primary cursor-pointer":"bg-surface border-border text-text-muted hover:text-text-main hover:border-border-hover cursor-pointer"}`,children:[(0,d.jsx)("span",{className:`size-1.5 rounded-full shrink-0 ${au[c]}`}),(0,d.jsx)("span",{className:"font-medium",children:a.displayName||a.name}),a.displayName&&!a.isDefault&&(0,d.jsx)("span",{className:"font-mono text-[10px] opacity-60",children:a.name})]},a.name)})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"terminal"}),(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-surface/60 rounded font-mono text-[11px]",children:af.find(a=>a.name===ah)?.command||"hermes"}),(0,d.jsx)("button",{onClick:()=>ay(af.find(a=>a.name===ah)?.command||"hermes"),className:`p-0.5 rounded transition-colors ${al===(af.find(a=>a.name===ah)?.command||"hermes")?"text-green-600":"text-text-muted hover:text-text-main"}`,title:"Copy command",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:al===(af.find(a=>a.name===ah)?.command||"hermes")?"check":"content_copy"})}),(0,d.jsx)("span",{className:"hidden sm:inline",children:"— every profile runs as its own agent with its own model."})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{value:ad||aA(),onChange:ae,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:o,tunnelPublicUrl:q,tailscaleEnabled:r,tailscaleUrl:t,currentUrl:as})]}),C?.settings?.model?.base_url&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:C.settings.model.base_url})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:O,onChange:N,apiKeys:h,cloudEnabled:l})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Default Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:U,onChange:a=>T(a.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),U&&(0,d.jsx)("button",{type:"button",onClick:()=>T(null),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>aG("default"),disabled:!g,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${g?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Audio STT"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("label",{className:"flex items-center gap-2 text-xs text-text-muted cursor-pointer",title:"Route Hermes voice & audio transcription through 9router's /v1/audio/transcriptions — usage is tracked on this instance",children:[(0,d.jsx)("input",{type:"checkbox",checked:an,onChange:a=>ao(a.target.checked),className:"w-3.5 h-3.5 accent-primary cursor-pointer shrink-0"}),(0,d.jsx)("span",{children:"Transcribe voice & audio via 9router (per-profile)"})]}),(0,d.jsx)("span",{})]}),an&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"STT Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:ap,onChange:a=>aq(a.target.value),placeholder:"provider/whisper-model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),ap&&(0,d.jsx)("button",{onClick:()=>aq(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>aG("stt"),disabled:!g,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${g?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]}),(0,d.jsxs)("details",{className:"group",children:[(0,d.jsxs)("summary",{className:"cursor-pointer select-none text-xs font-semibold text-text-main hover:text-primary transition-colors",children:[(0,d.jsx)("span",{className:"material-symbols-outlined align-middle text-[16px] text-text-muted group-open:rotate-90 transition-transform",children:"chevron_right"}),"Model Roles (optional)"]}),(0,d.jsxs)("div",{className:"mt-2 flex flex-col gap-1.5",children:[R.map(a=>(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"truncate text-xs font-semibold text-text-main sm:text-right sm:text-sm",title:a.label,children:a.label}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:V[a.id]||"",onChange:b=>W(c=>({...c,[a.id]:b.target.value})),placeholder:"inherit default",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),V[a.id]&&(0,d.jsx)("button",{onClick:()=>W(b=>({...b,[a.id]:""})),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>aG(a.id),disabled:!g,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${g?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]},a.id)),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Empty roles inherit the default model."})]})]})]}),K&&(0,d.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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===K.type?"check_circle":"error"}),(0,d.jsx)("span",{children:K.text})]}),(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:aD,disabled:!U||an&&!ap.trim(),title:an&&!ap.trim()?"Select an STT model first":void 0,loading:G,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),af.length>1&&(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:aE,loading:aj,title:"Set the endpoint and API key on every profile that routes through 9router. Each profile keeps its own model.",className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"groups"}),"Apply to All Profiles"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:aF,disabled:!C?.has9Router&&!C?.has9RouterStt,loading:I,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>ac(!0),className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),Z&&(0,d.jsx)(i.ModelSelectModal,{isOpen:Z,onClose:()=>$(!1),onSelect:a=>{"stt"===X?aq(a.value):"default"===X?T(a.value):W(b=>({...b,[X]:a.value})),$(!1)},selectedModel:"stt"===X?ap:"default"===X?U:V[X]||"",activeProviders:k,modelAliases:_,kindFilter:"stt"===X?"stt":void 0,title:"stt"===X?"Select STT Model — audio transcription via 9router":`Select Model for Hermes Agent${"default"!==X?` — ${R.find(a=>a.id===X)?.label||X}`:""}`}),(0,d.jsx)(i.ManualConfigModal,{isOpen:ab,onClose:()=>ac(!1),title:"Hermes Agent - Manual Configuration",configs:(u=O&&O.trim()?O:l?"<API_KEY_FROM_DASHBOARD>":"sk_9router",w=aA(),y="default"===ah?"~/.hermes":`~/.hermes/profiles/${ah}`,z=af.find(a=>a.name===ah)?.command||"hermes",A=`# Run this profile: ${z}
16
+ model:
17
+ default: "${U||"provider/model-id"}"
17
18
  provider: "custom"
18
- base_url: "${t}"
19
+ base_url: "${w}"
19
20
  api_key: \${OPENAI_API_KEY}
20
- `,L.delegation?.trim()&&(v+=`delegation:
21
- model: "${L.delegation.trim()}"
21
+ `,V.delegation?.trim()&&(A+=`delegation:
22
+ model: "${V.delegation.trim()}"
22
23
  provider: "custom"
23
- base_url: "${t}"
24
+ base_url: "${w}"
24
25
  api_key: \${OPENAI_API_KEY}
25
- `),(x=Object.entries(L).filter(([a,b])=>"delegation"!==a&&b?.trim())).length>0&&(v+=`auxiliary:
26
- ${x.map(([a,b])=>` ${a}:
26
+ `),(B=Object.entries(V).filter(([a,b])=>"delegation"!==a&&b?.trim())).length>0&&(A+=`auxiliary:
27
+ ${B.map(([a,b])=>` ${a}:
27
28
  provider: "custom"
28
29
  model: "${b.trim()}"
29
- base_url: "${t}"
30
+ base_url: "${w}"
30
31
  api_key: \${OPENAI_API_KEY}
31
- `).join("")}`),[{filename:"~/.hermes/config.yaml",content:v},{filename:"~/.hermes/.env",content:`OPENAI_API_KEY=${s}
32
- `}])})]})}var T=c(87571);let U=[];function V({tool:a,toolId:b}){return a.image?(0,d.jsx)(j.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}}):a.icon?(0,d.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:a.color},children:a.icon}):(0,d.jsx)(j.default,{src:`/providers/${b}.webp`,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}function W({notes:a,cloudEnabled:b,tunnelEnabled:c}){return a&&0!==a.length?(0,d.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:a.map(a=>{if("cloudCheck"===a.type&&(b||c))return null;let e="warning"===a.type,f="cloudCheck"===a.type&&!b&&!c,g="bg-blue-500/10 border-blue-500/30",h="text-blue-600 dark:text-blue-400",i="text-blue-500",j="info";return e?(g="bg-yellow-500/10 border-yellow-500/30",h="text-yellow-600 dark:text-yellow-400",i="text-yellow-500",j="warning"):f&&(g="bg-red-500/10 border-red-500/30",h="text-red-600 dark:text-red-400",i="text-red-500",j="error"),(0,d.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${g}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-lg ${i}`,children:j}),(0,d.jsx)("p",{className:`text-sm ${h}`,children:a.text})]},`${a.type}-${a.text}`)})}):null}function X({toolId:a,tool:b,isExpanded:c,onToggle:f,baseUrl:g,apiKeys:h,activeProviders:j=U,cloudEnabled:k=!1,tunnelEnabled:l=!1}){let[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(()=>h?.length>0?h[0].key:""),v=a=>{let b=s&&s.trim()?s:k?"your-api-key":"sk_9router",c=g||"http://localhost:20128",d=c.endsWith("/v1")?c:`${c}/v1`;return a.replace(/\{\{baseUrl\}\}/g,d).replace(/\{\{apiKey\}\}/g,b).replace(/\{\{model\}\}/g,q||"provider/model-id")},{copy:w}=(0,T.C)(),x=async(a,b)=>{await w(v(a),`toolcard-${b}`),n(b),setTimeout(()=>n(null),2e3)},y=j.length>0,z=()=>(!b.requiresExternalUrl||!!k||!!l)&&(!b.requiresCloud||!!k),A=b.guideSteps?(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(W,{notes:b.notes,cloudEnabled:k,tunnelEnabled:l}),z()&&b.guideSteps.map(a=>(0,d.jsxs)("div",{className:"flex items-start gap-4",children:[(0,d.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:b.color},children:a.step}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"font-medium text-text",children:a.title}),a.desc&&(0,d.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:a.desc}),"apiKeySelector"===a.type&&(0,d.jsx)("div",{className:"mt-2 flex flex-col sm:flex-row sm:items-center gap-2",children:(0,d.jsx)(u,{value:s,onChange:t,apiKeys:h,cloudEnabled:k,className:"flex-1"})}),"modelSelector"===a.type&&(0,d.jsxs)("div",{className:"mt-2 flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsx)("input",{type:"text",value:q,onChange:a=>r(a.target.value),placeholder:"provider/model-id","aria-label":"Model ID",className:"w-full sm:w-auto 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,d.jsx)("button",{type:"button",onClick:()=>p(!0),disabled:!y,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${y?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),q&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{type:"button",onClick:()=>x(q,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===m?"check":"content_copy"})}),(0,d.jsx)("button",{type:"button",onClick:()=>r(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),a.value&&(0,d.jsxs)("div",{className:"mt-2 flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsx)("code",{className:"w-full sm:w-auto flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:v(a.value)}),a.copyable&&(0,d.jsx)("button",{type:"button",onClick:()=>x(a.value,`${a.step}-${a.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:m===`${a.step}-${a.title}`?"check":"content_copy"})})]})]})]},a.step)),z()&&b.codeBlock&&(0,d.jsxs)("div",{className:"mt-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:b.codeBlock.language}),(0,d.jsxs)("button",{type:"button",onClick:()=>x(b.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,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===m?"check":"content_copy"}),"codeblock"===m?"Copied!":"Copy"]})]}),(0,d.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,d.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:v(b.codeBlock.code)})})]})]}):(0,d.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."});return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden overflow-x-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between hover:cursor-pointer text-left",onClick:f,"aria-expanded":c,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:(0,d.jsx)(V,{tool:b,toolId:a})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:b.name}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:b.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${c?"rotate-180":""}`,children:"expand_more"})]}),c&&(0,d.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:A}),(0,d.jsx)(i.ModelSelectModal,{isOpen:o,onClose:()=>p(!1),onSelect:a=>{r(a.value)},selectedModel:q,activeProviders:j,title:"Select Model"})]})}let Y=[];function Z({activeModel:a,activeProviders:b,apiKeys:c,applying:e,checkStatus:f,checking:g,cloudEnabled:h,customBaseUrl:j,getDisplayUrl:k,handleApply:l,handleReset:m,message:n,restoring:o,selectedApiKey:p,selectedModel:q,selectedModels:s,setActiveModel:t,setCustomBaseUrl:v,setModalOpen:w,setSelectedApiKey:x,setSelectedModels:y,setShowInstallGuide:z,setShowManualConfigModal:A,setSubagentModalOpen:B,setSubagentModel:C,showInstallGuide:D,status:E,subagentModel:F,tailscaleEnabled:G,tailscaleUrl:H,tool:I,tunnelEnabled:J,tunnelPublicUrl:K}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[g&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking OpenCode CLI..."})]}),!g&&E&&!E.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"OpenCode CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansAI is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>A(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>z(!D),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:D?"expand_less":"help"}),D?"Hide":"How to Install"]})]})]}),D&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux:"}),(0,d.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,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"opencode"})," to verify."]})]})]})]}),!g&&E?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:E?.settings?.baseUrl||"",value:j||k(),onChange:v,requiresExternalUrl:I.requiresExternalUrl,tunnelEnabled:J,tunnelPublicUrl:K,tailscaleEnabled:G,tailscaleUrl:H})]}),(E?.config?.provider?.VansRoute?.options?.baseURL||E?.config?.provider?.["9router"]?.options?.baseURL)&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:E.config.provider.VansRoute?.options?.baseURL||E.config.provider["9router"]?.options?.baseURL})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:p,onChange:x,apiKeys:c,cloudEnabled:h})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Models"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,d.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===s.length?(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected"}):s.map(b=>(0,d.jsxs)("button",{type:"button",onClick:async()=>{if(b===a)try{(await fetch("/api/cli-tools/opencode-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({clearActiveModel:!0})})).ok&&(t(""),f())}catch(a){console.log("Error clearing active model:",a)}else t(b)},className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs cursor-pointer transition-colors ${b===a?"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:b===a?"Click to clear active model":"Click to set as active",children:[b===a&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[10px]",children:"star"}),b,(0,d.jsx)("span",{role:"none",onClick:async c=>{c.stopPropagation();try{if((await fetch(`/api/cli-tools/opencode-settings?model=${encodeURIComponent(b)}`,{method:"DELETE"})).ok){let c=s.filter(a=>a!==b);y(c),a===b&&t(""),f()}}catch(a){console.log("Error removing model:",a)}},className:"ml-0.5 hover:text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},b))}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:()=>w(!0),disabled:!b?.length,className:`px-2 py-1 rounded border text-xs transition-colors ${b?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Add Model"}),(0,d.jsx)("span",{className:"text-xs text-text-muted",children:s.length>0&&a?(0,d.jsxs)(d.Fragment,{children:["Active: ",(0,d.jsx)("span",{className:"text-primary",children:a})]}):s.length>0?(0,d.jsx)("span",{className:"text-yellow-500",children:"Click a model to set/clear active"}):"Select models to add"})]})]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:F,onChange:a=>C(a.target.value),placeholder:q||"provider/model-id (defaults to main model)","aria-label":"Subagent model",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),(0,d.jsx)("button",{type:"button",onClick:()=>B(!0),disabled:!b?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${b?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),F&&(0,d.jsx)("button",{type:"button",onClick:()=>C(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),n&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===n.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===n.type?"check_circle":"error"}),(0,d.jsx)("span",{children:n.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:l,disabled:0===s.length,loading:e,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:m,disabled:!E.hasVansRoute,loading:o,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>A(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function $({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:h,cloudEnabled:k,initialStatus:l,tunnelEnabled:m,tunnelPublicUrl:n,tailscaleEnabled:o,tailscaleUrl:p}){let q,r,s,t,u,v,[x,y]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:l||null,checking:!1,applying:!1,restoring:!1,message:null}),z=x.status,A=x.checking,{applying:B,restoring:C,message:D}=x,[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(null),I=G??(g?.length>0?g[0].key:""),[J,K]=(0,e.useState)(""),[L,M]=(0,e.useState)(null),N=L??((q=z?.config?.agent?.explorer?.model||"").startsWith("VansRoute/")?q.replace("VansRoute/",""):q.startsWith("9router/")?q.replace("9router/",""):""),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)({}),[U,V]=(0,e.useState)(!1),[W,X]=(0,e.useState)(""),[_,aa]=(0,e.useState)(null),ab=_??z?.opencode?.models??Y,[ac,ad]=(0,e.useState)(null),ae=ac??z?.opencode?.activeModel??"",af=(0,e.useRef)([]),ag=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&T(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),ah=(0,e.useCallback)(async()=>{y({type:"CHECK_START"});try{let a=await fetch("/api/cli-tools/opencode-settings"),b=await a.json();y({type:"CHECK_DONE",data:b})}catch(a){y({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),ai=(0,e.useRef)(!!l),aj=(0,e.useRef)(!1),ak=(0,e.useCallback)(async()=>{ai.current||(ai.current=!0,await ah()),aj.current||(aj.current=!0,await ag())},[ah,ag]),al=(0,e.useCallback)(()=>{b||ak(),c()},[b,ak,c]),am=async a=>{try{let b=I&&I.trim()||k?I:"sk_VansRoute",c=a.includes(ae)?ae:a[0]||"";await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ao(),apiKey:b,models:a,activeModel:c,subagentModel:N})})}catch(a){console.log("Error saving models:",a)}},an=z?.installed?z.config&&z.hasVansRoute?w(z.config?.provider?.VansRoute?.options?.baseURL||z.config?.provider?.["9router"]?.options?.baseURL||"",{tunnelPublicUrl:n,tailscaleUrl:p})?"configured":"other":"not_configured":null,ao=()=>{let a=W||f;return a.endsWith("/v1")?a:`${a}/v1`},ap=async()=>{y({type:"APPLY_START"});try{let a=I&&I.trim()||k?I:"sk_VansRoute",b=await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ao(),apiKey:a,models:ab,activeModel:""===ae?"":ae||ab[0],subagentModel:N})}),c=await b.json();b.ok?(y({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),ah()):y({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){y({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},aq=async()=>{y({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/opencode-settings",{method:"DELETE"}),b=await a.json();a.ok?(y({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),K(""),M(""),aa([]),ad(""),ah()):y({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){y({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:al,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/opencode.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===an&&(0,d.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"===an&&(0,d.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"===an&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(Z,{activeModel:ae,activeProviders:h,apiKeys:g,applying:B,checkStatus:ah,checking:A,cloudEnabled:k,customBaseUrl:W,getDisplayUrl:()=>W||`${f}/v1`,handleApply:ap,handleReset:aq,message:D,restoring:C,selectedApiKey:I,selectedModel:J,selectedModels:ab,setActiveModel:ad,setCustomBaseUrl:X,setModalOpen:P,setSelectedApiKey:H,setSelectedModels:aa,setShowInstallGuide:F,setShowManualConfigModal:V,setSubagentModalOpen:R,setSubagentModel:M,showInstallGuide:E,status:z,subagentModel:N,tailscaleEnabled:o,tailscaleUrl:p,tool:a,tunnelEnabled:m,tunnelPublicUrl:n}),(0,d.jsx)(i.ModelSelectModal,{isOpen:O,onClose:()=>{P(!1),am(af.current)},onSelect:a=>{!ab.includes(a.value)&&(aa([...ab,a.value]),ae||ad(a.value))},onDeselect:a=>{let b=ab.filter(b=>b!==a.value);aa(b),ae===a.value&&ad(b[0]||"")},selectedModel:null,activeProviders:h,modelAliases:S,addedModelValues:ab,closeOnSelect:!1,title:"Add Model for OpenCode"}),(0,d.jsx)(i.ModelSelectModal,{isOpen:Q,onClose:()=>R(!1),onSelect:a=>{M(a.value),R(!1)},selectedModel:N,activeProviders:h,modelAliases:S,title:"Select Subagent Model for OpenCode"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:U,onClose:()=>V(!1),title:"OpenCode - Manual Configuration",configs:(r=I&&I.trim()?I:k?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",s=ab.length>0?ab:["provider/model-id"],t=ae||ab[0]||s[0],u=N||t,v={},s.forEach(a=>{v[a]={name:a,modalities:{input:["text","image"],output:["text"]}}}),[{filename:"~/.config/opencode/opencode.json",content:JSON.stringify({provider:{VansRoute:{npm:"@ai-sdk/openai-compatible",options:{baseURL:ao(),apiKey:r},models:v}},model:`VansRoute/${t}`,agent:{explorer:{description:"Fast explorer subagent for codebase exploration",mode:"subagent",model:`VansRoute/${u}`}}},null,2)}])})]})}let _="/api/cli-tools/cowork-settings",aa=a=>(a||"").replace(/\/v1\/?$/,"");function ab({apiKeys:a,applying:b,checking:c,cloudEnabled:e,cloudUrl:f,customPlugins:g,getEffectiveBaseUrl:h,handleApply:j,handleRemoveModel:k,handleReset:l,hasActiveProviders:m,localPlugins:n,message:o,plugins:p,removePlugin:q,restoring:s,selectedApiKey:t,selectedModels:v,setAddMcpForm:w,setAddMcpOpen:x,setComboModalOpen:y,setCustomBaseUrl:z,setCustomPlugins:A,setLocalPlugins:B,setMarketplaceOpen:C,setPlugins:D,setSelectedApiKey:E,setShowManualConfigModal:F,status:G,tailscaleEnabled:H,tailscaleUrl:I,tunnelEnabled:J,tunnelPublicUrl:K}){let L,M;return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Claude Cowork..."})]}),!c&&G&&!G.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude Desktop (Cowork mode) not detected"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Open Claude Desktop → Help → Troubleshooting → Enable Developer mode → Configure third-party inference, then return here."})]})]}),(0,d.jsx)("div",{className:"pl-9",children:(0,d.jsxs)(i.Button,{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,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]}),!c&&G?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:G?.settings?.baseUrl||"",value:h(),onChange:a=>z(aa(a)),tunnelEnabled:J,tunnelPublicUrl:K,tailscaleEnabled:H,tailscaleUrl:I,cloudEnabled:e,cloudUrl:f})]}),G?.cowork?.baseUrl&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:G.cowork.baseUrl})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:t,onChange:E,apiKeys:a,cloudEnabled:e})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Models"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex items-center gap-2",children:[(0,d.jsx)("div",{className:"flex-1 flex flex-wrap gap-1.5 min-h-[28px] px-2 py-1.5 bg-surface rounded border border-border",children:0===v.length?(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected"}):v.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-black/5 dark:bg-white/5 text-text-muted border border-transparent hover:border-border",children:[a,(0,d.jsx)("button",{type:"button",onClick:()=>k(a),className:"ml-0.5 hover:text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a))}),(0,d.jsx)("button",{type:"button",onClick:()=>y(!0),disabled:!m,className:`shrink-0 px-2 py-1.5 rounded border text-xs whitespace-nowrap transition-colors ${m?"bg-primary/10 border-primary/40 text-primary hover:bg-primary/20 cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"+ Combo"})]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-2",children:"MCP"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-2",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-1",children:[p.flatMap(a=>"exa"===a.name?[]:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-surface rounded border border-border",children:[(0,d.jsx)("span",{className:"text-xs font-medium min-w-0 truncate flex-shrink-0",children:a.title||a.name}),a.oauth&&(0,d.jsx)("span",{className:"text-[8px] text-amber-600 shrink-0",children:"OAuth"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-wrap gap-1 overflow-hidden",style:{maxHeight:"1.5rem"},children:[Array.isArray(a.toolNames)&&a.toolNames.slice(0,6).map(a=>(0,d.jsx)("span",{className:"text-[9px] px-1 py-0.5 rounded bg-black/5 dark:bg-white/5 text-text-muted whitespace-nowrap",children:a},a)),Array.isArray(a.toolNames)&&a.toolNames.length>6&&(0,d.jsxs)("span",{className:"text-[9px] px-1 py-0.5 rounded bg-black/5 dark:bg-white/5 text-text-muted whitespace-nowrap",children:["+",a.toolNames.length-6]})]}),(0,d.jsx)("button",{type:"button",onClick:()=>q(a.name),className:"shrink-0 hover:text-red-500 ml-auto",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a.name)]),g.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-surface rounded border border-border",children:[(0,d.jsx)("span",{className:"text-xs font-medium min-w-0 truncate flex-shrink-0",children:a.name}),(0,d.jsx)("span",{className:"text-[8px] px-1 py-0.5 rounded bg-blue-500/10 text-blue-500 shrink-0",children:"custom"}),(0,d.jsx)("span",{className:"flex-1 text-[9px] text-text-muted truncate",children:a.url||a.command}),(0,d.jsx)("button",{type:"button",onClick:()=>A(g.filter(b=>b.name!==a.name)),className:"shrink-0 hover:text-red-500 ml-auto",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a.name)),0===p.filter(a=>"exa"!==a.name).length&&0===g.length&&(0,d.jsx)("div",{className:"px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-muted",children:"No MCPs added"}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,d.jsx)("button",{type:"button",onClick:()=>C(!0),className:"px-2 py-1 rounded border text-xs bg-primary/10 border-primary/40 text-primary hover:bg-primary/20 cursor-pointer whitespace-nowrap",children:"+ Browse"}),(0,d.jsx)("button",{type:"button",onClick:()=>{w({type:"url",name:"",url:"",command:"",args:""}),x(!0)},className:"px-2 py-1 rounded border text-xs bg-surface border-border text-text-muted hover:border-primary hover:text-primary cursor-pointer whitespace-nowrap",children:"+ Custom"}),(0,d.jsx)("a",{href:"https://mcp.so",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-text-muted hover:text-primary underline ml-auto",children:"Find MCPs →"})]})]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Tools"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-1.5",children:[(L=p.some(a=>"exa"===a.name),M=(G?.defaultPlugins||[]).find(a=>"exa"===a.name),(0,d.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer px-2 py-1.5 bg-surface rounded border border-border",children:[(0,d.jsx)("input",{type:"checkbox",checked:L,onChange:a=>{a.target.checked&&M?D([...p.filter(a=>"exa"!==a.name),M]):D(p.filter(a=>"exa"!==a.name))},className:"mt-0.5"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-xs font-medium",children:"Web Search & Fetch (Exa)"}),(0,d.jsx)("p",{className:"text-[10px] text-text-muted leading-snug",children:"Replaces built-in WebSearch/WebFetch. Auto-strips duplicates from tool list."})]})]})),(()=>{let a=(G?.localStdioPlugins||[]).find(a=>"browsermcp"===a.name);if(!a)return null;let b=n.includes("browsermcp");return(0,d.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer px-2 py-1.5 bg-surface rounded border border-border",children:[(0,d.jsx)("input",{type:"checkbox",checked:b,onChange:a=>B(a.target.checked?[...n,"browsermcp"]:n.filter(a=>"browsermcp"!==a)),className:"mt-0.5"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-xs font-medium",children:"Browser Control (Browser MCP)"}),(0,d.jsxs)("p",{className:"text-[10px] text-text-muted leading-snug",children:["Controls your running Chrome. Auto-strips Cowork's built-in browser tools."," ",(0,d.jsx)("a",{href:a.extensionUrl,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"Install Chrome extension"})]})]})]})})()]})]}),Array.isArray(G?.localStdioPlugins)&&G.localStdioPlugins.filter(a=>"browsermcp"!==a.name).length>0&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Local Plugins"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,d.jsx)("div",{className:"flex flex-col gap-1.5 px-2 py-1.5 bg-surface rounded border border-border",children:G.localStdioPlugins.flatMap(a=>{if("browsermcp"===a.name)return[];let b=n.includes(a.name);return[(0,d.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",checked:b,onChange:b=>B(b.target.checked?[...n,a.name]:n.filter(b=>b!==a.name)),className:"mt-0.5"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-xs font-medium",children:a.title}),(0,d.jsx)("span",{className:"text-[8px] text-amber-600",children:"stdio"})]}),(0,d.jsx)("p",{className:"text-[10px] text-text-muted leading-snug",children:a.description}),a.extensionUrl&&(0,d.jsx)("a",{href:a.extensionUrl,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-primary underline",children:"Install Chrome extension"})]})]},a.name)]})}),(0,d.jsxs)("p",{className:"text-[10px] text-text-muted leading-snug",children:["⚠️ Local plugins run as subprocess via ",(0,d.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/5",children:"npx"}),". Requires Node.js installed."]})]})]})]}),o&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===o.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===o.type?"check_circle":"error"}),(0,d.jsx)("span",{children:o.text})]}),(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:j,disabled:0===v.length,loading:b,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:l,disabled:!G.hasVansRoute,loading:s,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>F(!0),className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function ac({addMcpOpen:a,setAddMcpOpen:b,addMcpForm:c,setAddMcpForm:e,setCustomPlugins:f}){return a?(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:()=>b(!1),"aria-hidden":"true",children:(0,d.jsxs)("div",{className:"bg-surface border border-border rounded-xl shadow-xl w-full max-w-sm mx-4 p-5 flex flex-col gap-4",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h3",{className:"font-semibold text-sm",children:"Add Custom MCP"}),(0,d.jsx)("button",{type:"button",onClick:()=>b(!1),className:"text-text-muted hover:text-text-main",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:()=>e(a=>({...a,type:"url"})),className:`flex-1 py-1.5 rounded border text-xs font-medium transition-colors ${"url"===c.type?"bg-primary/10 border-primary/40 text-primary":"border-border text-text-muted hover:border-primary/40"}`,children:"URL (SSE)"}),(0,d.jsx)("button",{type:"button",onClick:()=>e(a=>({...a,type:"cmd"})),className:`flex-1 py-1.5 rounded border text-xs font-medium transition-colors ${"cmd"===c.type?"bg-primary/10 border-primary/40 text-primary":"border-border text-text-muted hover:border-primary/40"}`,children:"Command (stdio)"})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("label",{htmlFor:"cowork-mcp-name",className:"text-[11px] text-text-muted font-medium",children:"Name"}),(0,d.jsx)("input",{id:"cowork-mcp-name",type:"text",placeholder:"my-mcp",value:c.name,onChange:a=>e(b=>({...b,name:a.target.value.replace(/\s+/g,"-").toLowerCase()})),className:"px-2 py-1.5 rounded border border-border bg-surface text-xs outline-none focus:border-primary"})]}),"url"===c.type?(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("label",{htmlFor:"cowork-mcp-url",className:"text-[11px] text-text-muted font-medium",children:"SSE URL"}),(0,d.jsx)("input",{id:"cowork-mcp-url",type:"text",placeholder:"https://your-mcp-server.com/sse",value:c.url,onChange:a=>e(b=>({...b,url:a.target.value})),className:"px-2 py-1.5 rounded border border-border bg-surface text-xs outline-none focus:border-primary"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("label",{htmlFor:"cowork-mcp-command",className:"text-[11px] text-text-muted font-medium",children:"Command"}),(0,d.jsx)("input",{id:"cowork-mcp-command",type:"text",placeholder:"npx",value:c.command,onChange:a=>e(b=>({...b,command:a.target.value})),className:"px-2 py-1.5 rounded border border-border bg-surface text-xs outline-none focus:border-primary"})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsxs)("label",{htmlFor:"cowork-mcp-args",className:"text-[11px] text-text-muted font-medium",children:["Args ",(0,d.jsx)("span",{className:"font-normal",children:"(comma-separated)"})]}),(0,d.jsx)("input",{id:"cowork-mcp-args",type:"text",placeholder:"-y, @some/mcp-package",value:c.args,onChange:a=>e(b=>({...b,args:a.target.value})),className:"px-2 py-1.5 rounded border border-border bg-surface text-xs outline-none focus:border-primary"})]})]})]}),(0,d.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,d.jsx)("button",{type:"button",onClick:()=>b(!1),className:"px-3 py-1.5 rounded border border-border text-xs text-text-muted hover:bg-surface cursor-pointer",children:"Cancel"}),(0,d.jsx)("button",{type:"button",onClick:()=>{let a=c.name.trim();if(a){if("url"===c.type){if(!c.url.trim())return;f(b=>[...b.filter(b=>b.name!==a),{name:a,url:c.url.trim(),transport:"sse",custom:!0}])}else{if(!c.command.trim())return;let b=c.args.split(",").flatMap(a=>{let b=a.trim();return b?[b]:[]});f(d=>[...d.filter(b=>b.name!==a),{name:a,command:c.command.trim(),args:b,custom:!0}])}b(!1)}},className:"px-3 py-1.5 rounded bg-primary text-white text-xs font-medium hover:opacity-90 cursor-pointer",children:"Add"})]})]})}):null}function ad({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:h,hasActiveProviders:k,cloudEnabled:l,cloudUrl:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q,initialStatus:r}){let s,t,[u,v]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:r||null,checking:!1,applying:!1,restoring:!1,message:null}),w=u.status,x=u.checking,{applying:y,restoring:z,message:A}=u,[B,C]=(0,e.useState)(null),D=B??(g?.length>0?g[0].key:""),[E,F]=(0,e.useState)([]),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(""),[K,L]=(0,e.useState)([]),[M,N]=(0,e.useState)([]),[O,P]=(0,e.useState)([]),[Q,R]=(0,e.useState)({}),[S,T]=(0,e.useState)(!1),[U,V]=(0,e.useState)(!1),[W,X]=(0,e.useState)(!1),[Y,Z]=(0,e.useState)(!1),[$,ae]=(0,e.useState)({type:"url",name:"",url:"",command:"",args:""}),af=(0,e.useCallback)(async()=>{v({type:"CHECK_START"});try{let a=await fetch(_),b=await a.json();v({type:"CHECK_DONE",data:b})}catch(a){v({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),ag=(0,e.useRef)(!!r),ah=(0,e.useRef)(!1),ai=(0,e.useCallback)(async()=>{if(ag.current||(ag.current=!0,await af()),!ah.current){ah.current=!0;try{let a=await fetch("/api/models/alias");if(a.ok){let b=await a.json();R(b.aliases||{})}}catch{}}},[af]),aj=(0,e.useCallback)(()=>{b||ai(),c()},[b,ai,c]),[ak,al]=(0,e.useState)(!1);w?.cowork&&!ak&&(al(!0),w.cowork.models?.length&&0===E.length&&F(w.cowork.models),w.cowork.baseUrl&&!I&&J(aa(w.cowork.baseUrl)),Array.isArray(w.cowork.plugins)&&w.cowork.plugins.length>0?L(w.cowork.plugins):0===K.length&&Array.isArray(w?.defaultPlugins)&&L(w.defaultPlugins),Array.isArray(w.cowork.localPlugins)&&N(w.cowork.localPlugins),Array.isArray(w.cowork.customPlugins)&&w.cowork.customPlugins.length>0&&P(w.cowork.customPlugins));let am=()=>{let a;return(a=(I||"").replace(/\/+$/,""))?/\/v1$/.test(a)?a:`${a}/v1`:""},an=w?.installed?w?.cowork?.baseUrl?w.hasVansRoute?"configured":"other":"not_configured":null,ao=async()=>{v({type:"APPLY_START"});let a=am();if(0===E.length)return void v({type:"APPLY_DONE",message:{type:"error",text:"Please select at least one model"}});try{let b=D?.trim()||(g?.length>0?g[0].key:null)||(l?null:"sk_VansRoute"),c=await fetch(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:a,apiKey:b,models:E,plugins:K,localPlugins:M,customPlugins:O})}),d=await c.json();c.ok?(v({type:"APPLY_DONE",message:{type:"success",text:"Settings applied. Quit & reopen Claude Desktop to load."}}),af()):v({type:"APPLY_DONE",message:{type:"error",text:d.error||"Failed to apply settings"}})}catch(a){v({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},ap=async({name:a,models:b})=>{try{let c=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a,models:b})});if(!c.ok){let a=await c.json();v({type:"APPLY_DONE",message:{type:"error",text:a.error||"Failed to create combo"}});return}E.includes(a)||F([...E,a]),T(!1),v({type:"APPLY_DONE",message:{type:"success",text:`Combo "${a}" created and added.`}})}catch(a){v({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},aq=a=>{let b=a?.value||a?.name||a;F(a=>a.filter(a=>a!==b))},ar=async()=>{v({type:"RESTORE_START"});try{let a=await fetch(_,{method:"DELETE"}),b=await a.json();a.ok?(v({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully"}}),F([]),L(w?.defaultPlugins||[]),N([]),P([]),af()):v({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset"}})}catch(a){v({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:aj,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===an&&(0,d.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"===an&&(0,d.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"===an&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(ab,{apiKeys:g,applying:y,checking:x,cloudEnabled:l,cloudUrl:m,customPlugins:O,getEffectiveBaseUrl:am,handleApply:ao,handleRemoveModel:aq,handleReset:ar,hasActiveProviders:k,localPlugins:M,message:A,plugins:K,removePlugin:a=>{L(K.filter(b=>b.name!==a))},restoring:z,selectedApiKey:D,selectedModels:E,setAddMcpForm:ae,setAddMcpOpen:Z,setComboModalOpen:T,setCustomBaseUrl:J,setCustomPlugins:P,setLocalPlugins:N,setMarketplaceOpen:X,setPlugins:L,setSelectedApiKey:C,setShowManualConfigModal:H,status:w,tailscaleEnabled:p,tailscaleUrl:q,tunnelEnabled:n,tunnelPublicUrl:o}),(0,d.jsx)(i.ManualConfigModal,{isOpen:G,onClose:()=>H(!1),title:"Claude Cowork - Manual Configuration",configs:(s=D&&D.trim()?D:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",t=E.length>0?E:["provider/model-id"],[{filename:"~/Library/Application Support/Claude-3p/configLibrary/<appliedId>.json",content:JSON.stringify({inferenceProvider:"gateway",inferenceGatewayBaseUrl:am()||"https://your-public-host/v1",inferenceGatewayApiKey:s,inferenceModels:t.map(a=>({name:a}))},null,2)}])}),(0,d.jsx)(i.ComboFormModal,{isOpen:S,combo:null,onClose:()=>T(!1),onSave:ap,activeProviders:h,forcePrefix:"claude-",title:"Create Cowork Combo"}),(0,d.jsx)(i.ModelSelectModal,{isOpen:U,onClose:()=>V(!1),onSelect:a=>{let b=a?.value||a?.name||a;!b||E.includes(b)||F(a=>[...a,b])},onDeselect:aq,activeProviders:h,modelAliases:Q,title:"Select Cowork Model",addedModelValues:E,closeOnSelect:!1}),(0,d.jsx)(i.McpMarketplaceModal,{isOpen:W,onClose:()=>X(!1),onAdd:a=>{K.some(b=>b.name===a.name)||L([...K,a])},addedNames:K.map(a=>a.name)}),(0,d.jsx)(ac,{addMcpOpen:Y,setAddMcpOpen:Z,addMcpForm:$,setAddMcpForm:ae,setCustomPlugins:P})]})}function ae({tool:a,status:b,checking:c,baseUrl:e,apiKeys:f,activeProviders:g,cloudEnabled:h,tunnelEnabled:j,tunnelPublicUrl:k,tailscaleEnabled:l,tailscaleUrl:m,selectedApiKey:n,setSelectedApiKey:o,customBaseUrl:p,setCustomBaseUrl:q,selectedModels:s,setSelectedModels:t,getEffectiveBaseUrl:v,getDisplayUrl:w,message:x,applying:y,restoring:z,handleApply:A,handleReset:B,setModalOpen:C,setShowManualConfigModal:D}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Copilot config..."})]}),!c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-500 text-lg",children:"info"}),(0,d.jsxs)("div",{className:"text-xs text-blue-700 dark:text-blue-300",children:[(0,d.jsxs)("p",{className:"font-medium",children:["Writes to ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/10 rounded",children:"chatLanguageModels.json"})]}),(0,d.jsx)("p",{className:"mt-0.5 opacity-80",children:"Reload VS Code after applying for changes to take effect."})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:b?.settings?.baseUrl||"",value:p||w(),onChange:q,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:j,tunnelPublicUrl:k,tailscaleEnabled:l,tailscaleUrl:m})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:n,onChange:o,apiKeys:f,cloudEnabled:h})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Models"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,d.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===s.length?(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected"}):s.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-black/5 dark:bg-white/5 text-text-muted border border-transparent hover:border-border",children:[a,(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),t(b=>b.filter(b=>b!==a))},className:"ml-0.5 hover:text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a))}),(0,d.jsx)("div",{children:(0,d.jsx)("button",{type:"button",onClick:()=>C(!0),disabled:!g?.length,className:`px-2 py-1 rounded border text-xs transition-colors ${g?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Add Model"})})]})]})]}),x&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===x.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===x.type?"check_circle":"error"}),(0,d.jsx)("span",{children:x.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:A,disabled:0===s.length,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:B,disabled:!b?.has9Router,loading:z,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>D(!0),disabled:0===s.length,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function af({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:h,cloudEnabled:k,initialStatus:l,tunnelEnabled:m,tunnelPublicUrl:n,tailscaleEnabled:o,tailscaleUrl:p}){let q,r,[s,t]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:l||null,checking:!1,applying:!1,restoring:!1,message:null}),{status:u,checking:v,applying:x,restoring:y,message:z}=s,[A,B]=(0,e.useState)(null),C=A??(g?.length>0?g[0].key:""),[D,E]=(0,e.useState)(""),[F,G]=(0,e.useState)({}),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(null),L=(0,e.useMemo)(()=>{if(u?.config&&Array.isArray(u.config)){let a=u.config.find(a=>"9Router"===a.name);if(a?.models?.length>0)return a.models.map(a=>a.id)}return[]},[u]),M=J??L,[N,O]=(0,e.useState)(!1),P=(0,e.useRef)([]),Q=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&G(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),R=(0,e.useCallback)(async()=>{t({type:"CHECK_START"});try{let a=await fetch("/api/cli-tools/copilot-settings"),b=await a.json();t({type:"CHECK_DONE",data:b})}catch(a){t({type:"CHECK_DONE",data:{error:a.message}})}},[]),S=(0,e.useRef)(!!l),T=(0,e.useRef)(!1),U=(0,e.useCallback)(async()=>{S.current||(S.current=!0,await R()),T.current||(T.current=!0,await Q())},[R,Q]),V=(0,e.useCallback)(()=>{b||U(),c()},[b,U,c]),W=async a=>{try{let b=C&&C.trim()||k?C:"sk_9router";await fetch("/api/cli-tools/copilot-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Y(),apiKey:b,models:a})})}catch(a){console.log("Error saving models:",a)}},X=u?u.has9Router?w(u.currentUrl||"",{tunnelPublicUrl:n,tailscaleUrl:p})?"configured":"other":"not_configured":null,Y=()=>{let a=D||f;return a.endsWith("/v1")?a:`${a}/v1`},Z=async()=>{t({type:"APPLY_START"});try{let a=C&&C.trim()||k?C:"sk_9router",b=await fetch("/api/cli-tools/copilot-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Y(),apiKey:a,models:M})}),c=await b.json();b.ok?(t({type:"APPLY_DONE",message:{type:"success",text:c.message||"Settings applied! Reload VS Code."}}),R()):t({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){t({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},$=async()=>{t({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/copilot-settings",{method:"DELETE"}),b=await a.json();a.ok?(t({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),K([]),R()):t({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){t({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:V,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/copilot.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===X&&(0,d.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"===X&&(0,d.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"===X&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(ae,{tool:a,status:u,checking:v,baseUrl:f,apiKeys:g,activeProviders:h,cloudEnabled:k,tunnelEnabled:m,tunnelPublicUrl:n,tailscaleEnabled:o,tailscaleUrl:p,selectedApiKey:C,setSelectedApiKey:B,customBaseUrl:D,setCustomBaseUrl:E,selectedModels:M,setSelectedModels:K,getEffectiveBaseUrl:Y,getDisplayUrl:()=>D||`${f}/v1`,message:z,applying:x,restoring:y,handleApply:Z,handleReset:$,setModalOpen:O,setShowManualConfigModal:I}),(0,d.jsx)(i.ModelSelectModal,{isOpen:N,onClose:()=>{O(!1),W(P.current)},onSelect:a=>{M.includes(a.value)||K([...M,a.value])},onDeselect:a=>{K(M.filter(b=>b!==a.value))},selectedModel:null,activeProviders:h,modelAliases:F,addedModelValues:M,closeOnSelect:!1,title:"Add Model for GitHub Copilot"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:H,onClose:()=>I(!1),title:"GitHub Copilot - Manual Configuration",configs:(q=C&&C.trim()?C:k?"<API_KEY_FROM_DASHBOARD>":"sk_9router",r=Y(),[{filename:"~/Library/Application Support/Code/User/chatLanguageModels.json",content:JSON.stringify([{name:"9Router",vendor:"azure",apiKey:q,models:(M.length>0?M:["provider/model-id"]).map(a=>({id:a,name:a,url:`${r}/chat/completions#models.ai.azure.com`,toolCalling:!0,vision:!1,maxInputTokens:128e3,maxOutputTokens:16e3}))}],null,2)}])})]})}function ag({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let s,t,{status:v,checking:x,applying:y,restoring:z,message:A,dispatch:B,checkStatus:C,customBaseUrl:D,getDisplayUrl:E,getEffectiveBaseUrl:F,handleToggle:G,modelAliases:H,selectedApiKey:I,setCustomBaseUrl:J,setSelectedApiKey:K}=h({apiKeys:g,baseUrl:f,cloudEnabled:l,initialStatus:m,isExpanded:b,onToggle:c,statusEndpoint:"/api/cli-tools/cline-settings"}),[L,M]=(0,e.useState)(!1),[N,O]=(0,e.useState)(null),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(!1),T=N??v?.settings?.openAiModelId??"",U=v?.installed?v.hasVansRoute?w(v.settings?.openAiBaseUrl||"",{tunnelPublicUrl:o,tailscaleUrl:q})?"configured":"other":"not_configured":null,V=async()=>{B({type:"APPLY_START"});try{let a=I&&I.trim()||l?I:"sk_VansRoute",b=await fetch("/api/cli-tools/cline-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:F(),apiKey:a,model:T})}),c=await b.json();b.ok?(B({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),C()):B({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){B({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},W=async()=>{B({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/cline-settings",{method:"DELETE"}),b=await a.json();a.ok?(B({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),O(""),C()):B({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){B({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:G,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/cline.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===U&&(0,d.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"===U&&(0,d.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"===U&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[x&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Cline..."})]}),!x&&v&&!v.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Cline not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansRoute is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>S(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>M(!L),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:L?"expand_less":"help"}),L?"Hide":"How to Install"]})]})]}),L&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsx)("div",{className:"space-y-3 text-sm",children:(0,d.jsxs)("p",{className:"text-text-muted",children:["Install Cline VS Code extension or CLI from ",(0,d.jsx)("a",{className:"text-primary underline",href:"https://docs.cline.bot/",target:"_blank",rel:"noreferrer",children:"docs.cline.bot"}),"."]})})]})]}),!x&&v?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:v?.settings?.baseUrl||"",value:D||E(),onChange:J,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q})]}),v?.settings?.openAiBaseUrl&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:v.settings.openAiBaseUrl})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:I,onChange:K,apiKeys:g,cloudEnabled:l})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:T,onChange:a=>O(a.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),T&&(0,d.jsx)("button",{type:"button",onClick:()=>O(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>Q(!0),disabled:!k?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${k?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),A&&(0,d.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 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,d.jsx)("span",{children:A.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:V,disabled:!I&&l&&g.length>0||!T,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:W,disabled:z,loading:z,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>S(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(i.ModelSelectModal,{isOpen:P,onClose:()=>Q(!1),onSelect:a=>{O(a.value),Q(!1)},selectedModel:T,activeProviders:k,modelAliases:H,title:"Select Model for Cline"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:R,onClose:()=>S(!1),title:"Cline - Manual Configuration",configs:(s=I&&I.trim()?I:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",[{filename:"~/.cline/data/globalState.json",content:JSON.stringify({actModeApiProvider:"openai",planModeApiProvider:"openai",openAiBaseUrl:(t=F()).endsWith("/v1")?t.slice(0,-3):t,openAiModelId:T||"provider/model-id",planModeOpenAiModelId:T||"provider/model-id"},null,2)},{filename:"~/.cline/data/secrets.json",content:JSON.stringify({openAiApiKey:s},null,2)}])})]})}function ah({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let{status:s,checking:t,applying:v,restoring:w,message:x,dispatch:y,checkStatus:z,customBaseUrl:A,getDisplayUrl:B,getEffectiveBaseUrl:C,handleToggle:D,modelAliases:E,selectedApiKey:F,setCustomBaseUrl:G,setSelectedApiKey:H}=h({apiKeys:g,baseUrl:f,cloudEnabled:l,initialStatus:m,isExpanded:b,onToggle:c,statusEndpoint:"/api/cli-tools/kilo-settings"}),[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(""),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(!1),Q=s?.installed?s.hasVansRoute?"configured":"not_configured":null,R=async()=>{y({type:"APPLY_START"});try{let a=F&&F.trim()||l?F:"sk_VansRoute",b=await fetch("/api/cli-tools/kilo-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:C(),apiKey:a,model:K})}),c=await b.json();b.ok?(y({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),z()):y({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){y({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},S=async()=>{y({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/kilo-settings",{method:"DELETE"}),b=await a.json();a.ok?(y({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),L(""),z()):y({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){y({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:D,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/kilocode.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===Q&&(0,d.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"===Q&&(0,d.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"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[t&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Kilo Code..."})]}),!t&&s&&!s.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Kilo Code not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansRoute is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(i.Button,{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,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>J(!I),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:I?"expand_less":"help"}),I?"Hide":"How to Install"]})]})]}),I&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Install Kilo Code from ",(0,d.jsx)("a",{className:"text-primary underline",href:"https://kilocode.ai",target:"_blank",rel:"noreferrer",children:"kilocode.ai"})," or VS Code extension marketplace."]})]})]}),!t&&s?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:s?.settings?.baseUrl||"",value:A||B(),onChange:G,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:F,onChange:H,apiKeys:g,cloudEnabled:l})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:K,onChange:a=>L(a.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),K&&(0,d.jsx)("button",{type:"button",onClick:()=>L(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>N(!0),disabled:!k?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${k?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),x&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===x.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===x.type?"check_circle":"error"}),(0,d.jsx)("span",{children:x.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:R,disabled:!F&&l&&g.length>0||!K,loading:v,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:S,disabled:w,loading:w,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>P(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(i.ModelSelectModal,{isOpen:M,onClose:()=>N(!1),onSelect:a=>{L(a.value),N(!1)},selectedModel:K,activeProviders:k,modelAliases:E,title:"Select Model for Kilo Code"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:O,onClose:()=>P(!1),title:"Kilo Code - Manual Configuration",configs:[{filename:"~/.local/share/kilo/auth.json",content:JSON.stringify({"openai-compatible":{type:"api-key",apiKey:F&&F.trim()?F:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",baseUrl:C(),model:K||"provider/model-id"}},null,2)}]})]})}let ai="/api/cli-tools/deepseek-tui-settings";function aj({apiKeys:a,applying:b,checking:c,cloudEnabled:e,customBaseUrl:f,deepseekStatus:g,getEffectiveBaseUrl:h,handleApply:j,handleReset:k,hasActiveProviders:l,message:m,restoring:n,selectedApiKey:o,selectedModel:p,setCustomBaseUrl:q,setModalOpen:s,setSelectedApiKey:t,setSelectedModel:v,setShowManualConfigModal:w,tailscaleEnabled:x,tailscaleUrl:y,tool:z,tunnelEnabled:A,tunnelPublicUrl:B}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking DeepSeek TUI..."})]}),!c&&g&&!g.installed&&(0,d.jsx)("div",{className:"flex flex-col gap-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"DeepSeek TUI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Install via npm:"}),(0,d.jsx)("code",{className:"block mt-2 p-2 bg-black/20 rounded text-xs font-mono",children:"npm install -g deepseek-tui"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Manual configuration is still available if VansRoute is deployed on a remote server."})]})]}),(0,d.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>w(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!c&&g?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[z.notes&&z.notes.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-2 mb-2",children:z.notes.map(a=>(0,d.jsxs)("div",{className:`flex items-start gap-2 p-2 rounded text-xs ${"warning"===a.type?"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400":"error"===a.type?"bg-red-500/10 text-red-600 dark:text-red-400":"bg-blue-500/10 text-blue-600 dark:text-blue-400"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5",children:"warning"===a.type?"warning":"error"===a.type?"error":"info"}),(0,d.jsx)("span",{children:a.text})]},`${a.type}-${a.text}`))}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:status?.settings?.baseUrl||"",value:f||h(),onChange:q,requiresExternalUrl:z.requiresExternalUrl,tunnelEnabled:A,tunnelPublicUrl:B,tailscaleEnabled:x,tailscaleUrl:y})]}),g?.settings?.["providers.openai"]?.base_url&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:g.settings["providers.openai"].base_url})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:o,onChange:t,apiKeys:a,cloudEnabled:e})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Default Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:p,onChange:a=>v(a.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),p&&(0,d.jsx)("button",{type:"button",onClick:()=>v(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>s(!0),disabled:!l,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${l?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]})]}),m&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===m.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===m.type?"check_circle":"error"}),(0,d.jsx)("span",{children:m.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:j,disabled:!p,loading:b,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:k,disabled:!g?.hasVansRoute,loading:n,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>w(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function ak({tool:a,isExpanded:b,onToggle:c,baseUrl:f,hasActiveProviders:g,apiKeys:h,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let r,[s,t]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:m||null,checking:!1,applying:!1,restoring:!1,message:null}),u=s.status,v=s.checking,{applying:x,restoring:y,message:z}=s,[A,B]=(0,e.useState)(null),C=A??(h?.length>0?h[0].key:""),[D,E]=(0,e.useState)(null),F=D??u?.settings?.["providers.openai"]?.model??"",[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)({}),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)(""),O=(()=>{if(!u?.installed)return null;let a=u.settings?.["providers.openai"];return a?.base_url?w(a.base_url,{tunnelPublicUrl:o,tailscaleUrl:q})?"configured":"other":"not_configured"})(),P=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&J(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),Q=(0,e.useCallback)(async()=>{t({type:"CHECK_START"});try{let a=await fetch(ai),b=await a.json();t({type:"CHECK_DONE",data:b})}catch(a){t({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),R=(0,e.useRef)(!!m),S=(0,e.useRef)(!1),T=(0,e.useCallback)(async()=>{R.current||(R.current=!0,await Q()),S.current||(S.current=!0,await P())},[Q,P]),U=(0,e.useCallback)(()=>{b||T(),c()},[b,T,c]),V=()=>{let a=M||"http://127.0.0.1:20128";return a.endsWith("/v1")?a:`${a}/v1`},W=async()=>{t({type:"APPLY_START"});try{let a=C?.trim()||(h?.length>0?h[0].key:null)||(l?null:"sk_VansRoute"),b=await fetch(ai,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:V(),apiKey:a,model:F})}),c=await b.json();b.ok?(t({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),Q()):t({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){t({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},X=async()=>{t({type:"RESTORE_START"});try{let a=await fetch(ai,{method:"DELETE"}),b=await a.json();a.ok?(t({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),E(""),Q()):t({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){t({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:U,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:a.image||"/providers/deepseek-tui.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===O&&(0,d.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"===O&&(0,d.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"===O&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(aj,{apiKeys:h,applying:x,checking:v,cloudEnabled:l,customBaseUrl:M,deepseekStatus:u,getEffectiveBaseUrl:V,handleApply:W,handleReset:X,hasActiveProviders:g,message:z,restoring:y,selectedApiKey:C,selectedModel:F,setCustomBaseUrl:N,setModalOpen:H,setSelectedApiKey:B,setSelectedModel:E,setShowManualConfigModal:L,tailscaleEnabled:p,tailscaleUrl:q,tool:a,tunnelEnabled:n,tunnelPublicUrl:o}),(0,d.jsx)(i.ModelSelectModal,{isOpen:G,onClose:()=>H(!1),onSelect:a=>{E(a.value),H(!1)},selectedModel:F,activeProviders:k,modelAliases:I,title:"Select Model for DeepSeek TUI"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:K,onClose:()=>L(!1),title:"DeepSeek TUI - Manual Configuration",configs:(r=C&&C.trim()?C:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",[{filename:"~/.deepseek/config.toml",content:`[providers.openai]
32
+ `).join("")}`),an&&ap.trim()&&(A+=`stt:
33
+ enabled: true
34
+ provider: "openai"
35
+ openai:
36
+ model: "${ap.trim()}"
37
+ base_url: "${w}"
38
+ api_key: \${OPENAI_API_KEY}
39
+ `),[{filename:`${y}/config.yaml`,content:A},{filename:`${y}/.env`,content:`OPENAI_API_KEY=${u}
40
+ `}])})]})}var T=c(87571);let U=[];function V({tool:a,toolId:b}){return a.image?(0,d.jsx)(j.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}}):a.icon?(0,d.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:a.color},children:a.icon}):(0,d.jsx)(j.default,{src:`/providers/${b}.webp`,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}function W({notes:a,cloudEnabled:b,tunnelEnabled:c}){return a&&0!==a.length?(0,d.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:a.map(a=>{if("cloudCheck"===a.type&&(b||c))return null;let e="warning"===a.type,f="cloudCheck"===a.type&&!b&&!c,g="bg-blue-500/10 border-blue-500/30",h="text-blue-600 dark:text-blue-400",i="text-blue-500",j="info";return e?(g="bg-yellow-500/10 border-yellow-500/30",h="text-yellow-600 dark:text-yellow-400",i="text-yellow-500",j="warning"):f&&(g="bg-red-500/10 border-red-500/30",h="text-red-600 dark:text-red-400",i="text-red-500",j="error"),(0,d.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${g}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-lg ${i}`,children:j}),(0,d.jsx)("p",{className:`text-sm ${h}`,children:a.text})]},`${a.type}-${a.text}`)})}):null}function X({toolId:a,tool:b,isExpanded:c,onToggle:f,baseUrl:g,apiKeys:h,activeProviders:j=U,cloudEnabled:k=!1,tunnelEnabled:l=!1}){let[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(()=>h?.length>0?h[0].key:""),u=a=>{let b=s&&s.trim()?s:k?"your-api-key":"sk_9router",c=g||"http://localhost:20128",d=c.endsWith("/v1")?c:`${c}/v1`;return a.replace(/\{\{baseUrl\}\}/g,d).replace(/\{\{apiKey\}\}/g,b).replace(/\{\{model\}\}/g,q||"provider/model-id")},{copy:w}=(0,T.C)(),x=async(a,b)=>{await w(u(a),`toolcard-${b}`),n(b),setTimeout(()=>n(null),2e3)},y=j.length>0,z=()=>(!b.requiresExternalUrl||!!k||!!l)&&(!b.requiresCloud||!!k),A=b.guideSteps?(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(W,{notes:b.notes,cloudEnabled:k,tunnelEnabled:l}),z()&&b.guideSteps.map(a=>(0,d.jsxs)("div",{className:"flex items-start gap-4",children:[(0,d.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:b.color},children:a.step}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"font-medium text-text",children:a.title}),a.desc&&(0,d.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:a.desc}),"apiKeySelector"===a.type&&(0,d.jsx)("div",{className:"mt-2 flex flex-col sm:flex-row sm:items-center gap-2",children:(0,d.jsx)(v,{value:s,onChange:t,apiKeys:h,cloudEnabled:k,className:"flex-1"})}),"modelSelector"===a.type&&(0,d.jsxs)("div",{className:"mt-2 flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsx)("input",{type:"text",value:q,onChange:a=>r(a.target.value),placeholder:"provider/model-id","aria-label":"Model ID",className:"w-full sm:w-auto 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,d.jsx)("button",{type:"button",onClick:()=>p(!0),disabled:!y,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${y?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),q&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{type:"button",onClick:()=>x(q,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===m?"check":"content_copy"})}),(0,d.jsx)("button",{type:"button",onClick:()=>r(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),a.value&&(0,d.jsxs)("div",{className:"mt-2 flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsx)("code",{className:"w-full sm:w-auto flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:u(a.value)}),a.copyable&&(0,d.jsx)("button",{type:"button",onClick:()=>x(a.value,`${a.step}-${a.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:m===`${a.step}-${a.title}`?"check":"content_copy"})})]})]})]},a.step)),z()&&b.codeBlock&&(0,d.jsxs)("div",{className:"mt-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:b.codeBlock.language}),(0,d.jsxs)("button",{type:"button",onClick:()=>x(b.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,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===m?"check":"content_copy"}),"codeblock"===m?"Copied!":"Copy"]})]}),(0,d.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,d.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:u(b.codeBlock.code)})})]})]}):(0,d.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."});return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden overflow-x-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between hover:cursor-pointer text-left",onClick:f,"aria-expanded":c,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:(0,d.jsx)(V,{tool:b,toolId:a})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:b.name}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:b.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${c?"rotate-180":""}`,children:"expand_more"})]}),c&&(0,d.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:A}),(0,d.jsx)(i.ModelSelectModal,{isOpen:o,onClose:()=>p(!1),onSelect:a=>{r(a.value)},selectedModel:q,activeProviders:j,title:"Select Model"})]})}let Y=[];function Z({activeModel:a,activeProviders:b,apiKeys:c,applying:e,checkStatus:f,checking:g,cloudEnabled:h,customBaseUrl:j,getDisplayUrl:k,handleApply:l,handleReset:m,message:n,restoring:o,selectedApiKey:p,selectedModel:q,selectedModels:r,setActiveModel:t,setCustomBaseUrl:u,setModalOpen:w,setSelectedApiKey:x,setSelectedModels:y,setShowInstallGuide:z,setShowManualConfigModal:A,setSubagentModalOpen:B,setSubagentModel:C,showInstallGuide:D,status:E,subagentModel:F,tailscaleEnabled:G,tailscaleUrl:H,tool:I,tunnelEnabled:J,tunnelPublicUrl:K}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[g&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking OpenCode CLI..."})]}),!g&&E&&!E.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"OpenCode CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansAI is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>A(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>z(!D),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:D?"expand_less":"help"}),D?"Hide":"How to Install"]})]})]}),D&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux:"}),(0,d.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,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"opencode"})," to verify."]})]})]})]}),!g&&E?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:E?.settings?.baseUrl||"",value:j||k(),onChange:u,requiresExternalUrl:I.requiresExternalUrl,tunnelEnabled:J,tunnelPublicUrl:K,tailscaleEnabled:G,tailscaleUrl:H})]}),(E?.config?.provider?.VansRoute?.options?.baseURL||E?.config?.provider?.["9router"]?.options?.baseURL)&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:E.config.provider.VansRoute?.options?.baseURL||E.config.provider["9router"]?.options?.baseURL})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:p,onChange:x,apiKeys:c,cloudEnabled:h})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Models"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,d.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===r.length?(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected"}):r.map(b=>(0,d.jsxs)("button",{type:"button",onClick:async()=>{if(b===a)try{(await fetch("/api/cli-tools/opencode-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({clearActiveModel:!0})})).ok&&(t(""),f())}catch(a){console.log("Error clearing active model:",a)}else t(b)},className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs cursor-pointer transition-colors ${b===a?"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:b===a?"Click to clear active model":"Click to set as active",children:[b===a&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[10px]",children:"star"}),b,(0,d.jsx)("span",{role:"none",onClick:async c=>{c.stopPropagation();try{if((await fetch(`/api/cli-tools/opencode-settings?model=${encodeURIComponent(b)}`,{method:"DELETE"})).ok){let c=r.filter(a=>a!==b);y(c),a===b&&t(""),f()}}catch(a){console.log("Error removing model:",a)}},className:"ml-0.5 hover:text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},b))}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:()=>w(!0),disabled:!b?.length,className:`px-2 py-1 rounded border text-xs transition-colors ${b?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Add Model"}),(0,d.jsx)("span",{className:"text-xs text-text-muted",children:r.length>0&&a?(0,d.jsxs)(d.Fragment,{children:["Active: ",(0,d.jsx)("span",{className:"text-primary",children:a})]}):r.length>0?(0,d.jsx)("span",{className:"text-yellow-500",children:"Click a model to set/clear active"}):"Select models to add"})]})]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:F,onChange:a=>C(a.target.value),placeholder:q||"provider/model-id (defaults to main model)","aria-label":"Subagent model",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),(0,d.jsx)("button",{type:"button",onClick:()=>B(!0),disabled:!b?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${b?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),F&&(0,d.jsx)("button",{type:"button",onClick:()=>C(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),n&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===n.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===n.type?"check_circle":"error"}),(0,d.jsx)("span",{children:n.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:l,disabled:0===r.length,loading:e,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:m,disabled:!E.hasVansRoute,loading:o,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>A(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function $({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:h,cloudEnabled:k,initialStatus:l,tunnelEnabled:m,tunnelPublicUrl:n,tailscaleEnabled:o,tailscaleUrl:p}){let q,r,s,t,u,v,[w,y]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:l||null,checking:!1,applying:!1,restoring:!1,message:null}),z=w.status,A=w.checking,{applying:B,restoring:C,message:D}=w,[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(null),I=G??(g?.length>0?g[0].key:""),[J,K]=(0,e.useState)(""),[L,M]=(0,e.useState)(null),N=L??((q=z?.config?.agent?.explorer?.model||"").startsWith("VansRoute/")?q.replace("VansRoute/",""):q.startsWith("9router/")?q.replace("9router/",""):""),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)({}),[U,V]=(0,e.useState)(!1),[W,X]=(0,e.useState)(""),[_,aa]=(0,e.useState)(null),ab=_??z?.opencode?.models??Y,[ac,ad]=(0,e.useState)(null),ae=ac??z?.opencode?.activeModel??"",af=(0,e.useRef)([]),ag=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&T(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),ah=(0,e.useCallback)(async()=>{y({type:"CHECK_START"});try{let a=await fetch("/api/cli-tools/opencode-settings"),b=await a.json();y({type:"CHECK_DONE",data:b})}catch(a){y({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),ai=(0,e.useRef)(!!l),aj=(0,e.useRef)(!1),ak=(0,e.useCallback)(async()=>{ai.current||(ai.current=!0,await ah()),aj.current||(aj.current=!0,await ag())},[ah,ag]),al=(0,e.useCallback)(()=>{b||ak(),c()},[b,ak,c]),am=async a=>{try{let b=I&&I.trim()||k?I:"sk_VansRoute",c=a.includes(ae)?ae:a[0]||"";await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ao(),apiKey:b,models:a,activeModel:c,subagentModel:N})})}catch(a){console.log("Error saving models:",a)}},an=z?.installed?z.config&&z.hasVansRoute?x(z.config?.provider?.VansRoute?.options?.baseURL||z.config?.provider?.["9router"]?.options?.baseURL||"",{tunnelPublicUrl:n,tailscaleUrl:p})?"configured":"other":"not_configured":null,ao=()=>{let a=W||f;return a.endsWith("/v1")?a:`${a}/v1`},ap=async()=>{y({type:"APPLY_START"});try{let a=I&&I.trim()||k?I:"sk_VansRoute",b=await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ao(),apiKey:a,models:ab,activeModel:""===ae?"":ae||ab[0],subagentModel:N})}),c=await b.json();b.ok?(y({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),ah()):y({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){y({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},aq=async()=>{y({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/opencode-settings",{method:"DELETE"}),b=await a.json();a.ok?(y({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),K(""),M(""),aa([]),ad(""),ah()):y({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){y({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:al,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/opencode.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===an&&(0,d.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"===an&&(0,d.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"===an&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(Z,{activeModel:ae,activeProviders:h,apiKeys:g,applying:B,checkStatus:ah,checking:A,cloudEnabled:k,customBaseUrl:W,getDisplayUrl:()=>W||`${f}/v1`,handleApply:ap,handleReset:aq,message:D,restoring:C,selectedApiKey:I,selectedModel:J,selectedModels:ab,setActiveModel:ad,setCustomBaseUrl:X,setModalOpen:P,setSelectedApiKey:H,setSelectedModels:aa,setShowInstallGuide:F,setShowManualConfigModal:V,setSubagentModalOpen:R,setSubagentModel:M,showInstallGuide:E,status:z,subagentModel:N,tailscaleEnabled:o,tailscaleUrl:p,tool:a,tunnelEnabled:m,tunnelPublicUrl:n}),(0,d.jsx)(i.ModelSelectModal,{isOpen:O,onClose:()=>{P(!1),am(af.current)},onSelect:a=>{!ab.includes(a.value)&&(aa([...ab,a.value]),ae||ad(a.value))},onDeselect:a=>{let b=ab.filter(b=>b!==a.value);aa(b),ae===a.value&&ad(b[0]||"")},selectedModel:null,activeProviders:h,modelAliases:S,addedModelValues:ab,closeOnSelect:!1,title:"Add Model for OpenCode"}),(0,d.jsx)(i.ModelSelectModal,{isOpen:Q,onClose:()=>R(!1),onSelect:a=>{M(a.value),R(!1)},selectedModel:N,activeProviders:h,modelAliases:S,title:"Select Subagent Model for OpenCode"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:U,onClose:()=>V(!1),title:"OpenCode - Manual Configuration",configs:(r=I&&I.trim()?I:k?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",s=ab.length>0?ab:["provider/model-id"],t=ae||ab[0]||s[0],u=N||t,v={},s.forEach(a=>{v[a]={name:a,modalities:{input:["text","image"],output:["text"]}}}),[{filename:"~/.config/opencode/opencode.json",content:JSON.stringify({provider:{VansRoute:{npm:"@ai-sdk/openai-compatible",options:{baseURL:ao(),apiKey:r},models:v}},model:`VansRoute/${t}`,agent:{explorer:{description:"Fast explorer subagent for codebase exploration",mode:"subagent",model:`VansRoute/${u}`}}},null,2)}])})]})}let _="/api/cli-tools/cowork-settings",aa=a=>(a||"").replace(/\/v1\/?$/,"");function ab({apiKeys:a,applying:b,checking:c,cloudEnabled:e,cloudUrl:f,customPlugins:g,getEffectiveBaseUrl:h,handleApply:j,handleRemoveModel:k,handleReset:l,hasActiveProviders:m,localPlugins:n,message:o,plugins:p,removePlugin:q,restoring:r,selectedApiKey:t,selectedModels:u,setAddMcpForm:w,setAddMcpOpen:x,setComboModalOpen:y,setCustomBaseUrl:z,setCustomPlugins:A,setLocalPlugins:B,setMarketplaceOpen:C,setPlugins:D,setSelectedApiKey:E,setShowManualConfigModal:F,status:G,tailscaleEnabled:H,tailscaleUrl:I,tunnelEnabled:J,tunnelPublicUrl:K}){let L,M;return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Claude Cowork..."})]}),!c&&G&&!G.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude Desktop (Cowork mode) not detected"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Open Claude Desktop → Help → Troubleshooting → Enable Developer mode → Configure third-party inference, then return here."})]})]}),(0,d.jsx)("div",{className:"pl-9",children:(0,d.jsxs)(i.Button,{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,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]}),!c&&G?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:G?.settings?.baseUrl||"",value:h(),onChange:a=>z(aa(a)),tunnelEnabled:J,tunnelPublicUrl:K,tailscaleEnabled:H,tailscaleUrl:I,cloudEnabled:e,cloudUrl:f})]}),G?.cowork?.baseUrl&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:G.cowork.baseUrl})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:t,onChange:E,apiKeys:a,cloudEnabled:e})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Models"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex items-center gap-2",children:[(0,d.jsx)("div",{className:"flex-1 flex flex-wrap gap-1.5 min-h-[28px] px-2 py-1.5 bg-surface rounded border border-border",children:0===u.length?(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected"}):u.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-black/5 dark:bg-white/5 text-text-muted border border-transparent hover:border-border",children:[a,(0,d.jsx)("button",{type:"button",onClick:()=>k(a),className:"ml-0.5 hover:text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a))}),(0,d.jsx)("button",{type:"button",onClick:()=>y(!0),disabled:!m,className:`shrink-0 px-2 py-1.5 rounded border text-xs whitespace-nowrap transition-colors ${m?"bg-primary/10 border-primary/40 text-primary hover:bg-primary/20 cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"+ Combo"})]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-2",children:"MCP"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-2",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-1",children:[p.flatMap(a=>"exa"===a.name?[]:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-surface rounded border border-border",children:[(0,d.jsx)("span",{className:"text-xs font-medium min-w-0 truncate flex-shrink-0",children:a.title||a.name}),a.oauth&&(0,d.jsx)("span",{className:"text-[8px] text-amber-600 shrink-0",children:"OAuth"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-wrap gap-1 overflow-hidden",style:{maxHeight:"1.5rem"},children:[Array.isArray(a.toolNames)&&a.toolNames.slice(0,6).map(a=>(0,d.jsx)("span",{className:"text-[9px] px-1 py-0.5 rounded bg-black/5 dark:bg-white/5 text-text-muted whitespace-nowrap",children:a},a)),Array.isArray(a.toolNames)&&a.toolNames.length>6&&(0,d.jsxs)("span",{className:"text-[9px] px-1 py-0.5 rounded bg-black/5 dark:bg-white/5 text-text-muted whitespace-nowrap",children:["+",a.toolNames.length-6]})]}),(0,d.jsx)("button",{type:"button",onClick:()=>q(a.name),className:"shrink-0 hover:text-red-500 ml-auto",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a.name)]),g.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-surface rounded border border-border",children:[(0,d.jsx)("span",{className:"text-xs font-medium min-w-0 truncate flex-shrink-0",children:a.name}),(0,d.jsx)("span",{className:"text-[8px] px-1 py-0.5 rounded bg-blue-500/10 text-blue-500 shrink-0",children:"custom"}),(0,d.jsx)("span",{className:"flex-1 text-[9px] text-text-muted truncate",children:a.url||a.command}),(0,d.jsx)("button",{type:"button",onClick:()=>A(g.filter(b=>b.name!==a.name)),className:"shrink-0 hover:text-red-500 ml-auto",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a.name)),0===p.filter(a=>"exa"!==a.name).length&&0===g.length&&(0,d.jsx)("div",{className:"px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-muted",children:"No MCPs added"}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,d.jsx)("button",{type:"button",onClick:()=>C(!0),className:"px-2 py-1 rounded border text-xs bg-primary/10 border-primary/40 text-primary hover:bg-primary/20 cursor-pointer whitespace-nowrap",children:"+ Browse"}),(0,d.jsx)("button",{type:"button",onClick:()=>{w({type:"url",name:"",url:"",command:"",args:""}),x(!0)},className:"px-2 py-1 rounded border text-xs bg-surface border-border text-text-muted hover:border-primary hover:text-primary cursor-pointer whitespace-nowrap",children:"+ Custom"}),(0,d.jsx)("a",{href:"https://mcp.so",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-text-muted hover:text-primary underline ml-auto",children:"Find MCPs →"})]})]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Tools"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-1.5",children:[(L=p.some(a=>"exa"===a.name),M=(G?.defaultPlugins||[]).find(a=>"exa"===a.name),(0,d.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer px-2 py-1.5 bg-surface rounded border border-border",children:[(0,d.jsx)("input",{type:"checkbox",checked:L,onChange:a=>{a.target.checked&&M?D([...p.filter(a=>"exa"!==a.name),M]):D(p.filter(a=>"exa"!==a.name))},className:"mt-0.5"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-xs font-medium",children:"Web Search & Fetch (Exa)"}),(0,d.jsx)("p",{className:"text-[10px] text-text-muted leading-snug",children:"Replaces built-in WebSearch/WebFetch. Auto-strips duplicates from tool list."})]})]})),(()=>{let a=(G?.localStdioPlugins||[]).find(a=>"browsermcp"===a.name);if(!a)return null;let b=n.includes("browsermcp");return(0,d.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer px-2 py-1.5 bg-surface rounded border border-border",children:[(0,d.jsx)("input",{type:"checkbox",checked:b,onChange:a=>B(a.target.checked?[...n,"browsermcp"]:n.filter(a=>"browsermcp"!==a)),className:"mt-0.5"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-xs font-medium",children:"Browser Control (Browser MCP)"}),(0,d.jsxs)("p",{className:"text-[10px] text-text-muted leading-snug",children:["Controls your running Chrome. Auto-strips Cowork's built-in browser tools."," ",(0,d.jsx)("a",{href:a.extensionUrl,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"Install Chrome extension"})]})]})]})})()]})]}),Array.isArray(G?.localStdioPlugins)&&G.localStdioPlugins.filter(a=>"browsermcp"!==a.name).length>0&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Local Plugins"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,d.jsx)("div",{className:"flex flex-col gap-1.5 px-2 py-1.5 bg-surface rounded border border-border",children:G.localStdioPlugins.flatMap(a=>{if("browsermcp"===a.name)return[];let b=n.includes(a.name);return[(0,d.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",checked:b,onChange:b=>B(b.target.checked?[...n,a.name]:n.filter(b=>b!==a.name)),className:"mt-0.5"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-xs font-medium",children:a.title}),(0,d.jsx)("span",{className:"text-[8px] text-amber-600",children:"stdio"})]}),(0,d.jsx)("p",{className:"text-[10px] text-text-muted leading-snug",children:a.description}),a.extensionUrl&&(0,d.jsx)("a",{href:a.extensionUrl,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-primary underline",children:"Install Chrome extension"})]})]},a.name)]})}),(0,d.jsxs)("p",{className:"text-[10px] text-text-muted leading-snug",children:["⚠️ Local plugins run as subprocess via ",(0,d.jsx)("code",{className:"px-1 py-0.5 rounded bg-black/5 dark:bg-white/5",children:"npx"}),". Requires Node.js installed."]})]})]})]}),o&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===o.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===o.type?"check_circle":"error"}),(0,d.jsx)("span",{children:o.text})]}),(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:j,disabled:0===u.length,loading:b,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:l,disabled:!G.hasVansRoute,loading:r,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>F(!0),className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function ac({addMcpOpen:a,setAddMcpOpen:b,addMcpForm:c,setAddMcpForm:e,setCustomPlugins:f}){return a?(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:()=>b(!1),"aria-hidden":"true",children:(0,d.jsxs)("div",{className:"bg-surface border border-border rounded-xl shadow-xl w-full max-w-sm mx-4 p-5 flex flex-col gap-4",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h3",{className:"font-semibold text-sm",children:"Add Custom MCP"}),(0,d.jsx)("button",{type:"button",onClick:()=>b(!1),className:"text-text-muted hover:text-text-main",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:()=>e(a=>({...a,type:"url"})),className:`flex-1 py-1.5 rounded border text-xs font-medium transition-colors ${"url"===c.type?"bg-primary/10 border-primary/40 text-primary":"border-border text-text-muted hover:border-primary/40"}`,children:"URL (SSE)"}),(0,d.jsx)("button",{type:"button",onClick:()=>e(a=>({...a,type:"cmd"})),className:`flex-1 py-1.5 rounded border text-xs font-medium transition-colors ${"cmd"===c.type?"bg-primary/10 border-primary/40 text-primary":"border-border text-text-muted hover:border-primary/40"}`,children:"Command (stdio)"})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("label",{htmlFor:"cowork-mcp-name",className:"text-[11px] text-text-muted font-medium",children:"Name"}),(0,d.jsx)("input",{id:"cowork-mcp-name",type:"text",placeholder:"my-mcp",value:c.name,onChange:a=>e(b=>({...b,name:a.target.value.replace(/\s+/g,"-").toLowerCase()})),className:"px-2 py-1.5 rounded border border-border bg-surface text-xs outline-none focus:border-primary"})]}),"url"===c.type?(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("label",{htmlFor:"cowork-mcp-url",className:"text-[11px] text-text-muted font-medium",children:"SSE URL"}),(0,d.jsx)("input",{id:"cowork-mcp-url",type:"text",placeholder:"https://your-mcp-server.com/sse",value:c.url,onChange:a=>e(b=>({...b,url:a.target.value})),className:"px-2 py-1.5 rounded border border-border bg-surface text-xs outline-none focus:border-primary"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("label",{htmlFor:"cowork-mcp-command",className:"text-[11px] text-text-muted font-medium",children:"Command"}),(0,d.jsx)("input",{id:"cowork-mcp-command",type:"text",placeholder:"npx",value:c.command,onChange:a=>e(b=>({...b,command:a.target.value})),className:"px-2 py-1.5 rounded border border-border bg-surface text-xs outline-none focus:border-primary"})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsxs)("label",{htmlFor:"cowork-mcp-args",className:"text-[11px] text-text-muted font-medium",children:["Args ",(0,d.jsx)("span",{className:"font-normal",children:"(comma-separated)"})]}),(0,d.jsx)("input",{id:"cowork-mcp-args",type:"text",placeholder:"-y, @some/mcp-package",value:c.args,onChange:a=>e(b=>({...b,args:a.target.value})),className:"px-2 py-1.5 rounded border border-border bg-surface text-xs outline-none focus:border-primary"})]})]})]}),(0,d.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,d.jsx)("button",{type:"button",onClick:()=>b(!1),className:"px-3 py-1.5 rounded border border-border text-xs text-text-muted hover:bg-surface cursor-pointer",children:"Cancel"}),(0,d.jsx)("button",{type:"button",onClick:()=>{let a=c.name.trim();if(a){if("url"===c.type){if(!c.url.trim())return;f(b=>[...b.filter(b=>b.name!==a),{name:a,url:c.url.trim(),transport:"sse",custom:!0}])}else{if(!c.command.trim())return;let b=c.args.split(",").flatMap(a=>{let b=a.trim();return b?[b]:[]});f(d=>[...d.filter(b=>b.name!==a),{name:a,command:c.command.trim(),args:b,custom:!0}])}b(!1)}},className:"px-3 py-1.5 rounded bg-primary text-white text-xs font-medium hover:opacity-90 cursor-pointer",children:"Add"})]})]})}):null}function ad({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:h,hasActiveProviders:k,cloudEnabled:l,cloudUrl:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q,initialStatus:r}){let s,t,[u,v]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:r||null,checking:!1,applying:!1,restoring:!1,message:null}),w=u.status,x=u.checking,{applying:y,restoring:z,message:A}=u,[B,C]=(0,e.useState)(null),D=B??(g?.length>0?g[0].key:""),[E,F]=(0,e.useState)([]),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(""),[K,L]=(0,e.useState)([]),[M,N]=(0,e.useState)([]),[O,P]=(0,e.useState)([]),[Q,R]=(0,e.useState)({}),[S,T]=(0,e.useState)(!1),[U,V]=(0,e.useState)(!1),[W,X]=(0,e.useState)(!1),[Y,Z]=(0,e.useState)(!1),[$,ae]=(0,e.useState)({type:"url",name:"",url:"",command:"",args:""}),af=(0,e.useCallback)(async()=>{v({type:"CHECK_START"});try{let a=await fetch(_),b=await a.json();v({type:"CHECK_DONE",data:b})}catch(a){v({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),ag=(0,e.useRef)(!!r),ah=(0,e.useRef)(!1),ai=(0,e.useCallback)(async()=>{if(ag.current||(ag.current=!0,await af()),!ah.current){ah.current=!0;try{let a=await fetch("/api/models/alias");if(a.ok){let b=await a.json();R(b.aliases||{})}}catch{}}},[af]),aj=(0,e.useCallback)(()=>{b||ai(),c()},[b,ai,c]),[ak,al]=(0,e.useState)(!1);w?.cowork&&!ak&&(al(!0),w.cowork.models?.length&&0===E.length&&F(w.cowork.models),w.cowork.baseUrl&&!I&&J(aa(w.cowork.baseUrl)),Array.isArray(w.cowork.plugins)&&w.cowork.plugins.length>0?L(w.cowork.plugins):0===K.length&&Array.isArray(w?.defaultPlugins)&&L(w.defaultPlugins),Array.isArray(w.cowork.localPlugins)&&N(w.cowork.localPlugins),Array.isArray(w.cowork.customPlugins)&&w.cowork.customPlugins.length>0&&P(w.cowork.customPlugins));let am=()=>{let a;return(a=(I||"").replace(/\/+$/,""))?/\/v1$/.test(a)?a:`${a}/v1`:""},an=w?.installed?w?.cowork?.baseUrl?w.hasVansRoute?"configured":"other":"not_configured":null,ao=async()=>{v({type:"APPLY_START"});let a=am();if(0===E.length)return void v({type:"APPLY_DONE",message:{type:"error",text:"Please select at least one model"}});try{let b=D?.trim()||(g?.length>0?g[0].key:null)||(l?null:"sk_VansRoute"),c=await fetch(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:a,apiKey:b,models:E,plugins:K,localPlugins:M,customPlugins:O})}),d=await c.json();c.ok?(v({type:"APPLY_DONE",message:{type:"success",text:"Settings applied. Quit & reopen Claude Desktop to load."}}),af()):v({type:"APPLY_DONE",message:{type:"error",text:d.error||"Failed to apply settings"}})}catch(a){v({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},ap=async({name:a,models:b})=>{try{let c=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a,models:b})});if(!c.ok){let a=await c.json();v({type:"APPLY_DONE",message:{type:"error",text:a.error||"Failed to create combo"}});return}E.includes(a)||F([...E,a]),T(!1),v({type:"APPLY_DONE",message:{type:"success",text:`Combo "${a}" created and added.`}})}catch(a){v({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},aq=a=>{let b=a?.value||a?.name||a;F(a=>a.filter(a=>a!==b))},ar=async()=>{v({type:"RESTORE_START"});try{let a=await fetch(_,{method:"DELETE"}),b=await a.json();a.ok?(v({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully"}}),F([]),L(w?.defaultPlugins||[]),N([]),P([]),af()):v({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset"}})}catch(a){v({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:aj,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===an&&(0,d.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"===an&&(0,d.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"===an&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(ab,{apiKeys:g,applying:y,checking:x,cloudEnabled:l,cloudUrl:m,customPlugins:O,getEffectiveBaseUrl:am,handleApply:ao,handleRemoveModel:aq,handleReset:ar,hasActiveProviders:k,localPlugins:M,message:A,plugins:K,removePlugin:a=>{L(K.filter(b=>b.name!==a))},restoring:z,selectedApiKey:D,selectedModels:E,setAddMcpForm:ae,setAddMcpOpen:Z,setComboModalOpen:T,setCustomBaseUrl:J,setCustomPlugins:P,setLocalPlugins:N,setMarketplaceOpen:X,setPlugins:L,setSelectedApiKey:C,setShowManualConfigModal:H,status:w,tailscaleEnabled:p,tailscaleUrl:q,tunnelEnabled:n,tunnelPublicUrl:o}),(0,d.jsx)(i.ManualConfigModal,{isOpen:G,onClose:()=>H(!1),title:"Claude Cowork - Manual Configuration",configs:(s=D&&D.trim()?D:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",t=E.length>0?E:["provider/model-id"],[{filename:"~/Library/Application Support/Claude-3p/configLibrary/<appliedId>.json",content:JSON.stringify({inferenceProvider:"gateway",inferenceGatewayBaseUrl:am()||"https://your-public-host/v1",inferenceGatewayApiKey:s,inferenceModels:t.map(a=>({name:a}))},null,2)}])}),(0,d.jsx)(i.ComboFormModal,{isOpen:S,combo:null,onClose:()=>T(!1),onSave:ap,activeProviders:h,forcePrefix:"claude-",title:"Create Cowork Combo"}),(0,d.jsx)(i.ModelSelectModal,{isOpen:U,onClose:()=>V(!1),onSelect:a=>{let b=a?.value||a?.name||a;!b||E.includes(b)||F(a=>[...a,b])},onDeselect:aq,activeProviders:h,modelAliases:Q,title:"Select Cowork Model",addedModelValues:E,closeOnSelect:!1}),(0,d.jsx)(i.McpMarketplaceModal,{isOpen:W,onClose:()=>X(!1),onAdd:a=>{K.some(b=>b.name===a.name)||L([...K,a])},addedNames:K.map(a=>a.name)}),(0,d.jsx)(ac,{addMcpOpen:Y,setAddMcpOpen:Z,addMcpForm:$,setAddMcpForm:ae,setCustomPlugins:P})]})}function ae({tool:a,status:b,checking:c,baseUrl:e,apiKeys:f,activeProviders:g,cloudEnabled:h,tunnelEnabled:j,tunnelPublicUrl:k,tailscaleEnabled:l,tailscaleUrl:m,selectedApiKey:n,setSelectedApiKey:o,customBaseUrl:p,setCustomBaseUrl:q,selectedModels:r,setSelectedModels:t,getEffectiveBaseUrl:u,getDisplayUrl:w,message:x,applying:y,restoring:z,handleApply:A,handleReset:B,setModalOpen:C,setShowManualConfigModal:D}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Copilot config..."})]}),!c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-500 text-lg",children:"info"}),(0,d.jsxs)("div",{className:"text-xs text-blue-700 dark:text-blue-300",children:[(0,d.jsxs)("p",{className:"font-medium",children:["Writes to ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/10 rounded",children:"chatLanguageModels.json"})]}),(0,d.jsx)("p",{className:"mt-0.5 opacity-80",children:"Reload VS Code after applying for changes to take effect."})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:b?.settings?.baseUrl||"",value:p||w(),onChange:q,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:j,tunnelPublicUrl:k,tailscaleEnabled:l,tailscaleUrl:m})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:n,onChange:o,apiKeys:f,cloudEnabled:h})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Models"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,d.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===r.length?(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected"}):r.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-black/5 dark:bg-white/5 text-text-muted border border-transparent hover:border-border",children:[a,(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),t(b=>b.filter(b=>b!==a))},className:"ml-0.5 hover:text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a))}),(0,d.jsx)("div",{children:(0,d.jsx)("button",{type:"button",onClick:()=>C(!0),disabled:!g?.length,className:`px-2 py-1 rounded border text-xs transition-colors ${g?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Add Model"})})]})]})]}),x&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===x.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===x.type?"check_circle":"error"}),(0,d.jsx)("span",{children:x.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:A,disabled:0===r.length,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:B,disabled:!b?.has9Router,loading:z,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>D(!0),disabled:0===r.length,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function af({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:h,cloudEnabled:k,initialStatus:l,tunnelEnabled:m,tunnelPublicUrl:n,tailscaleEnabled:o,tailscaleUrl:p}){let q,r,[s,t]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:l||null,checking:!1,applying:!1,restoring:!1,message:null}),{status:u,checking:v,applying:w,restoring:y,message:z}=s,[A,B]=(0,e.useState)(null),C=A??(g?.length>0?g[0].key:""),[D,E]=(0,e.useState)(""),[F,G]=(0,e.useState)({}),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(null),L=(0,e.useMemo)(()=>{if(u?.config&&Array.isArray(u.config)){let a=u.config.find(a=>"9Router"===a.name);if(a?.models?.length>0)return a.models.map(a=>a.id)}return[]},[u]),M=J??L,[N,O]=(0,e.useState)(!1),P=(0,e.useRef)([]),Q=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&G(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),R=(0,e.useCallback)(async()=>{t({type:"CHECK_START"});try{let a=await fetch("/api/cli-tools/copilot-settings"),b=await a.json();t({type:"CHECK_DONE",data:b})}catch(a){t({type:"CHECK_DONE",data:{error:a.message}})}},[]),S=(0,e.useRef)(!!l),T=(0,e.useRef)(!1),U=(0,e.useCallback)(async()=>{S.current||(S.current=!0,await R()),T.current||(T.current=!0,await Q())},[R,Q]),V=(0,e.useCallback)(()=>{b||U(),c()},[b,U,c]),W=async a=>{try{let b=C&&C.trim()||k?C:"sk_9router";await fetch("/api/cli-tools/copilot-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Y(),apiKey:b,models:a})})}catch(a){console.log("Error saving models:",a)}},X=u?u.has9Router?x(u.currentUrl||"",{tunnelPublicUrl:n,tailscaleUrl:p})?"configured":"other":"not_configured":null,Y=()=>{let a=D||f;return a.endsWith("/v1")?a:`${a}/v1`},Z=async()=>{t({type:"APPLY_START"});try{let a=C&&C.trim()||k?C:"sk_9router",b=await fetch("/api/cli-tools/copilot-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Y(),apiKey:a,models:M})}),c=await b.json();b.ok?(t({type:"APPLY_DONE",message:{type:"success",text:c.message||"Settings applied! Reload VS Code."}}),R()):t({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){t({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},$=async()=>{t({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/copilot-settings",{method:"DELETE"}),b=await a.json();a.ok?(t({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),K([]),R()):t({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){t({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:V,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/copilot.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===X&&(0,d.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"===X&&(0,d.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"===X&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(ae,{tool:a,status:u,checking:v,baseUrl:f,apiKeys:g,activeProviders:h,cloudEnabled:k,tunnelEnabled:m,tunnelPublicUrl:n,tailscaleEnabled:o,tailscaleUrl:p,selectedApiKey:C,setSelectedApiKey:B,customBaseUrl:D,setCustomBaseUrl:E,selectedModels:M,setSelectedModels:K,getEffectiveBaseUrl:Y,getDisplayUrl:()=>D||`${f}/v1`,message:z,applying:w,restoring:y,handleApply:Z,handleReset:$,setModalOpen:O,setShowManualConfigModal:I}),(0,d.jsx)(i.ModelSelectModal,{isOpen:N,onClose:()=>{O(!1),W(P.current)},onSelect:a=>{M.includes(a.value)||K([...M,a.value])},onDeselect:a=>{K(M.filter(b=>b!==a.value))},selectedModel:null,activeProviders:h,modelAliases:F,addedModelValues:M,closeOnSelect:!1,title:"Add Model for GitHub Copilot"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:H,onClose:()=>I(!1),title:"GitHub Copilot - Manual Configuration",configs:(q=C&&C.trim()?C:k?"<API_KEY_FROM_DASHBOARD>":"sk_9router",r=Y(),[{filename:"~/Library/Application Support/Code/User/chatLanguageModels.json",content:JSON.stringify([{name:"9Router",vendor:"azure",apiKey:q,models:(M.length>0?M:["provider/model-id"]).map(a=>({id:a,name:a,url:`${r}/chat/completions#models.ai.azure.com`,toolCalling:!0,vision:!1,maxInputTokens:128e3,maxOutputTokens:16e3}))}],null,2)}])})]})}function ag({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let r,t,{status:u,checking:w,applying:y,restoring:z,message:A,dispatch:B,checkStatus:C,customBaseUrl:D,getDisplayUrl:E,getEffectiveBaseUrl:F,handleToggle:G,modelAliases:H,selectedApiKey:I,setCustomBaseUrl:J,setSelectedApiKey:K}=h({apiKeys:g,baseUrl:f,cloudEnabled:l,initialStatus:m,isExpanded:b,onToggle:c,statusEndpoint:"/api/cli-tools/cline-settings"}),[L,M]=(0,e.useState)(!1),[N,O]=(0,e.useState)(null),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(!1),T=N??u?.settings?.openAiModelId??"",U=u?.installed?u.hasVansRoute?x(u.settings?.openAiBaseUrl||"",{tunnelPublicUrl:o,tailscaleUrl:q})?"configured":"other":"not_configured":null,V=async()=>{B({type:"APPLY_START"});try{let a=I&&I.trim()||l?I:"sk_VansRoute",b=await fetch("/api/cli-tools/cline-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:F(),apiKey:a,model:T})}),c=await b.json();b.ok?(B({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),C()):B({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){B({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},W=async()=>{B({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/cline-settings",{method:"DELETE"}),b=await a.json();a.ok?(B({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),O(""),C()):B({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){B({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:G,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/cline.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===U&&(0,d.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"===U&&(0,d.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"===U&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[w&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Cline..."})]}),!w&&u&&!u.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Cline not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansRoute is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>S(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>M(!L),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:L?"expand_less":"help"}),L?"Hide":"How to Install"]})]})]}),L&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsx)("div",{className:"space-y-3 text-sm",children:(0,d.jsxs)("p",{className:"text-text-muted",children:["Install Cline VS Code extension or CLI from ",(0,d.jsx)("a",{className:"text-primary underline",href:"https://docs.cline.bot/",target:"_blank",rel:"noreferrer",children:"docs.cline.bot"}),"."]})})]})]}),!w&&u?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:u?.settings?.baseUrl||"",value:D||E(),onChange:J,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q})]}),u?.settings?.openAiBaseUrl&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:u.settings.openAiBaseUrl})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:I,onChange:K,apiKeys:g,cloudEnabled:l})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:T,onChange:a=>O(a.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),T&&(0,d.jsx)("button",{type:"button",onClick:()=>O(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>Q(!0),disabled:!k?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${k?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),A&&(0,d.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 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,d.jsx)("span",{children:A.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:V,disabled:!I&&l&&g.length>0||!T,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:W,disabled:z,loading:z,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>S(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(i.ModelSelectModal,{isOpen:P,onClose:()=>Q(!1),onSelect:a=>{O(a.value),Q(!1)},selectedModel:T,activeProviders:k,modelAliases:H,title:"Select Model for Cline"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:R,onClose:()=>S(!1),title:"Cline - Manual Configuration",configs:(r=I&&I.trim()?I:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",[{filename:"~/.cline/data/globalState.json",content:JSON.stringify({actModeApiProvider:"openai",planModeApiProvider:"openai",openAiBaseUrl:(t=F()).endsWith("/v1")?t.slice(0,-3):t,openAiModelId:T||"provider/model-id",planModeOpenAiModelId:T||"provider/model-id"},null,2)},{filename:"~/.cline/data/secrets.json",content:JSON.stringify({openAiApiKey:r},null,2)}])})]})}function ah({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let{status:r,checking:t,applying:u,restoring:w,message:x,dispatch:y,checkStatus:z,customBaseUrl:A,getDisplayUrl:B,getEffectiveBaseUrl:C,handleToggle:D,modelAliases:E,selectedApiKey:F,setCustomBaseUrl:G,setSelectedApiKey:H}=h({apiKeys:g,baseUrl:f,cloudEnabled:l,initialStatus:m,isExpanded:b,onToggle:c,statusEndpoint:"/api/cli-tools/kilo-settings"}),[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(""),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(!1),Q=r?.installed?r.hasVansRoute?"configured":"not_configured":null,R=async()=>{y({type:"APPLY_START"});try{let a=F&&F.trim()||l?F:"sk_VansRoute",b=await fetch("/api/cli-tools/kilo-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:C(),apiKey:a,model:K})}),c=await b.json();b.ok?(y({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),z()):y({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){y({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},S=async()=>{y({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/kilo-settings",{method:"DELETE"}),b=await a.json();a.ok?(y({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),L(""),z()):y({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){y({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:D,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:"/providers/kilocode.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===Q&&(0,d.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"===Q&&(0,d.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"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[t&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Kilo Code..."})]}),!t&&r&&!r.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Kilo Code not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansRoute is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(i.Button,{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,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>J(!I),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:I?"expand_less":"help"}),I?"Hide":"How to Install"]})]})]}),I&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Install Kilo Code from ",(0,d.jsx)("a",{className:"text-primary underline",href:"https://kilocode.ai",target:"_blank",rel:"noreferrer",children:"kilocode.ai"})," or VS Code extension marketplace."]})]})]}),!t&&r?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:r?.settings?.baseUrl||"",value:A||B(),onChange:G,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:F,onChange:H,apiKeys:g,cloudEnabled:l})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:K,onChange:a=>L(a.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),K&&(0,d.jsx)("button",{type:"button",onClick:()=>L(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>N(!0),disabled:!k?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${k?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),x&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===x.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===x.type?"check_circle":"error"}),(0,d.jsx)("span",{children:x.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:R,disabled:!F&&l&&g.length>0||!K,loading:u,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:S,disabled:w,loading:w,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>P(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(i.ModelSelectModal,{isOpen:M,onClose:()=>N(!1),onSelect:a=>{L(a.value),N(!1)},selectedModel:K,activeProviders:k,modelAliases:E,title:"Select Model for Kilo Code"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:O,onClose:()=>P(!1),title:"Kilo Code - Manual Configuration",configs:[{filename:"~/.local/share/kilo/auth.json",content:JSON.stringify({"openai-compatible":{type:"api-key",apiKey:F&&F.trim()?F:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",baseUrl:C(),model:K||"provider/model-id"}},null,2)}]})]})}let ai="/api/cli-tools/deepseek-tui-settings";function aj({apiKeys:a,applying:b,checking:c,cloudEnabled:e,customBaseUrl:f,deepseekStatus:g,getEffectiveBaseUrl:h,handleApply:j,handleReset:k,hasActiveProviders:l,message:m,restoring:n,selectedApiKey:o,selectedModel:p,setCustomBaseUrl:q,setModalOpen:r,setSelectedApiKey:t,setSelectedModel:u,setShowManualConfigModal:w,tailscaleEnabled:x,tailscaleUrl:y,tool:z,tunnelEnabled:A,tunnelPublicUrl:B}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking DeepSeek TUI..."})]}),!c&&g&&!g.installed&&(0,d.jsx)("div",{className:"flex flex-col gap-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"DeepSeek TUI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Install via npm:"}),(0,d.jsx)("code",{className:"block mt-2 p-2 bg-black/20 rounded text-xs font-mono",children:"npm install -g deepseek-tui"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Manual configuration is still available if VansRoute is deployed on a remote server."})]})]}),(0,d.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>w(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!c&&g?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[z.notes&&z.notes.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-2 mb-2",children:z.notes.map(a=>(0,d.jsxs)("div",{className:`flex items-start gap-2 p-2 rounded text-xs ${"warning"===a.type?"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400":"error"===a.type?"bg-red-500/10 text-red-600 dark:text-red-400":"bg-blue-500/10 text-blue-600 dark:text-blue-400"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5",children:"warning"===a.type?"warning":"error"===a.type?"error":"info"}),(0,d.jsx)("span",{children:a.text})]},`${a.type}-${a.text}`))}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:status?.settings?.baseUrl||"",value:f||h(),onChange:q,requiresExternalUrl:z.requiresExternalUrl,tunnelEnabled:A,tunnelPublicUrl:B,tailscaleEnabled:x,tailscaleUrl:y})]}),g?.settings?.["providers.openai"]?.base_url&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:g.settings["providers.openai"].base_url})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:o,onChange:t,apiKeys:a,cloudEnabled:e})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Default Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:p,onChange:a=>u(a.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),p&&(0,d.jsx)("button",{type:"button",onClick:()=>u(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>r(!0),disabled:!l,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${l?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]})]}),m&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===m.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===m.type?"check_circle":"error"}),(0,d.jsx)("span",{children:m.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:j,disabled:!p,loading:b,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:k,disabled:!g?.hasVansRoute,loading:n,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>w(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function ak({tool:a,isExpanded:b,onToggle:c,baseUrl:f,hasActiveProviders:g,apiKeys:h,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let r,[s,t]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:m||null,checking:!1,applying:!1,restoring:!1,message:null}),u=s.status,v=s.checking,{applying:w,restoring:y,message:z}=s,[A,B]=(0,e.useState)(null),C=A??(h?.length>0?h[0].key:""),[D,E]=(0,e.useState)(null),F=D??u?.settings?.["providers.openai"]?.model??"",[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)({}),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)(""),O=(()=>{if(!u?.installed)return null;let a=u.settings?.["providers.openai"];return a?.base_url?x(a.base_url,{tunnelPublicUrl:o,tailscaleUrl:q})?"configured":"other":"not_configured"})(),P=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&J(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),Q=(0,e.useCallback)(async()=>{t({type:"CHECK_START"});try{let a=await fetch(ai),b=await a.json();t({type:"CHECK_DONE",data:b})}catch(a){t({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),R=(0,e.useRef)(!!m),S=(0,e.useRef)(!1),T=(0,e.useCallback)(async()=>{R.current||(R.current=!0,await Q()),S.current||(S.current=!0,await P())},[Q,P]),U=(0,e.useCallback)(()=>{b||T(),c()},[b,T,c]),V=()=>{let a=M||"http://127.0.0.1:20128";return a.endsWith("/v1")?a:`${a}/v1`},W=async()=>{t({type:"APPLY_START"});try{let a=C?.trim()||(h?.length>0?h[0].key:null)||(l?null:"sk_VansRoute"),b=await fetch(ai,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:V(),apiKey:a,model:F})}),c=await b.json();b.ok?(t({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),Q()):t({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){t({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},X=async()=>{t({type:"RESTORE_START"});try{let a=await fetch(ai,{method:"DELETE"}),b=await a.json();a.ok?(t({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),E(""),Q()):t({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){t({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:U,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:a.image||"/providers/deepseek-tui.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===O&&(0,d.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"===O&&(0,d.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"===O&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(aj,{apiKeys:h,applying:w,checking:v,cloudEnabled:l,customBaseUrl:M,deepseekStatus:u,getEffectiveBaseUrl:V,handleApply:W,handleReset:X,hasActiveProviders:g,message:z,restoring:y,selectedApiKey:C,selectedModel:F,setCustomBaseUrl:N,setModalOpen:H,setSelectedApiKey:B,setSelectedModel:E,setShowManualConfigModal:L,tailscaleEnabled:p,tailscaleUrl:q,tool:a,tunnelEnabled:n,tunnelPublicUrl:o}),(0,d.jsx)(i.ModelSelectModal,{isOpen:G,onClose:()=>H(!1),onSelect:a=>{E(a.value),H(!1)},selectedModel:F,activeProviders:k,modelAliases:I,title:"Select Model for DeepSeek TUI"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:K,onClose:()=>L(!1),title:"DeepSeek TUI - Manual Configuration",configs:(r=C&&C.trim()?C:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",[{filename:"~/.deepseek/config.toml",content:`[providers.openai]
33
41
  base_url = "${V()}"
34
42
  api_key = "${r}"
35
43
  model = "${F||"provider/model-id"}"
36
- `}])})]})}function al(){return"http://127.0.0.1:20128"}function am({apiKeys:a,applying:b,checkingJcode:c,cloudEnabled:e,customBaseUrl:f,getDisplayUrl:g,handleApplySettings:h,handleResetSettings:j,hasActiveProviders:k,jcodeStatus:l,message:m,restoring:n,selectedApiKey:o,selectedModel:p,setCustomBaseUrl:q,setModalOpen:s,setSelectedApiKey:t,setSelectedModel:v,setShowManualConfigModal:w,tailscaleEnabled:x,tailscaleUrl:y,tool:z,tunnelEnabled:A,tunnelPublicUrl:B}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking jcode CLI..."})]}),!c&&l&&!l.installed&&(0,d.jsx)("div",{className:"flex flex-col gap-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"jcode CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Install jcode to enable automatic configuration:"}),(0,d.jsx)("code",{className:"block mt-2 p-2 bg-black/20 rounded text-xs font-mono",children:"curl -fsSL https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.sh | bash"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Manual configuration is still available if VansRoute is deployed on a remote server."})]})]}),(0,d.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>w(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!c&&l?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[z.notes&&z.notes.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-2 mb-2",children:z.notes.map(a=>(0,d.jsxs)("div",{className:`flex items-start gap-2 p-2 rounded text-xs ${"info"===a.type?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"warning"===a.type?"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400":"bg-gray-500/10 text-text-muted"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5",children:"info"===a.type?"info":"warning"===a.type?"warning":"help"}),(0,d.jsx)("span",{children:a.text})]},`${a.type}-${a.text}`))}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:l?.settings?.baseUrl||"",value:f||g(),onChange:q,requiresExternalUrl:z.requiresExternalUrl,tunnelEnabled:A,tunnelPublicUrl:B,tailscaleEnabled:x,tailscaleUrl:y})]}),l?.config?.providers?.VansRoute?.base_url&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:l.config.providers.VansRoute.base_url})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:o,onChange:t,apiKeys:a,cloudEnabled:e})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Default Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:p,onChange:a=>v(a.target.value),"aria-label":"Model ID",placeholder:"cc/claude-opus-4-7",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),p&&(0,d.jsx)("button",{type:"button",onClick:()=>v(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>s(!0),disabled:!k,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${k?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1 p-3 bg-blue-500/5 border border-blue-500/20 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-blue-600 dark:text-blue-400",children:"Usage:"}),(0,d.jsx)("code",{className:"text-xs font-mono text-text-muted",children:"jcode --provider-profile VansRoute"}),(0,d.jsxs)("code",{className:"text-xs font-mono text-text-muted",children:["jcode --provider-profile VansRoute --model ",p||"cc/claude-opus-4-7"]})]})]}),m&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===m.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===m.type?"check_circle":"error"}),(0,d.jsx)("span",{children:m.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:h,disabled:!p,loading:b,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:j,disabled:!l?.hasVansRoute,loading:n,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>w(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function an({tool:a,isExpanded:b,onToggle:c,baseUrl:f,hasActiveProviders:g,apiKeys:h,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let r,[s,t]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:m||null,checking:!1,applying:!1,restoring:!1,message:null}),u=s.status,v=s.checking,{applying:x,restoring:y,message:z}=s,[A,B]=(0,e.useState)(null),C=u?.envApiKey,D=C&&h?.some(a=>a.key===C)?C:null,E=A??D??(h?.length>0?h[0].key:""),[F,G]=(0,e.useState)(null),H=F??u?.config?.providers?.VansRoute?.default_model??"",[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)({}),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(""),Q=(()=>{if(!u?.installed)return null;if(!u?.hasVansRoute)return"not_configured";let a=u.config?.providers?.VansRoute;return a?w(a.base_url,{tunnelPublicUrl:o,tailscaleUrl:q})?"configured":"other":"not_configured"})(),R=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&L(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),S=(0,e.useCallback)(async()=>{t({type:"CHECK_START"});try{let a=await fetch("/api/cli-tools/jcode-settings"),b=await a.json();t({type:"CHECK_DONE",data:b})}catch(a){t({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),T=(0,e.useRef)(!!m),U=(0,e.useRef)(!1),V=(0,e.useCallback)(async()=>{T.current||(T.current=!0,await S()),U.current||(U.current=!0,await R())},[S,R]),W=(0,e.useCallback)(()=>{b||V(),c()},[b,V,c]),X=()=>{let a=O||al();return a.endsWith("/v1")?a:`${a}/v1`},Y=async()=>{t({type:"APPLY_START"});try{let a=E?.trim()||(h?.length>0?h[0].key:null)||(l?null:"sk_VansRoute"),b=await fetch("/api/cli-tools/jcode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:X(),apiKey:a,models:H?[H]:[]})}),c=await b.json();b.ok?(t({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),S()):t({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){t({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},Z=async()=>{t({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/jcode-settings",{method:"DELETE"}),b=await a.json();a.ok?(t({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),G(""),B(""),S()):t({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){t({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:W,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:a.image||"/providers/jcode.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===Q&&(0,d.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"===Q&&(0,d.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"===Q&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(am,{apiKeys:h,applying:x,checkingJcode:v,cloudEnabled:l,customBaseUrl:O,getDisplayUrl:()=>{let a=O||al();return a.endsWith("/v1")?a:`${a}/v1`},handleApplySettings:Y,handleResetSettings:Z,hasActiveProviders:g,jcodeStatus:u,message:z,restoring:y,selectedApiKey:E,selectedModel:H,setCustomBaseUrl:P,setModalOpen:J,setSelectedApiKey:B,setSelectedModel:G,setShowManualConfigModal:N,tailscaleEnabled:p,tailscaleUrl:q,tool:a,tunnelEnabled:n,tunnelPublicUrl:o}),(0,d.jsx)(i.ModelSelectModal,{isOpen:I,onClose:()=>J(!1),onSelect:a=>{G(a.value),J(!1)},selectedModel:H,activeProviders:k,modelAliases:K,title:"Select Model for jcode"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:M,onClose:()=>N(!1),title:"jcode - Manual Configuration",configs:(r=E&&E.trim()?E:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",[{filename:"~/.jcode/config.toml",content:`[providers.VansRoute]
44
+ `}])})]})}function al(){return"http://127.0.0.1:20128"}function am({apiKeys:a,applying:b,checkingJcode:c,cloudEnabled:e,customBaseUrl:f,getDisplayUrl:g,handleApplySettings:h,handleResetSettings:j,hasActiveProviders:k,jcodeStatus:l,message:m,restoring:n,selectedApiKey:o,selectedModel:p,setCustomBaseUrl:q,setModalOpen:r,setSelectedApiKey:t,setSelectedModel:u,setShowManualConfigModal:w,tailscaleEnabled:x,tailscaleUrl:y,tool:z,tunnelEnabled:A,tunnelPublicUrl:B}){return(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking jcode CLI..."})]}),!c&&l&&!l.installed&&(0,d.jsx)("div",{className:"flex flex-col gap-4",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"jcode CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Install jcode to enable automatic configuration:"}),(0,d.jsx)("code",{className:"block mt-2 p-2 bg-black/20 rounded text-xs font-mono",children:"curl -fsSL https://raw.githubusercontent.com/1jehuang/jcode/master/scripts/install.sh | bash"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Manual configuration is still available if VansRoute is deployed on a remote server."})]})]}),(0,d.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>w(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!c&&l?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[z.notes&&z.notes.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-2 mb-2",children:z.notes.map(a=>(0,d.jsxs)("div",{className:`flex items-start gap-2 p-2 rounded text-xs ${"info"===a.type?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"warning"===a.type?"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400":"bg-gray-500/10 text-text-muted"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5",children:"info"===a.type?"info":"warning"===a.type?"warning":"help"}),(0,d.jsx)("span",{children:a.text})]},`${a.type}-${a.text}`))}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:l?.settings?.baseUrl||"",value:f||g(),onChange:q,requiresExternalUrl:z.requiresExternalUrl,tunnelEnabled:A,tunnelPublicUrl:B,tailscaleEnabled:x,tailscaleUrl:y})]}),l?.config?.providers?.VansRoute?.base_url&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:l.config.providers.VansRoute.base_url})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:o,onChange:t,apiKeys:a,cloudEnabled:e})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Default Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:p,onChange:a=>u(a.target.value),"aria-label":"Model ID",placeholder:"cc/claude-opus-4-7",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),p&&(0,d.jsx)("button",{type:"button",onClick:()=>u(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>r(!0),disabled:!k,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${k?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1 p-3 bg-blue-500/5 border border-blue-500/20 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-blue-600 dark:text-blue-400",children:"Usage:"}),(0,d.jsx)("code",{className:"text-xs font-mono text-text-muted",children:"jcode --provider-profile VansRoute"}),(0,d.jsxs)("code",{className:"text-xs font-mono text-text-muted",children:["jcode --provider-profile VansRoute --model ",p||"cc/claude-opus-4-7"]})]})]}),m&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===m.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===m.type?"check_circle":"error"}),(0,d.jsx)("span",{children:m.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:h,disabled:!p,loading:b,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:j,disabled:!l?.hasVansRoute,loading:n,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>w(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]})}function an({tool:a,isExpanded:b,onToggle:c,baseUrl:f,hasActiveProviders:g,apiKeys:h,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let r,[s,t]=(0,e.useReducer)((a,b)=>{switch(b.type){case"CHECK_START":return{...a,checking:!0};case"CHECK_DONE":return{...a,status:b.data,checking:!1};case"APPLY_START":return{...a,applying:!0,message:null};case"APPLY_DONE":return{...a,applying:!1,message:b.message};case"RESTORE_START":return{...a,restoring:!0,message:null};case"RESTORE_DONE":return{...a,restoring:!1,message:b.message};default:return a}},{status:m||null,checking:!1,applying:!1,restoring:!1,message:null}),u=s.status,v=s.checking,{applying:w,restoring:y,message:z}=s,[A,B]=(0,e.useState)(null),C=u?.envApiKey,D=C&&h?.some(a=>a.key===C)?C:null,E=A??D??(h?.length>0?h[0].key:""),[F,G]=(0,e.useState)(null),H=F??u?.config?.providers?.VansRoute?.default_model??"",[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)({}),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(""),Q=(()=>{if(!u?.installed)return null;if(!u?.hasVansRoute)return"not_configured";let a=u.config?.providers?.VansRoute;return a?x(a.base_url,{tunnelPublicUrl:o,tailscaleUrl:q})?"configured":"other":"not_configured"})(),R=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&L(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]),S=(0,e.useCallback)(async()=>{t({type:"CHECK_START"});try{let a=await fetch("/api/cli-tools/jcode-settings"),b=await a.json();t({type:"CHECK_DONE",data:b})}catch(a){t({type:"CHECK_DONE",data:{installed:!1,error:a.message}})}},[]),T=(0,e.useRef)(!!m),U=(0,e.useRef)(!1),V=(0,e.useCallback)(async()=>{T.current||(T.current=!0,await S()),U.current||(U.current=!0,await R())},[S,R]),W=(0,e.useCallback)(()=>{b||V(),c()},[b,V,c]),X=()=>{let a=O||al();return a.endsWith("/v1")?a:`${a}/v1`},Y=async()=>{t({type:"APPLY_START"});try{let a=E?.trim()||(h?.length>0?h[0].key:null)||(l?null:"sk_VansRoute"),b=await fetch("/api/cli-tools/jcode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:X(),apiKey:a,models:H?[H]:[]})}),c=await b.json();b.ok?(t({type:"APPLY_DONE",message:{type:"success",text:"Settings applied successfully!"}}),S()):t({type:"APPLY_DONE",message:{type:"error",text:c.error||"Failed to apply settings"}})}catch(a){t({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},Z=async()=>{t({type:"RESTORE_START"});try{let a=await fetch("/api/cli-tools/jcode-settings",{method:"DELETE"}),b=await a.json();a.ok?(t({type:"RESTORE_DONE",message:{type:"success",text:"Settings reset successfully!"}}),G(""),B(""),S()):t({type:"RESTORE_DONE",message:{type:"error",text:b.error||"Failed to reset settings"}})}catch(a){t({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:W,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:a.image||"/providers/jcode.webp",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===Q&&(0,d.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"===Q&&(0,d.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"===Q&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsx)(am,{apiKeys:h,applying:w,checkingJcode:v,cloudEnabled:l,customBaseUrl:O,getDisplayUrl:()=>{let a=O||al();return a.endsWith("/v1")?a:`${a}/v1`},handleApplySettings:Y,handleResetSettings:Z,hasActiveProviders:g,jcodeStatus:u,message:z,restoring:y,selectedApiKey:E,selectedModel:H,setCustomBaseUrl:P,setModalOpen:J,setSelectedApiKey:B,setSelectedModel:G,setShowManualConfigModal:N,tailscaleEnabled:p,tailscaleUrl:q,tool:a,tunnelEnabled:n,tunnelPublicUrl:o}),(0,d.jsx)(i.ModelSelectModal,{isOpen:I,onClose:()=>J(!1),onSelect:a=>{G(a.value),J(!1)},selectedModel:H,activeProviders:k,modelAliases:K,title:"Select Model for jcode"}),(0,d.jsx)(i.ManualConfigModal,{isOpen:M,onClose:()=>N(!1),title:"jcode - Manual Configuration",configs:(r=E&&E.trim()?E:l?"<API_KEY_FROM_DASHBOARD>":"sk_VansRoute",[{filename:"~/.jcode/config.toml",content:`[providers.VansRoute]
37
45
  type = "openai-compatible"
38
46
  base_url = "${X()}"
39
47
  auth = "bearer"
@@ -43,7 +51,7 @@ default_model = "${H||"cc/claude-opus-4-7"}"
43
51
  requires_api_key = true
44
52
 
45
53
  [[providers.VansRoute.models]]
46
- id = "${H||"cc/claude-opus-4-7"}"`},{filename:"~/.config/jcode/provider-VansRoute.env",content:`JCODE_VansRoute_API_KEY="${r}"`}])})]})}var ao=c(55009);let ap="/api/cli-tools/grok-build-settings",aq="9router",ar=[{id:"general-purpose",label:"General-purpose",help:"Implementation, testing, and full-capability delegated tasks"},{id:"explore",label:"Explore",help:"Read-only codebase research and investigation"},{id:"plan",label:"Plan",help:"Architecture and implementation planning"}];function as({label:a,value:b,placeholder:c,onChange:e,onSelect:f,disabled:g,help:h}){return(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsxs)("div",{className:"sm:text-right",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-sm",children:a}),h&&(0,d.jsx)("p",{className:"mt-0.5 text-[10px] leading-tight text-text-muted",children:h})]}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:b,onChange:a=>e(a.target.value),placeholder:c,className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),b&&(0,d.jsx)("button",{type:"button",onClick:()=>e(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (inherit main model for subagents)",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:f,disabled:g,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${!g?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]})}function at({tool:a,isExpanded:b,onToggle:c,hasActiveProviders:f,apiKeys:g,activeProviders:h,cloudEnabled:k,initialStatus:l,tunnelEnabled:m,tunnelPublicUrl:n,tailscaleEnabled:o,tailscaleUrl:p}){let{getCaps:q}=(0,ao.y)(),s=a=>q(a)?.contextWindow||null,t=l?.settings?.model?.model||"",v=Object.fromEntries(ar.map(a=>[a.id,l?.settings?.subagentModels?.[a.id]?.model]).filter(([,a])=>!!a)),[x,y]=(0,e.useState)(l||null),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(null),[H,I]=(0,e.useState)(g?.[0]?.key||""),[J,K]=(0,e.useState)(t),[L,M]=(0,e.useState)(v),[N,O]=(0,e.useState)(null),[P,Q]=(0,e.useState)({}),[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(""),V=(0,e.useRef)(!!l),W=x?.settings?.model,X=x?.installed?W?.base_url?w(W.base_url,{tunnelPublicUrl:n,tailscaleUrl:p})?"configured":"other":"not_configured":null,Y=(0,e.useCallback)(a=>{let b=a?.settings?.model?.model||"",c=Object.fromEntries(ar.map(b=>[b.id,a?.settings?.subagentModels?.[b.id]?.model]).filter(([,a])=>!!a));K(b),M(c)},[]);(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&Q(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]);let Z=(0,e.useCallback)(async({hydrate:a=!1}={})=>{A(!0);try{let b=await fetch(ap),c=await b.json();y(c),V.current=!0,a&&Y(c)}catch(a){y({installed:!1,error:a.message})}finally{A(!1)}},[Y]),$=()=>{let a=T||"http://127.0.0.1:20128";return a.endsWith("/v1")?a:`${a}/v1`},_=async()=>{C(!0),G(null);try{let a=H?.trim()||(g?.length>0?g[0].key:null)||(k?null:"sk_9router"),b={};for(let a of ar){let c=L[a.id]?.trim();c&&(b[a.id]={model:c,contextWindow:s(c)})}let c=await fetch(ap,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:$(),apiKey:a,model:J,contextWindow:s(J),subagentModels:b})}),d=await c.json();c.ok?(G({type:"success",text:"Main and subagent models applied successfully!"}),Z()):G({type:"error",text:d.error||"Failed to apply settings"})}catch(a){G({type:"error",text:a.message})}finally{C(!1)}},aa=async()=>{E(!0),G(null);try{let a=await fetch(ap,{method:"DELETE"}),b=await a.json();a.ok?(G({type:"success",text:"Settings reset successfully!"}),K(""),M({}),Z()):G({type:"error",text:b.error||"Failed to reset settings"})}catch(a){G({type:"error",text:a.message})}finally{E(!1)}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:a.image||"/providers/grok-cli.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===X&&(0,d.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"===X&&(0,d.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"===X&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[z&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Grok Build..."})]}),!z&&x&&!x.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Grok Build not detected locally"}),(0,d.jsx)("code",{className:"block mt-2 p-2 bg-black/20 rounded text-xs font-mono",children:"curl -fsSL https://x.ai/cli/install.sh | bash"})]})]}),(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>S(!0),className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})]}),!z&&x?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[a.notes?.length>0&&(0,d.jsx)("div",{className:"mb-2 flex flex-col gap-2",children:a.notes.map((a,b)=>(0,d.jsxs)("div",{className:`flex items-start gap-2 rounded p-2 text-xs ${"warning"===a.type?"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400":"bg-blue-500/10 text-blue-600 dark:text-blue-400"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-[14px]",children:"warning"===a.type?"warning":"info"}),(0,d.jsx)("span",{children:a.text})]},b))}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:x?.settings?.baseUrl||"",value:T||$(),onChange:U,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:m,tunnelPublicUrl:n,tailscaleEnabled:o,tailscaleUrl:p})]}),W?.base_url&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:[W.base_url," \xb7 ",W.model,W.context_window?` \xb7 ${(W.context_window/1e3).toLocaleString()}K ctx`:""]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:H,onChange:I,apiKeys:g,cloudEnabled:k})]}),(0,d.jsx)(as,{label:"Main Model",value:J,onChange:K,placeholder:"provider/model-id",onSelect:()=>O("main"),disabled:!f}),(0,d.jsx)("div",{className:"my-1 border-t border-border pt-3",children:(0,d.jsxs)("div",{className:"mb-2 flex items-start gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[16px]",children:"account_tree"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-xs font-semibold text-text-main",children:"Subagent model overrides"}),(0,d.jsx)("p",{className:"text-[10px] text-text-muted",children:"Leave blank to inherit Main Model. Each override keeps its own context window."})]})]})}),ar.map(a=>(0,d.jsx)(as,{label:a.label,help:a.help,value:L[a.id]||"",onChange:b=>M(c=>({...c,[a.id]:b})),placeholder:`${J||"Main Model"} (inherit)`,onSelect:()=>O(a.id),disabled:!f},a.id))]}),F&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===F.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===F.type?"check_circle":"error"}),(0,d.jsx)("span",{children:F.text})]}),(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:_,disabled:!J,loading:B,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:aa,disabled:!x?.has9Router,loading:D,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>S(!0),className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),N&&(0,d.jsx)(i.ModelSelectModal,{isOpen:!!N,onClose:()=>O(null),onSelect:a=>{"main"===N?K(a.value):N&&M(b=>({...b,[N]:a.value})),O(null)},selectedModel:"main"===N?J:L[N]||"",activeProviders:h,modelAliases:P,title:"main"===N?"Select Main Model for Grok Build":`Select ${ar.find(a=>a.id===N)?.label||"Subagent"} Model`}),(0,d.jsx)(i.ManualConfigModal,{isOpen:R,onClose:()=>S(!1),title:"Grok Build - Manual Configuration",configs:(()=>{let a=H?.trim()||(k?"<API_KEY_FROM_DASHBOARD>":"sk_9router"),b=$(),c=J||"provider/model-id",d=[`[models]
54
+ id = "${H||"cc/claude-opus-4-7"}"`},{filename:"~/.config/jcode/provider-VansRoute.env",content:`JCODE_VansRoute_API_KEY="${r}"`}])})]})}var ao=c(55009);let ap="/api/cli-tools/grok-build-settings",aq="9router",ar=[{id:"general-purpose",label:"General-purpose",help:"Implementation, testing, and full-capability delegated tasks"},{id:"explore",label:"Explore",help:"Read-only codebase research and investigation"},{id:"plan",label:"Plan",help:"Architecture and implementation planning"}];function as({label:a,value:b,placeholder:c,onChange:e,onSelect:f,disabled:g,help:h}){return(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsxs)("div",{className:"sm:text-right",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-sm",children:a}),h&&(0,d.jsx)("p",{className:"mt-0.5 text-[10px] leading-tight text-text-muted",children:h})]}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:b,onChange:a=>e(a.target.value),placeholder:c,className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),b&&(0,d.jsx)("button",{type:"button",onClick:()=>e(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (inherit main model for subagents)",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:f,disabled:g,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${!g?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]})}function at({tool:a,isExpanded:b,onToggle:c,hasActiveProviders:f,apiKeys:g,activeProviders:h,cloudEnabled:k,initialStatus:l,tunnelEnabled:m,tunnelPublicUrl:n,tailscaleEnabled:o,tailscaleUrl:p}){let{getCaps:q}=(0,ao.y)(),r=a=>q(a)?.contextWindow||null,t=l?.settings?.model?.model||"",u=Object.fromEntries(ar.map(a=>[a.id,l?.settings?.subagentModels?.[a.id]?.model]).filter(([,a])=>!!a)),[w,y]=(0,e.useState)(l||null),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(null),[H,I]=(0,e.useState)(g?.[0]?.key||""),[J,K]=(0,e.useState)(t),[L,M]=(0,e.useState)(u),[N,O]=(0,e.useState)(null),[P,Q]=(0,e.useState)({}),[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(""),V=(0,e.useRef)(!!l),W=w?.settings?.model,X=w?.installed?W?.base_url?x(W.base_url,{tunnelPublicUrl:n,tailscaleUrl:p})?"configured":"other":"not_configured":null,Y=(0,e.useCallback)(a=>{let b=a?.settings?.model?.model||"",c=Object.fromEntries(ar.map(b=>[b.id,a?.settings?.subagentModels?.[b.id]?.model]).filter(([,a])=>!!a));K(b),M(c)},[]);(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&Q(b.aliases||{})}catch(a){console.log("Error fetching model aliases:",a)}},[]);let Z=(0,e.useCallback)(async({hydrate:a=!1}={})=>{A(!0);try{let b=await fetch(ap),c=await b.json();y(c),V.current=!0,a&&Y(c)}catch(a){y({installed:!1,error:a.message})}finally{A(!1)}},[Y]),$=()=>{let a=T||"http://127.0.0.1:20128";return a.endsWith("/v1")?a:`${a}/v1`},_=async()=>{C(!0),G(null);try{let a=H?.trim()||(g?.length>0?g[0].key:null)||(k?null:"sk_9router"),b={};for(let a of ar){let c=L[a.id]?.trim();c&&(b[a.id]={model:c,contextWindow:r(c)})}let c=await fetch(ap,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:$(),apiKey:a,model:J,contextWindow:r(J),subagentModels:b})}),d=await c.json();c.ok?(G({type:"success",text:"Main and subagent models applied successfully!"}),Z()):G({type:"error",text:d.error||"Failed to apply settings"})}catch(a){G({type:"error",text:a.message})}finally{C(!1)}},aa=async()=>{E(!0),G(null);try{let a=await fetch(ap,{method:"DELETE"}),b=await a.json();a.ok?(G({type:"success",text:"Settings reset successfully!"}),K(""),M({}),Z()):G({type:"error",text:b.error||"Failed to reset settings"})}catch(a){G({type:"error",text:a.message})}finally{E(!1)}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:a.image||"/providers/grok-cli.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===X&&(0,d.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"===X&&(0,d.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"===X&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[z&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Grok Build..."})]}),!z&&w&&!w.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Grok Build not detected locally"}),(0,d.jsx)("code",{className:"block mt-2 p-2 bg-black/20 rounded text-xs font-mono",children:"curl -fsSL https://x.ai/cli/install.sh | bash"})]})]}),(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>S(!0),className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})]}),!z&&w?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[a.notes?.length>0&&(0,d.jsx)("div",{className:"mb-2 flex flex-col gap-2",children:a.notes.map((a,b)=>(0,d.jsxs)("div",{className:`flex items-start gap-2 rounded p-2 text-xs ${"warning"===a.type?"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400":"bg-blue-500/10 text-blue-600 dark:text-blue-400"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-[14px]",children:"warning"===a.type?"warning":"info"}),(0,d.jsx)("span",{children:a.text})]},b))}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:w?.settings?.baseUrl||"",value:T||$(),onChange:U,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:m,tunnelPublicUrl:n,tailscaleEnabled:o,tailscaleUrl:p})]}),W?.base_url&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:[W.base_url," \xb7 ",W.model,W.context_window?` \xb7 ${(W.context_window/1e3).toLocaleString()}K ctx`:""]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:H,onChange:I,apiKeys:g,cloudEnabled:k})]}),(0,d.jsx)(as,{label:"Main Model",value:J,onChange:K,placeholder:"provider/model-id",onSelect:()=>O("main"),disabled:!f}),(0,d.jsx)("div",{className:"my-1 border-t border-border pt-3",children:(0,d.jsxs)("div",{className:"mb-2 flex items-start gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[16px]",children:"account_tree"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-xs font-semibold text-text-main",children:"Subagent model overrides"}),(0,d.jsx)("p",{className:"text-[10px] text-text-muted",children:"Leave blank to inherit Main Model. Each override keeps its own context window."})]})]})}),ar.map(a=>(0,d.jsx)(as,{label:a.label,help:a.help,value:L[a.id]||"",onChange:b=>M(c=>({...c,[a.id]:b})),placeholder:`${J||"Main Model"} (inherit)`,onSelect:()=>O(a.id),disabled:!f},a.id))]}),F&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===F.type?"bg-green-500/10 text-green-600 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===F.type?"check_circle":"error"}),(0,d.jsx)("span",{children:F.text})]}),(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:_,disabled:!J,loading:B,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:aa,disabled:!w?.has9Router,loading:D,className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>S(!0),className:"w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),N&&(0,d.jsx)(i.ModelSelectModal,{isOpen:!!N,onClose:()=>O(null),onSelect:a=>{"main"===N?K(a.value):N&&M(b=>({...b,[N]:a.value})),O(null)},selectedModel:"main"===N?J:L[N]||"",activeProviders:h,modelAliases:P,title:"main"===N?"Select Main Model for Grok Build":`Select ${ar.find(a=>a.id===N)?.label||"Subagent"} Model`}),(0,d.jsx)(i.ManualConfigModal,{isOpen:R,onClose:()=>S(!1),title:"Grok Build - Manual Configuration",configs:(()=>{let a=H?.trim()||(k?"<API_KEY_FROM_DASHBOARD>":"sk_9router"),b=$(),c=J||"provider/model-id",d=[`[models]
47
55
  default = "${aq}"`,`[model.${aq}]
48
56
  model = "${c}"
49
57
  base_url = "${b}"
@@ -51,16 +59,16 @@ name = "9Router"
51
59
  description = "Routed via 9Router gateway"
52
60
  api_backend = "chat_completions"
53
61
  api_key = "${a}"
54
- context_window = ${s(c)||2e5}`],e=[];for(let c of ar){let f=L[c.id]?.trim();if(!f)continue;let g=`${aq}-${c.id}`;e.push(`${c.id} = "${g}"`),d.push(`[model.${g}]
62
+ context_window = ${r(c)||2e5}`],e=[];for(let c of ar){let f=L[c.id]?.trim();if(!f)continue;let g=`${aq}-${c.id}`;e.push(`${c.id} = "${g}"`),d.push(`[model.${g}]
55
63
  model = "${f}"
56
64
  base_url = "${b}"
57
65
  name = "9Router ${c.id}"
58
66
  description = "Routed via 9Router gateway"
59
67
  api_backend = "chat_completions"
60
68
  api_key = "${a}"
61
- context_window = ${s(f)||2e5}`)}return e.length&&d.splice(1,0,`[subagents.models]
69
+ context_window = ${r(f)||2e5}`)}return e.length&&d.splice(1,0,`[subagents.models]
62
70
  ${e.join("\n")}`),[{filename:"~/.grok/config.toml",content:`${d.join("\n\n")}
63
- `}]})()})]})}let au={pi:"~/.pi/agent/models.json",omp:"~/.omp/agent/models.yml",crush:"~/.config/crush/crush.json",forge:"~/.forge/config.toml",smelt:"~/.smelt/config.json",codewhale:"~/.codewhale/config.toml"},av=a=>"pi"!==a&&"omp"!==a,aw=a=>{let b=a?.providers?.["9router"]?.models;return Array.isArray(b)?b.map(a=>"string"==typeof a?a:a?.id).filter(Boolean):[]};function ax({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let s,t=`/api/cli-tools/${a.id}-settings`,{status:v,checking:x,applying:y,restoring:z,message:A,dispatch:B,checkStatus:C,customBaseUrl:D,getDisplayUrl:E,getEffectiveBaseUrl:F,handleToggle:G,modelAliases:H,selectedApiKey:I,setCustomBaseUrl:J,setSelectedApiKey:K}=h({apiKeys:g,baseUrl:f,cloudEnabled:l,initialStatus:m,isExpanded:b,onToggle:c,statusEndpoint:t}),[L,M]=(0,e.useState)(null),[N,O]=(0,e.useState)(null),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(!1),V=au[a.id],W=(s=v?.config,s?.baseUrl||s?.openai?.base_url||s?.providers?.["9router"]?.base_url||s?.providers?.["9router"]?.baseUrl||""),X=L??v?.config?.model??v?.config?.openai?.model??aw(v?.config)[0]??"",Y=N??aw(v?.config),Z=av(a.id)&&!X||"pi"===a.id&&0===Y.length,$=v?.installed?v.has9Router?w(W,{tunnelPublicUrl:o,tailscaleUrl:q})?"configured":"other":"not_configured":null,_=async()=>{B({type:"APPLY_START"});try{let b,c={baseUrl:F(),apiKey:I&&I.trim()?I:l?"":"sk_9router"};(b=a.id,"pi"===b)?c.models=Y:av(a.id)&&(c.model=X);let d=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}),e=await d.json();d.ok?(B({type:"APPLY_DONE",message:{type:"success",text:e.message||"Settings applied successfully!"}}),M(null),O(null),C()):B({type:"APPLY_DONE",message:{type:"error",text:e.error?.message||"Failed to apply settings"}})}catch(a){B({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},aa=async()=>{B({type:"RESTORE_START"});try{let a=await fetch(t,{method:"DELETE"}),b=await a.json();a.ok?(B({type:"RESTORE_DONE",message:{type:"success",text:b.message||"Settings reset successfully!"}}),M(null),O(null),C()):B({type:"RESTORE_DONE",message:{type:"error",text:b.error?.message||"Failed to reset settings"}})}catch(a){B({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:G,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===$&&(0,d.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"===$&&(0,d.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"===$&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[x&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsxs)("span",{children:["Checking ",a.name,"..."]})]}),!x&&v&&!v.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsxs)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:[a.name," not detected locally"]}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansRoute is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>U(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),a.docsUrl&&(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>S(!R),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:R?"expand_less":"help"}),R?"Hide":"How to Install"]})]})]}),R&&a.docsUrl&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Install ",a.name," following the official instructions at"," ",(0,d.jsx)("a",{className:"text-primary underline",href:a.docsUrl,target:"_blank",rel:"noreferrer",children:a.docsUrl}),"."]})]})]}),!x&&v?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(r,{currentUrl:W,value:D||E(),onChange:J,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q})]}),W&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:W})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(u,{value:I,onChange:K,apiKeys:g,cloudEnabled:l})]}),"pi"===a.id&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm mt-1",children:"Models"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline mt-1.5",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5 min-h-[36px] p-2 bg-surface rounded border border-border",children:0===Y.length?(0,d.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models selected yet."}):Y.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded bg-bg-secondary text-xs text-text-main border border-border",children:[(0,d.jsx)("span",{children:a}),(0,d.jsx)("button",{type:"button",onClick:()=>O(Y.filter(b=>b!==a)),"aria-label":`Remove ${a}`,className:"text-text-muted hover:text-red-500 rounded p-0.5",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a))}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)(i.Button,{type:"button",size:"sm",variant:"secondary",onClick:()=>Q(!0),disabled:!k?.length,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"add"}),"Add Model"]}),Y.length>0&&(0,d.jsx)("button",{type:"button",onClick:()=>O([]),className:"text-xs text-text-muted hover:text-red-500 ml-auto",children:"Clear all"})]})]})]}),av(a.id)&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:X,onChange:a=>M(a.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),X&&(0,d.jsx)("button",{type:"button",onClick:()=>M(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>Q(!0),disabled:!k?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${k?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),A&&(0,d.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 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,d.jsx)("span",{children:A.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:_,disabled:Z||!I&&l&&g.length>0,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:aa,disabled:z||!v.has9Router,loading:z,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>U(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(i.ModelSelectModal,{isOpen:P,onClose:()=>Q(!1),onSelect:b=>{"pi"===a.id?O(Y.includes(b.value)?Y:[...Y,b.value]):M(b.value),Q(!1)},selectedModel:"pi"===a.id?"":X,activeProviders:k,modelAliases:H,title:`Select Model for ${a.name}`}),(0,d.jsx)(i.ManualConfigModal,{isOpen:T,onClose:()=>U(!1),title:`${a.name} - Manual Configuration`,configs:(()=>{let b=I&&I.trim()?I:l?"<API_KEY_FROM_DASHBOARD>":"sk_9router",c=F(),d=X||"provider/model-id";if("pi"===a.id)return[{filename:V,content:JSON.stringify({providers:{"9router":{baseUrl:c,apiKey:b,api:"openai-completions",models:(Y.length>0?Y:[d]).map(a=>({id:a,name:a,contextWindow:128e3,maxTokens:16384}))}}},null,2)}];switch(a.id){case"omp":return[{filename:V,content:`providers:
71
+ `}]})()})]})}let au={pi:"~/.pi/agent/models.json",omp:"~/.omp/agent/models.yml",crush:"~/.config/crush/crush.json",forge:"~/.forge/config.toml",smelt:"~/.smelt/config.json",codewhale:"~/.codewhale/config.toml"},av=a=>"pi"!==a&&"omp"!==a,aw=a=>{let b=a?.providers?.["9router"]?.models;return Array.isArray(b)?b.map(a=>"string"==typeof a?a:a?.id).filter(Boolean):[]};function ax({tool:a,isExpanded:b,onToggle:c,baseUrl:f,apiKeys:g,activeProviders:k,cloudEnabled:l,initialStatus:m,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q}){let r,t=`/api/cli-tools/${a.id}-settings`,{status:u,checking:w,applying:y,restoring:z,message:A,dispatch:B,checkStatus:C,customBaseUrl:D,getDisplayUrl:E,getEffectiveBaseUrl:F,handleToggle:G,modelAliases:H,selectedApiKey:I,setCustomBaseUrl:J,setSelectedApiKey:K}=h({apiKeys:g,baseUrl:f,cloudEnabled:l,initialStatus:m,isExpanded:b,onToggle:c,statusEndpoint:t}),[L,M]=(0,e.useState)(null),[N,O]=(0,e.useState)(null),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(!1),V=au[a.id],W=(r=u?.config,r?.baseUrl||r?.openai?.base_url||r?.providers?.["9router"]?.base_url||r?.providers?.["9router"]?.baseUrl||""),X=L??u?.config?.model??u?.config?.openai?.model??aw(u?.config)[0]??"",Y=N??aw(u?.config),Z=av(a.id)&&!X||"pi"===a.id&&0===Y.length,$=u?.installed?u.has9Router?x(W,{tunnelPublicUrl:o,tailscaleUrl:q})?"configured":"other":"not_configured":null,_=async()=>{B({type:"APPLY_START"});try{let b,c={baseUrl:F(),apiKey:I&&I.trim()?I:l?"":"sk_9router"};(b=a.id,"pi"===b)?c.models=Y:av(a.id)&&(c.model=X);let d=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}),e=await d.json();d.ok?(B({type:"APPLY_DONE",message:{type:"success",text:e.message||"Settings applied successfully!"}}),M(null),O(null),C()):B({type:"APPLY_DONE",message:{type:"error",text:e.error?.message||"Failed to apply settings"}})}catch(a){B({type:"APPLY_DONE",message:{type:"error",text:a.message}})}},aa=async()=>{B({type:"RESTORE_START"});try{let a=await fetch(t,{method:"DELETE"}),b=await a.json();a.ok?(B({type:"RESTORE_DONE",message:{type:"success",text:b.message||"Settings reset successfully!"}}),M(null),O(null),C()):B({type:"RESTORE_DONE",message:{type:"error",text:b.error?.message||"Failed to reset settings"}})}catch(a){B({type:"RESTORE_DONE",message:{type:"error",text:a.message}})}};return(0,d.jsxs)(i.Card,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-start justify-between gap-3 hover:cursor-pointer sm:items-center text-left",onClick:G,"aria-expanded":b,"aria-label":"Toggle section",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(j.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===$&&(0,d.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"===$&&(0,d.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"===$&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[w&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsxs)("span",{children:["Checking ",a.name,"..."]})]}),!w&&u&&!u.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsxs)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:[a.name," not detected locally"]}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if VansRoute is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(i.Button,{variant:"secondary",size:"sm",onClick:()=>U(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),a.docsUrl&&(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>S(!R),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:R?"expand_less":"help"}),R?"Hide":"How to Install"]})]})]}),R&&a.docsUrl&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Install ",a.name," following the official instructions at"," ",(0,d.jsx)("a",{className:"text-primary underline",href:a.docsUrl,target:"_blank",rel:"noreferrer",children:a.docsUrl}),"."]})]})]}),!w&&u?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(s,{currentUrl:W,value:D||E(),onChange:J,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:n,tunnelPublicUrl:o,tailscaleEnabled:p,tailscaleUrl:q})]}),W&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:W})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(v,{value:I,onChange:K,apiKeys:g,cloudEnabled:l})]}),"pi"===a.id&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm mt-1",children:"Models"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline mt-1.5",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5 min-h-[36px] p-2 bg-surface rounded border border-border",children:0===Y.length?(0,d.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models selected yet."}):Y.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded bg-bg-secondary text-xs text-text-main border border-border",children:[(0,d.jsx)("span",{children:a}),(0,d.jsx)("button",{type:"button",onClick:()=>O(Y.filter(b=>b!==a)),"aria-label":`Remove ${a}`,className:"text-text-muted hover:text-red-500 rounded p-0.5",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},a))}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)(i.Button,{type:"button",size:"sm",variant:"secondary",onClick:()=>Q(!0),disabled:!k?.length,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"add"}),"Add Model"]}),Y.length>0&&(0,d.jsx)("button",{type:"button",onClick:()=>O([]),className:"text-xs text-text-muted hover:text-red-500 ml-auto",children:"Clear all"})]})]})]}),av(a.id)&&(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:X,onChange:a=>M(a.target.value),"aria-label":"Model ID",placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),X&&(0,d.jsx)("button",{type:"button",onClick:()=>M(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>Q(!0),disabled:!k?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${k?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),A&&(0,d.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 dark:text-green-400 dark:bg-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 dark:bg-red-500/20"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,d.jsx)("span",{children:A.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(i.Button,{variant:"primary",size:"sm",onClick:_,disabled:Z||!I&&l&&g.length>0,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:aa,disabled:z||!u.has9Router,loading:z,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>U(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(i.ModelSelectModal,{isOpen:P,onClose:()=>Q(!1),onSelect:b=>{"pi"===a.id?O(Y.includes(b.value)?Y:[...Y,b.value]):M(b.value),Q(!1)},selectedModel:"pi"===a.id?"":X,activeProviders:k,modelAliases:H,title:`Select Model for ${a.name}`}),(0,d.jsx)(i.ManualConfigModal,{isOpen:T,onClose:()=>U(!1),title:`${a.name} - Manual Configuration`,configs:(()=>{let b=I&&I.trim()?I:l?"<API_KEY_FROM_DASHBOARD>":"sk_9router",c=F(),d=X||"provider/model-id";if("pi"===a.id)return[{filename:V,content:JSON.stringify({providers:{"9router":{baseUrl:c,apiKey:b,api:"openai-completions",models:(Y.length>0?Y:[d]).map(a=>({id:a,name:a,contextWindow:128e3,maxTokens:16384}))}}},null,2)}];switch(a.id){case"omp":return[{filename:V,content:`providers:
64
72
  9router:
65
73
  baseUrl: ${c}
66
74
  apiKey: ${b}