9router-proxy 0.6.19 → 0.6.21

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 (605) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +19 -19
  3. package/app/.next-cli-build/build-manifest.json +3 -3
  4. package/app/.next-cli-build/prerender-manifest.json +4 -4
  5. package/app/.next-cli-build/react-loadable-manifest.json +7 -7
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +6 -6
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +5 -5
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  75. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  78. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  79. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  80. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  81. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  82. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  83. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  84. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  85. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  86. package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  87. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  88. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
  89. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  90. package/app/.next-cli-build/server/app/api/auth/login/route.js +1 -1
  91. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  92. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js +1 -1
  98. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js +1 -1
  100. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js +1 -1
  102. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js +1 -1
  104. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/auth/status/route.js +1 -1
  106. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
  108. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  110. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  113. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
  115. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +2 -2
  117. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  121. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  125. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
  129. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
  131. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +2 -2
  133. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
  135. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +1 -1
  137. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +2 -2
  139. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +1 -1
  142. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +1 -1
  144. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  146. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +2 -2
  148. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  150. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  152. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +1 -1
  154. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  155. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +1 -1
  156. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
  158. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/combos/presets/route.js +1 -1
  160. package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  175. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  177. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  179. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  181. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  184. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js +1 -1
  185. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
  186. package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  187. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  190. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  192. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  194. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  196. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  198. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  201. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  205. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  206. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  209. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  212. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  214. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js +1 -1
  223. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  225. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  228. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js +1 -1
  230. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  232. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  234. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  236. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  238. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  241. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js +1 -1
  243. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  245. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  247. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/providers/web-login/route.js +1 -1
  249. package/app/.next-cli-build/server/app/api/providers/web-login/route.js.nft.json +1 -1
  250. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  269. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  270. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  273. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
  275. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  276. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  277. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  278. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  279. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  280. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  281. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  283. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  284. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  286. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  288. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
  289. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  290. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  291. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
  292. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  293. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  294. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  295. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  296. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  298. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  299. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  300. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  301. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  302. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  303. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  304. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  305. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  306. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  307. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  308. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  309. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  310. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  311. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  312. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  313. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  314. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  315. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  316. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  317. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +3 -3
  318. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  319. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  320. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  321. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  322. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js +1 -1
  323. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
  324. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  325. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  326. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  327. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  328. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  329. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  330. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  331. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  332. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  333. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  334. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  335. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  336. package/app/.next-cli-build/server/app/api/v1/systemone/route.js +1 -1
  337. package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
  338. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  339. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  340. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  341. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  342. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  343. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  344. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  345. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  346. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  347. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  348. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  349. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  350. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  351. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  352. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  353. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  354. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  355. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  356. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  357. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  358. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  359. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  360. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  361. package/app/.next-cli-build/server/app/callback.html +1 -1
  362. package/app/.next-cli-build/server/app/callback.rsc +4 -4
  363. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  364. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  365. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +4 -4
  366. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  367. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +4 -4
  368. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +4 -4
  369. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +4 -4
  370. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  371. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  372. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
  373. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +6 -6
  374. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  375. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  376. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  377. package/app/.next-cli-build/server/app/dashboard/combos.rsc +4 -4
  378. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +4 -4
  379. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +4 -4
  380. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  381. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  382. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
  383. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +5 -5
  384. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
  385. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  386. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  387. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +4 -4
  388. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +4 -4
  389. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +4 -4
  390. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  391. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  392. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
  393. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +5 -5
  394. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
  395. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  396. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  397. package/app/.next-cli-build/server/app/dashboard/profile.rsc +4 -4
  398. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +4 -4
  399. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +4 -4
  400. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  401. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  402. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +4 -4
  403. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +4 -4
  404. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +4 -4
  405. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  406. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  407. package/app/.next-cli-build/server/app/dashboard/providers.rsc +4 -4
  408. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +4 -4
  409. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +4 -4
  410. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  411. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  412. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +4 -4
  413. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +4 -4
  414. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +4 -4
  415. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  416. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  417. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +5 -5
  418. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +5 -5
  419. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +5 -5
  420. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
  421. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  422. package/app/.next-cli-build/server/app/dashboard/quota.rsc +4 -4
  423. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +4 -4
  424. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +4 -4
  425. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  426. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  427. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  428. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  429. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  430. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  431. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  432. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  433. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +4 -4
  434. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  435. package/app/.next-cli-build/server/app/dashboard/skills.rsc +4 -4
  436. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +4 -4
  437. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +4 -4
  438. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  439. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  440. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +4 -4
  441. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +4 -4
  442. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +4 -4
  443. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
  444. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  445. package/app/.next-cli-build/server/app/dashboard/translator.rsc +4 -4
  446. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +4 -4
  447. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +4 -4
  448. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  449. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  450. package/app/.next-cli-build/server/app/dashboard/usage.rsc +4 -4
  451. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +4 -4
  452. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +4 -4
  453. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  454. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  455. package/app/.next-cli-build/server/app/dashboard.rsc +5 -5
  456. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +5 -5
  457. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
  458. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  459. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  460. package/app/.next-cli-build/server/app/index.html +1 -1
  461. package/app/.next-cli-build/server/app/index.rsc +4 -4
  462. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  463. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
  464. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  465. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  466. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  467. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  468. package/app/.next-cli-build/server/app/landing.html +1 -1
  469. package/app/.next-cli-build/server/app/landing.rsc +4 -4
  470. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  471. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  472. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +4 -4
  473. package/app/.next-cli-build/server/app/login/page.js +1 -1
  474. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  475. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  476. package/app/.next-cli-build/server/app/login.html +1 -1
  477. package/app/.next-cli-build/server/app/login.rsc +4 -4
  478. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  479. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  480. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  481. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  482. package/app/.next-cli-build/server/app/page.js +1 -1
  483. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  484. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  485. package/app/.next-cli-build/server/app-paths-manifest.json +19 -19
  486. package/app/.next-cli-build/server/chunks/1260.js +1 -1
  487. package/app/.next-cli-build/server/chunks/1329.js +1 -1
  488. package/app/.next-cli-build/server/chunks/1350.js +1 -1
  489. package/app/.next-cli-build/server/chunks/1356.js +1 -1
  490. package/app/.next-cli-build/server/chunks/1679.js +1 -1
  491. package/app/.next-cli-build/server/chunks/1757.js +1 -1
  492. package/app/.next-cli-build/server/chunks/21.js +1 -1
  493. package/app/.next-cli-build/server/chunks/2327.js +1 -1
  494. package/app/.next-cli-build/server/chunks/2380.js +29 -0
  495. package/app/.next-cli-build/server/chunks/24.js +1 -1
  496. package/app/.next-cli-build/server/chunks/2822.js +1 -0
  497. package/app/.next-cli-build/server/chunks/3726.js +1 -1
  498. package/app/.next-cli-build/server/chunks/3943.js +1 -1
  499. package/app/.next-cli-build/server/chunks/412.js +1 -1
  500. package/app/.next-cli-build/server/chunks/4123.js +1 -1
  501. package/app/.next-cli-build/server/chunks/4279.js +1 -1
  502. package/app/.next-cli-build/server/chunks/4882.js +1 -1
  503. package/app/.next-cli-build/server/chunks/4956.js +1 -1
  504. package/app/.next-cli-build/server/chunks/4957.js +1 -1
  505. package/app/.next-cli-build/server/chunks/5026.js +1 -1
  506. package/app/.next-cli-build/server/chunks/5081.js +3 -6
  507. package/app/.next-cli-build/server/chunks/5299.js +3 -3
  508. package/app/.next-cli-build/server/chunks/5308.js +1 -1
  509. package/app/.next-cli-build/server/chunks/5330.js +10 -10
  510. package/app/.next-cli-build/server/chunks/5615.js +2 -2
  511. package/app/.next-cli-build/server/chunks/6070.js +1 -1
  512. package/app/.next-cli-build/server/chunks/615.js +1 -1
  513. package/app/.next-cli-build/server/chunks/6171.js +1 -1
  514. package/app/.next-cli-build/server/chunks/6638.js +1 -1
  515. package/app/.next-cli-build/server/chunks/6763.js +1 -1
  516. package/app/.next-cli-build/server/chunks/6921.js +15 -11
  517. package/app/.next-cli-build/server/chunks/6983.js +1 -1
  518. package/app/.next-cli-build/server/chunks/7187.js +1 -1
  519. package/app/.next-cli-build/server/chunks/7220.js +1 -1
  520. package/app/.next-cli-build/server/chunks/7247.js +1 -1
  521. package/app/.next-cli-build/server/chunks/7716.js +1 -1
  522. package/app/.next-cli-build/server/chunks/778.js +1 -1
  523. package/app/.next-cli-build/server/chunks/7843.js +1 -1
  524. package/app/.next-cli-build/server/chunks/794.js +1 -1
  525. package/app/.next-cli-build/server/chunks/8238.js +1 -1
  526. package/app/.next-cli-build/server/chunks/8251.js +1 -1
  527. package/app/.next-cli-build/server/chunks/8271.js +1 -1
  528. package/app/.next-cli-build/server/chunks/8402.js +1 -1
  529. package/app/.next-cli-build/server/chunks/8623.js +3 -3
  530. package/app/.next-cli-build/server/chunks/8895.js +4 -4
  531. package/app/.next-cli-build/server/chunks/8920.js +1 -1
  532. package/app/.next-cli-build/server/chunks/9287.js +1 -0
  533. package/app/.next-cli-build/server/chunks/9289.js +1 -0
  534. package/app/.next-cli-build/server/chunks/9489.js +1 -1
  535. package/app/.next-cli-build/server/instrumentation.js +1 -1
  536. package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
  537. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  538. package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
  539. package/app/.next-cli-build/server/middleware.js +1 -1
  540. package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
  541. package/app/.next-cli-build/server/pages/404.html +1 -1
  542. package/app/.next-cli-build/server/pages/500.html +1 -1
  543. package/app/.next-cli-build/server/preview-props.json +3 -3
  544. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  545. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  546. package/app/.next-cli-build/static/chunks/1321-fe52dc90990db91b.js +1 -0
  547. package/app/.next-cli-build/static/chunks/4285-8e8fd1dc26ade67d.js +1 -0
  548. package/app/.next-cli-build/static/chunks/{5497-11663c3e80a3cf5a.js → 5497-abf32427a085ebfc.js} +2 -2
  549. package/app/.next-cli-build/static/chunks/{761-c9086970fe03f4a1.js → 761-53a017633cce939e.js} +3 -3
  550. package/app/.next-cli-build/static/chunks/9233.e1c3403556983abd.js +69 -0
  551. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-48ac55fc1ff50baa.js +69 -0
  552. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-3c63a3db19c1a67b.js +27 -0
  553. package/app/.next-cli-build/static/chunks/{webpack-6463d5fe66fbfc78.js → webpack-d230ecbd7bd706e6.js} +1 -1
  554. package/app/.next-cli-build/static/css/b58b1123edb3578f.css +1 -0
  555. package/app/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +26 -13
  556. package/app/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +6 -3
  557. package/app/node_modules/@aws-sdk/core/package.json +3 -3
  558. package/app/node_modules/@aws-sdk/credential-provider-cognito-identity/package.json +3 -3
  559. package/app/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
  560. package/app/node_modules/@aws-sdk/credential-provider-http/package.json +4 -4
  561. package/app/node_modules/@aws-sdk/credential-provider-ini/package.json +10 -10
  562. package/app/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
  563. package/app/node_modules/@aws-sdk/credential-provider-node/package.json +8 -8
  564. package/app/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
  565. package/app/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
  566. package/app/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
  567. package/app/node_modules/@aws-sdk/credential-providers/package.json +13 -13
  568. package/app/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  569. package/app/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  570. package/app/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  571. package/app/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  572. package/app/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  573. package/app/node_modules/@aws-sdk/nested-clients/package.json +5 -5
  574. package/app/node_modules/@aws-sdk/signature-v4-multi-region/package.json +1 -1
  575. package/app/node_modules/@aws-sdk/token-providers/package.json +4 -4
  576. package/app/node_modules/@aws-sdk/xml-builder/package.json +1 -1
  577. package/app/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +13 -37
  578. package/app/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +44 -29
  579. package/app/node_modules/@smithy/core/package.json +1 -1
  580. package/app/node_modules/@smithy/node-http-handler/dist-cjs/index.js +48 -6
  581. package/app/node_modules/@smithy/node-http-handler/package.json +3 -3
  582. package/app/node_modules/baseline-browser-mapping/dist/index.cjs +1 -1
  583. package/app/node_modules/baseline-browser-mapping/package.json +1 -1
  584. package/app/node_modules/bowser/es5.js +14 -1
  585. package/app/node_modules/bowser/package.json +90 -31
  586. package/app/node_modules/sql.js/dist/sql-wasm.js +93 -92
  587. package/app/node_modules/sql.js/package.json +1 -1
  588. package/app/open-sse/lib/deepseek-pow-hash.js +114 -428
  589. package/app/package.json +1 -1
  590. package/app/public/providers/nace.png +0 -0
  591. package/app/src/mitm/server.js +38 -34
  592. package/package.json +1 -1
  593. package/app/.next-cli-build/server/chunks/4125.js +0 -1
  594. package/app/.next-cli-build/server/chunks/5840.js +0 -1
  595. package/app/.next-cli-build/server/chunks/6140.js +0 -1
  596. package/app/.next-cli-build/server/chunks/7732.js +0 -1
  597. package/app/.next-cli-build/server/chunks/8499.js +0 -23
  598. package/app/.next-cli-build/static/chunks/1321-d42a1c66e9cf1a99.js +0 -1
  599. package/app/.next-cli-build/static/chunks/4285-e97c3151f30199d8.js +0 -1
  600. package/app/.next-cli-build/static/chunks/9233.b5ad25d75f88baa7.js +0 -65
  601. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-d61866af0fa7b54f.js +0 -69
  602. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-44c9bfdcf25db09b.js +0 -27
  603. package/app/.next-cli-build/static/css/0a4c443a8a7225f7.css +0 -1
  604. /package/app/.next-cli-build/static/{MoWT_XpUp-bKSt7-wK19U → i1Kua3lBkcnBzhQ70lbQO}/_buildManifest.js +0 -0
  605. /package/app/.next-cli-build/static/{MoWT_XpUp-bKSt7-wK19U → i1Kua3lBkcnBzhQ70lbQO}/_ssgManifest.js +0 -0
