9router 0.3.54 → 0.3.56

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 (387) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +34 -34
  3. package/app/.next/build-manifest.json +5 -5
  4. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  5. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  6. package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  7. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  9. package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  16. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  18. package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  19. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  21. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  22. package/app/.next/server/app/_global-error.html +2 -2
  23. package/app/.next/server/app/_global-error.rsc +1 -1
  24. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  25. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  26. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  27. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  28. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  29. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  30. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  31. package/app/.next/server/app/_not-found.html +1 -1
  32. package/app/.next/server/app/_not-found.rsc +4 -4
  33. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
  34. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  35. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
  36. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  37. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  38. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  39. package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  40. package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
  42. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
  43. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
  44. package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
  45. package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
  46. package/app/.next/server/app/api/cli-tools/copilot-settings/route_client-reference-manifest.js +1 -1
  47. package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
  48. package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
  49. package/app/.next/server/app/api/cli-tools/opencode-settings/route_client-reference-manifest.js +1 -1
  50. package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
  51. package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
  52. package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
  54. package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
  55. package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
  56. package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  57. package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
  58. package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
  59. package/app/.next/server/app/api/locale/route.js +1 -1
  60. package/app/.next/server/app/api/locale/route_client-reference-manifest.js +1 -1
  61. package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
  62. package/app/.next/server/app/api/models/route.js +1 -1
  63. package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  64. package/app/.next/server/app/api/models/test/route_client-reference-manifest.js +1 -1
  65. package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
  66. package/app/.next/server/app/api/oauth/cursor/auto-import/route.js +1 -1
  67. package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
  68. package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
  69. package/app/.next/server/app/api/oauth/iflow/cookie/route_client-reference-manifest.js +1 -1
  70. package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
  71. package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
  72. package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
  73. package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
  74. package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
  75. package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
  76. package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
  77. package/app/.next/server/app/api/provider-nodes/validate/route.js +1 -1
  78. package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
  79. package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
  80. package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
  81. package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
  82. package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
  83. package/app/.next/server/app/api/providers/[id]/test-models/route_client-reference-manifest.js +1 -1
  84. package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
  85. package/app/.next/server/app/api/providers/route.js +1 -1
  86. package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  87. package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
  88. package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
  89. package/app/.next/server/app/api/proxy-pools/[id]/route_client-reference-manifest.js +1 -1
  90. package/app/.next/server/app/api/proxy-pools/[id]/test/route_client-reference-manifest.js +1 -1
  91. package/app/.next/server/app/api/proxy-pools/route_client-reference-manifest.js +1 -1
  92. package/app/.next/server/app/api/settings/database/route_client-reference-manifest.js +1 -1
  93. package/app/.next/server/app/api/settings/proxy-test/route_client-reference-manifest.js +1 -1
  94. package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
  95. package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  96. package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  97. package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  98. package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
  99. package/app/.next/server/app/api/translator/console-logs/route_client-reference-manifest.js +1 -1
  100. package/app/.next/server/app/api/translator/console-logs/stream/route.js +1 -1
  101. package/app/.next/server/app/api/translator/console-logs/stream/route_client-reference-manifest.js +1 -1
  102. package/app/.next/server/app/api/translator/load/route.js.nft.json +1 -1
  103. package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
  104. package/app/.next/server/app/api/translator/save/route.js.nft.json +1 -1
  105. package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
  106. package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
  107. package/app/.next/server/app/api/translator/translate/route.js +1 -1
  108. package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
  109. package/app/.next/server/app/api/tunnel/disable/route.js +1 -1
  110. package/app/.next/server/app/api/tunnel/disable/route_client-reference-manifest.js +1 -1
  111. package/app/.next/server/app/api/tunnel/enable/route.js +1 -1
  112. package/app/.next/server/app/api/tunnel/enable/route_client-reference-manifest.js +1 -1
  113. package/app/.next/server/app/api/tunnel/status/route.js +1 -1
  114. package/app/.next/server/app/api/tunnel/status/route_client-reference-manifest.js +1 -1
  115. package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
  116. package/app/.next/server/app/api/usage/chart/route_client-reference-manifest.js +1 -1
  117. package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
  118. package/app/.next/server/app/api/usage/providers/route_client-reference-manifest.js +1 -1
  119. package/app/.next/server/app/api/usage/request-details/route_client-reference-manifest.js +1 -1
  120. package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
  121. package/app/.next/server/app/api/usage/stats/route_client-reference-manifest.js +1 -1
  122. package/app/.next/server/app/api/usage/stream/route_client-reference-manifest.js +1 -1
  123. package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
  124. package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
  125. package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
  126. package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
  127. package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
  128. package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
  129. package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
  130. package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
  131. package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
  132. package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
  133. package/app/.next/server/app/api/version/route.js +1 -1
  134. package/app/.next/server/app/api/version/route_client-reference-manifest.js +1 -1
  135. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  136. package/app/.next/server/app/callback.html +1 -1
  137. package/app/.next/server/app/callback.rsc +4 -4
  138. package/app/.next/server/app/callback.segments/_full.segment.rsc +4 -4
  139. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  140. package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
  141. package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
  142. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  143. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  144. package/app/.next/server/app/dashboard/cli-tools.html +1 -1
  145. package/app/.next/server/app/dashboard/cli-tools.rsc +6 -6
  146. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  147. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  148. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  149. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  150. package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  151. package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  152. package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
  153. package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  154. package/app/.next/server/app/dashboard/combos.html +1 -1
  155. package/app/.next/server/app/dashboard/combos.rsc +6 -6
  156. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  157. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  158. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  159. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  160. package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
  161. package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  162. package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
  163. package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  164. package/app/.next/server/app/dashboard/endpoint.html +1 -1
  165. package/app/.next/server/app/dashboard/endpoint.rsc +6 -6
  166. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  167. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  168. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  169. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  170. package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
  171. package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  172. package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
  173. package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  174. package/app/.next/server/app/dashboard/mitm.html +1 -1
  175. package/app/.next/server/app/dashboard/mitm.rsc +6 -6
  176. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  177. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  178. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  179. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  180. package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  181. package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  182. package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
  183. package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  184. package/app/.next/server/app/dashboard/profile.html +1 -1
  185. package/app/.next/server/app/dashboard/profile.rsc +6 -6
  186. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  187. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  188. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  189. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  190. package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
  191. package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  192. package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
  193. package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  194. package/app/.next/server/app/dashboard/providers/new.html +1 -1
  195. package/app/.next/server/app/dashboard/providers/new.rsc +6 -6
  196. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  197. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  198. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  199. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  200. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  201. package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
  202. package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  203. package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
  204. package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  205. package/app/.next/server/app/dashboard/providers.html +1 -1
  206. package/app/.next/server/app/dashboard/providers.rsc +6 -6
  207. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  208. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  209. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  210. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  211. package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
  212. package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  213. package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
  214. package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  215. package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
  216. package/app/.next/server/app/dashboard/proxy-pools.rsc +6 -6
  217. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  218. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  219. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  220. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  221. package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
  222. package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  223. package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
  224. package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  225. package/app/.next/server/app/dashboard/quota.html +2 -2
  226. package/app/.next/server/app/dashboard/quota.rsc +7 -7
  227. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  228. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  229. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  230. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  231. package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
  232. package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  233. package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
  234. package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  235. package/app/.next/server/app/dashboard/settings/pricing/page.js +1 -1
  236. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  237. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  238. package/app/.next/server/app/dashboard/settings/pricing.rsc +5 -5
  239. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +5 -5
  240. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  241. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  242. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  243. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
  244. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  245. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  246. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  247. package/app/.next/server/app/dashboard/translator.html +1 -1
  248. package/app/.next/server/app/dashboard/translator.rsc +6 -6
  249. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  250. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  251. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  252. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  253. package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
  254. package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  255. package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
  256. package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  257. package/app/.next/server/app/dashboard/usage.html +1 -1
  258. package/app/.next/server/app/dashboard/usage.rsc +6 -6
  259. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  260. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  261. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  262. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  263. package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
  264. package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  265. package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
  266. package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  267. package/app/.next/server/app/dashboard.html +1 -1
  268. package/app/.next/server/app/dashboard.rsc +6 -6
  269. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  270. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  271. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  272. package/app/.next/server/app/dashboard.segments/_full.segment.rsc +6 -6
  273. package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  274. package/app/.next/server/app/dashboard.segments/_index.segment.rsc +4 -4
  275. package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  276. package/app/.next/server/app/index.html +1 -1
  277. package/app/.next/server/app/index.rsc +4 -4
  278. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  279. package/app/.next/server/app/index.segments/_full.segment.rsc +4 -4
  280. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  281. package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
  282. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  283. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  284. package/app/.next/server/app/landing.html +1 -1
  285. package/app/.next/server/app/landing.rsc +5 -5
  286. package/app/.next/server/app/landing.segments/_full.segment.rsc +5 -5
  287. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  288. package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
  289. package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
  290. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
  291. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  292. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  293. package/app/.next/server/app/login.html +1 -1
  294. package/app/.next/server/app/login.rsc +5 -5
  295. package/app/.next/server/app/login.segments/_full.segment.rsc +5 -5
  296. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  297. package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
  298. package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  299. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  300. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  301. package/app/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  302. package/app/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  303. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  304. package/app/.next/server/app-paths-manifest.json +34 -34
  305. package/app/.next/server/chunks/1114.js +1 -1
  306. package/app/.next/server/chunks/1424.js +1 -1
  307. package/app/.next/server/chunks/318.js +1 -1
  308. package/app/.next/server/chunks/3832.js +1 -1
  309. package/app/.next/server/chunks/412.js +1 -1
  310. package/app/.next/server/chunks/6182.js +4 -17
  311. package/app/.next/server/chunks/649.js +2 -2
  312. package/app/.next/server/chunks/7341.js +1 -1
  313. package/app/.next/server/chunks/8590.js +1 -1
  314. package/app/.next/server/chunks/9201.js +1 -1
  315. package/app/.next/server/chunks/9718.js +1 -1
  316. package/app/.next/server/middleware-build-manifest.js +1 -1
  317. package/app/.next/server/pages/404.html +1 -1
  318. package/app/.next/server/pages/500.html +2 -2
  319. package/app/.next/server/server-reference-manifest.js +1 -1
  320. package/app/.next/server/server-reference-manifest.json +1 -1
  321. package/app/.next/static/chunks/2652-51aca5cd32bd186f.js +1 -0
  322. package/app/.next/static/chunks/3794-23858078d298f399.js +2 -0
  323. package/app/.next/static/chunks/{4bd1b696-e5d7c65570c947b7.js → 4bd1b696-84e33c69f320f6a0.js} +1 -1
  324. package/app/.next/static/chunks/{5497-4115bafa029568f2.js → 5497-c5403d4340dfbeb0.js} +3 -3
  325. package/app/.next/static/chunks/{619-c4c101a6a78feeb4.js → 619-bfe7e89fff6eb942.js} +1 -1
  326. package/app/.next/static/chunks/{9242-c9d752975b449b44.js → 9242-a85bb5812b359227.js} +3 -3
  327. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-d973cbda9e65d6ae.js → page-15fc16f73981b9be.js} +1 -1
  328. package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/page-fb6736d76c7a3b6a.js +1 -0
  329. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-4ebc425afc0a221a.js → page-5e7e72628fe63cec.js} +1 -1
  330. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-bf901cec2b7f0ea0.js +1 -0
  331. package/app/.next/static/chunks/app/dashboard/settings/pricing/{page-4b7305b3e5d6e57b.js → page-e097c892258ad1fd.js} +1 -1
  332. package/app/.next/static/chunks/app/landing/{page-106f74afc6f71a31.js → page-cb9f1320605eaafc.js} +1 -1
  333. package/app/.next/static/chunks/app/{layout-2cf69a29bcc7722e.js → layout-a3634d564d5e7993.js} +1 -1
  334. package/app/.next/static/chunks/{framework-9f63a52f5ba18ac8.js → framework-6854168261815bb6.js} +1 -1
  335. package/app/.next/static/chunks/{main-aab9e1b069a77e0f.js → main-5b78d3de83609121.js} +2 -2
  336. package/app/.next/static/chunks/webpack-9bef9bba7ebc0551.js +1 -0
  337. package/app/.next/static/css/9dff3edaebe94c91.css +3 -0
  338. package/app/package.json +4 -1
  339. package/app/public/i18n/literals/ar.json +196 -0
  340. package/app/public/i18n/literals/bn.json +196 -0
  341. package/app/public/i18n/literals/cs.json +196 -0
  342. package/app/public/i18n/literals/da.json +196 -0
  343. package/app/public/i18n/literals/de.json +196 -0
  344. package/app/public/i18n/literals/el.json +196 -0
  345. package/app/public/i18n/literals/es.json +196 -0
  346. package/app/public/i18n/literals/fi.json +196 -0
  347. package/app/public/i18n/literals/fr.json +196 -0
  348. package/app/public/i18n/literals/he.json +196 -0
  349. package/app/public/i18n/literals/hi.json +196 -0
  350. package/app/public/i18n/literals/hu.json +196 -0
  351. package/app/public/i18n/literals/id.json +196 -0
  352. package/app/public/i18n/literals/it.json +196 -0
  353. package/app/public/i18n/literals/ja.json +196 -0
  354. package/app/public/i18n/literals/ko.json +196 -0
  355. package/app/public/i18n/literals/nl.json +196 -0
  356. package/app/public/i18n/literals/no.json +196 -0
  357. package/app/public/i18n/literals/pl.json +196 -0
  358. package/app/public/i18n/literals/pt-BR.json +196 -0
  359. package/app/public/i18n/literals/pt-PT.json +196 -0
  360. package/app/public/i18n/literals/ro.json +196 -0
  361. package/app/public/i18n/literals/ru.json +196 -0
  362. package/app/public/i18n/literals/sv.json +196 -0
  363. package/app/public/i18n/literals/th.json +196 -0
  364. package/app/public/i18n/literals/tl.json +196 -0
  365. package/app/public/i18n/literals/tr.json +196 -0
  366. package/app/public/i18n/literals/uk.json +196 -0
  367. package/app/public/i18n/literals/ur.json +196 -0
  368. package/app/public/i18n/literals/zh-TW.json +196 -0
  369. package/app/src/mitm/server.js +1 -297
  370. package/cli.js +6 -8
  371. package/package.json +1 -1
  372. package/app/.next/static/chunks/2652-378fd4fa14847021.js +0 -1
  373. package/app/.next/static/chunks/3794-c67589461d449d62.js +0 -2
  374. package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/page-bf88929b2cc595ab.js +0 -1
  375. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-3143d3dbb2dc3422.js +0 -1
  376. package/app/.next/static/chunks/webpack-25c43999146c934e.js +0 -1
  377. package/app/.next/static/css/4016074f63f34af9.css +0 -3
  378. package/app/src/mitm/cert/generate.js +0 -32
  379. package/app/src/mitm/cert/install.js +0 -177
  380. package/app/src/mitm/cert/rootCA.js +0 -153
  381. package/app/src/mitm/dns/dnsConfig.js +0 -270
  382. package/app/src/mitm/logger.js +0 -8
  383. package/app/src/mitm/manager.js +0 -611
  384. package/app/src/mitm/paths.js +0 -16
  385. package/app/src/mitm/server2.js +0 -1099
  386. /package/app/.next/static/{lQALtClEnCtM3rGs1b9Jb → gStrggE8HSBGxSIt_oloe}/_buildManifest.js +0 -0
  387. /package/app/.next/static/{lQALtClEnCtM3rGs1b9Jb → gStrggE8HSBGxSIt_oloe}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";exports.id=649,exports.ids=[649],exports.modules={62911:(a,b,c)=>{c.d(b,{d:()=>d});let d={claude:{id:"claude",name:"Claude Code",icon:"terminal",color:"#D97757",description:"Anthropic Claude Code CLI",configType:"env",envVars:{baseUrl:"ANTHROPIC_BASE_URL",model:"ANTHROPIC_MODEL",opusModel:"ANTHROPIC_DEFAULT_OPUS_MODEL",sonnetModel:"ANTHROPIC_DEFAULT_SONNET_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-4-6"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-4-6"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},openclaw:{id:"openclaw",name:"Open Claw",image:"/providers/openclaw.png",color:"#FF6B35",description:"Open Claw AI Assistant",configType:"custom"},codex:{id:"codex",name:"OpenAI Codex CLI",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},opencode:{id:"opencode",name:"OpenCode",image:"/providers/opencode.png",color:"#E87040",description:"OpenCode AI Terminal Assistant",configType:"custom"},antigravity:{id:"antigravity",name:"Antigravity",image:"/providers/antigravity.png",color:"#4285F4",description:"Google Antigravity IDE with MITM",configType:"mitm",mitmDomain:"daily-cloudcode-pa.googleapis.com",modelAliases:["claude-opus-4-6-thinking","claude-sonnet-4-6","gemini-3-flash","gpt-oss-120b-medium","gemini-3-pro-high","gemini-3-pro-low"],defaultModels:[{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro High",alias:"gemini-3.1-pro-high"},{id:"gemini-3.1-pro-low",name:"Gemini 3.1 Pro Low",alias:"gemini-3.1-pro-low"},{id:"gemini-3-flash",name:"Gemini 3 Flash",alias:"gemini-3-flash"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"claude-sonnet-4-6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",alias:"claude-opus-4-6-thinking"},{id:"gpt-oss-120b-medium",name:"GPT OSS 120B Medium",alias:"gpt-oss-120b-medium"}]},copilot:{id:"copilot",name:"GitHub Copilot",image:"/providers/copilot.png",color:"#1F6FEB",description:"GitHub Copilot IDE with MITM",configType:"mitm",mitmDomain:"api.individual.githubcopilot.com",modelAliases:["gpt-4o-mini","claude-haiku-4.5","gpt-4o","gpt-5-mini"],defaultModels:[{id:"gpt-4o",name:"GPT-4o",alias:"gpt-4o"},{id:"gpt-4.1",name:"GPT-4.1",alias:"gpt-4.1"},{id:"gpt-5-mini",name:"GPT-5 Mini",alias:"gpt-5-mini"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"}]},droid:{id:"droid",name:"Factory Droid",image:"/providers/droid.png",color:"#00D4FF",description:"Factory Droid AI Assistant",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresExternalUrl:!0,notes:[{type:"warning",text:"Requires Cursor Pro account to use this feature."},{type:"cloudCheck",text:"Cursor routes requests through its own server, so local endpoint is not supported. Please enable Tunnel or Cloud Endpoint in Settings."}],guideSteps:[{step:1,title:"Open Settings",desc:"Go to Settings → Models"},{step:2,title:"Enable OpenAI API",desc:'Enable "OpenAI API key" option'},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Add Custom Model",desc:'Click "View All Model" → "Add Custom Model"'},{step:6,title:"Select Model",type:"modelSelector"}]},cline:{id:"cline",name:"Cline",image:"/providers/cline.png",color:"#00D1B2",description:"Cline AI Coding Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Cline Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},kilo:{id:"kilo",name:"Kilo Code",image:"/providers/kilocode.png",color:"#FF6B6B",description:"Kilo Code AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Kilo Code Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},roo:{id:"roo",name:"Roo",image:"/providers/roo.png",color:"#FF6B6B",description:"Roo AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Roo Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → Ollama"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Config",desc:"Open Continue configuration file"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Model",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Add the following configuration to your models array:"}],codeBlock:{language:"json",code:`{