@@ -41,7 +41,7 @@ devin --version`}},opendesign:{id:"opendesign",name:"OpenDesign",image:"/provide
41
41
  gemini extensions install https://github.com/manalkaff/opendesign
42
42
 
43
43
  # OpenCode
44
- # Fetch and follow .opencode/INSTALL.md from the repo`}},pi:{id:"pi",name:"Pi (pi-coding-agent)",image:"/providers/pi.svg",color:"#6366F1",description:"Pi coding agent — minimal, extensible agent harness (pi.dev)",configType:"custom",docsUrl:"https://pi.dev",notes:[{type:"info",text:"Pi uses ~/.pi/agent/models.json. 9Router is configured under providers.9router as an OpenAI-compatible endpoint."}]},omp:{id:"omp",name:"Oh My Pi",image:"/providers/omp.png",color:"#EC4899",description:"Oh My Pi terminal AI agent with auto-discovery support",configType:"custom",docsUrl:"https://github.com/can1357/oh-my-pi",notes:[{type:"info",text:"Oh My Pi uses ~/.omp/agent/models.yml and agent.db. 9Router is configured with proxy discovery so all models appear automatically under /model."}]},crush:{id:"crush",name:"Crush",image:"/providers/crush.png",color:"#FB923C",description:"Charm Crush terminal AI coding agent",configType:"custom",docsUrl:"https://github.com/charmbracelet/crush",notes:[{type:"info",text:"Crush uses ~/.config/crush/crush.json. 9Router registers as an openai-compat provider."}]},forge:{id:"forge",name:"ForgeCode",image:"/providers/forge.png",color:"#EAB308",description:"Antinomy HQ ForgeCode agent harness",configType:"custom",docsUrl:"https://github.com/antinomyhq/forge",notes:[{type:"info",text:"ForgeCode uses ~/.forge/config.toml. 9Router updates the [openai] section with your baseUrl, apiKey, and model."}]},smelt:{id:"smelt",name:"Smelt",image:"/providers/smelt.svg",color:"#EF4444",description:"Smelt terminal AI coding assistant",configType:"custom",docsUrl:"https://github.com/leonardcser/smelt",notes:[{type:"info",text:"Smelt uses ~/.smelt/config.json for OpenAI-compatible endpoint configuration."}]},codewhale:{id:"codewhale",name:"CodeWhale",image:"/providers/codewhale.svg",color:"#4F46E5",description:"CodeWhale terminal coding agent (successor to DeepSeek TUI)",configType:"custom",docsUrl:"https://github.com/Hmbown/CodeWhale",notes:[{type:"info",text:"CodeWhale uses ~/.codewhale/config.toml. 9Router configures the [openai] provider with your base_url, api_key, and model."}]}}},10761:(e,t,s)=>{s.d(t,{Tk:()=>I,aG:()=>X,Ah:()=>D,Q6:()=>Q,lF:()=>es,a7:()=>J,ZM:()=>z,WE:()=>em,E_:()=>ed,RF:()=>B,mW:()=>el,c9:()=>ee,gY:()=>ey,tA:()=>ep,kn:()=>eh,yZ:()=>K,qO:()=>V});var l=s(95155),a=s(12115),r=s(35497),i=s(5772),n=s(90620);function o({storageKey:e,changeEvent:t,itemField:s,normalize:l=e=>e,defaultName:a=e=>e}){let r=()=>{try{let t=JSON.parse(window.localStorage.getItem(e)||"[]");if(!Array.isArray(t))return[];return t.filter(e=>e?.name&&e?.[s])}catch{return[]}},i=s=>{window.localStorage.setItem(e,JSON.stringify(s)),window.dispatchEvent(new CustomEvent(t))};return{read:r,subscribe:e=>(window.addEventListener(t,e),()=>window.removeEventListener(t,e)),upsert:(e,t)=>{let n=l(e);if(!n)return null;let o=r(),d=o.find(e=>l(e[s])===n);if(d&&!t)return d.name;let c=(t||a(n)).trim();return c?(i([...o.filter(e=>e.name!==c&&l(e[s])!==n),{name:c,[s]:n}].sort((e,t)=>e.name.localeCompare(t.name))),c):null},remove:e=>i(r().filter(t=>t.name!==e))}}let d=e=>(e||"").replace(/\/+$/,""),c=o({storageKey:"9router.cliToolEndpointPresets",changeEvent:"9router:endpoint-presets-changed",itemField:"baseUrl",normalize:d,defaultName:e=>{try{return new URL(e).host}catch{return e}}}),m=o({storageKey:"9router.cliToolApiKeyPresets",changeEvent:"9router:api-key-presets-changed",itemField:"key"}),x=c.read,p=c.subscribe,u=c.upsert,h=c.remove,g=m.read,f=m.subscribe,y=m.upsert,b=m.remove;function j(e,{tunnelPublicUrl:t,tailscaleUrl:s,cloudUrl:l}={}){let a=d(e);return!a||[`http://127.0.0.1:${n.h0.appPort}`,t,s,l].filter(Boolean).flatMap(e=>[d(e),`${d(e)}/v1`]).includes(a)?null:u(a)}let v="__custom__",N="__save__",w=e=>{let t=(e||"").replace(/\/+$/,"");return t?/\/v1$/.test(t)?t:`${t}/v1`:""};function k({value:e,onChange:t,requiresExternalUrl:s=!1,tunnelEnabled:r=!1,tunnelPublicUrl:i="",tailscaleEnabled:o=!1,tailscaleUrl:c="",cloudEnabled:m=!1,cloudUrl:g="",withV1:f=!0,currentUrl:y=""}){let[b,j]=(0,a.useState)([]),[C,_]=(0,a.useState)(!1),[S,E]=(0,a.useState)(""),[A,O]=(0,a.useState)(""),$=(0,a.useRef)(!1),M=(0,a.useRef)(""),I=(0,a.useRef)("");(0,a.useEffect)(()=>{let e=()=>{let e=x();j(e),E(t=>{if(t!==v)return t;let s=d(I.current);if(!s)return t;let l=e.find(e=>{let t=d(e.baseUrl);return t===s||t===w(s)});return l?`saved:${l.name}`:t})};return e(),_(!0),p(e)},[]);let U=(0,a.useMemo)(()=>(({requiresExternalUrl:e,tunnelEnabled:t,tunnelPublicUrl:s,tailscaleEnabled:l,tailscaleUrl:a,cloudEnabled:r,cloudUrl:i,savedPresets:o,withV1:d})=>{let c=[],m=e=>d?w(e):(e||"").replace(/\/+$/,"");if(!e){let e=m(`http://127.0.0.1:${n.h0.appPort}`);c.push({value:"local",label:e,url:e})}if(t&&s){let e=m(s);c.push({value:"tunnel",label:e,url:e})}if(l&&a){let e=m(a);c.push({value:"tailscale",label:e,url:e})}if(r&&i){let e=m(i);c.push({value:"cloud",label:e,url:e})}return o.forEach(e=>{c.push({value:`saved:${e.name}`,label:e.baseUrl,url:e.baseUrl,saved:!0})}),c.push({value:v,label:"Custom URL...",url:""}),c})({requiresExternalUrl:s,tunnelEnabled:r,tunnelPublicUrl:i,tailscaleEnabled:o,tailscaleUrl:c,cloudEnabled:m,cloudUrl:g,savedPresets:b,withV1:f}),[s,r,i,o,c,m,g,b,f]);(0,a.useEffect)(()=>{if(!C||0===U.length)return;let e=e=>f?w(e):d(e),s=e(y);if($.current&&M.current===s)return;$.current=!0,M.current=s;let l=s?U.find(t=>t.value!==v&&e(t.url)===s):null;if(l)O(""),I.current="",E(l.value),t(l.url);else if(s)O(s),I.current=s,E(v),t(s);else{let e=U.find(e=>e.value!==v);if(!e)return;E(e.value),t(e.url)}},[C,U,t,y,f]);let P=S.startsWith("saved:"),T=S===v,R=T&&(A||"").trim().length>0;return(0,l.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("select",{value:S,onChange:s=>{let l=s.target.value;if(l===N){let t=(e||"").trim();if(!t)return;let s=t;try{s=new URL(t).host}catch{}let l=window.prompt("Save endpoint as:",s),a=l?.trim()?u(t,l.trim()):null;a&&E(`saved:${a}`);return}if(E(l),l===v){O(""),t("");return}let a=U.find(e=>e.value===l);a&&t(a.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:[U.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value)),R&&(0,l.jsx)("option",{value:N,children:"+ Save current as..."})]}),P&&(0,l.jsx)("button",{type:"button",onClick:()=>{if(!S.startsWith("saved:"))return;h(S.slice(6)),O("");let e=U.find(e=>e.value!==v&&e.value!==S);e?(E(e.value),t(e.url)):(E(v),t(""))},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors shrink-0",title:"Delete saved endpoint",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]}),T&&(0,l.jsx)("input",{type:"text",value:A,onChange:e=>{let s=e.target.value;I.current=s,O(s),t(s)},placeholder:f?"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 C="__custom__",_="__save_key__";function S({value:e,onChange:t,apiKeys:s=[],cloudEnabled:r=!1,className:i=""}){let[n,o]=(0,a.useState)([]),[d,c]=(0,a.useState)(!1),[m,x]=(0,a.useState)("");(0,a.useEffect)(()=>{let e=()=>o(g());return e(),f(e)},[]);let p=(0,a.useMemo)(()=>[...s.map(e=>({value:e.key,label:e.key})),...n.map(e=>({value:`saved:${e.name}`,label:e.key,url:e.key,saved:!0})),{value:C,label:"Custom...",url:""}],[s,n]),u=e?p.find(t=>t.value===e||t.url===e):null,h=u?u.value:d||e?C:p[0]?.value??C,j=d?m:e||"",v="string"==typeof h&&h.startsWith("saved:"),N=h===C,w=N&&(e||"").trim().length>0&&!s.some(t=>t.key===e);return 0!==s.length||0!==n.length||d||e?(0,l.jsxs)("div",{className:`flex flex-col gap-1.5 ${i}`,children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("select",{value:h,onChange:s=>{let l=s.target.value;if(l===_)return void y((e||"").trim());if(l===C){c(!0),x(""),t("");return}c(!1),x("");let a=p.find(e=>e.value===l);a&&t(a.url??a.value)},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:[p.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value)),w&&(0,l.jsx)("option",{value:_,children:"+ Save current as..."})]}),v&&(0,l.jsx)("button",{type:"button",onClick:()=>{if(!v)return;b(h.slice(6)),c(!1),x("");let e=p.find(e=>e.value!==C&&e.value!==h);t(e?e.url??e.value:"")},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors shrink-0",title:"Delete saved key",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]}),N&&(0,l.jsx)("input",{type:"text",value:j,onChange:e=>{let s=e.target.value;c(!0),x(s),t(s)},placeholder:"sk-...",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,l.jsx)("span",{className:`min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5 ${i}`,children:r?"No API keys - Create one in Keys page":"sk_9router (default)"})}let E=e=>(e||"").replace(/\/+$/,"");function A(e,t={}){if(!e)return!1;let s=E(e),{tunnelPublicUrl:l,tailscaleUrl:a,cloudUrl:r}=t;return!!(/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(s)||l&&s.startsWith(E(l))||a&&s.startsWith(E(a))||r&&s.startsWith(E(r)))}let O=/\[1m\]$/i,$=s(41463).env.NEXT_PUBLIC_CLOUD_URL,M=[{label:"Default",value:""},{label:"200K",value:"198000"},{label:"300K",value:"298000"},{label:"500K",value:"498000"},{label:"700K",value:"698000"}];function I({tool:e,isExpanded:t,onToggle:s,activeProviders:n,modelMappings:o,onModelMappingChange:d,baseUrl:c,hasActiveProviders:m,apiKeys:x,cloudEnabled:p,initialStatus:u,tunnelEnabled:h,tunnelPublicUrl:g,tailscaleEnabled:f,tailscaleUrl:y}){let b,v,N,[w,C]=(0,a.useState)(u||null),[_,E]=(0,a.useState)(!1),[U,P]=(0,a.useState)(!1),[T,R]=(0,a.useState)(!1),[D,L]=(0,a.useState)(null),[z,K]=(0,a.useState)(!1),[F,q]=(0,a.useState)(!1),[H,B]=(0,a.useState)(null),[W,G]=(0,a.useState)(""),[J,V]=(0,a.useState)({}),[Y,Z]=(0,a.useState)(!1),[Q,X]=(0,a.useState)(""),[ee,et]=(0,a.useState)(!1),[es,el]=(0,a.useState)(!1),[ea,er]=(0,a.useState)(""),[ei,en]=(0,a.useState)(!1),eo=(0,a.useRef)(!1),ed=w?.settings?.env?.ANTHROPIC_BASE_URL||"",ec=(()=>{if(!w?.installed)return null;let e=w.settings?.env?.ANTHROPIC_BASE_URL;return e?A(e,{tunnelPublicUrl:g,tailscaleUrl:y,cloudUrl:p?$:null})?"configured":"other":"not_configured"})();(0,a.useEffect)(()=>{x?.length>0&&!W&&G(x[0].key)},[x,W]),(0,a.useEffect)(()=>{u&&(C(u),el(!!u.exaMcpEnabled))},[u]),(0,a.useEffect)(()=>{er(w?.settings?.env?.CLAUDE_CODE_AUTO_COMPACT_WINDOW||"")},[w?.settings?.env?.CLAUDE_CODE_AUTO_COMPACT_WINDOW]),(0,a.useEffect)(()=>{let t=w?.settings?.env;t&&en(e.defaultModels.some(e=>t[e.envKey]?.endsWith("[1m]")))},[w?.settings?.env,e.defaultModels]),(0,a.useEffect)(()=>{t&&(w||ep(),ex())},[t]),(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{et(!!e.ccFilterNaming)}).catch(()=>{})},[]);let em=async e=>{let t=e.target.checked;et(t),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:t})}).catch(()=>{})},ex=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&V(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(w?.installed&&!eo.current){eo.current=!0;let t=w.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&d(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&G(s)}},[w,x,e.defaultModels,d]);let ep=async()=>{E(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();C(t),el(!!t.exaMcpEnabled)}catch(e){C({installed:!1,error:e.message})}finally{E(!1)}},eu=()=>{let e=Q||c;return e.endsWith("/v1")?e:`${e}/v1`},eh=async()=>{P(!0),L(null);try{let t={ANTHROPIC_BASE_URL:eu()},s=W?.trim()||(x?.length>0?x[0].key:null)||(p?null:"sk_9router");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=o[e.alias];s&&e.envKey&&(t[e.envKey]=s)}),ea&&(t.CLAUDE_CODE_AUTO_COMPACT_WINDOW=ea);let l=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t,exaMcpEnabled:es,autoCompactWindow:ea})}),a=await l.json();l.ok?(j(eu(),{tunnelPublicUrl:g,tailscaleUrl:y}),L({type:"success",text:"Settings applied successfully!"}),C(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t},exaMcpEnabled:es}))):L({type:"error",text:a.error||"Failed to apply settings"})}catch(e){L({type:"error",text:e.message})}finally{P(!1)}},eg=async()=>{R(!0),L(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(L({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>d(e.alias,e.defaultValue||"")),G(""),el(!1),er(""),en(!1)):L({type:"error",text:s.error||"Failed to reset settings"})}catch(e){L({type:"error",text:e.message})}finally{R(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.A,{src:"/providers/claude.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===ec&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===ec&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===ec&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[_&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude CLI..."})]}),!_&&w&&!w.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>Z(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>K(!z),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:z?"expand_less":"help"}),z?"Hide":"How to Install"]})]})]}),z&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!_&&w?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(k,{value:Q||((b=Q||c).endsWith("/v1")?b:`${b}/v1`),onChange:X,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:h,tunnelPublicUrl:g,tailscaleEnabled:f,tailscaleUrl:y,currentUrl:ed})]}),w?.settings?.env?.ANTHROPIC_BASE_URL&&(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.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.settings.env.ANTHROPIC_BASE_URL})]}),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(S,{value:W,onChange:G,apiKeys:x,cloudEnabled:p})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,l.jsxs)("div",{className:"relative flex-1 min-w-0",children:[(0,l.jsx)("input",{type:"text",value:o[e.alias]||"",onChange:t=>d(e.alias,t.target.value),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"}),o[e.alias]&&(0,l.jsx)("button",{onClick:()=>d(e.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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>{B(e.alias),q(!0)},disabled:!m,className:`rounded border px-2.5 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap shrink-0 ${m?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]})]},e.alias)),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Auto-compact"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("select",{value:ea,onChange:e=>er(e.target.value),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",children:M.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.label))})]}),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"1M context"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:ei,onChange:t=>{var s;en(s=t.target.checked),e.defaultModels.forEach(e=>{let t=o[e.alias];t&&d(e.alias,((e,t)=>{let{model:s}=function(e){if("string"!=typeof e)return{model:e,contextMarker:null};let t=e.trim(),s=t.match(O);return s?{model:t.slice(0,-s[0].length),contextMarker:s[0].slice(1,-1).toLowerCase()}:{model:e,contextMarker:null}}(e);return t?`${s}[1m]`:s})(t,s))})},className:"w-3.5 h-3.5 accent-primary cursor-pointer shrink-0"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Append [1m] to the model name"}),(0,l.jsx)(r.m_,{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,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Filter naming"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:ee,onChange:em,className:"w-3.5 h-3.5 accent-primary cursor-pointer shrink-0"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"}),(0,l.jsx)(r.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Web Search"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:es,onChange:e=>el(e.target.checked),className:"w-3.5 h-3.5 accent-primary cursor-pointer shrink-0"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Exa MCP"}),(0,l.jsx)(r.m_,{text:"Injects Exa MCP into ~/.claude.json so non-Claude models gain web search. Restart Claude Code after Apply.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]})]}),D&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===D.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===D.type?"check_circle":"error"}),(0,l.jsx)("span",{children:D.text})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:eh,disabled:!m,loading:U,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:eg,disabled:!w?.has9Router,loading:T,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>Z(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),F&&(0,l.jsx)(r.rq,{isOpen:F,onClose:()=>q(!1),onSelect:e=>{H&&d(H,e.value)},selectedModel:H?o[H]:null,activeProviders:n,modelAliases:J,title:`Select model for ${H}`}),(0,l.jsx)(r.uR,{isOpen:Y,onClose:()=>Z(!1),title:"Claude CLI - Manual Configuration",configs:(v=W&&W.trim()?W:p?"<API_KEY_FROM_DASHBOARD>":"sk_9router",N={ANTHROPIC_BASE_URL:eu(),ANTHROPIC_AUTH_TOKEN:v},e.defaultModels.forEach(e=>{let t=o[e.alias];t&&e.envKey&&(N[e.envKey]=t)}),ea&&(N.CLAUDE_CODE_AUTO_COMPACT_WINDOW=ea),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:N},null,2)}])})]})}var U=s(57250);let P=(e,t)=>{let s=e.match(RegExp(`^\\s*${t}\\s*=\\s*(["'])([^\\n]*?)\\1\\s*(?:#.*)?$`));return s?s[2]:""};function T(e){if("string"!=typeof e)return{baseUrl:"",apiKey:""};let t=e.split(/\r?\n/),s="",l=!0;for(let e of t){if(/^\s*\[/.test(e)){l=!1;continue}l&&(s=P(e,"model_provider")||s)}if(!s)return{baseUrl:"",apiKey:""};let a=`model_providers.${s}`,r=!1,i=!1,n="",o="";for(let e of t){let t=e.match(/^\s*\[\s*([^\]]+?)\s*\]\s*(?:#.*)?$/);if(t){r=t[1]===a,i=t[1]===`${a}.http_headers`;continue}if(r&&(n=P(e,"base_url")||n),i){let t=P(e,"Authorization").match(/^Bearer\s+(.+)$/i);o=t?t[1]:o}}return{baseUrl:n,apiKey:o}}function R(e,t=[]){if(!e||"string"!=typeof e)return"model";let s="",l=e.trim();"config"===(s=(s=l.includes("/")?l.split("/")[0].toLowerCase().replace(/[^a-z0-9_-]/g,""):l.toLowerCase().replace(/[^a-z0-9_-]/g,"")).replace(/^[-_]+|[-_]+$/g,"")||"model")&&(s="model-config");let a=s,r=2;for(;t.includes(a);)a=`${s}-${r}`,r++;return a}function D({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d,cloudEnabled:c,initialStatus:m,tunnelEnabled:x,tunnelPublicUrl:p,tailscaleEnabled:u,tailscaleUrl:h}){let g,f,[y,b]=(0,a.useState)(m||null),[v,N]=(0,a.useState)(!1),[w,C]=(0,a.useState)(!1),[_,E]=(0,a.useState)(!1),[O,$]=(0,a.useState)(null),[M,I]=(0,a.useState)(!1),[P,L]=(0,a.useState)(""),[z,K]=(0,a.useState)(""),[F,q]=(0,a.useState)(""),[H,B]=(0,a.useState)(!1),[W,G]=(0,a.useState)(!1),[J,V]=(0,a.useState)({}),[Y,Z]=(0,a.useState)(!1),[Q,X]=(0,a.useState)(""),[ee,et]=(0,a.useState)([]),[es,el]=(0,a.useState)(""),[ea,er]=(0,a.useState)(""),[ei,en]=(0,a.useState)(!1),[eo,ed]=(0,a.useState)(!1),[ec,em]=(0,a.useState)(null),[ex,ep]=(0,a.useState)("");(0,a.useEffect)(()=>{eh()},[]),(0,a.useEffect)(()=>{!(o?.length>0)||P||y?.config||L(o[0].key)},[o,P,y?.config]),(0,a.useEffect)(()=>{m&&b(m)},[m]),(0,a.useEffect)(()=>{t&&(y||eN(),eu(),eh())},[t]);let eu=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&V(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}},eh=async()=>{try{let e=await fetch("/api/cli-tools/codex-profiles"),t=await e.json();e.ok&&et(t.profiles||[])}catch(e){console.log("Error fetching codex profiles:",e)}},eg=async()=>{let e=es.trim().toLowerCase().replace(/[^a-z0-9_-]/g,""),t=ea.trim();if(e&&t){ed(!0);try{let s=await fetch("/api/cli-tools/codex-profiles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,model:t})}),l=await s.json();s.ok?(el(""),er(""),eh()):$({type:"error",text:l.error||"Failed to add model"})}catch(e){$({type:"error",text:e.message})}finally{ed(!1)}}},ef=async e=>{em(e);try{(await fetch("/api/cli-tools/codex-profiles",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})})).ok&&eh()}catch(e){console.log("Error deleting codex profile:",e)}finally{em(null)}},ey=async e=>{try{await navigator.clipboard.writeText(e),ep(e),setTimeout(()=>ep(""),2e3)}catch(e){console.log("Copy failed",e)}};(0,a.useEffect)(()=>{let e=y?.config;if(e){let{baseUrl:t,apiKey:s}=T(e);X(t),L(s);let l=e.match(/^model\s*=\s*"([^"]+)"/m);l&&K(l[1]);let a=e.match(/^default_subagent_model\s*=\s*"([^"]+)"/m);a&&q(a[1])}},[y?.config]);let eb=T(y?.config).baseUrl,ej=y?.installed?y.config?A(eb,{tunnelPublicUrl:p,tailscaleUrl:h})?"configured":"other":"not_configured":null,ev=()=>{let e=(Q||`${n}/v1`).replace(/\/+$/,"");return e.endsWith("/v1")?e:`${e}/v1`},eN=async()=>{N(!0);try{let e=await fetch("/api/cli-tools/codex-settings",{cache:"no-store"}),t=await e.json();b(t)}catch(e){b({installed:!1,error:e.message})}finally{N(!1)}},ew=async()=>{C(!0),$(null);try{let e=P&&P.trim()||c?P:"sk_9router",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ev(),apiKey:e,model:z,subagentModel:F||z})}),s=await t.json();t.ok?(j(ev(),{tunnelPublicUrl:p,tailscaleUrl:h}),$({type:"success",text:"Settings applied successfully!"}),eN()):$({type:"error",text:s.error||"Failed to apply settings"})}catch(e){$({type:"error",text:e.message})}finally{C(!1)}},ek=async()=>{E(!0),$(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?($({type:"success",text:"Settings reset successfully!"}),K(""),q(""),eN()):$({type:"error",text:t.error||"Failed to reset settings"})}catch(e){$({type:"error",text:e.message})}finally{E(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.A,{src:"/providers/codex.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===ej&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===ej&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===ej&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[v&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Codex CLI..."})]}),!v&&y&&!y.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>Z(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>I(!M),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:M?"expand_less":"help"}),M?"Hide":"How to Install"]})]})]}),M&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,l.jsx)("div",{className:"pt-2 border-t border-border",children:(0,l.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex reads custom providers from ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/config.toml"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!v&&y?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(k,{value:Q||Q||`${n}/v1`,onChange:X,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:x,tunnelPublicUrl:p,tailscaleEnabled:u,tailscaleUrl:h,currentUrl:eb})]}),y?.config&&(eb?(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.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:eb})]}):null),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(S,{value:P,onChange:L,apiKeys:o,cloudEnabled:c})]}),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:z,onChange:e=>K(e.target.value),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"}),z&&(0,l.jsx)("button",{onClick:()=>K(""),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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>B(!0),disabled:!d?.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 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]}),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:F,onChange:e=>q(e.target.value),placeholder:z||"provider/model-id (defaults to main 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"}),F&&(0,l.jsx)("button",{onClick:()=>q(""),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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>G(!0),disabled:!d?.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 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),O&&(0,l.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":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===O.type?"check_circle":"error"}),(0,l.jsx)("span",{children:O.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:ew,disabled:!P&&c&&o.length>0||!z,loading:w,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:ek,disabled:_,loading:_,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>Z(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]}),(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-3",children:[(0,l.jsx)("div",{className:"flex items-center justify-between",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("span",{className:"text-xs font-semibold text-text-main flex items-center gap-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"layers"}),"Additional Models"]}),ee.length>0&&(0,l.jsx)("span",{className:"px-1.5 py-0.2 bg-primary/10 text-primary text-[10px] font-medium rounded-full",children:ee.length})]})}),(0,l.jsx)("div",{className:"flex flex-col gap-1.5 p-2.5 bg-surface/40 border border-border rounded-lg",children:(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-[10rem_1fr_auto_auto] sm:items-center",children:[(0,l.jsx)("input",{type:"text",value:es,onChange:e=>el(e.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:e=>"Enter"===e.key&&eg()}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:ea,onChange:e=>{let t=e.target.value;er(t),el(R(t.includes("/")?t.split("/")[0]:t,ee.map(e=>e.name)))},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:e=>"Enter"===e.key&&eg()}),ea&&(0,l.jsx)("button",{onClick:()=>er(""),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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>en(!0),disabled:!d?.length,className:`w-full sm:w-auto rounded border px-2.5 py-1.5 text-xs transition-colors whitespace-nowrap sm:shrink-0 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:eg,disabled:!es.trim()||!ea.trim()||eo,loading:eo,className:"!h-7.5 whitespace-nowrap",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[15px] mr-1",children:"add"}),"Add"]})]})}),0===ee.length?(0,l.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,l.jsx)("span",{className:"material-symbols-outlined text-[20px] text-text-muted mb-1 opacity-60",children:"terminal"}),(0,l.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,l.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ee.map(e=>{let t=e.model.includes("/")?e.model.split("/")[0]:e.name,s=ex===e.command;return(0,l.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,l.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,l.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,l.jsx)(U.A,{providerId:t,size:18,fallbackText:e.name.slice(0,2).toUpperCase()})}),(0,l.jsxs)("div",{className:"min-w-0 flex flex-col",children:[(0,l.jsx)("span",{className:"font-medium text-xs text-text-main truncate",children:e.name}),(0,l.jsx)("span",{className:"text-[11px] text-text-muted truncate font-mono",children:e.model})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,l.jsxs)("button",{onClick:()=>ey(e.command),className:`flex items-center gap-1 px-2 py-1 rounded text-[11px] font-mono border transition-all ${s?"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,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:s?"check":"terminal"}),(0,l.jsx)("span",{className:"hidden md:inline",children:e.command}),(0,l.jsx)("span",{className:"md:hidden",children:"copy"})]}),(0,l.jsx)("button",{onClick:()=>ef(e.name),disabled:ec===e.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,l.jsx)("span",{className:"material-symbols-outlined text-[15px]",children:"close"})})]})]},e.name)})})]})]})]}),H&&(0,l.jsx)(r.rq,{isOpen:H,onClose:()=>B(!1),onSelect:e=>{K(e.value),F||q(e.value),B(!1)},selectedModel:z,activeProviders:d,modelAliases:J,title:"Select Model for Codex"}),W&&(0,l.jsx)(r.rq,{isOpen:W,onClose:()=>G(!1),onSelect:e=>{q(e.value),G(!1)},selectedModel:F,activeProviders:d,modelAliases:J,title:"Select Subagent Model for Codex"}),ei&&(0,l.jsx)(r.rq,{isOpen:ei,onClose:()=>en(!1),onSelect:e=>{en(!1);let t=e?.value||e?.id;t&&(er(t),el(R(e?.provider||(t.includes("/")?t.split("/")[0]:t),ee.map(e=>e.name))))},selectedModel:ea,activeProviders:d,modelAliases:J,title:"Select Model for Codex CLI"}),(0,l.jsx)(r.uR,{isOpen:Y,onClose:()=>Z(!1),title:"Codex CLI - Manual Configuration",configs:(g=P&&P.trim()?P:c?"<API_KEY_FROM_DASHBOARD>":"sk_9router",f=F||z,[{filename:"~/.codex/config.toml",content:`# 9Router Configuration for Codex CLI
44
+ # Fetch and follow .opencode/INSTALL.md from the repo`}},pi:{id:"pi",name:"Pi (pi-coding-agent)",image:"/providers/pi.svg",color:"#6366F1",description:"Pi coding agent — minimal, extensible agent harness (pi.dev)",configType:"custom",docsUrl:"https://pi.dev",notes:[{type:"info",text:"Pi uses ~/.pi/agent/models.json. 9Router is configured under providers.9router as an OpenAI-compatible endpoint."}]},omp:{id:"omp",name:"Oh My Pi",image:"/providers/omp.png",color:"#EC4899",description:"Oh My Pi terminal AI agent with auto-discovery support",configType:"custom",docsUrl:"https://github.com/can1357/oh-my-pi",notes:[{type:"info",text:"Oh My Pi uses ~/.omp/agent/models.yml and agent.db. 9Router is configured with proxy discovery so all models appear automatically under /model."}]},crush:{id:"crush",name:"Crush",image:"/providers/crush.png",color:"#FB923C",description:"Charm Crush terminal AI coding agent",configType:"custom",docsUrl:"https://github.com/charmbracelet/crush",notes:[{type:"info",text:"Crush uses ~/.config/crush/crush.json. 9Router registers as an openai-compat provider."}]},forge:{id:"forge",name:"ForgeCode",image:"/providers/forge.png",color:"#EAB308",description:"Antinomy HQ ForgeCode agent harness",configType:"custom",docsUrl:"https://github.com/antinomyhq/forge",notes:[{type:"info",text:"ForgeCode uses ~/.forge/config.toml. 9Router updates the [openai] section with your baseUrl, apiKey, and model."}]},smelt:{id:"smelt",name:"Smelt",image:"/providers/smelt.svg",color:"#EF4444",description:"Smelt terminal AI coding assistant",configType:"custom",docsUrl:"https://github.com/leonardcser/smelt",notes:[{type:"info",text:"Smelt uses ~/.smelt/config.json for OpenAI-compatible endpoint configuration."}]},codewhale:{id:"codewhale",name:"CodeWhale",image:"/providers/codewhale.svg",color:"#4F46E5",description:"CodeWhale terminal coding agent (successor to DeepSeek TUI)",configType:"custom",docsUrl:"https://github.com/Hmbown/CodeWhale",notes:[{type:"info",text:"CodeWhale uses ~/.codewhale/config.toml. 9Router configures the [openai] provider with your base_url, api_key, and model."}]}}},10761:(e,t,s)=>{s.d(t,{Tk:()=>I,aG:()=>X,Ah:()=>D,Q6:()=>Q,lF:()=>es,a7:()=>J,ZM:()=>z,WE:()=>eb,E_:()=>ed,RF:()=>B,mW:()=>el,c9:()=>ee,gY:()=>e_,tA:()=>ev,kn:()=>ew,yZ:()=>K,qO:()=>V});var l=s(95155),a=s(12115),r=s(35497),i=s(5772),n=s(90620);function o({storageKey:e,changeEvent:t,itemField:s,normalize:l=e=>e,defaultName:a=e=>e}){let r=()=>{try{let t=JSON.parse(window.localStorage.getItem(e)||"[]");if(!Array.isArray(t))return[];return t.filter(e=>e?.name&&e?.[s])}catch{return[]}},i=s=>{window.localStorage.setItem(e,JSON.stringify(s)),window.dispatchEvent(new CustomEvent(t))};return{read:r,subscribe:e=>(window.addEventListener(t,e),()=>window.removeEventListener(t,e)),upsert:(e,t)=>{let n=l(e);if(!n)return null;let o=r(),d=o.find(e=>l(e[s])===n);if(d&&!t)return d.name;let c=(t||a(n)).trim();return c?(i([...o.filter(e=>e.name!==c&&l(e[s])!==n),{name:c,[s]:n}].sort((e,t)=>e.name.localeCompare(t.name))),c):null},remove:e=>i(r().filter(t=>t.name!==e))}}let d=e=>(e||"").replace(/\/+$/,""),c=o({storageKey:"9router.cliToolEndpointPresets",changeEvent:"9router:endpoint-presets-changed",itemField:"baseUrl",normalize:d,defaultName:e=>{try{return new URL(e).host}catch{return e}}}),m=o({storageKey:"9router.cliToolApiKeyPresets",changeEvent:"9router:api-key-presets-changed",itemField:"key"}),x=c.read,p=c.subscribe,u=c.upsert,h=c.remove,g=m.read,f=m.subscribe,y=m.upsert,b=m.remove;function j(e,{tunnelPublicUrl:t,tailscaleUrl:s,cloudUrl:l}={}){let a=d(e);return!a||[`http://127.0.0.1:${n.h0.appPort}`,t,s,l].filter(Boolean).flatMap(e=>[d(e),`${d(e)}/v1`]).includes(a)?null:u(a)}let v="__custom__",N="__save__",w=e=>{let t=(e||"").replace(/\/+$/,"");return t?/\/v1$/.test(t)?t:`${t}/v1`:""};function k({value:e,onChange:t,requiresExternalUrl:s=!1,tunnelEnabled:r=!1,tunnelPublicUrl:i="",tailscaleEnabled:o=!1,tailscaleUrl:c="",cloudEnabled:m=!1,cloudUrl:g="",withV1:f=!0,currentUrl:y=""}){let[b,j]=(0,a.useState)([]),[C,_]=(0,a.useState)(!1),[S,E]=(0,a.useState)(""),[A,O]=(0,a.useState)(""),$=(0,a.useRef)(!1),M=(0,a.useRef)(""),I=(0,a.useRef)("");(0,a.useEffect)(()=>{let e=()=>{let e=x();j(e),E(t=>{if(t!==v)return t;let s=d(I.current);if(!s)return t;let l=e.find(e=>{let t=d(e.baseUrl);return t===s||t===w(s)});return l?`saved:${l.name}`:t})};return e(),_(!0),p(e)},[]);let U=(0,a.useMemo)(()=>(({requiresExternalUrl:e,tunnelEnabled:t,tunnelPublicUrl:s,tailscaleEnabled:l,tailscaleUrl:a,cloudEnabled:r,cloudUrl:i,savedPresets:o,withV1:d})=>{let c=[],m=e=>d?w(e):(e||"").replace(/\/+$/,"");if(!e){let e=m(`http://127.0.0.1:${n.h0.appPort}`);c.push({value:"local",label:e,url:e})}if(t&&s){let e=m(s);c.push({value:"tunnel",label:e,url:e})}if(l&&a){let e=m(a);c.push({value:"tailscale",label:e,url:e})}if(r&&i){let e=m(i);c.push({value:"cloud",label:e,url:e})}return o.forEach(e=>{c.push({value:`saved:${e.name}`,label:e.baseUrl,url:e.baseUrl,saved:!0})}),c.push({value:v,label:"Custom URL...",url:""}),c})({requiresExternalUrl:s,tunnelEnabled:r,tunnelPublicUrl:i,tailscaleEnabled:o,tailscaleUrl:c,cloudEnabled:m,cloudUrl:g,savedPresets:b,withV1:f}),[s,r,i,o,c,m,g,b,f]);(0,a.useEffect)(()=>{if(!C||0===U.length)return;let e=e=>f?w(e):d(e),s=e(y);if($.current&&M.current===s)return;$.current=!0,M.current=s;let l=s?U.find(t=>t.value!==v&&e(t.url)===s):null;if(l)O(""),I.current="",E(l.value),t(l.url);else if(s)O(s),I.current=s,E(v),t(s);else{let e=U.find(e=>e.value!==v);if(!e)return;E(e.value),t(e.url)}},[C,U,t,y,f]);let P=S.startsWith("saved:"),T=S===v,R=T&&(A||"").trim().length>0;return(0,l.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("select",{value:S,onChange:s=>{let l=s.target.value;if(l===N){let t=(e||"").trim();if(!t)return;let s=t;try{s=new URL(t).host}catch{}let l=window.prompt("Save endpoint as:",s),a=l?.trim()?u(t,l.trim()):null;a&&E(`saved:${a}`);return}if(E(l),l===v){O(""),t("");return}let a=U.find(e=>e.value===l);a&&t(a.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:[U.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value)),R&&(0,l.jsx)("option",{value:N,children:"+ Save current as..."})]}),P&&(0,l.jsx)("button",{type:"button",onClick:()=>{if(!S.startsWith("saved:"))return;h(S.slice(6)),O("");let e=U.find(e=>e.value!==v&&e.value!==S);e?(E(e.value),t(e.url)):(E(v),t(""))},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors shrink-0",title:"Delete saved endpoint",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]}),T&&(0,l.jsx)("input",{type:"text",value:A,onChange:e=>{let s=e.target.value;I.current=s,O(s),t(s)},placeholder:f?"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 C="__custom__",_="__save_key__";function S({value:e,onChange:t,apiKeys:s=[],cloudEnabled:r=!1,className:i=""}){let[n,o]=(0,a.useState)([]),[d,c]=(0,a.useState)(!1),[m,x]=(0,a.useState)("");(0,a.useEffect)(()=>{let e=()=>o(g());return e(),f(e)},[]);let p=(0,a.useMemo)(()=>[...s.map(e=>({value:e.key,label:e.key})),...n.map(e=>({value:`saved:${e.name}`,label:e.key,url:e.key,saved:!0})),{value:C,label:"Custom...",url:""}],[s,n]),u=e?p.find(t=>t.value===e||t.url===e):null,h=u?u.value:d||e?C:p[0]?.value??C,j=d?m:e||"",v="string"==typeof h&&h.startsWith("saved:"),N=h===C,w=N&&(e||"").trim().length>0&&!s.some(t=>t.key===e);return 0!==s.length||0!==n.length||d||e?(0,l.jsxs)("div",{className:`flex flex-col gap-1.5 ${i}`,children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("select",{value:h,onChange:s=>{let l=s.target.value;if(l===_)return void y((e||"").trim());if(l===C){c(!0),x(""),t("");return}c(!1),x("");let a=p.find(e=>e.value===l);a&&t(a.url??a.value)},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:[p.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value)),w&&(0,l.jsx)("option",{value:_,children:"+ Save current as..."})]}),v&&(0,l.jsx)("button",{type:"button",onClick:()=>{if(!v)return;b(h.slice(6)),c(!1),x("");let e=p.find(e=>e.value!==C&&e.value!==h);t(e?e.url??e.value:"")},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors shrink-0",title:"Delete saved key",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]}),N&&(0,l.jsx)("input",{type:"text",value:j,onChange:e=>{let s=e.target.value;c(!0),x(s),t(s)},placeholder:"sk-...",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,l.jsx)("span",{className:`min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5 ${i}`,children:r?"No API keys - Create one in Keys page":"sk_9router (default)"})}let E=e=>(e||"").replace(/\/+$/,"");function A(e,t={}){if(!e)return!1;let s=E(e),{tunnelPublicUrl:l,tailscaleUrl:a,cloudUrl:r}=t;return!!(/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(s)||l&&s.startsWith(E(l))||a&&s.startsWith(E(a))||r&&s.startsWith(E(r)))}let O=/\[1m\]$/i,$=s(41463).env.NEXT_PUBLIC_CLOUD_URL,M=[{label:"Default",value:""},{label:"200K",value:"198000"},{label:"300K",value:"298000"},{label:"500K",value:"498000"},{label:"700K",value:"698000"}];function I({tool:e,isExpanded:t,onToggle:s,activeProviders:n,modelMappings:o,onModelMappingChange:d,baseUrl:c,hasActiveProviders:m,apiKeys:x,cloudEnabled:p,initialStatus:u,tunnelEnabled:h,tunnelPublicUrl:g,tailscaleEnabled:f,tailscaleUrl:y}){let b,v,N,[w,C]=(0,a.useState)(u||null),[_,E]=(0,a.useState)(!1),[U,P]=(0,a.useState)(!1),[T,R]=(0,a.useState)(!1),[D,L]=(0,a.useState)(null),[z,K]=(0,a.useState)(!1),[F,q]=(0,a.useState)(!1),[H,B]=(0,a.useState)(null),[W,G]=(0,a.useState)(""),[J,V]=(0,a.useState)({}),[Y,Z]=(0,a.useState)(!1),[Q,X]=(0,a.useState)(""),[ee,et]=(0,a.useState)(!1),[es,el]=(0,a.useState)(!1),[ea,er]=(0,a.useState)(""),[ei,en]=(0,a.useState)(!1),eo=(0,a.useRef)(!1),ed=w?.settings?.env?.ANTHROPIC_BASE_URL||"",ec=(()=>{if(!w?.installed)return null;let e=w.settings?.env?.ANTHROPIC_BASE_URL;return e?A(e,{tunnelPublicUrl:g,tailscaleUrl:y,cloudUrl:p?$:null})?"configured":"other":"not_configured"})();(0,a.useEffect)(()=>{x?.length>0&&!W&&G(x[0].key)},[x,W]),(0,a.useEffect)(()=>{u&&(C(u),el(!!u.exaMcpEnabled))},[u]),(0,a.useEffect)(()=>{er(w?.settings?.env?.CLAUDE_CODE_AUTO_COMPACT_WINDOW||"")},[w?.settings?.env?.CLAUDE_CODE_AUTO_COMPACT_WINDOW]),(0,a.useEffect)(()=>{let t=w?.settings?.env;t&&en(e.defaultModels.some(e=>t[e.envKey]?.endsWith("[1m]")))},[w?.settings?.env,e.defaultModels]),(0,a.useEffect)(()=>{t&&(w||ep(),ex())},[t]),(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{et(!!e.ccFilterNaming)}).catch(()=>{})},[]);let em=async e=>{let t=e.target.checked;et(t),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:t})}).catch(()=>{})},ex=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&V(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(w?.installed&&!eo.current){eo.current=!0;let t=w.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&d(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&G(s)}},[w,x,e.defaultModels,d]);let ep=async()=>{E(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();C(t),el(!!t.exaMcpEnabled)}catch(e){C({installed:!1,error:e.message})}finally{E(!1)}},eu=()=>{let e=Q||c;return e.endsWith("/v1")?e:`${e}/v1`},eh=async()=>{P(!0),L(null);try{let t={ANTHROPIC_BASE_URL:eu()},s=W?.trim()||(x?.length>0?x[0].key:null)||(p?null:"sk_9router");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=o[e.alias];s&&e.envKey&&(t[e.envKey]=s)}),ea&&(t.CLAUDE_CODE_AUTO_COMPACT_WINDOW=ea);let l=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t,exaMcpEnabled:es,autoCompactWindow:ea})}),a=await l.json();l.ok?(j(eu(),{tunnelPublicUrl:g,tailscaleUrl:y}),L({type:"success",text:"Settings applied successfully!"}),C(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t},exaMcpEnabled:es}))):L({type:"error",text:a.error||"Failed to apply settings"})}catch(e){L({type:"error",text:e.message})}finally{P(!1)}},eg=async()=>{R(!0),L(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(L({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>d(e.alias,e.defaultValue||"")),G(""),el(!1),er(""),en(!1)):L({type:"error",text:s.error||"Failed to reset settings"})}catch(e){L({type:"error",text:e.message})}finally{R(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.A,{src:"/providers/claude.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===ec&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===ec&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===ec&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[_&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude CLI..."})]}),!_&&w&&!w.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>Z(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>K(!z),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:z?"expand_less":"help"}),z?"Hide":"How to Install"]})]})]}),z&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!_&&w?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(k,{value:Q||((b=Q||c).endsWith("/v1")?b:`${b}/v1`),onChange:X,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:h,tunnelPublicUrl:g,tailscaleEnabled:f,tailscaleUrl:y,currentUrl:ed})]}),w?.settings?.env?.ANTHROPIC_BASE_URL&&(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.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.settings.env.ANTHROPIC_BASE_URL})]}),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(S,{value:W,onChange:G,apiKeys:x,cloudEnabled:p})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,l.jsxs)("div",{className:"relative flex-1 min-w-0",children:[(0,l.jsx)("input",{type:"text",value:o[e.alias]||"",onChange:t=>d(e.alias,t.target.value),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"}),o[e.alias]&&(0,l.jsx)("button",{onClick:()=>d(e.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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>{B(e.alias),q(!0)},disabled:!m,className:`rounded border px-2.5 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap shrink-0 ${m?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]})]},e.alias)),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Auto-compact"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("select",{value:ea,onChange:e=>er(e.target.value),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",children:M.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.label))})]}),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"1M context"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:ei,onChange:t=>{var s;en(s=t.target.checked),e.defaultModels.forEach(e=>{let t=o[e.alias];t&&d(e.alias,((e,t)=>{let{model:s}=function(e){if("string"!=typeof e)return{model:e,contextMarker:null};let t=e.trim(),s=t.match(O);return s?{model:t.slice(0,-s[0].length),contextMarker:s[0].slice(1,-1).toLowerCase()}:{model:e,contextMarker:null}}(e);return t?`${s}[1m]`:s})(t,s))})},className:"w-3.5 h-3.5 accent-primary cursor-pointer shrink-0"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Append [1m] to the model name"}),(0,l.jsx)(r.m_,{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,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Filter naming"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:ee,onChange:em,className:"w-3.5 h-3.5 accent-primary cursor-pointer shrink-0"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"}),(0,l.jsx)(r.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Web Search"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:es,onChange:e=>el(e.target.checked),className:"w-3.5 h-3.5 accent-primary cursor-pointer shrink-0"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Exa MCP"}),(0,l.jsx)(r.m_,{text:"Injects Exa MCP into ~/.claude.json so non-Claude models gain web search. Restart Claude Code after Apply.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]})]}),D&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===D.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===D.type?"check_circle":"error"}),(0,l.jsx)("span",{children:D.text})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:eh,disabled:!m,loading:U,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:eg,disabled:!w?.has9Router,loading:T,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>Z(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),F&&(0,l.jsx)(r.rq,{isOpen:F,onClose:()=>q(!1),onSelect:e=>{H&&d(H,e.value)},selectedModel:H?o[H]:null,activeProviders:n,modelAliases:J,title:`Select model for ${H}`}),(0,l.jsx)(r.uR,{isOpen:Y,onClose:()=>Z(!1),title:"Claude CLI - Manual Configuration",configs:(v=W&&W.trim()?W:p?"<API_KEY_FROM_DASHBOARD>":"sk_9router",N={ANTHROPIC_BASE_URL:eu(),ANTHROPIC_AUTH_TOKEN:v},e.defaultModels.forEach(e=>{let t=o[e.alias];t&&e.envKey&&(N[e.envKey]=t)}),ea&&(N.CLAUDE_CODE_AUTO_COMPACT_WINDOW=ea),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:N},null,2)}])})]})}var U=s(57250);let P=(e,t)=>{let s=e.match(RegExp(`^\\s*${t}\\s*=\\s*(["'])([^\\n]*?)\\1\\s*(?:#.*)?$`));return s?s[2]:""};function T(e){if("string"!=typeof e)return{baseUrl:"",apiKey:""};let t=e.split(/\r?\n/),s="",l=!0;for(let e of t){if(/^\s*\[/.test(e)){l=!1;continue}l&&(s=P(e,"model_provider")||s)}if(!s)return{baseUrl:"",apiKey:""};let a=`model_providers.${s}`,r=!1,i=!1,n="",o="";for(let e of t){let t=e.match(/^\s*\[\s*([^\]]+?)\s*\]\s*(?:#.*)?$/);if(t){r=t[1]===a,i=t[1]===`${a}.http_headers`;continue}if(r&&(n=P(e,"base_url")||n),i){let t=P(e,"Authorization").match(/^Bearer\s+(.+)$/i);o=t?t[1]:o}}return{baseUrl:n,apiKey:o}}function R(e,t=[]){if(!e||"string"!=typeof e)return"model";let s="",l=e.trim();"config"===(s=(s=l.includes("/")?l.split("/")[0].toLowerCase().replace(/[^a-z0-9_-]/g,""):l.toLowerCase().replace(/[^a-z0-9_-]/g,"")).replace(/^[-_]+|[-_]+$/g,"")||"model")&&(s="model-config");let a=s,r=2;for(;t.includes(a);)a=`${s}-${r}`,r++;return a}function D({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d,cloudEnabled:c,initialStatus:m,tunnelEnabled:x,tunnelPublicUrl:p,tailscaleEnabled:u,tailscaleUrl:h}){let g,f,[y,b]=(0,a.useState)(m||null),[v,N]=(0,a.useState)(!1),[w,C]=(0,a.useState)(!1),[_,E]=(0,a.useState)(!1),[O,$]=(0,a.useState)(null),[M,I]=(0,a.useState)(!1),[P,L]=(0,a.useState)(""),[z,K]=(0,a.useState)(""),[F,q]=(0,a.useState)(""),[H,B]=(0,a.useState)(!1),[W,G]=(0,a.useState)(!1),[J,V]=(0,a.useState)({}),[Y,Z]=(0,a.useState)(!1),[Q,X]=(0,a.useState)(""),[ee,et]=(0,a.useState)([]),[es,el]=(0,a.useState)(""),[ea,er]=(0,a.useState)(""),[ei,en]=(0,a.useState)(!1),[eo,ed]=(0,a.useState)(!1),[ec,em]=(0,a.useState)(null),[ex,ep]=(0,a.useState)("");(0,a.useEffect)(()=>{eh()},[]),(0,a.useEffect)(()=>{!(o?.length>0)||P||y?.config||L(o[0].key)},[o,P,y?.config]),(0,a.useEffect)(()=>{m&&b(m)},[m]),(0,a.useEffect)(()=>{t&&(y||eN(),eu(),eh())},[t]);let eu=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&V(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}},eh=async()=>{try{let e=await fetch("/api/cli-tools/codex-profiles"),t=await e.json();e.ok&&et(t.profiles||[])}catch(e){console.log("Error fetching codex profiles:",e)}},eg=async()=>{let e=es.trim().toLowerCase().replace(/[^a-z0-9_-]/g,""),t=ea.trim();if(e&&t){ed(!0);try{let s=await fetch("/api/cli-tools/codex-profiles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,model:t})}),l=await s.json();s.ok?(el(""),er(""),eh()):$({type:"error",text:l.error||"Failed to add model"})}catch(e){$({type:"error",text:e.message})}finally{ed(!1)}}},ef=async e=>{em(e);try{(await fetch("/api/cli-tools/codex-profiles",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})})).ok&&eh()}catch(e){console.log("Error deleting codex profile:",e)}finally{em(null)}},ey=async e=>{try{await navigator.clipboard.writeText(e),ep(e),setTimeout(()=>ep(""),2e3)}catch(e){console.log("Copy failed",e)}};(0,a.useEffect)(()=>{let e=y?.config;if(e){let{baseUrl:t,apiKey:s}=T(e);X(t),L(s);let l=e.match(/^model\s*=\s*"([^"]+)"/m);l&&K(l[1]);let a=e.match(/^default_subagent_model\s*=\s*"([^"]+)"/m);a&&q(a[1])}},[y?.config]);let eb=T(y?.config).baseUrl,ej=y?.installed?y.config?A(eb,{tunnelPublicUrl:p,tailscaleUrl:h})?"configured":"other":"not_configured":null,ev=()=>{let e=(Q||`${n}/v1`).replace(/\/+$/,"");return e.endsWith("/v1")?e:`${e}/v1`},eN=async()=>{N(!0);try{let e=await fetch("/api/cli-tools/codex-settings",{cache:"no-store"}),t=await e.json();b(t)}catch(e){b({installed:!1,error:e.message})}finally{N(!1)}},ew=async()=>{C(!0),$(null);try{let e=P&&P.trim()||c?P:"sk_9router",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:ev(),apiKey:e,model:z,subagentModel:F||z})}),s=await t.json();t.ok?(j(ev(),{tunnelPublicUrl:p,tailscaleUrl:h}),$({type:"success",text:"Settings applied successfully!"}),eN()):$({type:"error",text:s.error||"Failed to apply settings"})}catch(e){$({type:"error",text:e.message})}finally{C(!1)}},ek=async()=>{E(!0),$(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?($({type:"success",text:"Settings reset successfully!"}),K(""),q(""),eN()):$({type:"error",text:t.error||"Failed to reset settings"})}catch(e){$({type:"error",text:e.message})}finally{E(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.A,{src:"/providers/codex.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===ej&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===ej&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===ej&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[v&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Codex CLI..."})]}),!v&&y&&!y.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>Z(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>I(!M),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:M?"expand_less":"help"}),M?"Hide":"How to Install"]})]})]}),M&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,l.jsx)("div",{className:"pt-2 border-t border-border",children:(0,l.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex reads custom providers from ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/config.toml"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!v&&y?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(k,{value:Q||Q||`${n}/v1`,onChange:X,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:x,tunnelPublicUrl:p,tailscaleEnabled:u,tailscaleUrl:h,currentUrl:eb})]}),y?.config&&(eb?(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.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:eb})]}):null),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(S,{value:P,onChange:L,apiKeys:o,cloudEnabled:c})]}),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:z,onChange:e=>K(e.target.value),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"}),z&&(0,l.jsx)("button",{onClick:()=>K(""),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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>B(!0),disabled:!d?.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 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]}),(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:F,onChange:e=>q(e.target.value),placeholder:z||"provider/model-id (defaults to main 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"}),F&&(0,l.jsx)("button",{onClick:()=>q(""),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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>G(!0),disabled:!d?.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 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),O&&(0,l.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":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===O.type?"check_circle":"error"}),(0,l.jsx)("span",{children:O.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:ew,disabled:!P&&c&&o.length>0||!z,loading:w,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:ek,disabled:_,loading:_,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>Z(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]}),(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-3",children:[(0,l.jsx)("div",{className:"flex items-center justify-between",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("span",{className:"text-xs font-semibold text-text-main flex items-center gap-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"layers"}),"Additional Models"]}),ee.length>0&&(0,l.jsx)("span",{className:"px-1.5 py-0.2 bg-primary/10 text-primary text-[10px] font-medium rounded-full",children:ee.length})]})}),(0,l.jsx)("div",{className:"flex flex-col gap-1.5 p-2.5 bg-surface/40 border border-border rounded-lg",children:(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-[10rem_1fr_auto_auto] sm:items-center",children:[(0,l.jsx)("input",{type:"text",value:es,onChange:e=>el(e.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:e=>"Enter"===e.key&&eg()}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:ea,onChange:e=>{let t=e.target.value;er(t),el(R(t.includes("/")?t.split("/")[0]:t,ee.map(e=>e.name)))},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:e=>"Enter"===e.key&&eg()}),ea&&(0,l.jsx)("button",{onClick:()=>er(""),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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>en(!0),disabled:!d?.length,className:`w-full sm:w-auto rounded border px-2.5 py-1.5 text-xs transition-colors whitespace-nowrap sm:shrink-0 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:eg,disabled:!es.trim()||!ea.trim()||eo,loading:eo,className:"!h-7.5 whitespace-nowrap",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[15px] mr-1",children:"add"}),"Add"]})]})}),0===ee.length?(0,l.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,l.jsx)("span",{className:"material-symbols-outlined text-[20px] text-text-muted mb-1 opacity-60",children:"terminal"}),(0,l.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,l.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ee.map(e=>{let t=e.model.includes("/")?e.model.split("/")[0]:e.name,s=ex===e.command;return(0,l.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,l.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,l.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,l.jsx)(U.A,{providerId:t,size:18,fallbackText:e.name.slice(0,2).toUpperCase()})}),(0,l.jsxs)("div",{className:"min-w-0 flex flex-col",children:[(0,l.jsx)("span",{className:"font-medium text-xs text-text-main truncate",children:e.name}),(0,l.jsx)("span",{className:"text-[11px] text-text-muted truncate font-mono",children:e.model})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,l.jsxs)("button",{onClick:()=>ey(e.command),className:`flex items-center gap-1 px-2 py-1 rounded text-[11px] font-mono border transition-all ${s?"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,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:s?"check":"terminal"}),(0,l.jsx)("span",{className:"hidden md:inline",children:e.command}),(0,l.jsx)("span",{className:"md:hidden",children:"copy"})]}),(0,l.jsx)("button",{onClick:()=>ef(e.name),disabled:ec===e.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,l.jsx)("span",{className:"material-symbols-outlined text-[15px]",children:"close"})})]})]},e.name)})})]})]})]}),H&&(0,l.jsx)(r.rq,{isOpen:H,onClose:()=>B(!1),onSelect:e=>{K(e.value),F||q(e.value),B(!1)},selectedModel:z,activeProviders:d,modelAliases:J,title:"Select Model for Codex"}),W&&(0,l.jsx)(r.rq,{isOpen:W,onClose:()=>G(!1),onSelect:e=>{q(e.value),G(!1)},selectedModel:F,activeProviders:d,modelAliases:J,title:"Select Subagent Model for Codex"}),ei&&(0,l.jsx)(r.rq,{isOpen:ei,onClose:()=>en(!1),onSelect:e=>{en(!1);let t=e?.value||e?.id;t&&(er(t),el(R(e?.provider||(t.includes("/")?t.split("/")[0]:t),ee.map(e=>e.name))))},selectedModel:ea,activeProviders:d,modelAliases:J,title:"Select Model for Codex CLI"}),(0,l.jsx)(r.uR,{isOpen:Y,onClose:()=>Z(!1),title:"Codex CLI - Manual Configuration",configs:(g=P&&P.trim()?P:c?"<API_KEY_FROM_DASHBOARD>":"sk_9router",f=F||z,[{filename:"~/.codex/config.toml",content:`# 9Router Configuration for Codex CLI
45
45
  model = "${z}"
46
46
  model_provider = "9router"
47
47
 
@@ -111,7 +111,7 @@ api_backend = "chat_completions"
111
111
  api_key = "${e}"
112
112
  context_window = ${f(r)||2e5}`)}return a.length&&l.splice(1,0,`[subagents.models]
113
113
  ${a.join("\n")}`),[{filename:"~/.grok/config.toml",content:`${l.join("\n\n")}
114
- `}]})()})]})}var ec=s(28777);function em({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d=[],cloudEnabled:c,initialStatus:m,tunnelEnabled:x,tunnelPublicUrl:p,tailscaleEnabled:u,tailscaleUrl:h}){let[g,f]=(0,a.useState)(()=>m||null),[y,b]=(0,a.useState)(!1),[v,N]=(0,a.useState)(!1),[w,C]=(0,a.useState)(!1),[_,E]=(0,a.useState)(null),[O,$]=(0,a.useState)(!1),[M,I]=(0,a.useState)(()=>o?.[0]?.key||""),[U,P]=(0,a.useState)(()=>{let e=m?.config;return e?.model||e?.openai?.model||e?.providers?.["9router"]?.models?.[0]?.id||""}),[T,R]=(0,a.useState)(()=>{let e=m?.config,t=e?.providers?.["9router"]?.models;return Array.isArray(t)&&t.length>0?t.map(e=>"string"==typeof e?e:e.id):[]}),[D,L]=(0,a.useState)(!1),[z,K]=(0,a.useState)(!1),[F,q]=(0,a.useState)(""),H=`/api/cli-tools/${e.id}-settings`;(0,a.useEffect)(()=>{let s=!0;return t&&!m&&fetch(H).then(e=>e.json()).then(t=>{if(s){f(t);let s=t?.config;if("pi"===e.id){let e=s?.providers?.["9router"]?.models;Array.isArray(e)&&e.length>0&&R(e.map(e=>"string"==typeof e?e:e.id))}else{let e=s?.model||s?.openai?.model||s?.providers?.["9router"]?.models?.[0]?.id;e&&P(t=>t||e)}}}).catch(e=>{s&&f({installed:!1,error:e.message})}),()=>{s=!1}},[t,m,H,e.id]);let B=async()=>{b(!0);try{let t=await fetch(H),s=await t.json();f(s);let l=s?.config;if("pi"===e.id){let e=l?.providers?.["9router"]?.models;if(Array.isArray(e)&&e.length>0){let t=e.map(e=>"string"==typeof e?e:e.id);R(t)}}else{let e=l?.model||l?.openai?.model||l?.providers?.["9router"]?.models?.[0]?.id;e&&!U&&P(e)}}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},W=()=>{let e=F||`${n}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},G=(()=>{if(!g?.config)return"";let e=g.config;return"string"==typeof e.baseUrl?e.baseUrl:"string"==typeof e.openai?.base_url?e.openai.base_url:"string"==typeof e.providers?.["9router"]?.base_url?e.providers["9router"].base_url:"string"==typeof e.providers?.["9router"]?.baseUrl?e.providers["9router"].baseUrl:""})(),J=g?.installed?g.has9Router?(G&&A(G,{tunnelPublicUrl:p,tailscaleUrl:h}),"configured"):"not_configured":null,V=async()=>{N(!0),E(null);try{let t=M&&M.trim()||c?M:"sk_9router",s={baseUrl:W(),apiKey:t};"pi"===e.id?s.models=T.length>0?T:["provider/model-id"]:s.model=U;let l=await fetch(H,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),a=await l.json();l.ok?(j(W()),E({type:"success",text:a.message||"Settings applied successfully!"}),await B()):E({type:"error",text:a.error?.message||"Failed to apply settings."})}catch(e){E({type:"error",text:e.message})}finally{N(!1)}},Y=async()=>{C(!0),E(null);try{let e=await fetch(H,{method:"DELETE"}),t=await e.json();e.ok?(E({type:"success",text:t.message||"Settings removed successfully."}),await B()):E({type:"error",text:t.error?.message||"Failed to reset settings."})}catch(e){E({type:"error",text:e.message})}finally{C(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:e.image?(0,l.jsx)(i.A,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"}):e.icon?(0,l.jsx)("span",{className:"material-symbols-outlined text-[28px]",style:{color:e.color},children:e.icon}):(0,l.jsx)("span",{className:"material-symbols-outlined text-[28px] text-primary",children:"terminal"})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===J&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===J&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===J&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsxs)("span",{children:["Checking ",e.name,"..."]})]}),!y&&g&&!g.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsxs)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:[e.name," not detected locally"]}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>K(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>$(!O),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:O?"expand_less":"help"}),O?"Hide":"How to Install"]})]})]}),O&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"Install command:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:(()=>{switch(e.id){case"pi":return"curl -fsSL https://pi.dev/install.sh | sh # or: npm install -g --ignore-scripts @earendil-works/pi-coding-agent";case"omp":return"npm install -g oh-my-pi";case"crush":return"brew install charmbracelet/tap/crush # or go install github.com/charmbracelet/crush@latest";case"forge":return"cargo install forgecode";case"smelt":return"cargo install smelt";case"codewhale":return"cargo install codewhale";default:return`npm install -g ${e.id}`}})()})]}),e.docsUrl&&(0,l.jsxs)("p",{className:"text-xs text-text-muted",children:["Docs: ",(0,l.jsx)("a",{href:e.docsUrl,target:"_blank",rel:"noreferrer",className:"text-primary hover:underline",children:e.docsUrl})]})]})]})]}),!y&&g?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(k,{value:F||W(),onChange:q,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:x,tunnelPublicUrl:p,tailscaleEnabled:u,tailscaleUrl:h,currentUrl:G})]}),G?(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.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})]}):null,(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(S,{value:M,onChange:I,apiKeys:o,cloudEnabled:c})]}),"pi"===e.id&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm mt-1",children:"Models"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline mt-1.5",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,l.jsx)("div",{className:"flex flex-wrap gap-1.5 min-h-[36px] p-2 bg-surface rounded border border-border",children:0===T.length?(0,l.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models selected. Add models to use in Pi."}):T.map(e=>(0,l.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,l.jsx)("span",{children:e}),(0,l.jsx)("button",{type:"button",onClick:()=>{R(t=>t.filter(t=>t!==e))},className:"text-text-muted hover:text-red-500 rounded p-0.5",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e))}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsxs)(r.$n,{type:"button",size:"sm",variant:"secondary",onClick:()=>L(!0),disabled:!d?.length,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"add"}),"Add Model"]}),d?.length>0&&(0,l.jsx)(r.$n,{type:"button",size:"sm",variant:"ghost",onClick:()=>{let e=[];d.forEach(t=>{let s=ec.Xg[t.provider]||t.provider;(0,ec.KC)(t.provider).forEach(t=>{let l=`${s}/${t.id}`;e.includes(l)||e.push(l)})}),e.length>0&&R(t=>Array.from(new Set([...t,...e])))},className:"text-xs text-primary hover:text-primary-hover",children:"+ Add All Active Models"}),T.length>0&&(0,l.jsx)("button",{type:"button",onClick:()=>R([]),className:"text-xs text-text-muted hover:text-red-500 ml-auto",children:"Clear all"})]})]})]}),"omp"!==e.id&&"pi"!==e.id&&(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:U,onChange:e=>P(e.target.value),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,l.jsx)("button",{onClick:()=>P(""),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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>L(!0),disabled:!d?.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 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),_&&(0,l.jsx)("div",{className:`p-3 rounded-lg text-sm ${"success"===_.type?"bg-green-500/10 text-green-600 dark:text-green-400 border border-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20"}`,children:_.text}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 pt-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:V,disabled:v||y,children:v?"Applying...":"Apply Settings"}),g?.has9Router&&(0,l.jsx)(r.$n,{variant:"outline",size:"sm",onClick:Y,disabled:w||y,className:"text-red-500 hover:text-red-600 hover:border-red-500/50",children:w?"Removing...":"Remove from Tool"})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>K(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"code"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:D,onClose:()=>L(!1),onSelect:t=>{"pi"===e.id?T.includes(t.value)||R(e=>[...e,t.value]):P(t.value),L(!1)},activeProviders:d}),(0,l.jsx)(r.uR,{isOpen:z,onClose:()=>K(!1),title:`${e.name} Configuration`,configs:(()=>{let t=W(),s=M||"sk_9router",l=U||"provider/model-id";switch(e.id){case"pi":return[{filename:"~/.pi/agent/models.json",content:JSON.stringify({providers:{"9router":{baseUrl:t,apiKey:s,api:"openai-completions",models:(T.length>0?T:[l]).map(e=>({id:e,name:e,contextWindow:128e3,maxTokens:16384}))}}},null,2)}];case"omp":return[{filename:"~/.omp/agent/models.yml",content:`providers:
114
+ `}]})()})]})}var ec=s(28777);let em=[2e5,4e5,6e5,1e6],ex=[16e3,32e3,64e3,128e3],ep={contextWindow:2e5,maxTokens:64e3},eu={contextWindow:2e6,maxTokens:2e5},eh=e=>e>=1e6?`${+(e/1e6).toFixed(2)}M`:`${Math.round(e/1e3)}k`,eg=(e,t,s)=>{let l=Number(e);return Number.isFinite(l)&&l>0&&l<=s?l:t},ef=(e,t)=>e.includes(t)?e:[...e,t].sort((e,t)=>e-t),ey=e=>{let t=e?.providers?.["9router"]?.models;if(!Array.isArray(t)||0===t.length)return null;let s={};return{ids:t.map(e=>{let t="string"==typeof e?e:e.id;return"string"!=typeof e&&(s[t]={contextWindow:eg(e.contextWindow,ep.contextWindow,eu.contextWindow),maxTokens:eg(e.maxTokens,ep.maxTokens,eu.maxTokens)}),t}),caps:s}};function eb({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d=[],cloudEnabled:c,initialStatus:m,tunnelEnabled:x,tunnelPublicUrl:p,tailscaleEnabled:u,tailscaleUrl:h}){let[g,f]=(0,a.useState)(()=>m||null),[y,b]=(0,a.useState)(!1),[v,N]=(0,a.useState)(!1),[w,C]=(0,a.useState)(!1),[_,E]=(0,a.useState)(null),[O,$]=(0,a.useState)(!1),[M,I]=(0,a.useState)(()=>o?.[0]?.key||""),[U,P]=(0,a.useState)(()=>{let e=m?.config;return e?.model||e?.openai?.model||e?.providers?.["9router"]?.models?.[0]?.id||""}),T=ey(m?.config),[R,D]=(0,a.useState)(()=>T?.ids||[]),[L,z]=(0,a.useState)(()=>T?.caps||{}),[K,F]=(0,a.useState)(!1),[q,H]=(0,a.useState)(!1),[B,W]=(0,a.useState)(""),G=`/api/cli-tools/${e.id}-settings`;(0,a.useEffect)(()=>{let s=!0;return t&&!m&&fetch(G).then(e=>e.json()).then(t=>{if(s){f(t);let s=t?.config;if("pi"===e.id){let e=ey(s);e&&(D(e.ids),z(e.caps))}else{let e=s?.model||s?.openai?.model||s?.providers?.["9router"]?.models?.[0]?.id;e&&P(t=>t||e)}}}).catch(e=>{s&&f({installed:!1,error:e.message})}),()=>{s=!1}},[t,m,G,e.id]);let J=async()=>{b(!0);try{let t=await fetch(G),s=await t.json();f(s);let l=s?.config;if("pi"===e.id){let e=ey(l);e&&(D(e.ids),z(e.caps))}else{let e=l?.model||l?.openai?.model||l?.providers?.["9router"]?.models?.[0]?.id;e&&!U&&P(e)}}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},V=()=>{let e=B||`${n}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},Y=(()=>{if(!g?.config)return"";let e=g.config;return"string"==typeof e.baseUrl?e.baseUrl:"string"==typeof e.openai?.base_url?e.openai.base_url:"string"==typeof e.providers?.["9router"]?.base_url?e.providers["9router"].base_url:"string"==typeof e.providers?.["9router"]?.baseUrl?e.providers["9router"].baseUrl:""})(),Z=g?.installed?g.has9Router?(Y&&A(Y,{tunnelPublicUrl:p,tailscaleUrl:h}),"configured"):"not_configured":null,Q=async()=>{N(!0),E(null);try{let t=M&&M.trim()||c?M:"sk_9router",s={baseUrl:V(),apiKey:t};"pi"===e.id?s.models=(R.length>0?R:["provider/model-id"]).map(e=>({id:e,name:e,...ep,...L[e]})):s.model=U;let l=await fetch(G,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),a=await l.json();l.ok?(j(V()),E({type:"success",text:a.message||"Settings applied successfully!"}),await J()):E({type:"error",text:a.error?.message||"Failed to apply settings."})}catch(e){E({type:"error",text:e.message})}finally{N(!1)}},X=async()=>{C(!0),E(null);try{let e=await fetch(G,{method:"DELETE"}),t=await e.json();e.ok?(E({type:"success",text:t.message||"Settings removed successfully."}),await J()):E({type:"error",text:t.error?.message||"Failed to reset settings."})}catch(e){E({type:"error",text:e.message})}finally{C(!1)}},ee=(e,t,s)=>{z(l=>({...l,[e]:{...ep,...l[e],[t]:eg(s,ep[t],eu[t])}}))};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:e.image?(0,l.jsx)(i.A,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"}):e.icon?(0,l.jsx)("span",{className:"material-symbols-outlined text-[28px]",style:{color:e.color},children:e.icon}):(0,l.jsx)("span",{className:"material-symbols-outlined text-[28px] text-primary",children:"terminal"})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===Z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===Z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===Z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsxs)("span",{children:["Checking ",e.name,"..."]})]}),!y&&g&&!g.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsxs)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:[e.name," not detected locally"]}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>H(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>$(!O),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:O?"expand_less":"help"}),O?"Hide":"How to Install"]})]})]}),O&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"Install command:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:(()=>{switch(e.id){case"pi":return"curl -fsSL https://pi.dev/install.sh | sh # or: npm install -g --ignore-scripts @earendil-works/pi-coding-agent";case"omp":return"npm install -g oh-my-pi";case"crush":return"brew install charmbracelet/tap/crush # or go install github.com/charmbracelet/crush@latest";case"forge":return"cargo install forgecode";case"smelt":return"cargo install smelt";case"codewhale":return"cargo install codewhale";default:return`npm install -g ${e.id}`}})()})]}),e.docsUrl&&(0,l.jsxs)("p",{className:"text-xs text-text-muted",children:["Docs: ",(0,l.jsx)("a",{href:e.docsUrl,target:"_blank",rel:"noreferrer",className:"text-primary hover:underline",children:e.docsUrl})]})]})]})]}),!y&&g?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(k,{value:B||V(),onChange:W,requiresExternalUrl:e.requiresExternalUrl,tunnelEnabled:x,tunnelPublicUrl:p,tailscaleEnabled:u,tailscaleUrl:h,currentUrl:Y})]}),Y?(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.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:Y})]}):null,(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)(S,{value:M,onChange:I,apiKeys:o,cloudEnabled:c})]}),"pi"===e.id&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm mt-1",children:"Models"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline mt-1.5",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,l.jsx)("div",{className:"flex flex-wrap gap-1.5 min-h-[36px] p-2 bg-surface rounded border border-border",children:0===R.length?(0,l.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models selected. Add models to use in Pi."}):R.map(e=>{let t={...ep,...L[e]};return(0,l.jsxs)("div",{className:"flex w-full flex-wrap items-center gap-1.5 rounded border border-border bg-bg-secondary px-2 py-1 text-xs text-text-main",children:[(0,l.jsx)("span",{className:"min-w-0 flex-1 basis-40 truncate",children:e}),(0,l.jsx)("select",{value:t.contextWindow,onChange:t=>ee(e,"contextWindow",t.target.value),title:"Context window",className:"shrink-0 rounded border border-border bg-surface px-1 py-0.5 text-[11px] focus:outline-none focus:ring-1 focus:ring-primary/50",children:ef(em,t.contextWindow).map(e=>(0,l.jsxs)("option",{value:e,children:[eh(e)," ctx"]},e))}),(0,l.jsx)("select",{value:t.maxTokens,onChange:t=>ee(e,"maxTokens",t.target.value),title:"Max output tokens",className:"rounded border border-border bg-surface px-1 py-0.5 text-[11px] focus:outline-none focus:ring-1 focus:ring-primary/50",children:ef(ex,t.maxTokens).map(e=>(0,l.jsxs)("option",{value:e,children:[eh(e)," out"]},e))}),(0,l.jsx)("button",{type:"button",onClick:()=>{D(t=>t.filter(t=>t!==e)),z(t=>{let s={...t};return delete s[e],s})},className:"text-text-muted hover:text-red-500 rounded p-0.5",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e)})}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsxs)(r.$n,{type:"button",size:"sm",variant:"secondary",onClick:()=>F(!0),disabled:!d?.length,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"add"}),"Add Model"]}),d?.length>0&&(0,l.jsx)(r.$n,{type:"button",size:"sm",variant:"ghost",onClick:()=>{let e=[];d.forEach(t=>{let s=ec.Xg[t.provider]||t.provider;(0,ec.KC)(t.provider).forEach(t=>{let l=`${s}/${t.id}`;e.includes(l)||e.push(l)})}),e.length>0&&(D(t=>Array.from(new Set([...t,...e]))),z(t=>{let s={...t};return e.forEach(e=>{s[e]||={...ep}}),s}))},className:"text-xs text-primary hover:text-primary-hover",children:"+ Add All Active Models"}),R.length>0&&(0,l.jsx)("button",{type:"button",onClick:()=>D([]),className:"text-xs text-text-muted hover:text-red-500 ml-auto",children:"Clear all"})]})]})]}),"omp"!==e.id&&"pi"!==e.id&&(0,l.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,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:U,onChange:e=>P(e.target.value),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,l.jsx)("button",{onClick:()=>P(""),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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>F(!0),disabled:!d?.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 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),_&&(0,l.jsx)("div",{className:`p-3 rounded-lg text-sm ${"success"===_.type?"bg-green-500/10 text-green-600 dark:text-green-400 border border-green-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20"}`,children:_.text}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 pt-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:Q,disabled:v||y,children:v?"Applying...":"Apply Settings"}),g?.has9Router&&(0,l.jsx)(r.$n,{variant:"outline",size:"sm",onClick:X,disabled:w||y,className:"text-red-500 hover:text-red-600 hover:border-red-500/50",children:w?"Removing...":"Remove from Tool"})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>H(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"code"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:K,onClose:()=>F(!1),onSelect:t=>{"pi"===e.id?R.includes(t.value)||(D(e=>[...e,t.value]),z(e=>({...e,[t.value]:{...ep,...e[t.value]}}))):P(t.value),F(!1)},activeProviders:d}),(0,l.jsx)(r.uR,{isOpen:q,onClose:()=>H(!1),title:`${e.name} Configuration`,configs:(()=>{let t=V(),s=M||"sk_9router",l=U||"provider/model-id";switch(e.id){case"pi":return[{filename:"~/.pi/agent/models.json",content:JSON.stringify({providers:{"9router":{baseUrl:t,apiKey:s,api:"openai-completions",models:(R.length>0?R:[l]).map(e=>({id:e,name:e,...ep,...L[e]}))}}},null,2)}];case"omp":return[{filename:"~/.omp/agent/models.yml",content:`providers:
115
115
  9router:
116
116
  baseUrl: ${t}
117
117
  apiKey: ${s}
@@ -129,4 +129,4 @@ model = "${l}"`}];case"smelt":return[{filename:"~/.smelt/config.json",content:JS
129
129
  [openai]
130
130
  base_url = "${t}"
131
131
  api_key = "${s}"
132
- model = "${l}"`}];default:return[]}})()})]})}let ex="http://localhost:20128";function ep({apiKeys:e,cloudEnabled:t,onStatusChange:s}){let[i,n]=(0,a.useState)(null),[o,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)(!1),[x,p]=(0,a.useState)(""),[u,h]=(0,a.useState)(()=>e?.[0]?.key||""),[g,f]=(0,a.useState)(null),[y,b]=(0,a.useState)(null),[j,v]=(0,a.useState)(null),[N,w]=(0,a.useState)(ex),[k,C]=(0,a.useState)(null),_=i?.isWin===!0,S=_||i?.hasCachedPassword||i?.needsSudoPassword===!1,E=i?.isAdmin!==!1;!E&&(_||i?.hasCachedPassword||i?.needsSudoPassword);let A=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();n(t),t.mitmRouterBaseUrl&&w(t.mitmRouterBaseUrl),s?.(t)}}catch{n({running:!1,certExists:!1,dnsStatus:{}})}},[s]);(0,a.useEffect)(()=>{queueMicrotask(()=>{A()})},[A]);let O=e=>{v(null),i&&(S?$(e,""):(f(e),m(!0),b(null)))},$=async(s,l,a=!1)=>{d(!0),v(null);try{let r;if("trust-cert"===s)r=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:l})});else if("start"===s){let s=u?.trim()||(e?.length>0?e[0].key:null)||(t?null:"sk_9router");r=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:s,sudoPassword:l,mitmRouterBaseUrl:N.trim()||ex,forceKillPort443:a})})}else r=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:l})});if(!r.ok){let e=await r.json().catch(()=>({}));if("PORT_443_BUSY"===e.code&&e.portOwner){m(!1),C({owner:e.portOwner,password:l});return}v(e.error||`Failed to ${s} MITM server`);return}m(!1),p(""),C(null),await A()}catch(e){v(e.message||"Network error")}finally{d(!1),f(null)}},M=()=>{x.trim()?$(g,x):b("Sudo password is required")},I=i?.running;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,l.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),I?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Running"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,l.jsx)("div",{className:"flex flex-wrap items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:i?.certExists},{label:"Trusted",ok:i?.certTrusted},{label:"Server",ok:I}].map(({label:e,ok:t})=>(0,l.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${t?"text-green-600":"text-text-muted"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:t?"check_circle":"cancel"}),e]},e))})]}),(0,l.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from 9Router"]}),(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Antigravity/Copilot IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → 9Router → response to Antigravity/Copilot"]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid gap-1 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"9Router Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:N,onChange:e=>w(e.target.value),placeholder:ex,disabled:I,className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]}),!I&&(0,l.jsxs)("div",{className:"grid gap-1 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",list:"mitm-api-keys",value:u,onChange:e=>h(e.target.value),placeholder:t?"Enter or pick API key":"sk_9router (default)",className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50"}),e?.length>0&&(0,l.jsx)("datalist",{id:"mitm-api-keys",children:e.map(e=>(0,l.jsx)("option",{value:e.key,children:e.name||e.key},e.id))})]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center","data-i18n-skip":"true",children:[i?.certExists&&!i?.certTrusted&&(0,l.jsxs)("button",{onClick:()=>O("trust-cert"),disabled:o,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-4 py-2 text-xs font-medium text-yellow-600 transition-colors hover:bg-yellow-500/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),I?(0,l.jsxs)("button",{onClick:()=>O("stop"),disabled:o,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-medium text-red-500 transition-colors hover:bg-red-500/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,l.jsxs)("button",{onClick:()=>O("start"),disabled:o||!i||_&&!E,title:_&&!E?"Administrator required":void 0,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-primary/30 bg-primary/10 px-4 py-2 text-xs font-medium text-primary transition-colors hover:bg-primary/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),I&&(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),j&&(0,l.jsxs)("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5 shrink-0",children:"error"}),(0,l.jsx)("span",{children:j})]}),_&&!E&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 border border-red-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"shield_lock"}),(0,l.jsx)("span",{children:"Administrator required — restart 9Router as Administrator to use MITM"})]})]})}),c&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"mx-4 flex w-full max-w-sm flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:x,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"!==e.key||o||M()}}),y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:y})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{m(!1),p(""),b(null)},disabled:o,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:M,loading:o,children:"Confirm"})]})]})}),k&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Port 443 Already In Use"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsxs)("div",{className:"flex flex-col gap-1 text-xs text-text-muted",children:[(0,l.jsx)("p",{children:"Port 443 is currently used by another process:"}),(0,l.jsxs)("p",{className:"font-mono text-text-main","data-i18n-skip":"true",children:[k.owner.name," (PID ",k.owner.pid,")"]}),(0,l.jsx)("p",{children:"Kill this process to start MITM Server?"})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{C(null),d(!1)},disabled:o,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:()=>{$("start",k?.password||"",!0)},loading:o,children:"Kill & Start"})]})]})})]})}var eu=s(40295);function eh({tool:e,isExpanded:t,onToggle:s,serverRunning:n,dnsActive:o,hasCachedPassword:d,needsSudoPassword:c,isWin:m,apiKeys:x,activeProviders:p,hasActiveProviders:u,modelAliases:h={},cloudEnabled:g,onDnsChange:f}){let[y,b]=(0,a.useState)(!1),[j,v]=(0,a.useState)(null),[N,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(""),[_,S]=(0,a.useState)(null),[E,A]=(0,a.useState)(null),[O,$]=(0,a.useState)({}),[M,I]=(0,a.useState)(!1),[U,P]=(0,a.useState)(null),T=eu.TOOL_HOSTS[e.id]??[],R=m||d||!1===c;(0,a.useEffect)(()=>{t&&D()},[t]);let D=async()=>{try{let t=await fetch(`/api/cli-tools/antigravity-mitm/alias?tool=${e.id}`);if(t.ok){let e=await t.json();Object.keys(e.aliases||{}).length>0&&$(e.aliases)}}catch{}},L=(0,a.useCallback)(async t=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,mappings:t})})}catch{}},[e.id]),z=(e,t)=>{$(s=>({...s,[e]:t}))},K=()=>{if(!n)return;let e=o?"disable":"enable";R?F(e,""):(S(e),w(!0),A(null))},F=async(t,s)=>{b(!0),v(null);try{let l=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,action:t,sudoPassword:s})}),a=await l.json();if(!l.ok)throw Error(a.error||"Failed to toggle DNS");"enable"===t&&v(`Restart ${e.name} to apply changes`),w(!1),C(""),f?.(a)}catch{}finally{b(!1),S(null)}},q=()=>{k.trim()?F(_,k):A("Sudo password is required")};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.A,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),n?o?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Active"}):(0,l.jsx)(r.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,l.jsxs)("p",{className:"text-xs text-text-muted sm:truncate",children:["Intercept ",e.name," requests via MITM proxy"]})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[T.length>0&&(0,l.jsxs)("div",{className:"mt-2 rounded-md border border-border bg-surface/50 px-2 py-1.5",children:[(0,l.jsx)("p",{className:"text-[10px] font-medium tracking-wide text-text-main/80 mb-1",children:"Edit hosts file manually to add the following entries:"}),(0,l.jsx)("ul",{className:"list-none space-y-0.5 font-mono text-[10px] text-text-muted break-all",children:T.map(e=>(0,l.jsxs)("li",{children:["127.0.0.1 ",e]},e))})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,l.jsxs)("p",{children:["Toggle DNS to redirect ",e.name," traffic through 9Router via MITM."]}),!o&&(0,l.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),e.defaultModels?.length>0&&(0,l.jsx)("div",{className:"flex flex-col gap-2",children:e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[9rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:O[e.alias]||"",onChange:t=>z(e.alias,t.target.value),onBlur:t=>{var s,l;return s=e.alias,l=t.target.value,void L({...O,[s]:l})},placeholder:"provider/model-id",disabled:!o,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 ${!o?"opacity-50 cursor-not-allowed":""}`}),O[e.alias]&&(0,l.jsx)("button",{onClick:()=>{z(e.alias,""),L({...O,[e.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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>{P(e.alias),I(!0)},disabled:!u||!o,className:`rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 ${u&&o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]},e.alias))}),e.defaultModels?.length===0&&(0,l.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 sm:items-start",children:[o?(0,l.jsxs)("button",{onClick:K,disabled:!n||y,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-medium text-red-500 transition-colors hover:bg-red-500/20 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,l.jsxs)("button",{onClick:K,disabled:!n||y,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-primary/30 bg-primary/10 px-4 py-2 text-xs font-medium text-primary transition-colors hover:bg-primary/20 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start DNS"]}),j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs text-amber-500",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,l.jsx)("span",{children:j})]})]})]})]}),N&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"mx-4 flex w-full max-w-sm flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:k,onChange:e=>C(e.target.value),onKeyDown:e=>{"Enter"!==e.key||y||q()}}),E&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:E})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{w(!1),C(""),A(null)},disabled:y,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:q,loading:y,children:"Confirm"})]})]})}),M&&(0,l.jsx)(r.rq,{isOpen:M,onClose:()=>I(!1),onSelect:e=>{if(!U||e.isPlaceholder)return;let t={...O,[U]:e.value};$(t),L(t)},selectedModel:U?O[U]:null,activeProviders:p,modelAliases:h,title:`Select model for ${U}`})]})}var eg=s(98500),ef=s.n(eg);function ey({tool:e}){return(0,l.jsx)(ef(),{href:"/dashboard/mitm",className:"block",children:(0,l.jsx)(r.Zp,{padding:"sm",className:"overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.A,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded-full",children:"MITM"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"chevron_right"})]})})})}},40295:e=>{e.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"]}}}}]);
132
+ model = "${l}"`}];default:return[]}})()})]})}let ej="http://localhost:20128";function ev({apiKeys:e,cloudEnabled:t,onStatusChange:s}){let[i,n]=(0,a.useState)(null),[o,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)(!1),[x,p]=(0,a.useState)(""),[u,h]=(0,a.useState)(()=>e?.[0]?.key||""),[g,f]=(0,a.useState)(null),[y,b]=(0,a.useState)(null),[j,v]=(0,a.useState)(null),[N,w]=(0,a.useState)(ej),[k,C]=(0,a.useState)(null),_=i?.isWin===!0,S=_||i?.hasCachedPassword||i?.needsSudoPassword===!1,E=i?.isAdmin!==!1;!E&&(_||i?.hasCachedPassword||i?.needsSudoPassword);let A=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();n(t),t.mitmRouterBaseUrl&&w(t.mitmRouterBaseUrl),s?.(t)}}catch{n({running:!1,certExists:!1,dnsStatus:{}})}},[s]);(0,a.useEffect)(()=>{queueMicrotask(()=>{A()})},[A]);let O=e=>{v(null),i&&(S?$(e,""):(f(e),m(!0),b(null)))},$=async(s,l,a=!1)=>{d(!0),v(null);try{let r;if("trust-cert"===s)r=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:l})});else if("start"===s){let s=u?.trim()||(e?.length>0?e[0].key:null)||(t?null:"sk_9router");r=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:s,sudoPassword:l,mitmRouterBaseUrl:N.trim()||ej,forceKillPort443:a})})}else r=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:l})});if(!r.ok){let e=await r.json().catch(()=>({}));if("PORT_443_BUSY"===e.code&&e.portOwner){m(!1),C({owner:e.portOwner,password:l});return}v(e.error||`Failed to ${s} MITM server`);return}m(!1),p(""),C(null),await A()}catch(e){v(e.message||"Network error")}finally{d(!1),f(null)}},M=()=>{x.trim()?$(g,x):b("Sudo password is required")},I=i?.running;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,l.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),I?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Running"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,l.jsx)("div",{className:"flex flex-wrap items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:i?.certExists},{label:"Trusted",ok:i?.certTrusted},{label:"Server",ok:I}].map(({label:e,ok:t})=>(0,l.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${t?"text-green-600":"text-text-muted"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:t?"check_circle":"cancel"}),e]},e))})]}),(0,l.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from 9Router"]}),(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Antigravity/Copilot IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → 9Router → response to Antigravity/Copilot"]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid gap-1 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"9Router Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:N,onChange:e=>w(e.target.value),placeholder:ej,disabled:I,className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]}),!I&&(0,l.jsxs)("div",{className:"grid gap-1 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",list:"mitm-api-keys",value:u,onChange:e=>h(e.target.value),placeholder:t?"Enter or pick API key":"sk_9router (default)",className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50"}),e?.length>0&&(0,l.jsx)("datalist",{id:"mitm-api-keys",children:e.map(e=>(0,l.jsx)("option",{value:e.key,children:e.name||e.key},e.id))})]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center","data-i18n-skip":"true",children:[i?.certExists&&!i?.certTrusted&&(0,l.jsxs)("button",{onClick:()=>O("trust-cert"),disabled:o,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-4 py-2 text-xs font-medium text-yellow-600 transition-colors hover:bg-yellow-500/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),I?(0,l.jsxs)("button",{onClick:()=>O("stop"),disabled:o,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-medium text-red-500 transition-colors hover:bg-red-500/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,l.jsxs)("button",{onClick:()=>O("start"),disabled:o||!i||_&&!E,title:_&&!E?"Administrator required":void 0,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-primary/30 bg-primary/10 px-4 py-2 text-xs font-medium text-primary transition-colors hover:bg-primary/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),I&&(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),j&&(0,l.jsxs)("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5 shrink-0",children:"error"}),(0,l.jsx)("span",{children:j})]}),_&&!E&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 border border-red-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"shield_lock"}),(0,l.jsx)("span",{children:"Administrator required — restart 9Router as Administrator to use MITM"})]})]})}),c&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"mx-4 flex w-full max-w-sm flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:x,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"!==e.key||o||M()}}),y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:y})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{m(!1),p(""),b(null)},disabled:o,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:M,loading:o,children:"Confirm"})]})]})}),k&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Port 443 Already In Use"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsxs)("div",{className:"flex flex-col gap-1 text-xs text-text-muted",children:[(0,l.jsx)("p",{children:"Port 443 is currently used by another process:"}),(0,l.jsxs)("p",{className:"font-mono text-text-main","data-i18n-skip":"true",children:[k.owner.name," (PID ",k.owner.pid,")"]}),(0,l.jsx)("p",{children:"Kill this process to start MITM Server?"})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{C(null),d(!1)},disabled:o,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:()=>{$("start",k?.password||"",!0)},loading:o,children:"Kill & Start"})]})]})})]})}var eN=s(40295);function ew({tool:e,isExpanded:t,onToggle:s,serverRunning:n,dnsActive:o,hasCachedPassword:d,needsSudoPassword:c,isWin:m,apiKeys:x,activeProviders:p,hasActiveProviders:u,modelAliases:h={},cloudEnabled:g,onDnsChange:f}){let[y,b]=(0,a.useState)(!1),[j,v]=(0,a.useState)(null),[N,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(""),[_,S]=(0,a.useState)(null),[E,A]=(0,a.useState)(null),[O,$]=(0,a.useState)({}),[M,I]=(0,a.useState)(!1),[U,P]=(0,a.useState)(null),T=eN.TOOL_HOSTS[e.id]??[],R=m||d||!1===c;(0,a.useEffect)(()=>{t&&D()},[t]);let D=async()=>{try{let t=await fetch(`/api/cli-tools/antigravity-mitm/alias?tool=${e.id}`);if(t.ok){let e=await t.json();Object.keys(e.aliases||{}).length>0&&$(e.aliases)}}catch{}},L=(0,a.useCallback)(async t=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,mappings:t})})}catch{}},[e.id]),z=(e,t)=>{$(s=>({...s,[e]:t}))},K=()=>{if(!n)return;let e=o?"disable":"enable";R?F(e,""):(S(e),w(!0),A(null))},F=async(t,s)=>{b(!0),v(null);try{let l=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,action:t,sudoPassword:s})}),a=await l.json();if(!l.ok)throw Error(a.error||"Failed to toggle DNS");"enable"===t&&v(`Restart ${e.name} to apply changes`),w(!1),C(""),f?.(a)}catch{}finally{b(!1),S(null)}},q=()=>{k.trim()?F(_,k):A("Sudo password is required")};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.A,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),n?o?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Active"}):(0,l.jsx)(r.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,l.jsxs)("p",{className:"text-xs text-text-muted sm:truncate",children:["Intercept ",e.name," requests via MITM proxy"]})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[T.length>0&&(0,l.jsxs)("div",{className:"mt-2 rounded-md border border-border bg-surface/50 px-2 py-1.5",children:[(0,l.jsx)("p",{className:"text-[10px] font-medium tracking-wide text-text-main/80 mb-1",children:"Edit hosts file manually to add the following entries:"}),(0,l.jsx)("ul",{className:"list-none space-y-0.5 font-mono text-[10px] text-text-muted break-all",children:T.map(e=>(0,l.jsxs)("li",{children:["127.0.0.1 ",e]},e))})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,l.jsxs)("p",{children:["Toggle DNS to redirect ",e.name," traffic through 9Router via MITM."]}),!o&&(0,l.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),e.defaultModels?.length>0&&(0,l.jsx)("div",{className:"flex flex-col gap-2",children:e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[9rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:O[e.alias]||"",onChange:t=>z(e.alias,t.target.value),onBlur:t=>{var s,l;return s=e.alias,l=t.target.value,void L({...O,[s]:l})},placeholder:"provider/model-id",disabled:!o,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 ${!o?"opacity-50 cursor-not-allowed":""}`}),O[e.alias]&&(0,l.jsx)("button",{onClick:()=>{z(e.alias,""),L({...O,[e.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,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>{P(e.alias),I(!0)},disabled:!u||!o,className:`rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 ${u&&o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]},e.alias))}),e.defaultModels?.length===0&&(0,l.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 sm:items-start",children:[o?(0,l.jsxs)("button",{onClick:K,disabled:!n||y,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-medium text-red-500 transition-colors hover:bg-red-500/20 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,l.jsxs)("button",{onClick:K,disabled:!n||y,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-primary/30 bg-primary/10 px-4 py-2 text-xs font-medium text-primary transition-colors hover:bg-primary/20 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start DNS"]}),j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs text-amber-500",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,l.jsx)("span",{children:j})]})]})]})]}),N&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"mx-4 flex w-full max-w-sm flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:k,onChange:e=>C(e.target.value),onKeyDown:e=>{"Enter"!==e.key||y||q()}}),E&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:E})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{w(!1),C(""),A(null)},disabled:y,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:q,loading:y,children:"Confirm"})]})]})}),M&&(0,l.jsx)(r.rq,{isOpen:M,onClose:()=>I(!1),onSelect:e=>{if(!U||e.isPlaceholder)return;let t={...O,[U]:e.value};$(t),L(t)},selectedModel:U?O[U]:null,activeProviders:p,modelAliases:h,title:`Select model for ${U}`})]})}var ek=s(98500),eC=s.n(ek);function e_({tool:e}){return(0,l.jsx)(eC(),{href:"/dashboard/mitm",className:"block",children:(0,l.jsx)(r.Zp,{padding:"sm",className:"overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.A,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"},loading:"lazy",decoding:"async"})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded-full",children:"MITM"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"chevron_right"})]})})})}},40295:e=>{e.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"]}}}}]);