1
+ "use strict";exports.id=649,exports.ids=[649],exports.modules={62911:(a,b,c)=>{c.d(b,{d:()=>d});let d={claude:{id:"claude",name:"Claude Code",icon:"terminal",color:"#D97757",description:"Anthropic Claude Code CLI",configType:"env",envVars:{baseUrl:"ANTHROPIC_BASE_URL",model:"ANTHROPIC_MODEL",opusModel:"ANTHROPIC_DEFAULT_OPUS_MODEL",sonnetModel:"ANTHROPIC_DEFAULT_SONNET_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-4-6"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-4-6"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},openclaw:{id:"openclaw",name:"Open Claw",image:"/providers/openclaw.png",color:"#FF6B35",description:"Open Claw AI Assistant",configType:"custom"},codex:{id:"codex",name:"OpenAI Codex CLI",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},opencode:{id:"opencode",name:"OpenCode",image:"/providers/opencode.png",color:"#E87040",description:"OpenCode AI Terminal Assistant",configType:"custom"},antigravity:{id:"antigravity",name:"Antigravity",image:"/providers/antigravity.png",color:"#4285F4",description:"Google Antigravity IDE with MITM",configType:"mitm",mitmDomain:"daily-cloudcode-pa.googleapis.com",modelAliases:["claude-opus-4-6-thinking","claude-sonnet-4-6","gemini-3-flash","gpt-oss-120b-medium","gemini-3-pro-high","gemini-3-pro-low"],defaultModels:[{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro High",alias:"gemini-3.1-pro-high"},{id:"gemini-3.1-pro-low",name:"Gemini 3.1 Pro Low",alias:"gemini-3.1-pro-low"},{id:"gemini-3-flash",name:"Gemini 3 Flash",alias:"gemini-3-flash"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"claude-sonnet-4-6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",alias:"claude-opus-4-6-thinking"},{id:"gpt-oss-120b-medium",name:"GPT OSS 120B Medium",alias:"gpt-oss-120b-medium"}]},copilot:{id:"copilot",name:"GitHub Copilot",image:"/providers/copilot.png",color:"#1F6FEB",description:"GitHub Copilot IDE with MITM",configType:"mitm",mitmDomain:"api.individual.githubcopilot.com",modelAliases:["gpt-4o-mini","claude-haiku-4.5","gpt-4o","gpt-5-mini"],defaultModels:[{id:"gpt-4o",name:"GPT-4o",alias:"gpt-4o"},{id:"gpt-4.1",name:"GPT-4.1",alias:"gpt-4.1"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"}]},kiro:{id:"kiro",name:"Kiro",image:"/providers/kiro.png",color:"#FF6B00",description:"Kiro IDE with MITM",configType:"mitm",mitmDomain:"q.us-east-1.amazonaws.com",defaultModels:[{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",alias:"claude-sonnet-4.5"},{id:"claude-sonnet-4",name:"Claude Sonnet 4",alias:"claude-sonnet-4"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"},{id:"deepseek-3.2",name:"DeepSeek 3.2",alias:"deepseek-3.2"},{id:"minimax-m2.1",name:"MiniMax M2.1",alias:"minimax-m2.1"},{id:"simple-task",name:"Qwen3 Coder Next",alias:"simple-task"}]},droid:{id:"droid",name:"Factory Droid",image:"/providers/droid.png",color:"#00D4FF",description:"Factory Droid AI Assistant",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresExternalUrl:!0,notes:[{type:"warning",text:"Requires Cursor Pro account to use this feature."},{type:"cloudCheck",text:"Cursor routes requests through its own server, so local endpoint is not supported. Please enable Tunnel or Cloud Endpoint in Settings."}],guideSteps:[{step:1,title:"Open Settings",desc:"Go to Settings → Models"},{step:2,title:"Enable OpenAI API",desc:'Enable "OpenAI API key" option'},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Add Custom Model",desc:'Click "View All Model" → "Add Custom Model"'},{step:6,title:"Select Model",type:"modelSelector"}]},cline:{id:"cline",name:"Cline",image:"/providers/cline.png",color:"#00D1B2",description:"Cline AI Coding Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Cline Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},kilo:{id:"kilo",name:"Kilo Code",image:"/providers/kilocode.png",color:"#FF6B6B",description:"Kilo Code AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Kilo Code Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},roo:{id:"roo",name:"Roo",image:"/providers/roo.png",color:"#FF6B6B",description:"Roo AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Roo Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → Ollama"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Config",desc:"Open Continue configuration file"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Model",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Add the following configuration to your models array:"}],codeBlock:{language:"json",code:`{
2
2
  "apiBase": "{{baseUrl}}",
3
3
  "title": "{{model}}",
4
4
  "model": "{{model}}",
@@ -12,4 +12,4 @@ model_provider = "9router"
12
12
  name = "9Router"
13
13
  base_url = "${O()}"
14
14
  wire_api = "responses"
15
- `},{filename:"~/.codex/auth.json",content:JSON.stringify({OPENAI_API_KEY:o},null,2)}])})]})}let k=process.env.NEXT_PUBLIC_CLOUD_URL;function l({tool:a,isExpanded:b,onToggle:c,baseUrl:h,hasActiveProviders:i,apiKeys:j,activeProviders:l,cloudEnabled:m,initialStatus:n}){let o,p,q,r,[s,t]=(0,e.useState)(n||null),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(null),[C,D]=(0,e.useState)(""),[E,F]=(0,e.useState)(""),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)({}),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)("");(0,e.useRef)(!1);let O=(()=>{if(!s?.installed)return null;let a=s.settings?.customModels?.find(a=>"custom:9Router-0"===a.id);if(!a)return"not_configured";let b=a.baseUrl?.includes("localhost")||a.baseUrl?.includes("127.0.0.1"),c=m&&k&&a.baseUrl?.startsWith(k),d=h&&a.baseUrl?.startsWith(h);return b||c||d?"configured":"other"})(),P=async()=>{v(!0);try{let a=await fetch("/api/cli-tools/droid-settings"),b=await a.json();t(b)}catch(a){t({installed:!1,error:a.message})}finally{v(!1)}},Q=()=>{let a=M||h;return a.endsWith("/v1")?a:`${a}/v1`},R=async()=>{x(!0),B(null);try{let a=C?.trim()||(j?.length>0?j[0].key:null)||(m?null:"sk_9router"),b=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Q(),apiKey:a,model:E})}),c=await b.json();b.ok?(B({type:"success",text:"Settings applied successfully!"}),P()):B({type:"error",text:c.error||"Failed to apply settings"})}catch(a){B({type:"error",text:a.message})}finally{x(!1)}},S=async()=>{z(!0),B(null);try{let a=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),b=await a.json();a.ok?(B({type:"success",text:"Settings reset successfully!"}),F(""),D(""),P()):B({type:"error",text:b.error||"Failed to reset settings"})}catch(a){B({type:"error",text:a.message})}finally{z(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:c,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/droid.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===O&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===O&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===O&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[u&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!u&&s&&!s.installed&&(0,d.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not installed"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Factory Droid CLI to use this feature."})]})]}),!u&&s?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[s?.settings?.customModels?.find(a=>"custom:9Router-0"===a.id)?.baseUrl&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:s.settings.customModels.find(a=>"custom:9Router-0"===a.id).baseUrl})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:(o=M||h).endsWith("/v1")?o:`${o}/v1`,onChange:a=>N(a.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),M&&M!==h&&(0,d.jsx)("button",{onClick:()=>N(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),j.length>0?(0,d.jsx)("select",{value:C,onChange:a=>D(a.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:j.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}):(0,d.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:m?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:E,onChange:a=>F(a.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>H(!0),disabled:!i,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${i?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),E&&(0,d.jsx)("button",{onClick:()=>F(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),A&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,d.jsx)("span",{children:A.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:R,disabled:!E,loading:w,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:S,disabled:!s?.has9Router,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>L(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:G,onClose:()=>H(!1),onSelect:a=>{F(a.value),H(!1)},selectedModel:E,activeProviders:l,modelAliases:I,title:"Select Model for Factory Droid"}),(0,d.jsx)(f.uR,{isOpen:K,onClose:()=>L(!1),title:"Factory Droid - Manual Configuration",configs:(p=C&&C.trim()?C:m?"<API_KEY_FROM_DASHBOARD>":"sk_9router",q={customModels:[{model:E||"provider/model-id",id:"custom:9Router-0",index:0,baseUrl:Q(),apiKey:p,displayName:E||"provider/model-id",maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}]},r="u">typeof navigator&&navigator.platform,[{filename:r?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(q,null,2)}])})]})}function m({tool:a,isExpanded:b,onToggle:c,baseUrl:h,hasActiveProviders:i,apiKeys:j,activeProviders:k,cloudEnabled:l,initialStatus:m}){let n,o,[p,q]=(0,e.useState)(m||null),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(null),[z,A]=(0,e.useState)(""),[B,C]=(0,e.useState)(""),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)({}),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)("");(0,e.useRef)(!1);let L=(()=>{if(!p?.installed)return null;let a=p.settings?.models?.providers?.["9router"];if(!a)return"not_configured";let b=a.baseUrl?.includes("localhost")||a.baseUrl?.includes("127.0.0.1")||a.baseUrl?.includes("0.0.0.0"),c=h&&a.baseUrl?.startsWith(h);return b||c?"configured":"other"})(),M=async()=>{s(!0);try{let a=await fetch("/api/cli-tools/openclaw-settings"),b=await a.json();q(b)}catch(a){q({installed:!1,error:a.message})}finally{s(!1)}},N=()=>{let a=J||"http://127.0.0.1:20128";return a.endsWith("/v1")?a:`${a}/v1`},O=async()=>{u(!0),y(null);try{let a=z?.trim()||(j?.length>0?j[0].key:null)||(l?null:"sk_9router"),b=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:N(),apiKey:a,model:B})}),c=await b.json();b.ok?(y({type:"success",text:"Settings applied successfully!"}),M()):y({type:"error",text:c.error||"Failed to apply settings"})}catch(a){y({type:"error",text:a.message})}finally{u(!1)}},P=async()=>{w(!0),y(null);try{let a=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),b=await a.json();a.ok?(y({type:"success",text:"Settings reset successfully!"}),C(""),A(""),M()):y({type:"error",text:b.error||"Failed to reset settings"})}catch(a){y({type:"error",text:a.message})}finally{w(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:c,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/openclaw.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===L&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===L&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===L&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[r&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!r&&p&&!p.installed&&(0,d.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not installed"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Open Claw CLI to use this feature."})]})]}),!r&&p?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[p?.settings?.models?.providers?.["9router"]?.baseUrl&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:p.settings.models.providers["9router"].baseUrl})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:(n=J||"http://127.0.0.1:20128").endsWith("/v1")?n:`${n}/v1`,onChange:a=>K(a.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),J&&J!==h&&(0,d.jsx)("button",{onClick:()=>K(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),j.length>0?(0,d.jsx)("select",{value:z,onChange:a=>A(a.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:j.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}):(0,d.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:l?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:B,onChange:a=>C(a.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>E(!0),disabled:!i,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${i?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),B&&(0,d.jsx)("button",{onClick:()=>C(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),x&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===x.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===x.type?"check_circle":"error"}),(0,d.jsx)("span",{children:x.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:O,disabled:!B,loading:t,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:P,disabled:!p?.has9Router,loading:v,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>I(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:D,onClose:()=>E(!1),onSelect:a=>{C(a.value),E(!1)},selectedModel:B,activeProviders:k,modelAliases:F,title:"Select Model for Open Claw"}),(0,d.jsx)(f.uR,{isOpen:H,onClose:()=>I(!1),title:"Open Claw - Manual Configuration",configs:(o=z&&z.trim()?z:l?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`9router/${B||"provider/model-id"}`}}},models:{providers:{"9router":{baseUrl:N(),apiKey:o,api:"openai-completions",models:[{id:B||"provider/model-id",name:(B||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}function n({toolId:a,tool:b,isExpanded:c,onToggle:h,baseUrl:i,apiKeys:j,activeProviders:k=[],cloudEnabled:l=!1,tunnelEnabled:m=!1}){let[n,o]=(0,e.useState)(null),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(()=>j?.length>0?j[0].key:""),v=a=>{let b=t&&t.trim()?t:l?"your-api-key":"sk_9router",c=i||"http://localhost:20128",d=c.endsWith("/v1")?c:`${c}/v1`;return a.replace(/\{\{baseUrl\}\}/g,d).replace(/\{\{apiKey\}\}/g,b).replace(/\{\{model\}\}/g,r||"provider/model-id")},w=async(a,b)=>{await navigator.clipboard.writeText(v(a)),o(b),setTimeout(()=>o(null),2e3)},x=k.length>0,y=()=>(!b.requiresExternalUrl||!!l||!!m)&&(!b.requiresCloud||!!l);return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:h,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:b.image?(0,d.jsx)(g.default,{src:b.image,alt:b.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}}):b.icon?(0,d.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:b.color},children:b.icon}):(0,d.jsx)(g.default,{src:`/providers/${a}.png`,alt:b.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:b.name}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:b.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${c?"rotate-180":""}`,children:"expand_more"})]}),c&&(0,d.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:b.guideSteps?(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[b.notes&&0!==b.notes.length?(0,d.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:b.notes.map((a,b)=>{if("cloudCheck"===a.type&&(l||m))return null;let c="warning"===a.type,e="cloudCheck"===a.type&&!l&&!m,f="bg-blue-500/10 border-blue-500/30",g="text-blue-600 dark:text-blue-400",h="text-blue-500",i="info";return c?(f="bg-yellow-500/10 border-yellow-500/30",g="text-yellow-600 dark:text-yellow-400",h="text-yellow-500",i="warning"):e&&(f="bg-red-500/10 border-red-500/30",g="text-red-600 dark:text-red-400",h="text-red-500",i="error"),(0,d.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${f}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-lg ${h}`,children:i}),(0,d.jsx)("p",{className:`text-sm ${g}`,children:a.text})]},b)})}):null,y()&&b.guideSteps.map(a=>(0,d.jsxs)("div",{className:"flex items-start gap-4",children:[(0,d.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:b.color},children:a.step}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"font-medium text-text",children:a.title}),a.desc&&(0,d.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:a.desc}),"apiKeySelector"===a.type&&(0,d.jsx)("div",{className:"mt-2 flex items-center gap-2",children:j&&j.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("select",{value:t,onChange:a=>u(a.target.value),className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:j.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}),(0,d.jsx)("button",{onClick:()=>w(t,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===n?"check":"content_copy"})})]}):(0,d.jsx)("span",{className:"text-sm text-text-muted",children:l?"No API keys - Create one in Keys page":"sk_9router"})}),"modelSelector"===a.type&&(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,d.jsx)("input",{type:"text",value:r,onChange:a=>s(a.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>q(!0),disabled:!x,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${x?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{onClick:()=>w(r,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===n?"check":"content_copy"})}),(0,d.jsx)("button",{onClick:()=>s(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),a.value&&(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,d.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:v(a.value)}),a.copyable&&(0,d.jsx)("button",{onClick:()=>w(a.value,`${a.step}-${a.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:n===`${a.step}-${a.title}`?"check":"content_copy"})})]})]})]},a.step)),y()&&b.codeBlock&&(0,d.jsxs)("div",{className:"mt-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:b.codeBlock.language}),(0,d.jsxs)("button",{onClick:()=>w(b.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===n?"check":"content_copy"}),"codeblock"===n?"Copied!":"Copy"]})]}),(0,d.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,d.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:v(b.codeBlock.code)})})]})]}):(0,d.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,d.jsx)(f.rq,{isOpen:p,onClose:()=>q(!1),onSelect:a=>{s(a.value)},selectedModel:r,activeProviders:k,title:"Select Model"})]})}function o({tool:a,isExpanded:b,onToggle:c,baseUrl:h,apiKeys:i,activeProviders:j,cloudEnabled:k,initialStatus:l}){let m,[n,o]=(0,e.useState)(l||null),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(null),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(""),[B,C]=(0,e.useState)(""),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)({}),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(""),L=(()=>{if(!n?.installed)return null;if(!n.config)return"not_configured";let a=n.config?.provider?.["9router"]?.options?.baseURL||"",b=a.includes("localhost")||a.includes("127.0.0.1");return n.has9Router&&(b||a.includes(h))?"configured":n.has9Router?"other":"not_configured"})(),M=()=>{let a=J||h;return a.endsWith("/v1")?a:`${a}/v1`},N=async()=>{q(!0);try{let a=await fetch("/api/cli-tools/opencode-settings"),b=await a.json();o(b)}catch(a){o({installed:!1,error:a.message})}finally{q(!1)}},O=async()=>{s(!0),w(null);try{let a=z&&z.trim()||k?z:"sk_9router",b=await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:M(),apiKey:a,model:B})}),c=await b.json();b.ok?(w({type:"success",text:"Settings applied successfully!"}),N()):w({type:"error",text:c.error||"Failed to apply settings"})}catch(a){w({type:"error",text:a.message})}finally{s(!1)}},P=async()=>{u(!0),w(null);try{let a=await fetch("/api/cli-tools/opencode-settings",{method:"DELETE"}),b=await a.json();a.ok?(w({type:"success",text:"Settings reset successfully!"}),C(""),N()):w({type:"error",text:b.error||"Failed to reset settings"})}catch(a){w({type:"error",text:a.message})}finally{u(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:c,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/opencode.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===L&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===L&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===L&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[p&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking OpenCode CLI..."})]}),!p&&n&&!n.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"OpenCode CLI not installed"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Please install OpenCode CLI to use auto-apply feature."})]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:()=>y(!x),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:x?"expand_less":"help"}),x?"Hide":"How to Install"]})]}),x&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux:"}),(0,d.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g opencode-ai"})]}),(0,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"opencode"})," to verify."]})]})]})]}),!p&&n?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[n?.config?.provider?.["9router"]?.options?.baseURL&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:n.config.provider["9router"].options.baseURL})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:J||`${h}/v1`,onChange:a=>K(a.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),J&&J!==`${h}/v1`&&(0,d.jsx)("button",{onClick:()=>K(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),i.length>0?(0,d.jsx)("select",{value:z,onChange:a=>A(a.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:i.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}):(0,d.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:k?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:B,onChange:a=>C(a.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>E(!0),disabled:!j?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${j?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),B&&(0,d.jsx)("button",{onClick:()=>C(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),v&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===v.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===v.type?"check_circle":"error"}),(0,d.jsx)("span",{children:v.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:O,disabled:!B,loading:r,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:P,disabled:!n.has9Router,loading:t,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>I(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:D,onClose:()=>E(!1),onSelect:a=>{C(a.value),E(!1)},selectedModel:B,activeProviders:j,modelAliases:F,title:"Select Model for OpenCode"}),(0,d.jsx)(f.uR,{isOpen:H,onClose:()=>I(!1),title:"OpenCode - Manual Configuration",configs:(m=z&&z.trim()?z:k?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.config/opencode/opencode.json",content:JSON.stringify({provider:{"9router":{npm:"@ai-sdk/openai-compatible",options:{baseURL:M(),apiKey:m},models:{[B||"provider/model-id"]:{name:B||"provider/model-id"}}}},model:`9router/${B||"provider/model-id"}`},null,2)}])})]})}function p({apiKeys:a,cloudEnabled:b,onStatusChange:c}){let[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(null),u="u">typeof navigator&&navigator.userAgent?.includes("Windows"),v=async()=>{try{let a=await fetch("/api/cli-tools/antigravity-mitm");if(a.ok){let b=await a.json();h(b),c?.(b)}}catch{h({running:!1,certExists:!1,dnsStatus:{}})}},w=a=>{u||g?.hasCachedPassword?x(a,""):(t(a),l(!0),r(null))},x=async(c,d)=>{j(!0),r(null);try{if("trust-cert"===c){let a=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:d})}),b=await a.json();a.ok?r({type:"success",text:"Certificate trusted successfully"}):r({type:"error",text:b.error||"Failed to trust certificate"})}else if("start"===c){let c=o?.trim()||(a?.length>0?a[0].key:null)||(b?null:"sk_9router"),e=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,sudoPassword:d})}),f=await e.json();e.ok?r({type:"success",text:"Server started"}):r({type:"error",text:f.error||"Failed to start server"})}else{let a=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:d})}),b=await a.json();a.ok?r({type:"success",text:"Server stopped — all DNS cleared"}):r({type:"error",text:b.error||"Failed to stop server"})}l(!1),n(""),await v()}catch(a){r({type:"error",text:a.message})}finally{j(!1),t(null)}},y=()=>{m.trim()?x(s,m):r({type:"error",text:"Sudo password is required"})},z=g?.running;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,d.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),z?(0,d.jsx)(f.Ex,{variant:"success",size:"sm",children:"Running"}):(0,d.jsx)(f.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,d.jsx)("div",{className:"flex items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:g?.certExists},{label:"Trusted",ok:g?.certTrusted},{label:"Server",ok:z}].map(({label:a,ok:b})=>(0,d.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${b?"text-green-600":"text-text-muted"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:b?"check_circle":"cancel"}),a]},a))})]}),(0,d.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,d.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,d.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from 9Router"]}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,d.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"]})]}),!z&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted shrink-0",children:"API Key"}),a?.length>0?(0,d.jsx)("select",{value:o,onChange:a=>p(a.target.value),className:"flex-1 px-2 py-1 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:a.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}):(0,d.jsx)("span",{className:"text-xs text-text-muted",children:b?"No API keys — create one in Keys page":"sk_9router (default)"})]}),q&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===q.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===q.type?"check_circle":"error"}),(0,d.jsx)("span",{children:q.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 flex-wrap","data-i18n-skip":"true",children:[g?.certExists&&!g?.certTrusted&&!z&&(0,d.jsxs)("button",{onClick:()=>w("trust-cert"),disabled:i,className:"px-4 py-1.5 rounded-lg bg-yellow-500/10 border border-yellow-500/30 text-yellow-600 font-medium text-xs flex items-center gap-1.5 hover:bg-yellow-500/20 transition-colors disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),z?(0,d.jsxs)("button",{onClick:()=>w("stop"),disabled:i,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,d.jsxs)("button",{onClick:()=>w("start"),disabled:i,className:"px-4 py-1.5 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-xs flex items-center gap-1.5 hover:bg-primary/20 transition-colors disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),z&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),!z&&u&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-yellow-500/10 text-yellow-600 border border-yellow-500/20",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,d.jsx)("span",{children:"Windows: Run 9Router terminal as Administrator"})]})]})}),k&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,d.jsx)(f.pd,{type:"password",placeholder:"Enter sudo password",value:m,onChange:a=>n(a.target.value),onKeyDown:a=>{"Enter"!==a.key||i||y()}}),q&&(0,d.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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,d.jsx)("span",{children:q.text})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{l(!1),n(""),r(null)},disabled:i,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:y,loading:i,children:"Confirm"})]})]})})]})}function q({tool:a,isExpanded:b,onToggle:c,serverRunning:h,dnsActive:i,hasCachedPassword:j,apiKeys:k,activeProviders:l,hasActiveProviders:m,modelAliases:n={},cloudEnabled:o,onDnsChange:p}){let[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(""),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)({}),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(null),G="u">typeof navigator&&navigator.userAgent?.includes("Windows"),H=(0,e.useCallback)(async b=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:a.id,mappings:b})})}catch{}},[a.id]),I=(a,b)=>{B(c=>({...c,[a]:b}))},J=()=>{if(!h)return;let a=i?"disable":"enable";G||j?K(a,""):(z(a),v(!0),t(null))},K=async(b,c)=>{r(!0),t(null);try{let d=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:a.id,action:b,sudoPassword:c})}),e=await d.json();if(!d.ok)throw Error(e.error||"Failed to toggle DNS");"enable"===b?t({type:"success",text:"DNS enabled successfully.",warning:`Please restart ${a.name} to apply changes.`}):t({type:"success",text:"DNS disabled — traffic restored"}),v(!1),x(""),p?.(e)}catch(a){t({type:"error",text:a.message})}finally{r(!1),z(null)}},L=()=>{w.trim()?K(y,w):t({type:"error",text:"Sudo password is required"})};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:c,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),h?i?(0,d.jsx)(f.Ex,{variant:"success",size:"sm",children:"Active"}):(0,d.jsx)(f.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,d.jsx)(f.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Intercept ",a.name," requests via MITM proxy"]})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,d.jsxs)("p",{children:["Toggle DNS to redirect ",a.name," traffic through 9Router via MITM."]}),!i&&(0,d.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),s&&(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===s.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===s.type?"check_circle":"error"}),(0,d.jsx)("span",{children:s.text})]}),s.warning&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-amber-500/10 text-amber-600 border border-amber-500/20",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,d.jsx)("span",{className:"font-medium",children:s.warning})]})]}),a.defaultModels?.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-2",children:a.defaultModels.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-36 shrink-0 text-xs font-semibold text-text-main text-right",children:a.name}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:A[a.alias]||"",onChange:b=>I(a.alias,b.target.value),onBlur:b=>{var c,d;return c=a.alias,d=b.target.value,void H({...A,[c]:d})},placeholder:"provider/model-id",disabled:!i,className:`flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 ${!i?"opacity-50 cursor-not-allowed":""}`}),(0,d.jsx)("button",{onClick:()=>{F(a.alias),D(!0)},disabled:!m||!i,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 ${m&&i?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),A[a.alias]&&(0,d.jsx)("button",{onClick:()=>{I(a.alias,""),H({...A,[a.alias]:""})},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},a.alias))}),a.defaultModels?.length===0&&(0,d.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."}),(0,d.jsx)("div",{children:i?(0,d.jsxs)("button",{onClick:J,disabled:!h||q,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:J,loading:q,disabled:!h||q,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"play_circle"}),"Start DNS"]})})]})]}),u&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,d.jsx)(f.pd,{type:"password",placeholder:"Enter sudo password",value:w,onChange:a=>x(a.target.value),onKeyDown:a=>{"Enter"!==a.key||q||L()}}),s&&(0,d.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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,d.jsx)("span",{children:s.text})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{v(!1),x(""),t(null)},disabled:q,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:L,loading:q,children:"Confirm"})]})]})}),(0,d.jsx)(f.rq,{isOpen:C,onClose:()=>D(!1),onSelect:a=>{if(!E||a.isPlaceholder)return;let b={...A,[E]:a.value};B(b),H(b)},selectedModel:E?A[E]:null,activeProviders:l,modelAliases:n,title:`Select model for ${E}`})]})}}};
15
+ `},{filename:"~/.codex/auth.json",content:JSON.stringify({OPENAI_API_KEY:o},null,2)}])})]})}let k=process.env.NEXT_PUBLIC_CLOUD_URL;function l({tool:a,isExpanded:b,onToggle:c,baseUrl:h,hasActiveProviders:i,apiKeys:j,activeProviders:l,cloudEnabled:m,initialStatus:n}){let o,p,q,r,[s,t]=(0,e.useState)(n||null),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(null),[C,D]=(0,e.useState)(""),[E,F]=(0,e.useState)(""),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)({}),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)("");(0,e.useRef)(!1);let O=(()=>{if(!s?.installed)return null;let a=s.settings?.customModels?.find(a=>"custom:9Router-0"===a.id);if(!a)return"not_configured";let b=a.baseUrl?.includes("localhost")||a.baseUrl?.includes("127.0.0.1"),c=m&&k&&a.baseUrl?.startsWith(k),d=h&&a.baseUrl?.startsWith(h);return b||c||d?"configured":"other"})(),P=async()=>{v(!0);try{let a=await fetch("/api/cli-tools/droid-settings"),b=await a.json();t(b)}catch(a){t({installed:!1,error:a.message})}finally{v(!1)}},Q=()=>{let a=M||h;return a.endsWith("/v1")?a:`${a}/v1`},R=async()=>{x(!0),B(null);try{let a=C?.trim()||(j?.length>0?j[0].key:null)||(m?null:"sk_9router"),b=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Q(),apiKey:a,model:E})}),c=await b.json();b.ok?(B({type:"success",text:"Settings applied successfully!"}),P()):B({type:"error",text:c.error||"Failed to apply settings"})}catch(a){B({type:"error",text:a.message})}finally{x(!1)}},S=async()=>{z(!0),B(null);try{let a=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),b=await a.json();a.ok?(B({type:"success",text:"Settings reset successfully!"}),F(""),D(""),P()):B({type:"error",text:b.error||"Failed to reset settings"})}catch(a){B({type:"error",text:a.message})}finally{z(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:c,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/droid.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===O&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===O&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===O&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[u&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!u&&s&&!s.installed&&(0,d.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not installed"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Factory Droid CLI to use this feature."})]})]}),!u&&s?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[s?.settings?.customModels?.find(a=>"custom:9Router-0"===a.id)?.baseUrl&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:s.settings.customModels.find(a=>"custom:9Router-0"===a.id).baseUrl})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:(o=M||h).endsWith("/v1")?o:`${o}/v1`,onChange:a=>N(a.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),M&&M!==h&&(0,d.jsx)("button",{onClick:()=>N(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),j.length>0?(0,d.jsx)("select",{value:C,onChange:a=>D(a.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:j.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}):(0,d.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:m?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:E,onChange:a=>F(a.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>H(!0),disabled:!i,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${i?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),E&&(0,d.jsx)("button",{onClick:()=>F(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),A&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,d.jsx)("span",{children:A.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:R,disabled:!E,loading:w,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:S,disabled:!s?.has9Router,loading:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>L(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:G,onClose:()=>H(!1),onSelect:a=>{F(a.value),H(!1)},selectedModel:E,activeProviders:l,modelAliases:I,title:"Select Model for Factory Droid"}),(0,d.jsx)(f.uR,{isOpen:K,onClose:()=>L(!1),title:"Factory Droid - Manual Configuration",configs:(p=C&&C.trim()?C:m?"<API_KEY_FROM_DASHBOARD>":"sk_9router",q={customModels:[{model:E||"provider/model-id",id:"custom:9Router-0",index:0,baseUrl:Q(),apiKey:p,displayName:E||"provider/model-id",maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}]},r="u">typeof navigator&&navigator.platform,[{filename:r?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(q,null,2)}])})]})}function m({tool:a,isExpanded:b,onToggle:c,baseUrl:h,hasActiveProviders:i,apiKeys:j,activeProviders:k,cloudEnabled:l,initialStatus:m}){let n,o,[p,q]=(0,e.useState)(m||null),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(null),[z,A]=(0,e.useState)(""),[B,C]=(0,e.useState)(""),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)({}),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)("");(0,e.useRef)(!1);let L=(()=>{if(!p?.installed)return null;let a=p.settings?.models?.providers?.["9router"];if(!a)return"not_configured";let b=a.baseUrl?.includes("localhost")||a.baseUrl?.includes("127.0.0.1")||a.baseUrl?.includes("0.0.0.0"),c=h&&a.baseUrl?.startsWith(h);return b||c?"configured":"other"})(),M=async()=>{s(!0);try{let a=await fetch("/api/cli-tools/openclaw-settings"),b=await a.json();q(b)}catch(a){q({installed:!1,error:a.message})}finally{s(!1)}},N=()=>{let a=J||"http://127.0.0.1:20128";return a.endsWith("/v1")?a:`${a}/v1`},O=async()=>{u(!0),y(null);try{let a=z?.trim()||(j?.length>0?j[0].key:null)||(l?null:"sk_9router"),b=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:N(),apiKey:a,model:B})}),c=await b.json();b.ok?(y({type:"success",text:"Settings applied successfully!"}),M()):y({type:"error",text:c.error||"Failed to apply settings"})}catch(a){y({type:"error",text:a.message})}finally{u(!1)}},P=async()=>{w(!0),y(null);try{let a=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),b=await a.json();a.ok?(y({type:"success",text:"Settings reset successfully!"}),C(""),A(""),M()):y({type:"error",text:b.error||"Failed to reset settings"})}catch(a){y({type:"error",text:a.message})}finally{w(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:c,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/openclaw.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===L&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===L&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===L&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[r&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!r&&p&&!p.installed&&(0,d.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not installed"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Open Claw CLI to use this feature."})]})]}),!r&&p?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[p?.settings?.models?.providers?.["9router"]?.baseUrl&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:p.settings.models.providers["9router"].baseUrl})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:(n=J||"http://127.0.0.1:20128").endsWith("/v1")?n:`${n}/v1`,onChange:a=>K(a.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),J&&J!==h&&(0,d.jsx)("button",{onClick:()=>K(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),j.length>0?(0,d.jsx)("select",{value:z,onChange:a=>A(a.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:j.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}):(0,d.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:l?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:B,onChange:a=>C(a.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>E(!0),disabled:!i,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${i?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),B&&(0,d.jsx)("button",{onClick:()=>C(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),x&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===x.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===x.type?"check_circle":"error"}),(0,d.jsx)("span",{children:x.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:O,disabled:!B,loading:t,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:P,disabled:!p?.has9Router,loading:v,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>I(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:D,onClose:()=>E(!1),onSelect:a=>{C(a.value),E(!1)},selectedModel:B,activeProviders:k,modelAliases:F,title:"Select Model for Open Claw"}),(0,d.jsx)(f.uR,{isOpen:H,onClose:()=>I(!1),title:"Open Claw - Manual Configuration",configs:(o=z&&z.trim()?z:l?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`9router/${B||"provider/model-id"}`}}},models:{providers:{"9router":{baseUrl:N(),apiKey:o,api:"openai-completions",models:[{id:B||"provider/model-id",name:(B||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}function n({toolId:a,tool:b,isExpanded:c,onToggle:h,baseUrl:i,apiKeys:j,activeProviders:k=[],cloudEnabled:l=!1,tunnelEnabled:m=!1}){let[n,o]=(0,e.useState)(null),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(()=>j?.length>0?j[0].key:""),v=a=>{let b=t&&t.trim()?t:l?"your-api-key":"sk_9router",c=i||"http://localhost:20128",d=c.endsWith("/v1")?c:`${c}/v1`;return a.replace(/\{\{baseUrl\}\}/g,d).replace(/\{\{apiKey\}\}/g,b).replace(/\{\{model\}\}/g,r||"provider/model-id")},w=async(a,b)=>{await navigator.clipboard.writeText(v(a)),o(b),setTimeout(()=>o(null),2e3)},x=k.length>0,y=()=>(!b.requiresExternalUrl||!!l||!!m)&&(!b.requiresCloud||!!l);return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:h,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:b.image?(0,d.jsx)(g.default,{src:b.image,alt:b.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}}):b.icon?(0,d.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:b.color},children:b.icon}):(0,d.jsx)(g.default,{src:`/providers/${a}.png`,alt:b.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:b.name}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:b.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${c?"rotate-180":""}`,children:"expand_more"})]}),c&&(0,d.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:b.guideSteps?(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[b.notes&&0!==b.notes.length?(0,d.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:b.notes.map((a,b)=>{if("cloudCheck"===a.type&&(l||m))return null;let c="warning"===a.type,e="cloudCheck"===a.type&&!l&&!m,f="bg-blue-500/10 border-blue-500/30",g="text-blue-600 dark:text-blue-400",h="text-blue-500",i="info";return c?(f="bg-yellow-500/10 border-yellow-500/30",g="text-yellow-600 dark:text-yellow-400",h="text-yellow-500",i="warning"):e&&(f="bg-red-500/10 border-red-500/30",g="text-red-600 dark:text-red-400",h="text-red-500",i="error"),(0,d.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${f}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-lg ${h}`,children:i}),(0,d.jsx)("p",{className:`text-sm ${g}`,children:a.text})]},b)})}):null,y()&&b.guideSteps.map(a=>(0,d.jsxs)("div",{className:"flex items-start gap-4",children:[(0,d.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:b.color},children:a.step}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"font-medium text-text",children:a.title}),a.desc&&(0,d.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:a.desc}),"apiKeySelector"===a.type&&(0,d.jsx)("div",{className:"mt-2 flex items-center gap-2",children:j&&j.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("select",{value:t,onChange:a=>u(a.target.value),className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:j.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}),(0,d.jsx)("button",{onClick:()=>w(t,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===n?"check":"content_copy"})})]}):(0,d.jsx)("span",{className:"text-sm text-text-muted",children:l?"No API keys - Create one in Keys page":"sk_9router"})}),"modelSelector"===a.type&&(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,d.jsx)("input",{type:"text",value:r,onChange:a=>s(a.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>q(!0),disabled:!x,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${x?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{onClick:()=>w(r,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===n?"check":"content_copy"})}),(0,d.jsx)("button",{onClick:()=>s(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),a.value&&(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,d.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:v(a.value)}),a.copyable&&(0,d.jsx)("button",{onClick:()=>w(a.value,`${a.step}-${a.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:n===`${a.step}-${a.title}`?"check":"content_copy"})})]})]})]},a.step)),y()&&b.codeBlock&&(0,d.jsxs)("div",{className:"mt-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:b.codeBlock.language}),(0,d.jsxs)("button",{onClick:()=>w(b.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===n?"check":"content_copy"}),"codeblock"===n?"Copied!":"Copy"]})]}),(0,d.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,d.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:v(b.codeBlock.code)})})]})]}):(0,d.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,d.jsx)(f.rq,{isOpen:p,onClose:()=>q(!1),onSelect:a=>{s(a.value)},selectedModel:r,activeProviders:k,title:"Select Model"})]})}function o({tool:a,isExpanded:b,onToggle:c,baseUrl:h,apiKeys:i,activeProviders:j,cloudEnabled:k,initialStatus:l}){let m,[n,o]=(0,e.useState)(l||null),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(null),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(""),[B,C]=(0,e.useState)(""),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)({}),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(""),L=(()=>{if(!n?.installed)return null;if(!n.config)return"not_configured";let a=n.config?.provider?.["9router"]?.options?.baseURL||"",b=a.includes("localhost")||a.includes("127.0.0.1");return n.has9Router&&(b||a.includes(h))?"configured":n.has9Router?"other":"not_configured"})(),M=()=>{let a=J||h;return a.endsWith("/v1")?a:`${a}/v1`},N=async()=>{q(!0);try{let a=await fetch("/api/cli-tools/opencode-settings"),b=await a.json();o(b)}catch(a){o({installed:!1,error:a.message})}finally{q(!1)}},O=async()=>{s(!0),w(null);try{let a=z&&z.trim()||k?z:"sk_9router",b=await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:M(),apiKey:a,model:B})}),c=await b.json();b.ok?(w({type:"success",text:"Settings applied successfully!"}),N()):w({type:"error",text:c.error||"Failed to apply settings"})}catch(a){w({type:"error",text:a.message})}finally{s(!1)}},P=async()=>{u(!0),w(null);try{let a=await fetch("/api/cli-tools/opencode-settings",{method:"DELETE"}),b=await a.json();a.ok?(w({type:"success",text:"Settings reset successfully!"}),C(""),N()):w({type:"error",text:b.error||"Failed to reset settings"})}catch(a){w({type:"error",text:a.message})}finally{u(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:c,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/opencode.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===L&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===L&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===L&&(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[p&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking OpenCode CLI..."})]}),!p&&n&&!n.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"OpenCode CLI not installed"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Please install OpenCode CLI to use auto-apply feature."})]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:()=>y(!x),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:x?"expand_less":"help"}),x?"Hide":"How to Install"]})]}),x&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux:"}),(0,d.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g opencode-ai"})]}),(0,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"opencode"})," to verify."]})]})]})]}),!p&&n?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[n?.config?.provider?.["9router"]?.options?.baseURL&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:n.config.provider["9router"].options.baseURL})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:J||`${h}/v1`,onChange:a=>K(a.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),J&&J!==`${h}/v1`&&(0,d.jsx)("button",{onClick:()=>K(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),i.length>0?(0,d.jsx)("select",{value:z,onChange:a=>A(a.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:i.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}):(0,d.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:k?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:B,onChange:a=>C(a.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,d.jsx)("button",{onClick:()=>E(!0),disabled:!j?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${j?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),B&&(0,d.jsx)("button",{onClick:()=>C(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),v&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===v.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===v.type?"check_circle":"error"}),(0,d.jsx)("span",{children:v.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:O,disabled:!B,loading:r,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:P,disabled:!n.has9Router,loading:t,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>I(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:D,onClose:()=>E(!1),onSelect:a=>{C(a.value),E(!1)},selectedModel:B,activeProviders:j,modelAliases:F,title:"Select Model for OpenCode"}),(0,d.jsx)(f.uR,{isOpen:H,onClose:()=>I(!1),title:"OpenCode - Manual Configuration",configs:(m=z&&z.trim()?z:k?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.config/opencode/opencode.json",content:JSON.stringify({provider:{"9router":{npm:"@ai-sdk/openai-compatible",options:{baseURL:M(),apiKey:m},models:{[B||"provider/model-id"]:{name:B||"provider/model-id"}}}},model:`9router/${B||"provider/model-id"}`},null,2)}])})]})}function p({apiKeys:a,cloudEnabled:b,onStatusChange:c}){let[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(null),u="u">typeof navigator&&navigator.userAgent?.includes("Windows"),v=g?.isAdmin!==!1,w=async()=>{try{let a=await fetch("/api/cli-tools/antigravity-mitm");if(a.ok){let b=await a.json();h(b),c?.(b)}}catch{h({running:!1,certExists:!1,dnsStatus:{}})}},x=a=>{u||g?.hasCachedPassword?y(a,""):(t(a),l(!0),r(null))},y=async(c,d)=>{j(!0),r(null);try{if("trust-cert"===c){let a=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:d})}),b=await a.json();a.ok?r({type:"success",text:"Certificate trusted successfully"}):r({type:"error",text:b.error||"Failed to trust certificate"})}else if("start"===c){let c=o?.trim()||(a?.length>0?a[0].key:null)||(b?null:"sk_9router"),e=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,sudoPassword:d})}),f=await e.json();e.ok?r({type:"success",text:"Server started"}):r({type:"error",text:f.error||"Failed to start server"})}else{let a=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:d})}),b=await a.json();a.ok?r({type:"success",text:"Server stopped — all DNS cleared"}):r({type:"error",text:b.error||"Failed to stop server"})}l(!1),n(""),await w()}catch(a){r({type:"error",text:a.message})}finally{j(!1),t(null)}},z=()=>{m.trim()?y(s,m):r({type:"error",text:"Sudo password is required"})},A=g?.running;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,d.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),A?(0,d.jsx)(f.Ex,{variant:"success",size:"sm",children:"Running"}):(0,d.jsx)(f.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,d.jsx)("div",{className:"flex items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:g?.certExists},{label:"Trusted",ok:g?.certTrusted},{label:"Server",ok:A}].map(({label:a,ok:b})=>(0,d.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${b?"text-green-600":"text-text-muted"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:b?"check_circle":"cancel"}),a]},a))})]}),(0,d.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,d.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,d.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from 9Router"]}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,d.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"]})]}),!A&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted shrink-0",children:"API Key"}),a?.length>0?(0,d.jsx)("select",{value:o,onChange:a=>p(a.target.value),className:"flex-1 px-2 py-1 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:a.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id))}):(0,d.jsx)("span",{className:"text-xs text-text-muted",children:b?"No API keys — create one in Keys page":"sk_9router (default)"})]}),q&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===q.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===q.type?"check_circle":"error"}),(0,d.jsx)("span",{children:q.text})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 flex-wrap","data-i18n-skip":"true",children:[g?.certExists&&!g?.certTrusted&&(0,d.jsxs)("button",{onClick:()=>x("trust-cert"),disabled:i,className:"px-4 py-1.5 rounded-lg bg-yellow-500/10 border border-yellow-500/30 text-yellow-600 font-medium text-xs flex items-center gap-1.5 hover:bg-yellow-500/20 transition-colors disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),A?(0,d.jsxs)("button",{onClick:()=>x("stop"),disabled:i,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,d.jsxs)("button",{onClick:()=>x("start"),disabled:i||u&&!v,className:"px-4 py-1.5 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-xs flex items-center gap-1.5 hover:bg-primary/20 transition-colors disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),A&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),u&&!v&&(0,d.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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"shield_lock"}),(0,d.jsx)("span",{children:"Administrator required — restart 9Router as Administrator to use MITM"})]})]})}),k&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,d.jsx)(f.pd,{type:"password",placeholder:"Enter sudo password",value:m,onChange:a=>n(a.target.value),onKeyDown:a=>{"Enter"!==a.key||i||z()}}),q&&(0,d.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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,d.jsx)("span",{children:q.text})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{l(!1),n(""),r(null)},disabled:i,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:z,loading:i,children:"Confirm"})]})]})})]})}function q({tool:a,isExpanded:b,onToggle:c,serverRunning:h,dnsActive:i,hasCachedPassword:j,apiKeys:k,activeProviders:l,hasActiveProviders:m,modelAliases:n={},cloudEnabled:o,onDnsChange:p}){let[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(""),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)({}),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(null),G="u">typeof navigator&&navigator.userAgent?.includes("Windows"),H=(0,e.useCallback)(async b=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:a.id,mappings:b})})}catch{}},[a.id]),I=(a,b)=>{B(c=>({...c,[a]:b}))},J=()=>{if(!h)return;let a=i?"disable":"enable";G||j?K(a,""):(z(a),v(!0),t(null))},K=async(b,c)=>{r(!0),t(null);try{let d=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:a.id,action:b,sudoPassword:c})}),e=await d.json();if(!d.ok)throw Error(e.error||"Failed to toggle DNS");"enable"===b?t({type:"success",text:"DNS enabled successfully.",warning:`Please restart ${a.name} to apply changes.`}):t({type:"success",text:"DNS disabled — traffic restored"}),v(!1),x(""),p?.(e)}catch(a){t({type:"error",text:a.message})}finally{r(!1),z(null)}},L=()=>{w.trim()?K(y,w):t({type:"error",text:"Sudo password is required"})};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:c,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),h?i?(0,d.jsx)(f.Ex,{variant:"success",size:"sm",children:"Active"}):(0,d.jsx)(f.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,d.jsx)(f.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Intercept ",a.name," requests via MITM proxy"]})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,d.jsxs)("p",{children:["Toggle DNS to redirect ",a.name," traffic through 9Router via MITM."]}),!i&&(0,d.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),s&&(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===s.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===s.type?"check_circle":"error"}),(0,d.jsx)("span",{children:s.text})]}),s.warning&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-amber-500/10 text-amber-600 border border-amber-500/20",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,d.jsx)("span",{className:"font-medium",children:s.warning})]})]}),a.defaultModels?.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-2",children:a.defaultModels.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"w-36 shrink-0 text-xs font-semibold text-text-main text-right",children:a.name}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:A[a.alias]||"",onChange:b=>I(a.alias,b.target.value),onBlur:b=>{var c,d;return c=a.alias,d=b.target.value,void H({...A,[c]:d})},placeholder:"provider/model-id",disabled:!i,className:`flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 ${!i?"opacity-50 cursor-not-allowed":""}`}),(0,d.jsx)("button",{onClick:()=>{F(a.alias),D(!0)},disabled:!m||!i,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 ${m&&i?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),A[a.alias]&&(0,d.jsx)("button",{onClick:()=>{I(a.alias,""),H({...A,[a.alias]:""})},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},a.alias))}),a.defaultModels?.length===0&&(0,d.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."}),(0,d.jsx)("div",{children:i?(0,d.jsxs)("button",{onClick:J,disabled:!h||q,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:J,loading:q,disabled:!h||q,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"play_circle"}),"Start DNS"]})})]})]}),u&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,d.jsx)(f.pd,{type:"password",placeholder:"Enter sudo password",value:w,onChange:a=>x(a.target.value),onKeyDown:a=>{"Enter"!==a.key||q||L()}}),s&&(0,d.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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,d.jsx)("span",{children:s.text})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{v(!1),x(""),t(null)},disabled:q,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:L,loading:q,children:"Confirm"})]})]})}),(0,d.jsx)(f.rq,{isOpen:C,onClose:()=>D(!1),onSelect:a=>{if(!E||a.isPlaceholder)return;let b={...A,[E]:a.value};B(b),H(b)},selectedModel:E?A[E]:null,activeProviders:l,modelAliases:n,title:`Select model for ${E}`})]})}}};
@@ -1 +1 @@
1
- "use strict";exports.id=7341,exports.ids=[7341],exports.modules={57341:(a,b,c)=>{c.d(b,{getDefaultPricing:()=>e});let d={cc:{"claude-opus-4-6":{input:5,output:25,cached:.5,reasoning:25,cache_creation:6.25},"claude-opus-4-5-20251101":{input:5,output:25,cached:.5,reasoning:25,cache_creation:6.25},"claude-sonnet-4-6":{input:3,output:15,cached:.3,reasoning:15,cache_creation:3.75},"claude-sonnet-4-5-20250929":{input:3,output:15,cached:.3,reasoning:15,cache_creation:3.75},"claude-haiku-4-5-20251001":{input:1,output:5,cached:.1,reasoning:5,cache_creation:1.25}},cx:{"gpt-5.3-codex":{input:6,output:24,cached:3,reasoning:36,cache_creation:6},"gpt-5.3-codex-xhigh":{input:10,output:40,cached:5,reasoning:60,cache_creation:10},"gpt-5.3-codex-high":{input:8,output:32,cached:4,reasoning:48,cache_creation:8},"gpt-5.3-codex-low":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5.3-codex-none":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gpt-5.3-codex-spark":{input:3,output:12,cached:.3,reasoning:12,cache_creation:3},"gpt-5.2-codex":{input:5,output:20,cached:2.5,reasoning:30,cache_creation:5},"gpt-5.2":{input:5,output:20,cached:2.5,reasoning:30,cache_creation:5},"gpt-5.1-codex-max":{input:8,output:32,cached:4,reasoning:48,cache_creation:8},"gpt-5.1-codex":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5.1-codex-mini":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"gpt-5.1-codex-mini-high":{input:2,output:8,cached:1,reasoning:12,cache_creation:2},"gpt-5.1":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5-codex":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gpt-5-codex-mini":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},gc:{"gemini-3-flash-preview":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3-pro-preview":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3},"gemini-2.5-flash-lite":{input:.15,output:1.25,cached:.015,reasoning:1.875,cache_creation:.15}},qw:{"qwen3-coder-plus":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"qwen3-coder-flash":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"vision-model":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"coder-model":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5}},if:{"qwen3-coder-plus":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"kimi-k2":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"kimi-k2-thinking":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"kimi-k2.5":{input:1.2,output:4.8,cached:.6,reasoning:7.2,cache_creation:1.2},"deepseek-r1":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"deepseek-v3.2-chat":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"deepseek-v3.2-reasoner":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"minimax-m2.1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"minimax-m2.5":{input:.6,output:2.4,cached:.3,reasoning:3.6,cache_creation:.6},"glm-4.6":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"glm-4.7":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"glm-5":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},ag:{"gemini-3.1-pro-low":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-3.1-pro-high":{input:4,output:18,cached:.5,reasoning:27,cache_creation:4},"gemini-3-flash":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3},"claude-sonnet-4-6":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-opus-4-5-thinking":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-opus-4-6-thinking":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"gpt-oss-120b-medium":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},gh:{"gpt-3.5-turbo":{input:.5,output:1.5,cached:.25,reasoning:2.25,cache_creation:.5},"gpt-4":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-4o":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-4o-mini":{input:.15,output:.6,cached:.075,reasoning:.9,cache_creation:.15},"gpt-4.1":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-5":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gpt-5-mini":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"gpt-5-codex":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gpt-5.1":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5.1-codex":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5.1-codex-mini":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"gpt-5.1-codex-max":{input:8,output:32,cached:4,reasoning:48,cache_creation:8},"gpt-5.2":{input:5,output:20,cached:2.5,reasoning:30,cache_creation:5},"gpt-5.2-codex":{input:5,output:20,cached:2.5,reasoning:30,cache_creation:5},"gpt-5.3-codex":{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75},"claude-haiku-4.5":{input:.5,output:2.5,cached:.05,reasoning:3.75,cache_creation:.5},"claude-opus-4.1":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-opus-4.5":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-sonnet-4":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-sonnet-4.5":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-sonnet-4.6":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-opus-4.6":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-3-flash-preview":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3-pro-preview":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"grok-code-fast-1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"oswe-vscode-prime":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},kr:{"claude-sonnet-4.5":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-haiku-4.5":{input:.5,output:2.5,cached:.05,reasoning:3.75,cache_creation:.5}},openai:{"gpt-4o":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-4o-mini":{input:.15,output:.6,cached:.075,reasoning:.9,cache_creation:.15},"gpt-4-turbo":{input:10,output:30,cached:5,reasoning:45,cache_creation:10},o1:{input:15,output:60,cached:7.5,reasoning:90,cache_creation:15},"o1-mini":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3}},anthropic:{"claude-sonnet-4-20250514":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3},"claude-opus-4-20250514":{input:15,output:25,cached:7.5,reasoning:112.5,cache_creation:15},"claude-3-5-sonnet-20241022":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3}},gemini:{"gemini-3-pro-preview":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3},"gemini-2.5-flash-lite":{input:.15,output:1.25,cached:.015,reasoning:1.875,cache_creation:.15}},openrouter:{auto:{input:2,output:8,cached:1,reasoning:12,cache_creation:2}},glm:{"glm-4.7":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"glm-4.6":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"glm-4.6v":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75}},kimi:{"kimi-k2.5":{input:1.2,output:4.8,cached:.6,reasoning:7.2,cache_creation:1.2},"kimi-k2.5-thinking":{input:1.8,output:7.2,cached:.9,reasoning:10.8,cache_creation:1.8},"kimi-latest":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},minimax:{"MiniMax-M2.1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}}};function e(){return d}}};
1
+ "use strict";exports.id=7341,exports.ids=[7341],exports.modules={57341:(a,b,c)=>{c.d(b,{MODEL_PRICING:()=>e,getDefaultPricing:()=>f});let d={cc:{"claude-opus-4-6":{input:5,output:25,cached:.5,reasoning:25,cache_creation:6.25},"claude-opus-4-5-20251101":{input:5,output:25,cached:.5,reasoning:25,cache_creation:6.25},"claude-sonnet-4-6":{input:3,output:15,cached:.3,reasoning:15,cache_creation:3.75},"claude-sonnet-4-5-20250929":{input:3,output:15,cached:.3,reasoning:15,cache_creation:3.75},"claude-haiku-4-5-20251001":{input:1,output:5,cached:.1,reasoning:5,cache_creation:1.25}},cx:{"gpt-5.3-codex":{input:6,output:24,cached:3,reasoning:36,cache_creation:6},"gpt-5.3-codex-xhigh":{input:10,output:40,cached:5,reasoning:60,cache_creation:10},"gpt-5.3-codex-high":{input:8,output:32,cached:4,reasoning:48,cache_creation:8},"gpt-5.3-codex-low":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5.3-codex-none":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gpt-5.3-codex-spark":{input:3,output:12,cached:.3,reasoning:12,cache_creation:3},"gpt-5.2-codex":{input:5,output:20,cached:2.5,reasoning:30,cache_creation:5},"gpt-5.2":{input:5,output:20,cached:2.5,reasoning:30,cache_creation:5},"gpt-5.1-codex-max":{input:8,output:32,cached:4,reasoning:48,cache_creation:8},"gpt-5.1-codex":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5.1-codex-mini":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"gpt-5.1-codex-mini-high":{input:2,output:8,cached:1,reasoning:12,cache_creation:2},"gpt-5.1":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5-codex":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gpt-5-codex-mini":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},gc:{"gemini-3-flash-preview":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3-pro-preview":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3},"gemini-2.5-flash-lite":{input:.15,output:1.25,cached:.015,reasoning:1.875,cache_creation:.15}},qw:{"qwen3-coder-plus":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"qwen3-coder-flash":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"vision-model":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"coder-model":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5}},if:{"qwen3-coder-plus":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"kimi-k2":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1},"kimi-k2-thinking":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"kimi-k2.5":{input:1.2,output:4.8,cached:.6,reasoning:7.2,cache_creation:1.2},"deepseek-r1":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"deepseek-v3.2-chat":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"deepseek-v3.2-reasoner":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"minimax-m2.1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"minimax-m2.5":{input:.6,output:2.4,cached:.3,reasoning:3.6,cache_creation:.6},"glm-4.6":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"glm-4.7":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"glm-5":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},ag:{"gemini-3.1-pro-low":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-3.1-pro-high":{input:4,output:18,cached:.5,reasoning:27,cache_creation:4},"gemini-3-flash":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3},"claude-sonnet-4-6":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-opus-4-5-thinking":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-opus-4-6-thinking":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"gpt-oss-120b-medium":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},gh:{"gpt-3.5-turbo":{input:.5,output:1.5,cached:.25,reasoning:2.25,cache_creation:.5},"gpt-4":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-4o":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-4o-mini":{input:.15,output:.6,cached:.075,reasoning:.9,cache_creation:.15},"gpt-4.1":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-5":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gpt-5-mini":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"gpt-5-codex":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3},"gpt-5.1":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5.1-codex":{input:4,output:16,cached:2,reasoning:24,cache_creation:4},"gpt-5.1-codex-mini":{input:1.5,output:6,cached:.75,reasoning:9,cache_creation:1.5},"gpt-5.1-codex-max":{input:8,output:32,cached:4,reasoning:48,cache_creation:8},"gpt-5.2":{input:5,output:20,cached:2.5,reasoning:30,cache_creation:5},"gpt-5.2-codex":{input:5,output:20,cached:2.5,reasoning:30,cache_creation:5},"gpt-5.3-codex":{input:1.75,output:14,cached:.175,reasoning:14,cache_creation:1.75},"claude-haiku-4.5":{input:.5,output:2.5,cached:.05,reasoning:3.75,cache_creation:.5},"claude-opus-4.1":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-opus-4.5":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"claude-sonnet-4":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-sonnet-4.5":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-sonnet-4.6":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-opus-4.6":{input:5,output:25,cached:.5,reasoning:37.5,cache_creation:5},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-3-flash-preview":{input:.5,output:3,cached:.03,reasoning:4.5,cache_creation:.5},"gemini-3-pro-preview":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"grok-code-fast-1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"oswe-vscode-prime":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},kr:{"claude-sonnet-4.5":{input:3,output:15,cached:.3,reasoning:22.5,cache_creation:3},"claude-haiku-4.5":{input:.5,output:2.5,cached:.05,reasoning:3.75,cache_creation:.5}},openai:{"gpt-4o":{input:2.5,output:10,cached:1.25,reasoning:15,cache_creation:2.5},"gpt-4o-mini":{input:.15,output:.6,cached:.075,reasoning:.9,cache_creation:.15},"gpt-4-turbo":{input:10,output:30,cached:5,reasoning:45,cache_creation:10},o1:{input:15,output:60,cached:7.5,reasoning:90,cache_creation:15},"o1-mini":{input:3,output:12,cached:1.5,reasoning:18,cache_creation:3}},anthropic:{"claude-sonnet-4-20250514":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3},"claude-opus-4-20250514":{input:15,output:25,cached:7.5,reasoning:112.5,cache_creation:15},"claude-3-5-sonnet-20241022":{input:3,output:15,cached:1.5,reasoning:15,cache_creation:3}},gemini:{"gemini-3-pro-preview":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-pro":{input:2,output:12,cached:.25,reasoning:18,cache_creation:2},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,reasoning:3.75,cache_creation:.3},"gemini-2.5-flash-lite":{input:.15,output:1.25,cached:.015,reasoning:1.875,cache_creation:.15}},openrouter:{auto:{input:2,output:8,cached:1,reasoning:12,cache_creation:2}},glm:{"glm-4.7":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75},"glm-4.6":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5},"glm-4.6v":{input:.75,output:3,cached:.375,reasoning:4.5,cache_creation:.75}},kimi:{"kimi-k2.5":{input:1.2,output:4.8,cached:.6,reasoning:7.2,cache_creation:1.2},"kimi-k2.5-thinking":{input:1.8,output:7.2,cached:.9,reasoning:10.8,cache_creation:1.8},"kimi-latest":{input:1,output:4,cached:.5,reasoning:6,cache_creation:1}},minimax:{"MiniMax-M2.1":{input:.5,output:2,cached:.25,reasoning:3,cache_creation:.5}},deepseek:{"deepseek-chat":{input:.28,output:.42,cached:.028,reasoning:.42,cache_creation:.28},"deepseek-reasoner":{input:.28,output:.42,cached:.028,reasoning:.42,cache_creation:.28}}},e={"deepseek-chat":{input:.28,output:.42,cached:.028,reasoning:.42,cache_creation:.28},"deepseek-reasoner":{input:.28,output:.42,cached:.028,reasoning:.42,cache_creation:.28}};function f(){return d}}};
@@ -1 +1 @@
1
- "use strict";exports.id=8590,exports.ids=[8590],exports.modules={8590:(a,b,c)=>{c.d(b,{$B:()=>q,I9:()=>i,Ql:()=>l,Sc:()=>r,iD:()=>p,jR:()=>o,oD:()=>f,pb:()=>t,qZ:()=>u});var d=c(35024),e=c(75924);let f=3e5;async function g(a,b,c,e){let f=d.x[a];if(!f||!f.refreshUrl)return e?.warn?.("TOKEN_REFRESH",`No refresh URL configured for provider: ${a}`),null;if(!b)return e?.warn?.("TOKEN_REFRESH",`No refresh token available for provider: ${a}`),null;try{let c=await fetch(f.refreshUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:b,client_id:f.clientId,client_secret:f.clientSecret})});if(!c.ok){let b=await c.text();return e?.error?.("TOKEN_REFRESH",`Failed to refresh token for ${a}`,{status:c.status,error:b}),null}let d=await c.json();return e?.info?.("TOKEN_REFRESH",`Successfully refreshed token for ${a}`,{hasNewAccessToken:!!d.access_token,hasNewRefreshToken:!!d.refresh_token,expiresIn:d.expires_in}),{accessToken:d.access_token,refreshToken:d.refresh_token||b,expiresIn:d.expires_in}}catch(b){return e?.error?.("TOKEN_REFRESH",`Error refreshing token for ${a}`,{error:b.message}),null}}async function h(a,b){try{let c=await fetch(e.NA.anthropic.token,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:a,client_id:d.x.claude.clientId})});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh Claude OAuth token",{status:c.status,error:a}),null}let f=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Claude OAuth token",{hasNewAccessToken:!!f.access_token,expiresIn:f.expires_in}),{accessToken:f.access_token,refreshToken:f.refresh_token||a,expiresIn:f.expires_in}}catch(a){return b?.error?.("TOKEN_REFRESH",`Network error refreshing Claude token: ${a.message}`),null}}async function i(a,b,c,d){try{let f=await fetch(e.NA.google.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:b,client_secret:c})});if(!f.ok){let a=await f.text();return d?.error?.("TOKEN_REFRESH","Failed to refresh Google token",{status:f.status,error:a}),null}let g=await f.json();return d?.info?.("TOKEN_REFRESH","Successfully refreshed Google token",{hasNewAccessToken:!!g.access_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}}catch(a){return d?.error?.("TOKEN_REFRESH",`Network error refreshing Google token: ${a.message}`),null}}async function j(a,b){let c=e.NA.qwen.token;try{let e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.x.qwen.clientId})});if(200===e.status){let c=await e.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Qwen token",{hasNewAccessToken:!!c.access_token,hasNewRefreshToken:!!c.refresh_token,expiresIn:c.expires_in}),{accessToken:c.access_token,refreshToken:c.refresh_token||a,expiresIn:c.expires_in,providerSpecificData:c.resource_url?{resourceUrl:c.resource_url}:void 0}}{let a=await e.text().catch(()=>"");b?.warn?.("TOKEN_REFRESH","Error with Qwen endpoint",{status:e.status,error:a})}}catch(a){b?.warn?.("TOKEN_REFRESH","Network error trying Qwen endpoint",{error:a.message})}return b?.error?.("TOKEN_REFRESH","Failed to refresh Qwen token"),null}async function k(a,b){try{let c=await fetch(e.NA.openai.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.x.codex.clientId,scope:"openid profile email offline_access"})});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh Codex token",{status:c.status,error:a}),null}let f=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Codex token",{hasNewAccessToken:!!f.access_token,hasNewRefreshToken:!!f.refresh_token,expiresIn:f.expires_in}),{accessToken:f.access_token,refreshToken:f.refresh_token||a,expiresIn:f.expires_in}}catch(a){return b?.error?.("TOKEN_REFRESH",`Network error refreshing Codex token: ${a.message}`),null}}async function l(a,b,c){let e=b?.authMethod,f=b?.clientId,g=b?.clientSecret,h=b?.region;if(f&&g){let b="idc"===e&&h?`https://oidc.${h}.amazonaws.com/token`:"https://oidc.us-east-1.amazonaws.com/token",d=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({clientId:f,clientSecret:g,refreshToken:a,grantType:"refresh_token"})});if(!d.ok){let a=await d.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro AWS token",{status:d.status,error:a}),null}let i=await d.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro AWS token",{hasNewAccessToken:!!i.accessToken,expiresIn:i.expiresIn}),{accessToken:i.accessToken,refreshToken:i.refreshToken||a,expiresIn:i.expiresIn}}let i=await fetch(d.x.kiro.tokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":"kiro-cli/1.0.0"},body:JSON.stringify({refreshToken:a})});if(!i.ok){let a=await i.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro social token",{status:i.status,error:a}),null}let j=await i.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro social token",{hasNewAccessToken:!!j.accessToken,expiresIn:j.expiresIn}),{accessToken:j.accessToken,refreshToken:j.refreshToken||a,expiresIn:j.expiresIn}}async function m(a,b){let c=btoa(`${d.x.iflow.clientId}:${d.x.iflow.clientSecret}`),f=await fetch(e.NA.iflow.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",Authorization:`Basic ${c}`},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.x.iflow.clientId,client_secret:d.x.iflow.clientSecret})});if(!f.ok){let a=await f.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh iFlow token",{status:f.status,error:a}),null}let g=await f.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed iFlow token",{hasNewAccessToken:!!g.access_token,hasNewRefreshToken:!!g.refresh_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}}async function n(a,b){let c=await fetch(e.NA.github.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.x.github.clientId,client_secret:d.x.github.clientSecret})});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh GitHub token",{status:c.status,error:a}),null}let f=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed GitHub token",{hasNewAccessToken:!!f.access_token,hasNewRefreshToken:!!f.refresh_token,expiresIn:f.expires_in}),{accessToken:f.access_token,refreshToken:f.refresh_token||a,expiresIn:f.expires_in}}async function o(a,b){try{let c=await fetch("https://api.github.com/copilot_internal/v2/token",{headers:{Authorization:`token ${a}`,"User-Agent":e.x0.USER_AGENT,"Editor-Version":`vscode/${e.x0.VSCODE_VERSION}`,"Editor-Plugin-Version":`copilot-chat/${e.x0.COPILOT_CHAT_VERSION}`,Accept:"application/json","x-github-api-version":e.x0.API_VERSION}});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh Copilot token",{status:c.status,error:a}),null}let d=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Copilot token",{hasToken:!!d.token,expiresAt:d.expires_at}),{token:d.token,expiresAt:d.expires_at}}catch(a){return b?.error?.("TOKEN_REFRESH","Error refreshing Copilot token",{error:a.message}),null}}async function p(a,b,c){if(!b||!b.refreshToken)return c?.warn?.("TOKEN_REFRESH",`No refresh token available for provider: ${a}`),null;switch(a){case"gemini":case"gemini-cli":case"antigravity":return await i(b.refreshToken,d.x[a].clientId,d.x[a].clientSecret,c);case"claude":return await h(b.refreshToken,c);case"codex":return await k(b.refreshToken,c);case"qwen":return await j(b.refreshToken,c);case"iflow":return await m(b.refreshToken,c);case"github":return await n(b.refreshToken,c);case"kiro":return await l(b.refreshToken,b.providerSpecificData,c);case"vertex":case"vertex-partner":{let a=r(b.apiKey);if(!a)return null;return await t(a,c)}default:return c?.warn?.("TOKEN_REFRESH",`Unsupported provider for token refresh: ${a}`),null}}async function q(a,b,c){if(!b.refreshToken)return null;switch(a){case"gemini-cli":case"antigravity":return i(b.refreshToken,d.x[a].clientId,d.x[a].clientSecret,c);case"claude":return h(b.refreshToken,c);case"codex":return k(b.refreshToken,c);case"qwen":return j(b.refreshToken,c);case"iflow":return m(b.refreshToken,c);case"github":return n(b.refreshToken,c);case"kiro":return l(b.refreshToken,b.providerSpecificData,c);case"vertex":case"vertex-partner":{let a=r(b.apiKey);if(!a)return null;return t(a,c)}default:return g(a,b.refreshToken,b,c)}}function r(a){if("string"!=typeof a)return null;try{let b=JSON.parse(a);if("service_account"===b.type&&b.client_email&&b.private_key&&b.project_id)return b;return null}catch{return null}}let s=new Map;async function t(a,b){let d=a.client_email,e=s.get(d);if(e&&e.expiresAt-Date.now()>3e5)return{accessToken:e.token,expiresAt:e.expiresAt};try{let{SignJWT:e,importPKCS8:f}=await Promise.all([c.e(4292),c.e(5833)]).then(c.bind(c,65833));b?.debug?.("TOKEN_REFRESH",`Vertex minting token for ${a.client_email}`);let g=await f(a.private_key.replace(/\\n/g,"\n"),"RS256"),h=Math.floor(Date.now()/1e3),i=await new e({scope:"https://www.googleapis.com/auth/cloud-platform"}).setProtectedHeader({alg:"RS256"}).setIssuer(a.client_email).setAudience("https://oauth2.googleapis.com/token").setIssuedAt(h).setExpirationTime(h+3600).sign(g),j=await fetch("https://oauth2.googleapis.com/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:i})});if(!j.ok){let a=await j.text();return b?.error?.("TOKEN_REFRESH",`Vertex token mint failed: ${a}`),null}let{access_token:k,expires_in:l}=await j.json(),m=Date.now()+(l??3600)*1e3;return s.set(d,{token:k,expiresAt:m}),b?.info?.("TOKEN_REFRESH",`Vertex token minted for ${a.client_email}`),{accessToken:k,expiresAt:m}}catch(a){return b?.error?.("TOKEN_REFRESH",`Vertex token error: ${a.message}`),null}}async function u(a,b=3,c=null){for(let d=0;d<b;d++){if(d>0){let a=1e3*d;c?.debug?.("TOKEN_REFRESH",`Retry ${d}/${b} after ${a}ms`),await new Promise(b=>setTimeout(b,a))}try{let b=await a();if(b)return b}catch(a){c?.warn?.("TOKEN_REFRESH",`Attempt ${d+1}/${b} failed: ${a.message}`)}}return c?.error?.("TOKEN_REFRESH",`All ${b} retry attempts failed`),null}},75924:(a,b,c)=>{let d,e;c.d(b,{$V:()=>r,A9:()=>j,Cn:()=>k,Co:()=>q,Ic:()=>o,K:()=>m,NA:()=>s,Ox:()=>l,VK:()=>t,go:()=>g,nZ:()=>n,sX:()=>h,x0:()=>i,zv:()=>p});var f=c(21820);let g="google-genai-sdk/1.41.0 gl-node/v22.19.0";function h(a="unknown"){let b="win32"===(0,f.platform)()?"windows":(0,f.platform)();return`GeminiCLI/0.31.0/${a||"unknown"} (${b}; ${(0,f.arch)()})`}let i={VSCODE_VERSION:"1.110.0",COPILOT_CHAT_VERSION:"0.38.0",USER_AGENT:"GitHubCopilotChat/0.38.0",API_VERSION:"2025-04-01"};function j(){return`antigravity/1.104.0 ${(0,f.platform)()}/${(0,f.arch)()}`}let k={ideType:9,platform:(d=(0,f.platform)(),e=(0,f.arch)(),"darwin"===d?"arm64"===e?2:1:"linux"===d?"arm64"===e?4:3:5*("win32"===d)),pluginType:2},l={name:"x-request-source",value:"local"},m={"X-Client-Name":"antigravity","X-Client-Version":"1.107.0","x-goog-api-client":"gl-node/18.18.2 fire/0.8.6 grpc/1.10.x","User-Agent":"antigravity/1.107.0 darwin/arm64"},n={loadCodeAssist:"https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist",onboardUser:"https://cloudcode-pa.googleapis.com/v1internal:onboardUser"},o={"Content-Type":"application/json","User-Agent":"google-api-nodejs-client/9.15.1","X-Goog-Api-Client":"google-cloud-sdk vscode_cloudshelleditor/0.1","Client-Metadata":JSON.stringify({ideType:"IDE_UNSPECIFIED",platform:"PLATFORM_UNSPECIFIED",pluginType:"GEMINI"})},p={ideType:"IDE_UNSPECIFIED",platform:"PLATFORM_UNSPECIFIED",pluginType:"GEMINI"},q="You are a Claude agent, built on Anthropic's Claude Agent SDK.",r="You are Antigravity, a powerful agentic AI coding assistant designed by the Google Deepmind team working on Advanced Agentic Coding.You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.**Absolute paths only****Proactiveness**",s={google:{token:"https://oauth2.googleapis.com/token",auth:"https://accounts.google.com/o/oauth2/auth"},openai:{token:"https://auth.openai.com/oauth/token",auth:"https://auth.openai.com/oauth/authorize"},anthropic:{token:"https://api.anthropic.com/v1/oauth/token",auth:"https://api.anthropic.com/v1/oauth/authorize"},qwen:{token:"https://chat.qwen.ai/api/v1/oauth2/token",auth:"https://chat.qwen.ai/api/v1/oauth2/device/code"},iflow:{token:"https://iflow.cn/oauth/token",auth:"https://iflow.cn/oauth"},github:{token:"https://github.com/login/oauth/access_token",auth:"https://github.com/login/oauth/authorize",deviceCode:"https://github.com/login/device/code"}};function t(){return{"X-Msh-Platform":"9router","X-Msh-Version":"2.1.2","X-Msh-Device-Model":"u">typeof process?`${process.platform} ${process.arch}`:"unknown","X-Msh-Device-Id":`kimi-${Date.now()}`}}}};
1
+ "use strict";exports.id=8590,exports.ids=[8590],exports.modules={8590:(a,b,c)=>{c.d(b,{$B:()=>q,I9:()=>i,Ql:()=>l,Sc:()=>r,iD:()=>p,jR:()=>o,oD:()=>f,pb:()=>t,qZ:()=>u});var d=c(35024),e=c(75924);let f=3e5;async function g(a,b,c,e){let f=d.x[a];if(!f||!f.refreshUrl)return e?.warn?.("TOKEN_REFRESH",`No refresh URL configured for provider: ${a}`),null;if(!b)return e?.warn?.("TOKEN_REFRESH",`No refresh token available for provider: ${a}`),null;try{let c=await fetch(f.refreshUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:b,client_id:f.clientId,client_secret:f.clientSecret})});if(!c.ok){let b=await c.text();return e?.error?.("TOKEN_REFRESH",`Failed to refresh token for ${a}`,{status:c.status,error:b}),null}let d=await c.json();return e?.info?.("TOKEN_REFRESH",`Successfully refreshed token for ${a}`,{hasNewAccessToken:!!d.access_token,hasNewRefreshToken:!!d.refresh_token,expiresIn:d.expires_in}),{accessToken:d.access_token,refreshToken:d.refresh_token||b,expiresIn:d.expires_in}}catch(b){return e?.error?.("TOKEN_REFRESH",`Error refreshing token for ${a}`,{error:b.message}),null}}async function h(a,b){try{let c=await fetch(e.NA.anthropic.token,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:a,client_id:d.x.claude.clientId})});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh Claude OAuth token",{status:c.status,error:a}),null}let f=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Claude OAuth token",{hasNewAccessToken:!!f.access_token,expiresIn:f.expires_in}),{accessToken:f.access_token,refreshToken:f.refresh_token||a,expiresIn:f.expires_in}}catch(a){return b?.error?.("TOKEN_REFRESH",`Network error refreshing Claude token: ${a.message}`),null}}async function i(a,b,c,d){try{let f=await fetch(e.NA.google.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:b,client_secret:c})});if(!f.ok){let a=await f.text();return d?.error?.("TOKEN_REFRESH","Failed to refresh Google token",{status:f.status,error:a}),null}let g=await f.json();return d?.info?.("TOKEN_REFRESH","Successfully refreshed Google token",{hasNewAccessToken:!!g.access_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}}catch(a){return d?.error?.("TOKEN_REFRESH",`Network error refreshing Google token: ${a.message}`),null}}async function j(a,b){let c=e.NA.qwen.token;try{let e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.x.qwen.clientId})});if(200===e.status){let c=await e.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Qwen token",{hasNewAccessToken:!!c.access_token,hasNewRefreshToken:!!c.refresh_token,expiresIn:c.expires_in}),{accessToken:c.access_token,refreshToken:c.refresh_token||a,expiresIn:c.expires_in,providerSpecificData:c.resource_url?{resourceUrl:c.resource_url}:void 0}}{let a=await e.text().catch(()=>"");b?.warn?.("TOKEN_REFRESH","Error with Qwen endpoint",{status:e.status,error:a})}}catch(a){b?.warn?.("TOKEN_REFRESH","Network error trying Qwen endpoint",{error:a.message})}return b?.error?.("TOKEN_REFRESH","Failed to refresh Qwen token"),null}async function k(a,b){try{let c=await fetch(e.NA.openai.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.x.codex.clientId,scope:"openid profile email offline_access"})});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh Codex token",{status:c.status,error:a}),null}let f=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Codex token",{hasNewAccessToken:!!f.access_token,hasNewRefreshToken:!!f.refresh_token,expiresIn:f.expires_in}),{accessToken:f.access_token,refreshToken:f.refresh_token||a,expiresIn:f.expires_in}}catch(a){return b?.error?.("TOKEN_REFRESH",`Network error refreshing Codex token: ${a.message}`),null}}async function l(a,b,c){let e=b?.authMethod,f=b?.clientId,g=b?.clientSecret,h=b?.region;if(f&&g){let b="idc"===e&&h?`https://oidc.${h}.amazonaws.com/token`:"https://oidc.us-east-1.amazonaws.com/token",d=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({clientId:f,clientSecret:g,refreshToken:a,grantType:"refresh_token"})});if(!d.ok){let a=await d.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro AWS token",{status:d.status,error:a}),null}let i=await d.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro AWS token",{hasNewAccessToken:!!i.accessToken,expiresIn:i.expiresIn}),{accessToken:i.accessToken,refreshToken:i.refreshToken||a,expiresIn:i.expiresIn}}let i=await fetch(d.x.kiro.tokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":"kiro-cli/1.0.0"},body:JSON.stringify({refreshToken:a})});if(!i.ok){let a=await i.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro social token",{status:i.status,error:a}),null}let j=await i.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro social token",{hasNewAccessToken:!!j.accessToken,expiresIn:j.expiresIn}),{accessToken:j.accessToken,refreshToken:j.refreshToken||a,expiresIn:j.expiresIn}}async function m(a,b){let c=btoa(`${d.x.iflow.clientId}:${d.x.iflow.clientSecret}`),f=await fetch(e.NA.iflow.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",Authorization:`Basic ${c}`},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.x.iflow.clientId,client_secret:d.x.iflow.clientSecret})});if(!f.ok){let a=await f.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh iFlow token",{status:f.status,error:a}),null}let g=await f.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed iFlow token",{hasNewAccessToken:!!g.access_token,hasNewRefreshToken:!!g.refresh_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}}async function n(a,b){let c=await fetch(e.NA.github.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.x.github.clientId,client_secret:d.x.github.clientSecret})});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh GitHub token",{status:c.status,error:a}),null}let f=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed GitHub token",{hasNewAccessToken:!!f.access_token,hasNewRefreshToken:!!f.refresh_token,expiresIn:f.expires_in}),{accessToken:f.access_token,refreshToken:f.refresh_token||a,expiresIn:f.expires_in}}async function o(a,b){try{let c=await fetch("https://api.github.com/copilot_internal/v2/token",{headers:{Authorization:`token ${a}`,"User-Agent":e.x0.USER_AGENT,"Editor-Version":`vscode/${e.x0.VSCODE_VERSION}`,"Editor-Plugin-Version":`copilot-chat/${e.x0.COPILOT_CHAT_VERSION}`,Accept:"application/json","x-github-api-version":e.x0.API_VERSION}});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh Copilot token",{status:c.status,error:a}),null}let d=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Copilot token",{hasToken:!!d.token,expiresAt:d.expires_at}),{token:d.token,expiresAt:d.expires_at}}catch(a){return b?.error?.("TOKEN_REFRESH","Error refreshing Copilot token",{error:a.message}),null}}async function p(a,b,c){if(!b||!b.refreshToken)return c?.warn?.("TOKEN_REFRESH",`No refresh token available for provider: ${a}`),null;switch(a){case"gemini":case"gemini-cli":case"antigravity":return await i(b.refreshToken,d.x[a].clientId,d.x[a].clientSecret,c);case"claude":return await h(b.refreshToken,c);case"codex":return await k(b.refreshToken,c);case"qwen":return await j(b.refreshToken,c);case"iflow":return await m(b.refreshToken,c);case"github":return await n(b.refreshToken,c);case"kiro":return await l(b.refreshToken,b.providerSpecificData,c);case"vertex":case"vertex-partner":{let a=r(b.apiKey);if(!a)return null;return await t(a,c)}default:return c?.warn?.("TOKEN_REFRESH",`Unsupported provider for token refresh: ${a}`),null}}async function q(a,b,c){if(!b.refreshToken)return null;switch(a){case"gemini-cli":case"antigravity":return i(b.refreshToken,d.x[a].clientId,d.x[a].clientSecret,c);case"claude":return h(b.refreshToken,c);case"codex":return k(b.refreshToken,c);case"qwen":return j(b.refreshToken,c);case"iflow":return m(b.refreshToken,c);case"github":return n(b.refreshToken,c);case"kiro":return l(b.refreshToken,b.providerSpecificData,c);case"vertex":case"vertex-partner":{let a=r(b.apiKey);if(!a)return null;return t(a,c)}default:return g(a,b.refreshToken,b,c)}}function r(a){if("string"!=typeof a)return null;try{let b=JSON.parse(a);if("service_account"===b.type&&b.client_email&&b.private_key&&b.project_id)return b;return null}catch{return null}}let s=new Map;async function t(a,b){let d=a.client_email,e=s.get(d);if(e&&e.expiresAt-Date.now()>3e5)return{accessToken:e.token,expiresAt:e.expiresAt};try{let{SignJWT:e,importPKCS8:f}=await Promise.all([c.e(4292),c.e(5833)]).then(c.bind(c,65833));b?.debug?.("TOKEN_REFRESH",`Vertex minting token for ${a.client_email}`);let g=await f(a.private_key.replace(/\\n/g,"\n"),"RS256"),h=Math.floor(Date.now()/1e3),i=await new e({scope:"https://www.googleapis.com/auth/cloud-platform"}).setProtectedHeader({alg:"RS256"}).setIssuer(a.client_email).setAudience("https://oauth2.googleapis.com/token").setIssuedAt(h).setExpirationTime(h+3600).sign(g),j=await fetch("https://oauth2.googleapis.com/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:i})});if(!j.ok){let a=await j.text();return b?.error?.("TOKEN_REFRESH",`Vertex token mint failed: ${a}`),null}let{access_token:k,expires_in:l}=await j.json(),m=Date.now()+(l??3600)*1e3;return s.set(d,{token:k,expiresAt:m}),b?.info?.("TOKEN_REFRESH",`Vertex token minted for ${a.client_email}`),{accessToken:k,expiresAt:m}}catch(a){return b?.error?.("TOKEN_REFRESH",`Vertex token error: ${a.message}`),null}}async function u(a,b=3,c=null){for(let d=0;d<b;d++){if(d>0){let a=1e3*d;c?.debug?.("TOKEN_REFRESH",`Retry ${d}/${b} after ${a}ms`),await new Promise(b=>setTimeout(b,a))}try{let b=await a();if(b)return b}catch(a){c?.warn?.("TOKEN_REFRESH",`Attempt ${d+1}/${b} failed: ${a.message}`)}}return c?.error?.("TOKEN_REFRESH",`All ${b} retry attempts failed`),null}},75924:(a,b,c)=>{c.d(b,{$V:()=>q,A9:()=>i,Cn:()=>j,Co:()=>p,Ic:()=>n,K:()=>l,NA:()=>r,Ox:()=>k,VK:()=>s,go:()=>e,nZ:()=>m,sX:()=>f,x0:()=>g,zv:()=>o});var d=c(21820);let e="google-genai-sdk/1.41.0 gl-node/v22.19.0";function f(a="unknown"){let b="win32"===(0,d.platform)()?"windows":(0,d.platform)();return`GeminiCLI/0.31.0/${a||"unknown"} (${b}; ${(0,d.arch)()})`}let g={VSCODE_VERSION:"1.110.0",COPILOT_CHAT_VERSION:"0.38.0",USER_AGENT:"GitHubCopilotChat/0.38.0",API_VERSION:"2025-04-01"};function h(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}function i(){return`antigravity/1.104.0 ${(0,d.platform)()}/${(0,d.arch)()}`}let j={ideType:9,platform:h(),pluginType:2},k={name:"x-request-source",value:"local"},l={"User-Agent":`antigravity/1.107.0 ${(0,d.platform)()}/${(0,d.arch)()}`},m={loadCodeAssist:"https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist",onboardUser:"https://cloudcode-pa.googleapis.com/v1internal:onboardUser"},n={"Content-Type":"application/json","User-Agent":"google-api-nodejs-client/9.15.1","X-Goog-Api-Client":"google-cloud-sdk vscode_cloudshelleditor/0.1","Client-Metadata":JSON.stringify({ideType:9,platform:h(),pluginType:2})},o={ideType:9,platform:h(),pluginType:2},p="You are a Claude agent, built on Anthropic's Claude Agent SDK.",q="You are Antigravity, a powerful agentic AI coding assistant designed by the Google Deepmind team working on Advanced Agentic Coding.You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.**Absolute paths only****Proactiveness**",r={google:{token:"https://oauth2.googleapis.com/token",auth:"https://accounts.google.com/o/oauth2/auth"},openai:{token:"https://auth.openai.com/oauth/token",auth:"https://auth.openai.com/oauth/authorize"},anthropic:{token:"https://api.anthropic.com/v1/oauth/token",auth:"https://api.anthropic.com/v1/oauth/authorize"},qwen:{token:"https://chat.qwen.ai/api/v1/oauth2/token",auth:"https://chat.qwen.ai/api/v1/oauth2/device/code"},iflow:{token:"https://iflow.cn/oauth/token",auth:"https://iflow.cn/oauth"},github:{token:"https://github.com/login/oauth/access_token",auth:"https://github.com/login/oauth/authorize",deviceCode:"https://github.com/login/device/code"}};function s(){return{"X-Msh-Platform":"9router","X-Msh-Version":"2.1.2","X-Msh-Device-Model":"u">typeof process?`${process.platform} ${process.arch}`:"unknown","X-Msh-Device-Id":`kimi-${Date.now()}`}}}};
@@ -1 +1 @@
1
- "use strict";exports.id=9201,exports.ids=[9201],exports.modules={3179:(a,b,c)=>{c.d(b,{Al:()=>t,F0:()=>x,es:()=>w,nN:()=>z,ss:()=>y});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f),h=c(55591),i=c.n(h),j=c(21820),k=c.n(j),l=c(79646),m=c(85567);let n=g().join(k().homedir(),".9router","bin"),o="cloudflared",p="win32"===k().platform(),q=p?`${o}.exe`:o,r=g().join(n,q),s={darwin:{x64:"cloudflared-darwin-amd64.tgz",arm64:"cloudflared-darwin-amd64.tgz"},win32:{x64:"cloudflared-windows-amd64.exe"},linux:{x64:"cloudflared-linux-amd64",arm64:"cloudflared-linux-arm64"}};async function t(){if(e().existsSync(n)||e().mkdirSync(n,{recursive:!0}),e().existsSync(r))return p||e().chmodSync(r,"755"),r;let a=function(){let a=k().platform(),b=k().arch(),c=s[a];if(!c)throw Error(`Unsupported platform: ${a}`);let d=c[b];if(!d)throw Error(`Unsupported architecture: ${b} for platform ${a}`);return`https://github.com/cloudflare/cloudflared/releases/latest/download/${d}`}(),b=a.endsWith(".tgz"),c=b?g().join(n,"cloudflared.tgz"):r;return await function a(b,c){return new Promise((d,f)=>{let g=e().createWriteStream(c);i().get(b,b=>{if([301,302].includes(b.statusCode)){g.close(),e().unlinkSync(c),a(b.headers.location,c).then(d).catch(f);return}if(200!==b.statusCode){g.close(),e().unlinkSync(c),f(Error(`Download failed with status ${b.statusCode}`));return}b.pipe(g),g.on("finish",()=>{g.close(()=>d(c))}),g.on("error",a=>{g.close(),e().unlinkSync(c),f(a)})}).on("error",a=>{g.close(),e().existsSync(c)&&e().unlinkSync(c),f(a)})})}(a,c),b&&((0,l.execSync)(`tar -xzf "${c}" -C "${n}"`,{stdio:"pipe"}),e().unlinkSync(c)),p||e().chmodSync(r,"755"),r}let u=null,v=null;function w(a){v=a}async function x(a){let b=await t(),c=(0,l.spawn)(b,["tunnel","run","--dns-resolver-addrs","1.1.1.1:53","--token",a],{detached:!1,stdio:["ignore","pipe","pipe"]});return u=c,(0,m.xS)(c.pid),new Promise((a,b)=>{let d=0,e=!1,f=setTimeout(()=>{e=!0,a(c)},9e4),g=b=>{let g=b.toString().match(/Registered tunnel connection/g);g&&(d+=g.length)>=4&&!e&&(e=!0,clearTimeout(f),a(c))};c.stdout.on("data",g),c.stderr.on("data",g),c.on("error",a=>{e||(e=!0,clearTimeout(f),b(a))}),c.on("exit",a=>{u=null,(0,m.r4)();let c=e;e||(e=!0,clearTimeout(f),0!==d)?c&&v&&v():b(Error(`cloudflared exited with code ${a}`))})})}function y(){if(u){try{u.kill()}catch(a){}u=null}let a=(0,m.Cr)();if(a){try{process.kill(a)}catch(a){}(0,m.r4)()}try{(0,l.execSync)("pkill -f cloudflared 2>/dev/null || true",{stdio:"ignore"})}catch(a){}}function z(){let a=(0,m.Cr)();if(!a)return!1;try{return process.kill(a,0),!0}catch(a){return!1}}},19201:(a,b,c)=>{var d=c(89718),e=c(53855),f=c(3179),g=c(96182),h=c(1932),i=c(33873),j=c(29021),k=c(21820),l=c.n(k);if(!process.env.MITM_SERVER_PATH)try{let a=(0,h.fileURLToPath)("file:///Users/Working/router4/app/src/shared/services/initializeApp.js"),b=(0,i.dirname)((0,i.dirname)(a)),c=(0,i.join)(b,"mitm","server.js");(0,j.existsSync)(c)&&(process.env.MITM_SERVER_PATH=c)}catch{}try{(0,g.initDbHooks)(d.getSettings,d.Xx)}catch{}process.setMaxListeners(20);let m=global.__appSingleton??={signalHandlersRegistered:!1,watchdogInterval:null,networkMonitorInterval:null,lastNetworkFingerprint:null,lastWatchdogTick:Date.now(),lastTunnelRestartAt:0,tunnelRestartInProgress:!1};async function n(){try{if(await (0,d.bI)(),(await (0,d.getSettings)()).tunnelEnabled&&!(0,f.nN)()){console.log("[InitApp] Tunnel was enabled, auto-reconnecting...");try{await (0,e.cb)(),console.log("[InitApp] Tunnel reconnected")}catch(a){console.log("[InitApp] Tunnel reconnect failed:",a.message)}}if(!m.signalHandlersRegistered){let a=()=>{(0,f.ss)(),process.exit()};process.on("SIGINT",a),process.on("SIGTERM",a),m.signalHandlersRegistered=!0}(0,f.Al)().catch(()=>{}),!m.watchdogInterval&&(m.watchdogInterval=setInterval(async()=>{try{if(!(await (0,d.getSettings)()).tunnelEnabled||(0,f.nN)())return;console.log("[Watchdog] Tunnel process is down, attempting recovery..."),await (0,e.cb)(),console.log("[Watchdog] Tunnel recovered")}catch(a){console.log("[Watchdog] Recovery failed:",a.message)}},6e4),m.watchdogInterval.unref&&m.watchdogInterval.unref()),!m.networkMonitorInterval&&(m.lastNetworkFingerprint=p(),m.lastWatchdogTick=Date.now(),m.networkMonitorInterval=setInterval(async()=>{try{if(!(await (0,d.getSettings)()).tunnelEnabled)return;let a=Date.now(),b=a-m.lastWatchdogTick;m.lastWatchdogTick=a;let c=p(),g=c!==m.lastNetworkFingerprint,h=b>15e3;if(g&&(m.lastNetworkFingerprint=c),!g&&!h||m.tunnelRestartInProgress||a-m.lastTunnelRestartAt<3e4)return;console.log(`[NetworkMonitor] ${h&&g?"sleep/wake + network change":h?"sleep/wake":"network change"} detected, restarting tunnel...`),m.tunnelRestartInProgress=!0,m.lastTunnelRestartAt=a;try{(0,f.ss)(),await new Promise(a=>setTimeout(a,2e3)),await (0,e.cb)(),console.log("[NetworkMonitor] Tunnel restarted"),m.lastNetworkFingerprint=p()}finally{m.tunnelRestartInProgress=!1}}catch(a){console.log("[NetworkMonitor] Tunnel restart failed:",a.message)}},5e3),m.networkMonitorInterval.unref&&m.networkMonitorInterval.unref()),o()}catch(a){console.error("[InitApp] Error:",a)}}async function o(){try{if(!(await (0,d.getSettings)()).mitmEnabled||(await (0,g.getMitmStatus)()).running)return;let a=await (0,g.loadEncryptedPassword)();if(!a&&"win32"!==process.platform)return void console.log("[InitApp] MITM was enabled but no saved password found, skipping auto-start");let b=(await (0,d.getApiKeys)()).find(a=>!1!==a.isActive);if(!b)return void console.log("[InitApp] MITM auto-start skipped: no active API key");console.log("[InitApp] MITM was enabled, auto-starting..."),await (0,g.startMitm)(b.key,a||""),console.log("[InitApp] MITM auto-started")}catch(a){console.log("[InitApp] MITM auto-start failed:",a.message)}}function p(){let a=l().networkInterfaces(),b=[];for(let[c,d]of Object.entries(a))if(d)for(let a of d)a.internal||"IPv4"!==a.family||b.push(`${c}:${a.address}`);return b.sort().join("|")}let q=!1;(async function(){if(!q)try{await n(),q=!0}catch(a){console.error("[ServerInit] Error initializing app:",a)}return q})().catch(console.log)},53855:(a,b,c)=>{c.d(b,{Jv:()=>r,Rg:()=>q,cb:()=>o});var d=c(55511),e=c.n(d),f=c(85567),g=c(3179),h=c(89718);let i=process.env.TUNNEL_WORKER_URL||"https://tunnel.9router.com",j="abcdefghijklmnpqrstuvwxyz23456789",k=[5e3,1e4,2e4,3e4,6e4],l=k.length,m=!1;async function n(a,b={}){let c=`${i}${a}`;return(await fetch(c,{...b,headers:{"Content-Type":"application/json",...b.headers}})).json()}async function o(){let a=(0,f.C7)();if(a&&a.tunnelUrl&&(0,g.nN)())return{success:!0,tunnelUrl:a.tunnelUrl,shortId:a.shortId,alreadyRunning:!0};(0,g.ss)();let b=function(){try{let{machineIdSync:a}=c(19713),b=a();return e().createHash("sha256").update(b+"9router-tunnel-salt").digest("hex").substring(0,16)}catch(a){return e().randomUUID().replace(/-/g,"").substring(0,16)}}(),d=a?.shortId||function(){let a="";for(let b=0;b<6;b++)a+=j.charAt(Math.floor(Math.random()*j.length));return a}(),i=a?.apiKey||function(a){let b="abcdefghijklmnopqrstuvwxyz0123456789",c="";for(let a=0;a<6;a++)c+=b.charAt(Math.floor(Math.random()*b.length));let d=e().createHmac("sha256","9router-tunnel-api-key-secret").update(a+c).digest("hex").slice(0,8);return`sk-${a}-${c}-${d}`}(b);await n("/api/session/create",{method:"POST",body:JSON.stringify({apiKey:i,shortId:d})});let k=await n("/api/tunnel/create",{method:"POST",body:JSON.stringify({apiKey:i})});if(k.error)throw Error(k.error);let{token:l,hostname:o}=k;return await (0,g.F0)(l),(0,f.LZ)({shortId:d,apiKey:i,tunnelUrl:o,machineId:b}),await (0,h.Xx)({tunnelEnabled:!0,tunnelUrl:o}),(0,g.es)(()=>{m||p(0)}),{success:!0,tunnelUrl:o,shortId:d}}async function p(a){if(m)return;m=!0;let b=k[Math.min(a,k.length-1)];console.log(`[Tunnel] Unexpected exit detected, reconnecting in ${b/1e3}s (attempt ${a+1})...`),await new Promise(a=>setTimeout(a,b));try{if(!(await (0,h.getSettings)()).tunnelEnabled){console.log("[Tunnel] Tunnel disabled, skipping reconnect"),m=!1;return}await o(),console.log("[Tunnel] Reconnected successfully"),m=!1}catch(c){console.log(`[Tunnel] Reconnect attempt ${a+1} failed:`,c.message),m=!1;let b=a+1;b<l?p(b):console.log("[Tunnel] All reconnect attempts exhausted")}}async function q(){let a=(0,f.C7)();if((0,g.ss)(),a?.apiKey)try{await n("/api/tunnel/delete",{method:"DELETE",body:JSON.stringify({apiKey:a.apiKey})})}catch(a){}return a&&(0,f.LZ)({shortId:a.shortId,apiKey:a.apiKey,machineId:a.machineId,tunnelUrl:null}),await (0,h.Xx)({tunnelEnabled:!1,tunnelUrl:""}),{success:!0}}async function r(){let a=(0,f.C7)(),b=(0,g.nN)();return{enabled:!0===(await (0,h.getSettings)()).tunnelEnabled&&b,tunnelUrl:a?.tunnelUrl||"",shortId:a?.shortId||"",running:b}}},85567:(a,b,c)=>{c.d(b,{C7:()=>n,Cr:()=>q,LZ:()=>o,r4:()=>r,xS:()=>p});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f),h=c(21820),i=c.n(h);let j=g().join(i().homedir(),".9router","tunnel"),k=g().join(j,"state.json"),l=g().join(j,"cloudflared.pid");function m(){e().existsSync(j)||e().mkdirSync(j,{recursive:!0})}function n(){try{if(e().existsSync(k))return JSON.parse(e().readFileSync(k,"utf8"))}catch(a){}return null}function o(a){m(),e().writeFileSync(k,JSON.stringify(a,null,2))}function p(a){m(),e().writeFileSync(l,a.toString())}function q(){try{if(e().existsSync(l))return parseInt(e().readFileSync(l,"utf8"))}catch(a){}return null}function r(){try{e().existsSync(l)&&e().unlinkSync(l)}catch(a){}}}};
1
+ "use strict";exports.id=9201,exports.ids=[9201],exports.modules={3179:(a,b,c)=>{c.d(b,{Al:()=>t,F0:()=>x,es:()=>w,nN:()=>z,ss:()=>y});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f),h=c(55591),i=c.n(h),j=c(21820),k=c.n(j),l=c(79646),m=c(85567);let n=g().join(k().homedir(),".9router","bin"),o="cloudflared",p="win32"===k().platform(),q=p?`${o}.exe`:o,r=g().join(n,q),s={darwin:{x64:"cloudflared-darwin-amd64.tgz",arm64:"cloudflared-darwin-amd64.tgz"},win32:{x64:"cloudflared-windows-amd64.exe"},linux:{x64:"cloudflared-linux-amd64",arm64:"cloudflared-linux-arm64"}};async function t(){if(e().existsSync(n)||e().mkdirSync(n,{recursive:!0}),e().existsSync(r))return p||e().chmodSync(r,"755"),r;let a=function(){let a=k().platform(),b=k().arch(),c=s[a];if(!c)throw Error(`Unsupported platform: ${a}`);let d=c[b];if(!d)throw Error(`Unsupported architecture: ${b} for platform ${a}`);return`https://github.com/cloudflare/cloudflared/releases/latest/download/${d}`}(),b=a.endsWith(".tgz"),c=b?g().join(n,"cloudflared.tgz"):r;return await function a(b,c){return new Promise((d,f)=>{let g=e().createWriteStream(c);i().get(b,b=>{if([301,302].includes(b.statusCode)){g.close(),e().unlinkSync(c),a(b.headers.location,c).then(d).catch(f);return}if(200!==b.statusCode){g.close(),e().unlinkSync(c),f(Error(`Download failed with status ${b.statusCode}`));return}b.pipe(g),g.on("finish",()=>{g.close(()=>d(c))}),g.on("error",a=>{g.close(),e().unlinkSync(c),f(a)})}).on("error",a=>{g.close(),e().existsSync(c)&&e().unlinkSync(c),f(a)})})}(a,c),b&&((0,l.execSync)(`tar -xzf "${c}" -C "${n}"`,{stdio:"pipe"}),e().unlinkSync(c)),p||e().chmodSync(r,"755"),r}let u=null,v=null;function w(a){v=a}async function x(a){let b=await t(),c=(0,l.spawn)(b,["tunnel","run","--dns-resolver-addrs","1.1.1.1:53","--token",a],{detached:!1,windowsHide:!0,stdio:["ignore","pipe","pipe"]});return u=c,(0,m.xS)(c.pid),new Promise((a,b)=>{let d=0,e=!1,f=setTimeout(()=>{e=!0,a(c)},9e4),g=b=>{let g=b.toString().match(/Registered tunnel connection/g);g&&(d+=g.length)>=4&&!e&&(e=!0,clearTimeout(f),a(c))};c.stdout.on("data",g),c.stderr.on("data",g),c.on("error",a=>{e||(e=!0,clearTimeout(f),b(a))}),c.on("exit",a=>{u=null,(0,m.r4)();let c=e;e||(e=!0,clearTimeout(f),0!==d)?c&&v&&v():b(Error(`cloudflared exited with code ${a}`))})})}function y(){if(u){try{u.kill()}catch(a){}u=null}let a=(0,m.Cr)();if(a){try{process.kill(a)}catch(a){}(0,m.r4)()}try{(0,l.execSync)("pkill -f cloudflared 2>/dev/null || true",{stdio:"ignore"})}catch(a){}}function z(){let a=(0,m.Cr)();if(!a)return!1;try{return process.kill(a,0),!0}catch(a){return!1}}},19201:(a,b,c)=>{var d=c(89718),e=c(53855),f=c(3179),g=c(96182),h=c(1932),i=c(33873),j=c(29021),k=c(21820),l=c.n(k);if(!process.env.MITM_SERVER_PATH)try{let a=(0,h.fileURLToPath)("file:///Users/Working/router4/app/src/shared/services/initializeApp.js"),b=(0,i.dirname)((0,i.dirname)(a)),c=(0,i.join)(b,"mitm","server.js");(0,j.existsSync)(c)&&(process.env.MITM_SERVER_PATH=c)}catch{}try{(0,g.initDbHooks)(d.getSettings,d.Xx)}catch{}process.setMaxListeners(20);let m=global.__appSingleton??={signalHandlersRegistered:!1,watchdogInterval:null,networkMonitorInterval:null,lastNetworkFingerprint:null,lastWatchdogTick:Date.now(),lastTunnelRestartAt:0,tunnelRestartInProgress:!1};async function n(){try{if(await (0,d.bI)(),(await (0,d.getSettings)()).tunnelEnabled&&!(0,f.nN)()){console.log("[InitApp] Tunnel was enabled, auto-reconnecting...");try{await (0,e.cb)(),console.log("[InitApp] Tunnel reconnected")}catch(a){console.log("[InitApp] Tunnel reconnect failed:",a.message)}}if(!m.signalHandlersRegistered){let a=()=>{(0,f.ss)(),process.exit()};process.on("SIGINT",a),process.on("SIGTERM",a),m.signalHandlersRegistered=!0}(0,f.Al)().catch(()=>{}),!m.watchdogInterval&&(m.watchdogInterval=setInterval(async()=>{try{if(!(await (0,d.getSettings)()).tunnelEnabled||(0,f.nN)())return;console.log("[Watchdog] Tunnel process is down, attempting recovery..."),await (0,e.cb)(),console.log("[Watchdog] Tunnel recovered")}catch(a){console.log("[Watchdog] Recovery failed:",a.message)}},6e4),m.watchdogInterval.unref&&m.watchdogInterval.unref()),!m.networkMonitorInterval&&(m.lastNetworkFingerprint=p(),m.lastWatchdogTick=Date.now(),m.networkMonitorInterval=setInterval(async()=>{try{if(!(await (0,d.getSettings)()).tunnelEnabled)return;let a=Date.now(),b=a-m.lastWatchdogTick;m.lastWatchdogTick=a;let c=p(),g=c!==m.lastNetworkFingerprint,h=b>15e3;if(g&&(m.lastNetworkFingerprint=c),!g&&!h||m.tunnelRestartInProgress||a-m.lastTunnelRestartAt<3e4)return;console.log(`[NetworkMonitor] ${h&&g?"sleep/wake + network change":h?"sleep/wake":"network change"} detected, restarting tunnel...`),m.tunnelRestartInProgress=!0,m.lastTunnelRestartAt=a;try{(0,f.ss)(),await new Promise(a=>setTimeout(a,2e3)),await (0,e.cb)(),console.log("[NetworkMonitor] Tunnel restarted"),m.lastNetworkFingerprint=p()}finally{m.tunnelRestartInProgress=!1}}catch(a){console.log("[NetworkMonitor] Tunnel restart failed:",a.message)}},5e3),m.networkMonitorInterval.unref&&m.networkMonitorInterval.unref()),o()}catch(a){console.error("[InitApp] Error:",a)}}async function o(){try{if(!(await (0,d.getSettings)()).mitmEnabled||(await (0,g.getMitmStatus)()).running)return;let a=await (0,g.loadEncryptedPassword)();if(!a&&"win32"!==process.platform)return void console.log("[InitApp] MITM was enabled but no saved password found, skipping auto-start");let b=(await (0,d.getApiKeys)()).find(a=>!1!==a.isActive);console.log("[InitApp] MITM was enabled, auto-starting..."),await (0,g.startMitm)(b?.key||"sk_9router",a||""),console.log("[InitApp] MITM auto-started")}catch(a){console.log("[InitApp] MITM auto-start failed:",a.message)}}function p(){let a=l().networkInterfaces(),b=[];for(let[c,d]of Object.entries(a))if(d)for(let a of d)a.internal||"IPv4"!==a.family||b.push(`${c}:${a.address}`);return b.sort().join("|")}let q=!1;(async function(){if(!q)try{await n(),q=!0}catch(a){console.error("[ServerInit] Error initializing app:",a)}return q})().catch(console.log)},53855:(a,b,c)=>{c.d(b,{Jv:()=>r,Rg:()=>q,cb:()=>o});var d=c(55511),e=c.n(d),f=c(85567),g=c(3179),h=c(89718);let i=process.env.TUNNEL_WORKER_URL||"https://tunnel.9router.com",j="abcdefghijklmnpqrstuvwxyz23456789",k=[5e3,1e4,2e4,3e4,6e4],l=k.length,m=!1;async function n(a,b={}){let c=`${i}${a}`;return(await fetch(c,{...b,headers:{"Content-Type":"application/json",...b.headers}})).json()}async function o(){let a=(0,f.C7)();if(a&&a.tunnelUrl&&(0,g.nN)())return{success:!0,tunnelUrl:a.tunnelUrl,shortId:a.shortId,alreadyRunning:!0};(0,g.ss)();let b=function(){try{let{machineIdSync:a}=c(19713),b=a();return e().createHash("sha256").update(b+"9router-tunnel-salt").digest("hex").substring(0,16)}catch(a){return e().randomUUID().replace(/-/g,"").substring(0,16)}}(),d=a?.shortId||function(){let a="";for(let b=0;b<6;b++)a+=j.charAt(Math.floor(Math.random()*j.length));return a}(),i=a?.apiKey||function(a){let b="abcdefghijklmnopqrstuvwxyz0123456789",c="";for(let a=0;a<6;a++)c+=b.charAt(Math.floor(Math.random()*b.length));let d=e().createHmac("sha256","9router-tunnel-api-key-secret").update(a+c).digest("hex").slice(0,8);return`sk-${a}-${c}-${d}`}(b);await n("/api/session/create",{method:"POST",body:JSON.stringify({apiKey:i,shortId:d})});let k=await n("/api/tunnel/create",{method:"POST",body:JSON.stringify({apiKey:i})});if(k.error)throw Error(k.error);let{token:l,hostname:o}=k;return await (0,g.F0)(l),(0,f.LZ)({shortId:d,apiKey:i,tunnelUrl:o,machineId:b}),await (0,h.Xx)({tunnelEnabled:!0,tunnelUrl:o}),(0,g.es)(()=>{m||p(0)}),{success:!0,tunnelUrl:o,shortId:d}}async function p(a){if(m)return;m=!0;let b=k[Math.min(a,k.length-1)];console.log(`[Tunnel] Unexpected exit detected, reconnecting in ${b/1e3}s (attempt ${a+1})...`),await new Promise(a=>setTimeout(a,b));try{if(!(await (0,h.getSettings)()).tunnelEnabled){console.log("[Tunnel] Tunnel disabled, skipping reconnect"),m=!1;return}await o(),console.log("[Tunnel] Reconnected successfully"),m=!1}catch(c){console.log(`[Tunnel] Reconnect attempt ${a+1} failed:`,c.message),m=!1;let b=a+1;b<l?p(b):console.log("[Tunnel] All reconnect attempts exhausted")}}async function q(){let a=(0,f.C7)();if((0,g.ss)(),a?.apiKey)try{await n("/api/tunnel/delete",{method:"DELETE",body:JSON.stringify({apiKey:a.apiKey})})}catch(a){}return a&&(0,f.LZ)({shortId:a.shortId,apiKey:a.apiKey,machineId:a.machineId,tunnelUrl:null}),await (0,h.Xx)({tunnelEnabled:!1,tunnelUrl:""}),{success:!0}}async function r(){let a=(0,f.C7)(),b=(0,g.nN)();return{enabled:!0===(await (0,h.getSettings)()).tunnelEnabled&&b,tunnelUrl:a?.tunnelUrl||"",shortId:a?.shortId||"",running:b}}},85567:(a,b,c)=>{c.d(b,{C7:()=>n,Cr:()=>q,LZ:()=>o,r4:()=>r,xS:()=>p});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f),h=c(21820),i=c.n(h);let j=g().join(i().homedir(),".9router","tunnel"),k=g().join(j,"state.json"),l=g().join(j,"cloudflared.pid");function m(){e().existsSync(j)||e().mkdirSync(j,{recursive:!0})}function n(){try{if(e().existsSync(k))return JSON.parse(e().readFileSync(k,"utf8"))}catch(a){}return null}function o(a){m(),e().writeFileSync(k,JSON.stringify(a,null,2))}function p(a){m(),e().writeFileSync(l,a.toString())}function q(){try{if(e().existsSync(l))return parseInt(e().readFileSync(l,"utf8"))}catch(a){}return null}function r(){try{e().existsSync(l)&&e().unlinkSync(l)}catch(a){}}}};
@@ -1 +1 @@
1
- "use strict";exports.id=9718,exports.ids=[9718],exports.modules={89718:(a,b,c)=>{c.d(b,{CG:()=>U,Dj:()=>R,Iq:()=>W,K1:()=>ad,KJ:()=>ag,L:()=>Q,L9:()=>O,Lh:()=>X,Mc:()=>F,OM:()=>K,Pc:()=>y,Q_:()=>C,Qu:()=>v,Uv:()=>P,VT:()=>ai,XW:()=>Z,Xx:()=>ab,Yd:()=>D,ZO:()=>B,bI:()=>_,c:()=>N,ek:()=>$,fK:()=>I,fv:()=>M,getApiKeys:()=>V,getPricingForModel:()=>af,getProviderConnections:()=>t,getProviderNodes:()=>u,getSettings:()=>aa,ho:()=>x,hr:()=>A,i0:()=>w,iE:()=>G,jd:()=>S,o5:()=>L,oG:()=>T,op:()=>E,r4:()=>ae,rj:()=>H,ui:()=>z,yF:()=>ah,yg:()=>Y,zP:()=>ac});var d=c(82996),e=c(11259),f=c(94755),g=c(76760),h=c.n(g),i=c(48161),j=c.n(i),k=c(73024),l=c.n(k);let m="u">typeof caches||"object"==typeof caches,n=function(){if(m)return"/tmp";if(process.env.DATA_DIR)return process.env.DATA_DIR;let a=process.platform,b=j().homedir(),c="9router";return"win32"===a?h().join(process.env.APPDATA||h().join(b,"AppData","Roaming"),c):h().join(b,`.${c}`)}(),o=m?null:h().join(n,"db.json");function p(){return{providerConnections:[],providerNodes:[],proxyPools:[],modelAliases:{},mitmAlias:{},combos:[],apiKeys:[],settings:{cloudEnabled:!1,tunnelEnabled:!1,tunnelUrl:"",stickyRoundRobinLimit:3,providerStrategies:{},requireLogin:!0,observabilityEnabled:!0,observabilityMaxRecords:1e3,observabilityBatchSize:20,observabilityFlushIntervalMs:5e3,observabilityMaxJsonSize:1024,outboundProxyEnabled:!1,outboundProxyUrl:"",outboundNoProxy:""},pricing:{}}}function q(a){let b=p(),c=a&&"object"==typeof a?a:{},d=!1;for(let[a,e]of Object.entries(b)){if(void 0===c[a]||null===c[a]){c[a]=e,d=!0;continue}if("settings"===a&&("object"!=typeof c.settings||Array.isArray(c.settings))){c.settings={...e},d=!0;continue}if("settings"===a&&"object"==typeof c.settings&&!Array.isArray(c.settings))for(let[a,b]of Object.entries(e))void 0===c.settings[a]&&("outboundProxyEnabled"===a&&"string"==typeof c.settings.outboundProxyUrl&&c.settings.outboundProxyUrl.trim()?c.settings.outboundProxyEnabled=!0:c.settings[a]=b,d=!0);if("apiKeys"===a&&Array.isArray(c.apiKeys))for(let a of c.apiKeys)(void 0===a.isActive||null===a.isActive)&&(a.isActive=!0,d=!0)}return{data:c,changed:d}}m||l().existsSync(n)||l().mkdirSync(n,{recursive:!0});let r=null;async function s(){if(m){if(!r){let a=p();(r=new d.t({read:async()=>{},write:async()=>{}},a)).data=a}return r}if(!r){let a=new e.Pv(o);r=new d.t(a,p())}try{await r.read()}catch(a){if(a instanceof SyntaxError)console.warn("[DB] Corrupt JSON detected, resetting to defaults..."),r.data=p(),await r.write();else throw a}if(r.data){let{data:a,changed:b}=q(r.data);r.data=a,b&&await r.write()}else r.data=p(),await r.write();return r}async function t(a={}){let b=(await s()).data.providerConnections||[];return a.provider&&(b=b.filter(b=>b.provider===a.provider)),void 0!==a.isActive&&(b=b.filter(b=>b.isActive===a.isActive)),b.sort((a,b)=>(a.priority||999)-(b.priority||999)),b}async function u(a={}){let b=(await s()).data.providerNodes||[];return a.type&&(b=b.filter(b=>b.type===a.type)),b}async function v(a){return(await s()).data.providerNodes.find(b=>b.id===a)||null}async function w(a){let b=await s();b.data.providerNodes||(b.data.providerNodes=[]);let c=new Date().toISOString(),d={id:a.id||(0,f.A)(),type:a.type,name:a.name,prefix:a.prefix,apiType:a.apiType,baseUrl:a.baseUrl,createdAt:c,updatedAt:c};return b.data.providerNodes.push(d),await b.write(),d}async function x(a,b){let c=await s();c.data.providerNodes||(c.data.providerNodes=[]);let d=c.data.providerNodes.findIndex(b=>b.id===a);return -1===d?null:(c.data.providerNodes[d]={...c.data.providerNodes[d],...b,updatedAt:new Date().toISOString()},await c.write(),c.data.providerNodes[d])}async function y(a){let b=await s();b.data.providerNodes||(b.data.providerNodes=[]);let c=b.data.providerNodes.findIndex(b=>b.id===a);if(-1===c)return null;let[d]=b.data.providerNodes.splice(c,1);return await b.write(),d}async function z(a={}){let b=(await s()).data.proxyPools||[];return void 0!==a.isActive&&(b=b.filter(b=>b.isActive===a.isActive)),a.testStatus&&(b=b.filter(b=>b.testStatus===a.testStatus)),b.sort((a,b)=>new Date(b.updatedAt||0)-new Date(a.updatedAt||0))}async function A(a){return((await s()).data.proxyPools||[]).find(b=>b.id===a)||null}async function B(a){let b=await s();b.data.proxyPools||(b.data.proxyPools=[]);let c=new Date().toISOString(),d={id:a.id||(0,f.A)(),name:a.name,proxyUrl:a.proxyUrl,noProxy:a.noProxy||"",isActive:void 0===a.isActive||a.isActive,strictProxy:!0===a.strictProxy,testStatus:a.testStatus||"unknown",lastTestedAt:a.lastTestedAt||null,lastError:a.lastError||null,createdAt:c,updatedAt:c};return b.data.proxyPools.push(d),await b.write(),d}async function C(a,b){let c=await s();c.data.proxyPools||(c.data.proxyPools=[]);let d=c.data.proxyPools.findIndex(b=>b.id===a);return -1===d?null:(c.data.proxyPools[d]={...c.data.proxyPools[d],...b,updatedAt:new Date().toISOString()},await c.write(),c.data.proxyPools[d])}async function D(a){let b=await s();b.data.proxyPools||(b.data.proxyPools=[]);let c=b.data.proxyPools.findIndex(b=>b.id===a);if(-1===c)return null;let[d]=b.data.proxyPools.splice(c,1);return await b.write(),d}async function E(a){let b=await s(),c=b.data.providerConnections.length;b.data.providerConnections=b.data.providerConnections.filter(b=>b.provider!==a);let d=c-b.data.providerConnections.length;return await b.write(),d}async function F(a){return(await s()).data.providerConnections.find(b=>b.id===a)||null}async function G(a){let b=await s(),c=new Date().toISOString(),d=-1;if("oauth"===a.authType&&a.email?d=b.data.providerConnections.findIndex(b=>b.provider===a.provider&&"oauth"===b.authType&&b.email===a.email):"apikey"===a.authType&&a.name&&(d=b.data.providerConnections.findIndex(b=>b.provider===a.provider&&"apikey"===b.authType&&b.name===a.name)),-1!==d)return b.data.providerConnections[d]={...b.data.providerConnections[d],...a,updatedAt:c},await b.write(),b.data.providerConnections[d];let e=a.name||null;if(!e&&"oauth"===a.authType)if(a.email)e=a.email;else{let c=b.data.providerConnections.filter(b=>b.provider===a.provider).length;e=`Account ${c+1}`}let g=a.priority;g||(g=b.data.providerConnections.filter(b=>b.provider===a.provider).reduce((a,b)=>Math.max(a,b.priority||0),0)+1);let h={id:(0,f.A)(),provider:a.provider,authType:a.authType||"oauth",name:e,priority:g,isActive:void 0===a.isActive||a.isActive,createdAt:c,updatedAt:c};for(let b of["displayName","email","globalPriority","defaultModel","accessToken","refreshToken","expiresAt","tokenType","scope","idToken","projectId","apiKey","testStatus","lastTested","lastError","lastErrorAt","rateLimitedUntil","expiresIn","errorCode","consecutiveUseCount"])void 0!==a[b]&&null!==a[b]&&(h[b]=a[b]);return a.providerSpecificData&&Object.keys(a.providerSpecificData).length>0&&(h.providerSpecificData=a.providerSpecificData),b.data.providerConnections.push(h),await b.write(),await J(a.provider),h}async function H(a,b){let c=await s(),d=c.data.providerConnections.findIndex(b=>b.id===a);if(-1===d)return null;let e=c.data.providerConnections[d].provider;return c.data.providerConnections[d]={...c.data.providerConnections[d],...b,updatedAt:new Date().toISOString()},await c.write(),void 0!==b.priority&&await J(e),c.data.providerConnections[d]}async function I(a){let b=await s(),c=b.data.providerConnections.findIndex(b=>b.id===a);if(-1===c)return!1;let d=b.data.providerConnections[c].provider;return b.data.providerConnections.splice(c,1),await b.write(),await J(d),!0}async function J(a){let b=await s();b.data.providerConnections&&(b.data.providerConnections.filter(b=>b.provider===a).sort((a,b)=>{let c=(a.priority||0)-(b.priority||0);return 0!==c?c:new Date(b.updatedAt||0)-new Date(a.updatedAt||0)}).forEach((a,b)=>{a.priority=b+1}),await b.write())}async function K(){return(await s()).data.modelAliases||{}}async function L(a,b){let c=await s();c.data.modelAliases[a]=b,await c.write()}async function M(a){let b=await s();delete b.data.modelAliases[a],await b.write()}async function N(a){let b=(await s()).data.mitmAlias||{};return a?b[a]||{}:b}async function O(a,b){let c=await s();c.data.mitmAlias||(c.data.mitmAlias={}),c.data.mitmAlias[a]=b||{},await c.write()}async function P(){return(await s()).data.combos||[]}async function Q(a){return((await s()).data.combos||[]).find(b=>b.id===a)||null}async function R(a){return((await s()).data.combos||[]).find(b=>b.name===a)||null}async function S(a){let b=await s();b.data.combos||(b.data.combos=[]);let c=new Date().toISOString(),d={id:(0,f.A)(),name:a.name,models:a.models||[],createdAt:c,updatedAt:c};return b.data.combos.push(d),await b.write(),d}async function T(a,b){let c=await s();c.data.combos||(c.data.combos=[]);let d=c.data.combos.findIndex(b=>b.id===a);return -1===d?null:(c.data.combos[d]={...c.data.combos[d],...b,updatedAt:new Date().toISOString()},await c.write(),c.data.combos[d])}async function U(a){let b=await s();if(!b.data.combos)return!1;let c=b.data.combos.findIndex(b=>b.id===a);return -1!==c&&(b.data.combos.splice(c,1),await b.write(),!0)}async function V(){return(await s()).data.apiKeys||[]}async function W(a,b){if(!b)throw Error("machineId is required");let d=await s(),e=new Date().toISOString(),{generateApiKeyWithMachine:g}=await c.e(6844).then(c.bind(c,86844)),h=g(b),i={id:(0,f.A)(),name:a,key:h.key,machineId:b,isActive:!0,createdAt:e};return d.data.apiKeys.push(i),await d.write(),i}async function X(a){let b=await s(),c=b.data.apiKeys.findIndex(b=>b.id===a);return -1!==c&&(b.data.apiKeys.splice(c,1),await b.write(),!0)}async function Y(a){return(await s()).data.apiKeys.find(b=>b.id===a)||null}async function Z(a,b){let c=await s(),d=c.data.apiKeys.findIndex(b=>b.id===a);return -1===d?null:(c.data.apiKeys[d]={...c.data.apiKeys[d],...b},await c.write(),c.data.apiKeys[d])}async function $(a){let b=(await s()).data.apiKeys.find(b=>b.key===a);return b&&!1!==b.isActive}async function _(){let a=await s(),b=["displayName","email","globalPriority","defaultModel","accessToken","refreshToken","expiresAt","tokenType","scope","idToken","projectId","apiKey","testStatus","lastTested","lastError","lastErrorAt","rateLimitedUntil","expiresIn","consecutiveUseCount"],c=0;for(let d of a.data.providerConnections){for(let a of b)(null===d[a]||void 0===d[a])&&(delete d[a],c++);d.providerSpecificData&&0===Object.keys(d.providerSpecificData).length&&(delete d.providerSpecificData,c++)}return c>0&&await a.write(),c}async function aa(){return(await s()).data.settings||{cloudEnabled:!1}}async function ab(a){let b=await s();return b.data.settings={...b.data.settings,...a},await b.write(),b.data.settings}async function ac(){return(await s()).data||p()}async function ad(a){if(!a||"object"!=typeof a||Array.isArray(a))throw Error("Invalid database payload");let{data:b}=q({...p(),...a,settings:{...p().settings,...a.settings&&"object"==typeof a.settings&&!Array.isArray(a.settings)?a.settings:{}}}),c=await s();return c.data=b,await c.write(),c.data}async function ae(){let a=(await s()).data.pricing||{},{getDefaultPricing:b}=await c.e(7341).then(c.bind(c,57341)),d=b(),e={};for(let[b,c]of Object.entries(d))if(e[b]={...c},a[b])for(let[c,d]of Object.entries(a[b]))e[b][c]?e[b][c]={...e[b][c],...d}:e[b][c]=d;for(let[b,c]of Object.entries(a))if(e[b])for(let[a,d]of Object.entries(c))e[b][a]||(e[b][a]=d);else e[b]={...c};return e}async function af(a,b){let c=await ae();if(c[a]?.[b])return c[a][b];let d={claude:"cc",codex:"cx","gemini-cli":"gc",qwen:"qw",iflow:"if",antigravity:"ag",github:"gh",kiro:"kr",openai:"openai",anthropic:"anthropic",gemini:"gemini",openrouter:"openrouter",glm:"glm",kimi:"kimi",minimax:"minimax"}[a];return d&&c[d]&&c[d][b]||null}async function ag(a){let b=await s();for(let[c,d]of(b.data.pricing||(b.data.pricing={}),Object.entries(a)))for(let[a,e]of(b.data.pricing[c]||(b.data.pricing[c]={}),Object.entries(d)))b.data.pricing[c][a]=e;return await b.write(),b.data.pricing}async function ah(a,b){let c=await s();return c.data.pricing||(c.data.pricing={}),b?c.data.pricing[a]&&(delete c.data.pricing[a][b],0===Object.keys(c.data.pricing[a]).length&&delete c.data.pricing[a]):delete c.data.pricing[a],await c.write(),c.data.pricing}async function ai(){let a=await s();return a.data.pricing={},await a.write(),a.data.pricing}}};
1
+ "use strict";exports.id=9718,exports.ids=[9718],exports.modules={89718:(a,b,c)=>{c.d(b,{CG:()=>U,Dj:()=>R,Iq:()=>W,K1:()=>ad,KJ:()=>ag,L:()=>Q,L9:()=>O,Lh:()=>X,Mc:()=>F,OM:()=>K,Pc:()=>y,Q_:()=>C,Qu:()=>v,Uv:()=>P,VT:()=>ai,XW:()=>Z,Xx:()=>ab,Yd:()=>D,ZO:()=>B,bI:()=>_,c:()=>N,ek:()=>$,fK:()=>I,fv:()=>M,getApiKeys:()=>V,getPricingForModel:()=>af,getProviderConnections:()=>t,getProviderNodes:()=>u,getSettings:()=>aa,ho:()=>x,hr:()=>A,i0:()=>w,iE:()=>G,jd:()=>S,o5:()=>L,oG:()=>T,op:()=>E,r4:()=>ae,rj:()=>H,ui:()=>z,yF:()=>ah,yg:()=>Y,zP:()=>ac});var d=c(82996),e=c(11259),f=c(94755),g=c(76760),h=c.n(g),i=c(48161),j=c.n(i),k=c(73024),l=c.n(k);let m="u">typeof caches||"object"==typeof caches,n=function(){if(m)return"/tmp";if(process.env.DATA_DIR)return process.env.DATA_DIR;let a=process.platform,b=j().homedir(),c="9router";return"win32"===a?h().join(process.env.APPDATA||h().join(b,"AppData","Roaming"),c):h().join(b,`.${c}`)}(),o=m?null:h().join(n,"db.json");function p(){return{providerConnections:[],providerNodes:[],proxyPools:[],modelAliases:{},mitmAlias:{},combos:[],apiKeys:[],settings:{cloudEnabled:!1,tunnelEnabled:!1,tunnelUrl:"",stickyRoundRobinLimit:3,providerStrategies:{},requireLogin:!0,observabilityEnabled:!0,observabilityMaxRecords:1e3,observabilityBatchSize:20,observabilityFlushIntervalMs:5e3,observabilityMaxJsonSize:1024,outboundProxyEnabled:!1,outboundProxyUrl:"",outboundNoProxy:""},pricing:{}}}function q(a){let b=p(),c=a&&"object"==typeof a?a:{},d=!1;for(let[a,e]of Object.entries(b)){if(void 0===c[a]||null===c[a]){c[a]=e,d=!0;continue}if("settings"===a&&("object"!=typeof c.settings||Array.isArray(c.settings))){c.settings={...e},d=!0;continue}if("settings"===a&&"object"==typeof c.settings&&!Array.isArray(c.settings))for(let[a,b]of Object.entries(e))void 0===c.settings[a]&&("outboundProxyEnabled"===a&&"string"==typeof c.settings.outboundProxyUrl&&c.settings.outboundProxyUrl.trim()?c.settings.outboundProxyEnabled=!0:c.settings[a]=b,d=!0);if("apiKeys"===a&&Array.isArray(c.apiKeys))for(let a of c.apiKeys)(void 0===a.isActive||null===a.isActive)&&(a.isActive=!0,d=!0)}return{data:c,changed:d}}m||l().existsSync(n)||l().mkdirSync(n,{recursive:!0});let r=null;async function s(){if(m){if(!r){let a=p();(r=new d.t({read:async()=>{},write:async()=>{}},a)).data=a}return r}if(!r){let a=new e.Pv(o);r=new d.t(a,p())}try{await r.read()}catch(a){if(a instanceof SyntaxError)console.warn("[DB] Corrupt JSON detected, resetting to defaults..."),r.data=p(),await r.write();else throw a}if(r.data){let{data:a,changed:b}=q(r.data);r.data=a,b&&await r.write()}else r.data=p(),await r.write();return r}async function t(a={}){let b=(await s()).data.providerConnections||[];return a.provider&&(b=b.filter(b=>b.provider===a.provider)),void 0!==a.isActive&&(b=b.filter(b=>b.isActive===a.isActive)),b.sort((a,b)=>(a.priority||999)-(b.priority||999)),b}async function u(a={}){let b=(await s()).data.providerNodes||[];return a.type&&(b=b.filter(b=>b.type===a.type)),b}async function v(a){return(await s()).data.providerNodes.find(b=>b.id===a)||null}async function w(a){let b=await s();b.data.providerNodes||(b.data.providerNodes=[]);let c=new Date().toISOString(),d={id:a.id||(0,f.A)(),type:a.type,name:a.name,prefix:a.prefix,apiType:a.apiType,baseUrl:a.baseUrl,createdAt:c,updatedAt:c};return b.data.providerNodes.push(d),await b.write(),d}async function x(a,b){let c=await s();c.data.providerNodes||(c.data.providerNodes=[]);let d=c.data.providerNodes.findIndex(b=>b.id===a);return -1===d?null:(c.data.providerNodes[d]={...c.data.providerNodes[d],...b,updatedAt:new Date().toISOString()},await c.write(),c.data.providerNodes[d])}async function y(a){let b=await s();b.data.providerNodes||(b.data.providerNodes=[]);let c=b.data.providerNodes.findIndex(b=>b.id===a);if(-1===c)return null;let[d]=b.data.providerNodes.splice(c,1);return await b.write(),d}async function z(a={}){let b=(await s()).data.proxyPools||[];return void 0!==a.isActive&&(b=b.filter(b=>b.isActive===a.isActive)),a.testStatus&&(b=b.filter(b=>b.testStatus===a.testStatus)),b.sort((a,b)=>new Date(b.updatedAt||0)-new Date(a.updatedAt||0))}async function A(a){return((await s()).data.proxyPools||[]).find(b=>b.id===a)||null}async function B(a){let b=await s();b.data.proxyPools||(b.data.proxyPools=[]);let c=new Date().toISOString(),d={id:a.id||(0,f.A)(),name:a.name,proxyUrl:a.proxyUrl,noProxy:a.noProxy||"",isActive:void 0===a.isActive||a.isActive,strictProxy:!0===a.strictProxy,testStatus:a.testStatus||"unknown",lastTestedAt:a.lastTestedAt||null,lastError:a.lastError||null,createdAt:c,updatedAt:c};return b.data.proxyPools.push(d),await b.write(),d}async function C(a,b){let c=await s();c.data.proxyPools||(c.data.proxyPools=[]);let d=c.data.proxyPools.findIndex(b=>b.id===a);return -1===d?null:(c.data.proxyPools[d]={...c.data.proxyPools[d],...b,updatedAt:new Date().toISOString()},await c.write(),c.data.proxyPools[d])}async function D(a){let b=await s();b.data.proxyPools||(b.data.proxyPools=[]);let c=b.data.proxyPools.findIndex(b=>b.id===a);if(-1===c)return null;let[d]=b.data.proxyPools.splice(c,1);return await b.write(),d}async function E(a){let b=await s(),c=b.data.providerConnections.length;b.data.providerConnections=b.data.providerConnections.filter(b=>b.provider!==a);let d=c-b.data.providerConnections.length;return await b.write(),d}async function F(a){return(await s()).data.providerConnections.find(b=>b.id===a)||null}async function G(a){let b=await s(),c=new Date().toISOString(),d=-1;if("oauth"===a.authType&&a.email?d=b.data.providerConnections.findIndex(b=>b.provider===a.provider&&"oauth"===b.authType&&b.email===a.email):"apikey"===a.authType&&a.name&&(d=b.data.providerConnections.findIndex(b=>b.provider===a.provider&&"apikey"===b.authType&&b.name===a.name)),-1!==d)return b.data.providerConnections[d]={...b.data.providerConnections[d],...a,updatedAt:c},await b.write(),b.data.providerConnections[d];let e=a.name||null;if(!e&&"oauth"===a.authType)if(a.email)e=a.email;else{let c=b.data.providerConnections.filter(b=>b.provider===a.provider).length;e=`Account ${c+1}`}let g=a.priority;g||(g=b.data.providerConnections.filter(b=>b.provider===a.provider).reduce((a,b)=>Math.max(a,b.priority||0),0)+1);let h={id:(0,f.A)(),provider:a.provider,authType:a.authType||"oauth",name:e,priority:g,isActive:void 0===a.isActive||a.isActive,createdAt:c,updatedAt:c};for(let b of["displayName","email","globalPriority","defaultModel","accessToken","refreshToken","expiresAt","tokenType","scope","idToken","projectId","apiKey","testStatus","lastTested","lastError","lastErrorAt","rateLimitedUntil","expiresIn","errorCode","consecutiveUseCount"])void 0!==a[b]&&null!==a[b]&&(h[b]=a[b]);return a.providerSpecificData&&Object.keys(a.providerSpecificData).length>0&&(h.providerSpecificData=a.providerSpecificData),b.data.providerConnections.push(h),await b.write(),await J(a.provider),h}async function H(a,b){let c=await s(),d=c.data.providerConnections.findIndex(b=>b.id===a);if(-1===d)return null;let e=c.data.providerConnections[d].provider;return c.data.providerConnections[d]={...c.data.providerConnections[d],...b,updatedAt:new Date().toISOString()},await c.write(),void 0!==b.priority&&await J(e),c.data.providerConnections[d]}async function I(a){let b=await s(),c=b.data.providerConnections.findIndex(b=>b.id===a);if(-1===c)return!1;let d=b.data.providerConnections[c].provider;return b.data.providerConnections.splice(c,1),await b.write(),await J(d),!0}async function J(a){let b=await s();b.data.providerConnections&&(b.data.providerConnections.filter(b=>b.provider===a).sort((a,b)=>{let c=(a.priority||0)-(b.priority||0);return 0!==c?c:new Date(b.updatedAt||0)-new Date(a.updatedAt||0)}).forEach((a,b)=>{a.priority=b+1}),await b.write())}async function K(){return(await s()).data.modelAliases||{}}async function L(a,b){let c=await s();c.data.modelAliases[a]=b,await c.write()}async function M(a){let b=await s();delete b.data.modelAliases[a],await b.write()}async function N(a){let b=(await s()).data.mitmAlias||{};return a?b[a]||{}:b}async function O(a,b){let c=await s();c.data.mitmAlias||(c.data.mitmAlias={}),c.data.mitmAlias[a]=b||{},await c.write()}async function P(){return(await s()).data.combos||[]}async function Q(a){return((await s()).data.combos||[]).find(b=>b.id===a)||null}async function R(a){return((await s()).data.combos||[]).find(b=>b.name===a)||null}async function S(a){let b=await s();b.data.combos||(b.data.combos=[]);let c=new Date().toISOString(),d={id:(0,f.A)(),name:a.name,models:a.models||[],createdAt:c,updatedAt:c};return b.data.combos.push(d),await b.write(),d}async function T(a,b){let c=await s();c.data.combos||(c.data.combos=[]);let d=c.data.combos.findIndex(b=>b.id===a);return -1===d?null:(c.data.combos[d]={...c.data.combos[d],...b,updatedAt:new Date().toISOString()},await c.write(),c.data.combos[d])}async function U(a){let b=await s();if(!b.data.combos)return!1;let c=b.data.combos.findIndex(b=>b.id===a);return -1!==c&&(b.data.combos.splice(c,1),await b.write(),!0)}async function V(){return(await s()).data.apiKeys||[]}async function W(a,b){if(!b)throw Error("machineId is required");let d=await s(),e=new Date().toISOString(),{generateApiKeyWithMachine:g}=await c.e(6844).then(c.bind(c,86844)),h=g(b),i={id:(0,f.A)(),name:a,key:h.key,machineId:b,isActive:!0,createdAt:e};return d.data.apiKeys.push(i),await d.write(),i}async function X(a){let b=await s(),c=b.data.apiKeys.findIndex(b=>b.id===a);return -1!==c&&(b.data.apiKeys.splice(c,1),await b.write(),!0)}async function Y(a){return(await s()).data.apiKeys.find(b=>b.id===a)||null}async function Z(a,b){let c=await s(),d=c.data.apiKeys.findIndex(b=>b.id===a);return -1===d?null:(c.data.apiKeys[d]={...c.data.apiKeys[d],...b},await c.write(),c.data.apiKeys[d])}async function $(a){let b=(await s()).data.apiKeys.find(b=>b.key===a);return b&&!1!==b.isActive}async function _(){let a=await s(),b=["displayName","email","globalPriority","defaultModel","accessToken","refreshToken","expiresAt","tokenType","scope","idToken","projectId","apiKey","testStatus","lastTested","lastError","lastErrorAt","rateLimitedUntil","expiresIn","consecutiveUseCount"],c=0;for(let d of a.data.providerConnections){for(let a of b)(null===d[a]||void 0===d[a])&&(delete d[a],c++);d.providerSpecificData&&0===Object.keys(d.providerSpecificData).length&&(delete d.providerSpecificData,c++)}return c>0&&await a.write(),c}async function aa(){return(await s()).data.settings||{cloudEnabled:!1}}async function ab(a){let b=await s();return b.data.settings={...b.data.settings,...a},await b.write(),b.data.settings}async function ac(){return(await s()).data||p()}async function ad(a){if(!a||"object"!=typeof a||Array.isArray(a))throw Error("Invalid database payload");let{data:b}=q({...p(),...a,settings:{...p().settings,...a.settings&&"object"==typeof a.settings&&!Array.isArray(a.settings)?a.settings:{}}}),c=await s();return c.data=b,await c.write(),c.data}async function ae(){let a=(await s()).data.pricing||{},{getDefaultPricing:b}=await c.e(7341).then(c.bind(c,57341)),d=b(),e={};for(let[b,c]of Object.entries(d))if(e[b]={...c},a[b])for(let[c,d]of Object.entries(a[b]))e[b][c]?e[b][c]={...e[b][c],...d}:e[b][c]=d;for(let[b,c]of Object.entries(a))if(e[b])for(let[a,d]of Object.entries(c))e[b][a]||(e[b][a]=d);else e[b]={...c};return e}async function af(a,b){let d=await ae();if(d[a]?.[b])return d[a][b];let e={claude:"cc",codex:"cx","gemini-cli":"gc",qwen:"qw",iflow:"if",antigravity:"ag",github:"gh",kiro:"kr",openai:"openai",anthropic:"anthropic",gemini:"gemini",openrouter:"openrouter",glm:"glm",kimi:"kimi",minimax:"minimax"}[a];if(e&&d[e])return d[e][b]||null;let{MODEL_PRICING:f}=await c.e(7341).then(c.bind(c,57341));return f[b.includes("/")?b.split("/").pop():b]||f[b]||null}async function ag(a){let b=await s();for(let[c,d]of(b.data.pricing||(b.data.pricing={}),Object.entries(a)))for(let[a,e]of(b.data.pricing[c]||(b.data.pricing[c]={}),Object.entries(d)))b.data.pricing[c][a]=e;return await b.write(),b.data.pricing}async function ah(a,b){let c=await s();return c.data.pricing||(c.data.pricing={}),b?c.data.pricing[a]&&(delete c.data.pricing[a][b],0===Object.keys(c.data.pricing[a]).length&&delete c.data.pricing[a]):delete c.data.pricing[a],await c.write(),c.data.pricing}async function ai(){let a=await s();return a.data.pricing={},await a.write(),a.data.pricing}}};
@@ -1 +1 @@
1
- globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:[],rootMainFiles:["static/chunks/webpack-25c43999146c934e.js","static/chunks/4bd1b696-e5d7c65570c947b7.js","static/chunks/3794-c67589461d449d62.js","static/chunks/main-app-8803a230dfc5c361.js"],rootMainFilesTree:{},pages:{"/_app":[]}},globalThis.__BUILD_MANIFEST.lowPriorityFiles=["/static/"+process.env.__NEXT_BUILD_ID+"/_buildManifest.js","/static/"+process.env.__NEXT_BUILD_ID+"/_ssgManifest.js"];
1
+ globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:[],rootMainFiles:["static/chunks/webpack-9bef9bba7ebc0551.js","static/chunks/4bd1b696-84e33c69f320f6a0.js","static/chunks/3794-23858078d298f399.js","static/chunks/main-app-8803a230dfc5c361.js"],rootMainFilesTree:{},pages:{"/_app":[]}},globalThis.__BUILD_MANIFEST.lowPriorityFiles=["/static/"+process.env.__NEXT_BUILD_ID+"/_buildManifest.js","/static/"+process.env.__NEXT_BUILD_ID+"/_ssgManifest.js"];