9router 0.3.55 → 0.3.57

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 (375) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +40 -40
  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_client-reference-manifest.js +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  16. package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  18. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  19. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/_global-error.html +2 -2
  21. package/app/.next/server/app/_global-error.rsc +1 -1
  22. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  23. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  24. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  25. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  26. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  27. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  28. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  29. package/app/.next/server/app/_not-found.html +1 -1
  30. package/app/.next/server/app/_not-found.rsc +4 -4
  31. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
  32. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  33. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
  34. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  35. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  36. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  37. package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  38. package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  39. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
  40. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
  42. package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
  43. package/app/.next/server/app/api/cli-tools/copilot-settings/route_client-reference-manifest.js +1 -1
  44. package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
  45. package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
  46. package/app/.next/server/app/api/cli-tools/opencode-settings/route_client-reference-manifest.js +1 -1
  47. package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
  48. package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
  49. package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
  50. package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
  51. package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
  52. package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  54. package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
  55. package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
  56. package/app/.next/server/app/api/locale/route.js +1 -1
  57. package/app/.next/server/app/api/locale/route_client-reference-manifest.js +1 -1
  58. package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
  59. package/app/.next/server/app/api/models/route.js +1 -1
  60. package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  61. package/app/.next/server/app/api/models/test/route_client-reference-manifest.js +1 -1
  62. package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
  63. package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
  64. package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
  65. package/app/.next/server/app/api/oauth/iflow/cookie/route_client-reference-manifest.js +1 -1
  66. package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
  67. package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
  68. package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
  69. package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
  70. package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
  71. package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
  72. package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
  73. package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
  74. package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
  75. package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
  76. package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
  77. package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
  78. package/app/.next/server/app/api/providers/[id]/test-models/route_client-reference-manifest.js +1 -1
  79. package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
  80. package/app/.next/server/app/api/providers/route.js +1 -1
  81. package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  82. package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
  83. package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
  84. package/app/.next/server/app/api/proxy-pools/[id]/route_client-reference-manifest.js +1 -1
  85. package/app/.next/server/app/api/proxy-pools/[id]/test/route_client-reference-manifest.js +1 -1
  86. package/app/.next/server/app/api/proxy-pools/route_client-reference-manifest.js +1 -1
  87. package/app/.next/server/app/api/settings/database/route_client-reference-manifest.js +1 -1
  88. package/app/.next/server/app/api/settings/proxy-test/route_client-reference-manifest.js +1 -1
  89. package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
  90. package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  91. package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  92. package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  93. package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
  94. package/app/.next/server/app/api/translator/console-logs/route_client-reference-manifest.js +1 -1
  95. package/app/.next/server/app/api/translator/console-logs/stream/route.js +1 -1
  96. package/app/.next/server/app/api/translator/console-logs/stream/route_client-reference-manifest.js +1 -1
  97. package/app/.next/server/app/api/translator/load/route.js.nft.json +1 -1
  98. package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
  99. package/app/.next/server/app/api/translator/save/route.js.nft.json +1 -1
  100. package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
  101. package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
  102. package/app/.next/server/app/api/translator/translate/route.js +1 -1
  103. package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
  104. package/app/.next/server/app/api/tunnel/disable/route_client-reference-manifest.js +1 -1
  105. package/app/.next/server/app/api/tunnel/enable/route_client-reference-manifest.js +1 -1
  106. package/app/.next/server/app/api/tunnel/status/route_client-reference-manifest.js +1 -1
  107. package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
  108. package/app/.next/server/app/api/usage/chart/route_client-reference-manifest.js +1 -1
  109. package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
  110. package/app/.next/server/app/api/usage/providers/route_client-reference-manifest.js +1 -1
  111. package/app/.next/server/app/api/usage/request-details/route_client-reference-manifest.js +1 -1
  112. package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
  113. package/app/.next/server/app/api/usage/stats/route_client-reference-manifest.js +1 -1
  114. package/app/.next/server/app/api/usage/stream/route_client-reference-manifest.js +1 -1
  115. package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
  116. package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
  117. package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
  118. package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
  119. package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
  120. package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
  121. package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
  122. package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
  123. package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
  124. package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
  125. package/app/.next/server/app/api/version/route.js +1 -1
  126. package/app/.next/server/app/api/version/route_client-reference-manifest.js +1 -1
  127. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  128. package/app/.next/server/app/callback.html +1 -1
  129. package/app/.next/server/app/callback.rsc +4 -4
  130. package/app/.next/server/app/callback.segments/_full.segment.rsc +4 -4
  131. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  132. package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
  133. package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
  134. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  135. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  136. package/app/.next/server/app/dashboard/cli-tools.html +1 -1
  137. package/app/.next/server/app/dashboard/cli-tools.rsc +6 -6
  138. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  139. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  140. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  141. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  142. package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  143. package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  144. package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
  145. package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  146. package/app/.next/server/app/dashboard/combos.html +1 -1
  147. package/app/.next/server/app/dashboard/combos.rsc +6 -6
  148. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  149. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  150. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  151. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  152. package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
  153. package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  154. package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
  155. package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  156. package/app/.next/server/app/dashboard/endpoint.html +1 -1
  157. package/app/.next/server/app/dashboard/endpoint.rsc +6 -6
  158. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  159. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  160. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  161. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  162. package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
  163. package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  164. package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
  165. package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  166. package/app/.next/server/app/dashboard/mitm.html +1 -1
  167. package/app/.next/server/app/dashboard/mitm.rsc +6 -6
  168. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  169. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  170. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  171. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  172. package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  173. package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  174. package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
  175. package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  176. package/app/.next/server/app/dashboard/profile.html +1 -1
  177. package/app/.next/server/app/dashboard/profile.rsc +6 -6
  178. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  179. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  180. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  181. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  182. package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
  183. package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  184. package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
  185. package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  186. package/app/.next/server/app/dashboard/providers/new.html +1 -1
  187. package/app/.next/server/app/dashboard/providers/new.rsc +6 -6
  188. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  189. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  190. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  191. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  192. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  193. package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
  194. package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  195. package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
  196. package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  197. package/app/.next/server/app/dashboard/providers.html +1 -1
  198. package/app/.next/server/app/dashboard/providers.rsc +6 -6
  199. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  200. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  201. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  202. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  203. package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
  204. package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  205. package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
  206. package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  207. package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
  208. package/app/.next/server/app/dashboard/proxy-pools.rsc +6 -6
  209. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  210. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  211. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  212. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  213. package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
  214. package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  215. package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
  216. package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  217. package/app/.next/server/app/dashboard/quota.html +2 -2
  218. package/app/.next/server/app/dashboard/quota.rsc +7 -7
  219. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  220. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  221. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  222. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  223. package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
  224. package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  225. package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
  226. package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  227. package/app/.next/server/app/dashboard/settings/pricing/page.js +1 -1
  228. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  229. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  230. package/app/.next/server/app/dashboard/settings/pricing.rsc +5 -5
  231. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +5 -5
  232. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  233. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  234. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  235. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
  236. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  237. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  238. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  239. package/app/.next/server/app/dashboard/translator.html +1 -1
  240. package/app/.next/server/app/dashboard/translator.rsc +6 -6
  241. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  242. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  243. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  244. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  245. package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
  246. package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  247. package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
  248. package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  249. package/app/.next/server/app/dashboard/usage.html +1 -1
  250. package/app/.next/server/app/dashboard/usage.rsc +6 -6
  251. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  252. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  253. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  254. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  255. package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
  256. package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  257. package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
  258. package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  259. package/app/.next/server/app/dashboard.html +1 -1
  260. package/app/.next/server/app/dashboard.rsc +6 -6
  261. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  262. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  263. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  264. package/app/.next/server/app/dashboard.segments/_full.segment.rsc +6 -6
  265. package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  266. package/app/.next/server/app/dashboard.segments/_index.segment.rsc +4 -4
  267. package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  268. package/app/.next/server/app/index.html +1 -1
  269. package/app/.next/server/app/index.rsc +4 -4
  270. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  271. package/app/.next/server/app/index.segments/_full.segment.rsc +4 -4
  272. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  273. package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
  274. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  275. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  276. package/app/.next/server/app/landing.html +1 -1
  277. package/app/.next/server/app/landing.rsc +5 -5
  278. package/app/.next/server/app/landing.segments/_full.segment.rsc +5 -5
  279. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  280. package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
  281. package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
  282. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
  283. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  284. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  285. package/app/.next/server/app/login.html +1 -1
  286. package/app/.next/server/app/login.rsc +5 -5
  287. package/app/.next/server/app/login.segments/_full.segment.rsc +5 -5
  288. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  289. package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
  290. package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  291. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  292. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  293. package/app/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  294. package/app/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  295. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  296. package/app/.next/server/app-paths-manifest.json +40 -40
  297. package/app/.next/server/chunks/1114.js +1 -1
  298. package/app/.next/server/chunks/1424.js +1 -1
  299. package/app/.next/server/chunks/318.js +1 -1
  300. package/app/.next/server/chunks/3832.js +1 -1
  301. package/app/.next/server/chunks/412.js +1 -1
  302. package/app/.next/server/chunks/6182.js +1 -1
  303. package/app/.next/server/chunks/649.js +1 -1
  304. package/app/.next/server/chunks/7341.js +1 -1
  305. package/app/.next/server/chunks/8590.js +1 -1
  306. package/app/.next/server/chunks/9201.js +1 -1
  307. package/app/.next/server/chunks/9718.js +1 -1
  308. package/app/.next/server/middleware-build-manifest.js +1 -1
  309. package/app/.next/server/pages/404.html +1 -1
  310. package/app/.next/server/pages/500.html +2 -2
  311. package/app/.next/server/server-reference-manifest.js +1 -1
  312. package/app/.next/server/server-reference-manifest.json +1 -1
  313. package/app/.next/static/chunks/2652-51aca5cd32bd186f.js +1 -0
  314. package/app/.next/static/chunks/3794-23858078d298f399.js +2 -0
  315. package/app/.next/static/chunks/{4bd1b696-e5d7c65570c947b7.js → 4bd1b696-84e33c69f320f6a0.js} +1 -1
  316. package/app/.next/static/chunks/{5497-9933573cfe960e0c.js → 5497-ea854c092fddeb4d.js} +3 -3
  317. package/app/.next/static/chunks/{619-c4c101a6a78feeb4.js → 619-bfe7e89fff6eb942.js} +1 -1
  318. package/app/.next/static/chunks/{9242-3e0fdad972d9b35d.js → 9242-a85bb5812b359227.js} +3 -3
  319. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-d973cbda9e65d6ae.js → page-15fc16f73981b9be.js} +1 -1
  320. package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/page-fb6736d76c7a3b6a.js +1 -0
  321. package/app/.next/static/chunks/app/dashboard/settings/pricing/{page-4b7305b3e5d6e57b.js → page-e097c892258ad1fd.js} +1 -1
  322. package/app/.next/static/chunks/app/landing/{page-106f74afc6f71a31.js → page-cb9f1320605eaafc.js} +1 -1
  323. package/app/.next/static/chunks/app/{layout-08e56eacc7acf9e1.js → layout-095f249fd620f9cf.js} +1 -1
  324. package/app/.next/static/chunks/{framework-9f63a52f5ba18ac8.js → framework-6854168261815bb6.js} +1 -1
  325. package/app/.next/static/chunks/{main-aab9e1b069a77e0f.js → main-5b78d3de83609121.js} +2 -2
  326. package/app/.next/static/chunks/webpack-9bef9bba7ebc0551.js +1 -0
  327. package/app/.next/static/css/9dff3edaebe94c91.css +3 -0
  328. package/app/package.json +3 -1
  329. package/app/public/i18n/literals/ar.json +196 -0
  330. package/app/public/i18n/literals/bn.json +196 -0
  331. package/app/public/i18n/literals/cs.json +196 -0
  332. package/app/public/i18n/literals/da.json +196 -0
  333. package/app/public/i18n/literals/de.json +196 -0
  334. package/app/public/i18n/literals/el.json +196 -0
  335. package/app/public/i18n/literals/es.json +196 -0
  336. package/app/public/i18n/literals/fi.json +196 -0
  337. package/app/public/i18n/literals/fr.json +196 -0
  338. package/app/public/i18n/literals/he.json +196 -0
  339. package/app/public/i18n/literals/hi.json +196 -0
  340. package/app/public/i18n/literals/hu.json +196 -0
  341. package/app/public/i18n/literals/id.json +196 -0
  342. package/app/public/i18n/literals/it.json +196 -0
  343. package/app/public/i18n/literals/ja.json +196 -0
  344. package/app/public/i18n/literals/ko.json +196 -0
  345. package/app/public/i18n/literals/nl.json +196 -0
  346. package/app/public/i18n/literals/no.json +196 -0
  347. package/app/public/i18n/literals/pl.json +196 -0
  348. package/app/public/i18n/literals/pt-BR.json +196 -0
  349. package/app/public/i18n/literals/pt-PT.json +196 -0
  350. package/app/public/i18n/literals/ro.json +196 -0
  351. package/app/public/i18n/literals/ru.json +196 -0
  352. package/app/public/i18n/literals/sv.json +196 -0
  353. package/app/public/i18n/literals/th.json +196 -0
  354. package/app/public/i18n/literals/tl.json +196 -0
  355. package/app/public/i18n/literals/tr.json +196 -0
  356. package/app/public/i18n/literals/uk.json +196 -0
  357. package/app/public/i18n/literals/ur.json +196 -0
  358. package/app/public/i18n/literals/zh-TW.json +196 -0
  359. package/app/src/mitm/server.js +1 -297
  360. package/package.json +1 -1
  361. package/app/.next/static/chunks/2652-378fd4fa14847021.js +0 -1
  362. package/app/.next/static/chunks/3794-c67589461d449d62.js +0 -2
  363. package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/page-bf88929b2cc595ab.js +0 -1
  364. package/app/.next/static/chunks/webpack-25c43999146c934e.js +0 -1
  365. package/app/.next/static/css/4016074f63f34af9.css +0 -3
  366. package/app/src/mitm/cert/generate.js +0 -32
  367. package/app/src/mitm/cert/install.js +0 -176
  368. package/app/src/mitm/cert/rootCA.js +0 -173
  369. package/app/src/mitm/dns/dnsConfig.js +0 -216
  370. package/app/src/mitm/logger.js +0 -8
  371. package/app/src/mitm/manager.js +0 -602
  372. package/app/src/mitm/paths.js +0 -16
  373. package/app/src/mitm/server2.js +0 -1099
  374. /package/app/.next/static/{lSUZX6G8rzoxhxgvfuJ7I → k34dymG0FFBnm_nPA74jH}/_buildManifest.js +0 -0
  375. /package/app/.next/static/{lSUZX6G8rzoxhxgvfuJ7I → k34dymG0FFBnm_nPA74jH}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";exports.id=412,exports.ids=[412],exports.modules={267:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(51126),g=c(99258);let h=a=>({en:"English",vi:"Tiếng Việt","zh-CN":"简体中文"})[a]||a;function i({className:a=""}){let[b,c]=(0,e.useState)("en"),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(!1),m=(0,e.useRef)(null),n=async a=>{if(a!==b&&!i){j(!0),l(!1);try{await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:a})}),await (0,g.wn)(),c(a)}catch(a){console.error("Failed to set locale:",a)}finally{j(!1)}}};return(0,d.jsxs)("div",{className:`relative ${a}`,ref:m,children:[(0,d.jsxs)("button",{onClick:()=>l(!k),disabled:i,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-text-muted hover:text-text-main hover:bg-surface/60 transition-colors",title:"Language","data-i18n-skip":"true",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-xl",children:"language"}),(0,d.jsx)("span",{className:"text-sm font-medium",children:h(b)}),(0,d.jsx)("span",{className:"material-symbols-outlined text-base",children:k?"expand_less":"expand_more"})]}),k&&(0,d.jsx)("div",{className:"absolute right-0 mt-2 w-48 bg-surface border border-black/10 dark:border-white/10 rounded-lg shadow-lg overflow-hidden z-50","data-i18n-skip":"true",children:f.YZ.map(a=>{let c=b===a;return(0,d.jsxs)("button",{onClick:()=>n(a),disabled:i,className:`w-full flex items-center justify-between px-4 py-2.5 text-sm transition-colors ${c?"bg-primary/15 text-primary font-medium":"text-text-main hover:bg-surface-hover"} ${i?"opacity-70 cursor-wait":""}`,children:[(0,d.jsx)("span",{children:h(a)}),c&&(0,d.jsx)("span",{className:"material-symbols-outlined text-base",children:"check"})]},a)})})]})}},4770:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({label:a,options:b=[],value:c,onChange:f,placeholder:g="Select an option",error:h,hint:i,disabled:j=!1,required:k=!1,className:l,selectClassName:m,...n}){return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col gap-1.5",l),children:[a&&(0,d.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[a,k&&(0,d.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsxs)("select",{value:c,onChange:f,disabled:j,className:(0,e.cn)("w-full py-2 px-3 pr-10 text-sm text-text-main","bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md appearance-none","focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none","transition-all disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",h?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"",m),...n,children:[(0,d.jsx)("option",{value:"",disabled:!0,children:g}),b.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))]}),(0,d.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),h&&(0,d.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),h]}),i&&!h&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:i})]})}},5291:(a,b,c)=>{c.d(b,{default:()=>k});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(79346),i=c(86209),j=c(56110);function k({isOpen:a,providerInfo:b,onSuccess:c,onClose:f}){let[g,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(null),p=(0,e.useCallback)((a,b)=>{"builder-id"===a?k("builder-id"):"idc"===a?(k("idc"),o(b)):"social"===a?(k("social"),m(b.provider)):"import"===a&&c?.()},[c]),q=()=>{k(null),m(null),o(null)};return g?"builder-id"===g||"idc"===g?(0,d.jsx)(h.default,{isOpen:a,provider:"kiro",providerInfo:b,onSuccess:()=>{k(null),o(null),c?.(),f?.()},onClose:q,idcConfig:n}):"social"===g&&l?(0,d.jsx)(j.default,{isOpen:a,provider:l,onSuccess:()=>{k(null),m(null),c?.(),f?.()},onClose:q}):null:(0,d.jsx)(i.default,{isOpen:a,onMethodSelect:p,onClose:f})}k.propTypes={isOpen:g().bool.isRequired,providerInfo:g().shape({name:g().string}),onSuccess:g().func,onClose:g().func.isRequired}},17660:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({children:a,title:b,subtitle:c,icon:f,action:g,padding:h="md",hover:i=!1,className:j,...k}){return(0,d.jsxs)("div",{className:(0,e.cn)("bg-surface","border border-black/5 dark:border-white/5","rounded-lg shadow-sm",i&&"hover:shadow-md hover:border-primary/30 transition-all cursor-pointer",{none:"",xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8"}[h],j),...k,children:[(b||g)&&(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[f&&(0,d.jsx)("div",{className:"p-2 rounded-lg bg-bg text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:f})}),(0,d.jsxs)("div",{children:[b&&(0,d.jsx)("h3",{className:"text-text-main font-semibold",children:b}),c&&(0,d.jsx)("p",{className:"text-sm text-text-muted",children:c})]})]}),g]}),a]})}f.Section=function({children:a,className:b,...c}){return(0,d.jsx)("div",{className:(0,e.cn)("p-4 rounded-lg","bg-black/[0.02] dark:bg-white/[0.02]","border border-black/5 dark:border-white/5",b),...c,children:a})},f.Row=function({children:a,className:b,...c}){return(0,d.jsx)("div",{className:(0,e.cn)("p-3 -mx-3 px-3 transition-colors","border-b border-black/5 dark:border-white/5 last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]",b),...c,children:a})},f.ListItem=function({children:a,actions:b,className:c,...f}){return(0,d.jsxs)("div",{className:(0,e.cn)("group flex items-center justify-between p-3 -mx-3 px-3","border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]","transition-colors",c),...f,children:[(0,d.jsx)("div",{className:"flex-1 min-w-0",children:a}),b&&(0,d.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:b})]})}},25919:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({src:a,alt:b="Avatar",name:c,size:f="md",className:g}){let h={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return a?(0,d.jsx)("div",{className:(0,e.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",h[f],g),style:{backgroundImage:`url(${a})`},role:"img","aria-label":b}):(0,d.jsx)("div",{className:(0,e.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",h[f],(a=>{if(!a)return"bg-primary";let b=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],c=a.charCodeAt(0)%b.length;return b[c]})(c),g),role:"img","aria-label":b,children:(a=>{if(!a)return"?";let b=a.split(" ");return b.length>=2?`${b[0][0]}${b[1][0]}`.toUpperCase():a.substring(0,2).toUpperCase()})(c)})}},32971:(a,b,c)=>{c.d(b,{default:()=>e});var d=c(48249);function e({text:a,children:b,position:c="top"}){return(0,d.jsxs)("div",{className:"relative inline-flex group",children:[b,(0,d.jsx)("div",{className:`pointer-events-none absolute ${{top:"bottom-full left-1/2 -translate-x-1/2 mb-1.5",bottom:"top-full left-1/2 -translate-x-1/2 mt-1.5",left:"right-full top-1/2 -translate-y-1/2 mr-1.5",right:"left-full top-1/2 -translate-y-1/2 ml-1.5"}[c]} z-50 w-max max-w-56 rounded px-2 py-1 text-[11px] leading-snug bg-gray-900 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-150 whitespace-normal`,children:a})]})}},39645:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(67484),f=c(95145),g=c(99070);function h({isOpen:a,onClose:b,title:c="Manual Configuration",configs:h=[]}){let[i,j]=(0,e.useState)(null),k=async(a,b)=>{try{await navigator.clipboard.writeText(a),j(b),setTimeout(()=>j(null),2e3)}catch(a){console.log("Failed to copy:",a)}};return(0,d.jsx)(f.default,{isOpen:a,onClose:b,title:c,size:"xl",children:(0,d.jsx)("div",{className:"flex flex-col gap-4",children:h.map((a,b)=>(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:a.filename}),(0,d.jsxs)(g.default,{variant:"ghost",size:"sm",onClick:()=>k(a.content,b),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:i===b?"check":"content_copy"}),i===b?"Copied!":"Copy"]})]}),(0,d.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-60 overflow-y-auto border border-border",children:a.content})]},b))})})}},41371:(a,b,c)=>{c.d(b,{i:()=>f});var d=c(31417);let e=0,f=(0,d.v)((a,b)=>({notifications:[],addNotification:c=>{let d=++e,f={id:d,type:c.type||"info",message:c.message,title:c.title||null,duration:c.duration??5e3,dismissible:c.dismissible??!0,createdAt:Date.now()};return a(a=>({notifications:[...a.notifications,f]})),f.duration>0&&setTimeout(()=>b().removeNotification(d),f.duration),d},removeNotification:b=>{a(a=>({notifications:a.notifications.filter(a=>a.id!==b)}))},clearAll:()=>a({notifications:[]}),success:(a,c)=>b().addNotification({type:"success",message:a,title:c}),error:(a,c)=>b().addNotification({type:"error",message:a,title:c,duration:8e3}),warning:(a,c)=>b().addNotification({type:"warning",message:a,title:c}),info:(a,c)=>b().addNotification({type:"info",message:a,title:c})}))},42118:(a,b,c)=>{c.d(b,{D:()=>i});var d=c(67484),e=c(13033);function f(a){return()=>{}}function g(){return!1}function h(){return!1}function i(){let{theme:a,setTheme:b,toggleTheme:c,initTheme:i}=(0,e.A)(),j=(0,d.useSyncExternalStore)(f,g,h);return{theme:a,setTheme:b,toggleTheme:c,isDark:"dark"===a||"system"===a&&j}}},42196:(a,b,c)=>{c.d(b,{default:()=>r});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(2116),i=c.n(h),j=c(19099),k=c(71404),l=c(12020),m=c(99070),n=c(95145);let o=[{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/combos",label:"Combos",icon:"layers"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/mitm",label:"MITM",icon:"security"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],p=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"}],q=[{href:"/dashboard/profile",label:"Settings",icon:"settings"}];function r({onClose:a}){let b=(0,j.usePathname)(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(null),[v,w]=(0,e.useState)(!1),x=a=>"/dashboard/endpoint"===a?"/dashboard"===b||b.startsWith("/dashboard/endpoint"):b.startsWith(a),y=async()=>{h(!0);try{await fetch("/api/shutdown",{method:"POST"})}catch(a){}h(!1),f(!1),s(!0)};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("aside",{className:"flex w-72 flex-col border-r border-black/5 dark:border-white/5 bg-vibrancy backdrop-blur-xl transition-colors duration-300",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,d.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,d.jsxs)(i(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-9 rounded bg-linear-to-br from-[#f97815] to-[#c2590a]",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-white text-[20px]",children:"hub"})}),(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:l.vQ.name}),(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["v",l.vQ.version]})]})]}),t&&(0,d.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,d.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",t.latestVersion]}),(0,d.jsx)("code",{className:"text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono select-all",children:"npm install -g 9router@latest"})]})]}),(0,d.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-1 overflow-y-auto custom-scrollbar",children:[o.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",x(b.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",x(b.href)?"fill-1":"group-hover:text-primary transition-colors"),children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:b.label})]},b.href)),(0,d.jsxs)("div",{className:"pt-4 mt-2",children:[(0,d.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"Debug"}),v&&(0,d.jsxs)(i(),{href:"/dashboard/translator",onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",x("/dashboard/translator")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",x("/dashboard/translator")?"fill-1":"group-hover:text-primary transition-colors"),children:"translate"}),(0,d.jsx)("span",{className:"text-sm font-medium",children:"Translator"})]}),p.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",x(b.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",x(b.href)?"fill-1":"group-hover:text-primary transition-colors"),children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:b.label})]},b.href))]}),(0,d.jsxs)("div",{className:"pt-4 mt-2",children:[(0,d.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),q.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",x(b.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",x(b.href)?"fill-1":"group-hover:text-primary transition-colors"),children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:b.label})]},b.href))]})]}),(0,d.jsxs)("div",{className:"p-3 border-t border-black/5 dark:border-white/5",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-surface/50 mb-2",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-6 rounded-md bg-blue-500/10 text-blue-500 shrink-0 mt-0.5",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"})}),(0,d.jsx)("div",{className:"flex flex-col",children:(0,d.jsx)("span",{className:"text-xs font-medium text-text-main leading-relaxed",children:"Service is running in terminal. You can close this web page. Shutdown will stop the service."})})]}),(0,d.jsx)(m.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>f(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})]})]}),(0,d.jsx)(n.ConfirmModal,{isOpen:c,onClose:()=>f(!1),onConfirm:y,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:g}),r&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"text-center p-8",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-16 rounded-full bg-red-500/20 text-red-500 mx-auto mb-4",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,d.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,d.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,d.jsx)(m.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}r.propTypes={onClose:g().func}},48781:(a,b,c)=>{c.d(b,{default:()=>k});var d=c(48249),e=c(2116),f=c.n(e),g=c(12020);let h=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],i=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],j=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function k(){return(0,d.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,d.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,d.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,d.jsx)("div",{className:"size-6 text-primary",children:(0,d.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,d.jsx)("path",{clipRule:"evenodd",d:"M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z",fillRule:"evenodd"})})}),(0,d.jsx)("span",{className:"text-xl font-bold text-text-main",children:g.vQ.name})]}),(0,d.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,d.jsxs)("div",{className:"flex gap-4",children:[(0,d.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,d.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:h.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:j.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]})]}),(0,d.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",g.vQ.name," Inc. All rights reserved."]}),(0,d.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,d.jsx)(f(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,d.jsx)(f(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},50377:(a,b,c)=>{c.d(b,{C:()=>e});var d=c(67484);function e(a=2e3){let[b,c]=(0,d.useState)(null),f=(0,d.useRef)(null);return{copied:b,copy:(0,d.useCallback)((b,d="default")=>{navigator.clipboard.writeText(b),c(d),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{c(null)},a)},[a])}}},50412:(a,b,c)=>{c.d(b,{Ex:()=>j.default,$n:()=>d.default,Zp:()=>g.default,Qv:()=>i.CardSkeleton,G9:()=>t.default,vE:()=>u.default,pd:()=>e.default,Mh:()=>s.default,c5:()=>q.default,uR:()=>o.default,aF:()=>h.default,rq:()=>n.default,LF:()=>m.default,gM:()=>r.default,Iz:()=>v.default,l6:()=>f.default,UW:()=>l.default,lM:()=>k.default,m_:()=>w.default,jK:()=>p.default});var d=c(99070),e=c(83552),f=c(4770),g=c(17660),h=c(95145),i=c(74812);c(25919);var j=c(75171),k=c(95514),l=c(53845);c(19308),c(42196),c(86739),c(48781);var m=c(79346),n=c(83352),o=c(39645),p=c(87226),q=c(267),r=c(91809);c(86209);var s=c(5291);c(56110);var t=c(51109),u=c(79488),v=c(91099),w=c(32971);c(85306),c(53838)},51109:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onSuccess:b,onClose:c}){let[f,g]=(0,e.useState)(""),[i,j]=(0,e.useState)(""),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),u=async()=>{p(!0),l(null),r(!1),t(!1);try{let a=await fetch("/api/oauth/cursor/auto-import"),b=await a.json();b.found?(g(b.accessToken),j(b.machineId),r(!0)):b.windowsManual?t(!0):l(b.error||"Could not auto-detect tokens")}catch(a){l("Failed to auto-detect tokens")}finally{p(!1)}},v=async()=>{if(!f.trim())return void l("Please enter an access token");if(!i.trim())return void l("Please enter a machine ID");n(!0),l(null);try{let a=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:f.trim(),machineId:i.trim()})}),d=await a.json();if(!a.ok)throw Error(d.error||"Import failed");b?.(),c()}catch(a){l(a.message)}finally{n(!1)}};return(0,d.jsx)(h.aF,{isOpen:a,title:"Connect Cursor IDE",onClose:c,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[o&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!o&&(0,d.jsxs)(d.Fragment,{children:[q&&(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),s&&(0,d.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800 flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,d.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Run this command in your terminal, then click ",(0,d.jsx)("strong",{children:"Retry"}),":"]}),(0,d.jsx)("pre",{className:"text-xs bg-black/10 dark:bg-white/10 rounded p-2 font-mono select-all",children:"npm i better-sqlite3 -g"}),(0,d.jsx)(h.$n,{onClick:u,variant:"outline",fullWidth:!0,children:"Retry"})]}),!q&&!s&&!k&&(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:f,onChange:a=>g(a.target.value),placeholder:"Access token will be auto-filled...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(h.pd,{value:i,onChange:a=>j(a.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),k&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:k})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:v,fullWidth:!0,disabled:m||!f.trim()||!i.trim(),children:m?"Importing...":"Import Token"}),(0,d.jsx)(h.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}i.propTypes={isOpen:g().bool.isRequired,onSuccess:g().func,onClose:g().func.isRequired}},53838:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(49885),f=c.n(e),g=c(53845);function h({children:a}){return(0,d.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,d.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,d.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,d.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,d.jsx)(g.default,{variant:"card"})}),(0,d.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:a})]})}h.propTypes={children:f().node.isRequired}},53845:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(42118),f=c(71404);function g({className:a,variant:b="default"}){let{theme:c,toggleTheme:g,isDark:h}=(0,e.D)(),i={default:(0,f.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted","hover:bg-black/5","hover:text-text-main","transition-colors"),card:(0,f.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60","hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-md","text-text-muted-light hover:text-primary","hover:text-primary","transition-all group")};return(0,d.jsx)("button",{onClick:g,className:(0,f.cn)(i[b],a),"aria-label":`Switch to ${h?"light":"dark"} mode`,title:`Switch to ${h?"light":"dark"} mode`,children:(0,d.jsx)("span",{className:(0,f.cn)("material-symbols-outlined text-[22px]","card"===b&&"transition-transform duration-300 group-hover:rotate-12"),children:h?"light_mode":"dark_mode"})})}},56110:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(50377);function j({isOpen:a,provider:b,onSuccess:c,onClose:f}){let[g,j]=(0,e.useState)("loading"),[k,l]=(0,e.useState)(""),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(null),{copied:s,copy:t}=(0,i.C)(),u=async()=>{try{let a;r(null);try{a=new URL(o)}catch(a){throw Error("Invalid callback URL format")}let d=a.searchParams.get("code");a.searchParams.get("state");let e=a.searchParams.get("error");if(e)throw Error(a.searchParams.get("error_description")||e);if(!d)throw Error("No authorization code found in URL");let f=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,codeVerifier:m.codeVerifier,provider:b})}),g=await f.json();if(!f.ok)throw Error(g.error);j("success"),c?.()}catch(a){r(a.message),j("error")}},v="google"===b?"Google":"GitHub";return(0,d.jsx)(h.aF,{isOpen:a,title:`Connect Kiro via ${v}`,onClose:f,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",v," authentication"]})]}),"input"===g&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:k,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"auth_url"===s?"check":"content_copy",onClick:()=>t(k,"auth_url"),children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,d.jsx)(h.pd,{value:o,onChange:a=>p(a.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:u,fullWidth:!0,disabled:!o,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",v," has been connected."]}),(0,d.jsx)(h.$n,{onClick:f,fullWidth:!0,children:"Done"})]}),"error"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:q}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:()=>j("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(h.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}j.propTypes={isOpen:g().bool.isRequired,provider:g().oneOf(["google","github"]).isRequired,onSuccess:g().func,onClose:g().func.isRequired}},71404:(a,b,c)=>{c.d(b,{cn:()=>d});function d(...a){return a.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},74812:(a,b,c)=>{c.d(b,{CardSkeleton:()=>i,PageLoading:()=>g,Skeleton:()=>h,Spinner:()=>f,default:()=>j});var d=c(48249),e=c(71404);function f({size:a="md",className:b}){return(0,d.jsx)("span",{className:(0,e.cn)("material-symbols-outlined animate-spin text-primary",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[a],b),children:"progress_activity"})}function g({message:a="Loading..."}){return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,d.jsx)(f,{size:"xl"}),(0,d.jsx)("p",{className:"mt-4 text-text-muted",children:a})]})}function h({className:a,...b}){return(0,d.jsx)("div",{className:(0,e.cn)("animate-pulse rounded-lg bg-border",a),...b})}function i(){return(0,d.jsxs)("div",{className:"p-6 rounded-xl border border-border bg-surface",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsx)(h,{className:"h-4 w-24"}),(0,d.jsx)(h,{className:"size-10 rounded-lg"})]}),(0,d.jsx)(h,{className:"h-8 w-16 mb-2"}),(0,d.jsx)(h,{className:"h-3 w-20"})]})}function j({type:a="spinner",...b}){switch(a){case"page":return(0,d.jsx)(g,{...b});case"skeleton":return(0,d.jsx)(h,{...b});case"card":return(0,d.jsx)(i,{...b});default:return(0,d.jsx)(f,{...b})}}},75171:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(71404);let f={default:"bg-black/5 dark:bg-white/10 text-text-muted",primary:"bg-primary/10 text-primary",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},g={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function h({children:a,variant:b="default",size:c="md",dot:h=!1,icon:i,className:j}){return(0,d.jsxs)("span",{className:(0,e.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",f[b],g[c],j),children:[h&&(0,d.jsx)("span",{className:(0,e.cn)("size-1.5 rounded-full","success"===b&&"bg-green-500","warning"===b&&"bg-yellow-500","error"===b&&"bg-red-500","info"===b&&"bg-blue-500","primary"===b&&"bg-primary","default"===b&&"bg-gray-500")}),i&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:i}),a]})}},79346:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(50377);function j({isOpen:a,provider:b,providerInfo:c,onSuccess:f,onClose:g}){let[j,k]=(0,e.useState)("waiting"),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(null),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(null),[v,w]=(0,e.useState)(!1),x=(0,e.useRef)(null),y=(0,e.useRef)(!1),{copied:z,copy:A}=(0,i.C)(),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)("/callback?code=...");(0,e.useRef)(!1);let F=(0,e.useCallback)(async(a,c)=>{if(l)try{let d=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,redirectUri:l.redirectUri,codeVerifier:l.codeVerifier,state:c})}),e=await d.json();if(!d.ok)throw Error(e.error);k("success"),f?.()}catch(a){q(a.message),k("error")}},[l,b,f]),G=(0,e.useCallback)(async(a,c,d,e)=>{y.current=!1,w(!0);for(let g=0;g<60;g++){if(y.current){console.log("[OAuthModal] Polling aborted"),w(!1);return}if(await new Promise(a=>setTimeout(a,1e3*d)),y.current){console.log("[OAuthModal] Polling aborted after sleep"),w(!1);return}try{let g=await fetch(`/api/oauth/${b}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:a,codeVerifier:c,extraData:e})}),h=await g.json();if(h.success){y.current=!0,k("success"),w(!1),f?.();return}if("expired_token"===h.error||"access_denied"===h.error)throw Error(h.errorDescription||h.error);"slow_down"===h.error&&(d=Math.min(d+5,30))}catch(a){q(a.message),k("error"),w(!1);return}}q("Authorization timeout"),k("error"),w(!1)},[b,f]),H=(0,e.useCallback)(async()=>{if(b)try{let a;if(q(null),["github","qwen","kiro","kimi-coding","kilocode"].includes(b)){s(!0),k("waiting");let a=await fetch(`/api/oauth/${b}/device-code`),c=await a.json();if(!a.ok)throw Error(c.error);u(c);let d=c.verification_uri_complete||c.verification_uri;d&&window.open(d,"_blank");let e="kiro"===b?{_clientId:c._clientId,_clientSecret:c._clientSecret}:null;G(c.device_code,c.codeVerifier,c.interval||5,e);return}if("codex"===b)a="http://localhost:1455/auth/callback";else{let b=window.location.port||("https:"===window.location.protocol?"443":"80");a=`http://localhost:${b}/callback`}let c=await fetch(`/api/oauth/${b}/authorize?redirect_uri=${encodeURIComponent(a)}`),d=await c.json();if(!c.ok)throw Error(d.error);m({...d,redirectUri:a}),"codex"!==b&&B?(k("waiting"),x.current=window.open(d.authUrl,"oauth_popup","width=600,height=700"),x.current||k("input")):(k("input"),window.open(d.authUrl,"_blank"))}catch(a){q(a.message),k("error")}},[b,B,G]),I=async()=>{try{q(null);let a=new URL(n),b=a.searchParams.get("code"),c=a.searchParams.get("state"),d=a.searchParams.get("error");if(d)throw Error(a.searchParams.get("error_description")||d);if(!b)throw Error("No authorization code found in URL");await F(b,c)}catch(a){q(a.message),k("error")}},J=(0,e.useCallback)(()=>{g()},[g]);return b&&c?(0,d.jsx)(h.aF,{isOpen:a,title:`Connect ${c.name}`,onClose:J,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:["waiting"===j&&!r&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Waiting for Authorization"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Complete the authorization in the popup window."}),(0,d.jsx)(h.$n,{variant:"ghost",onClick:()=>k("input"),children:"Popup blocked? Enter URL manually"})]}),"waiting"===j&&r&&t&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"text-center py-4",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the URL below and enter the code:"}),(0,d.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Verification URL"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"flex-1 text-sm break-all",children:t.verification_uri}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"verify_url"===z?"check":"content_copy",onClick:()=>A(t.verification_uri,"verify_url")})]})]}),(0,d.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,d.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:t.user_code}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"user_code"===z?"check":"content_copy",onClick:()=>A(t.user_code,"user_code")})]})]})]}),v&&(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"input"===j&&!r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:l?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"auth_url"===z?"check":"content_copy",onClick:()=>A(l?.authUrl,"auth_url"),children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser."}),(0,d.jsx)(h.pd,{value:n,onChange:a=>o(a.target.value),placeholder:D,className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:I,fullWidth:!0,disabled:!n,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:J,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===j&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",c.name," account has been connected."]}),(0,d.jsx)(h.$n,{onClick:J,fullWidth:!0,children:"Done"})]}),"error"===j&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:p}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:H,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(h.$n,{onClick:J,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}j.propTypes={isOpen:g().bool.isRequired,provider:g().string,providerInfo:g().shape({name:g().string}),onSuccess:g().func,onClose:g().func.isRequired}},79488:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onSuccess:b,onClose:c}){let[f,g]=(0,e.useState)(""),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!1),o=async()=>{if(!f.trim())return void l("Please paste your cookie");j(!0),l(null);try{let a=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:f.trim()})}),c=await a.json();if(!a.ok)throw Error(c.error||"Authentication failed");n(!0),setTimeout(()=>{b?.(),p()},1500)}catch(a){l(a.message)}finally{j(!1)}},p=()=>{g(""),l(null),n(!1),c?.()};return(0,d.jsx)(h.aF,{isOpen:a,onClose:p,title:"iFlow Cookie Authentication",children:(0,d.jsx)("div",{className:"space-y-4",children:m?(0,d.jsxs)("div",{className:"text-center py-8",children:[(0,d.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,d.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,d.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,d.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,d.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,d.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,d.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,d.jsx)("li",{children:"Login to your account"}),(0,d.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,d.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,d.jsx)("li",{children:"Paste it below"})]})]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,d.jsx)("textarea",{value:f,onChange:a=>g(a.target.value),placeholder:"BXAuth=xxx; ...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary resize-none",rows:4,disabled:i})]}),k&&(0,d.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,d.jsx)("p",{className:"text-sm text-error",children:k})}),(0,d.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,d.jsx)(h.$n,{variant:"secondary",onClick:p,disabled:i,fullWidth:!0,children:"Cancel"}),(0,d.jsx)(h.$n,{onClick:o,loading:i,fullWidth:!0,children:"Authenticate"})]})]})})})}i.propTypes={isOpen:g().bool.isRequired,onSuccess:g().func,onClose:g().func}},83352:(a,b,c)=>{c.d(b,{default:()=>l});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(95145),i=c(91431),j=c(96919);let k=[...Object.keys(j.zN),...Object.keys(j.fg)];function l({isOpen:a,onClose:b,onSelect:c,selectedModel:f,activeProviders:g=[],title:l="Select Model",modelAliases:m={}}){let[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)([]),[r,s]=(0,e.useState)([]),t=(0,e.useMemo)(()=>({...j.zN,...j.fg}),[]),u=(0,e.useMemo)(()=>{let a={};return[...new Set([...g.map(a=>a.provider)])].sort((a,b)=>{let c=k.indexOf(a),d=k.indexOf(b);return(-1===c?999:c)-(-1===d?999:d)}).forEach(b=>{let c=i.Xg[b]||b,d=t[b]||{name:b,color:"#666"},e=(0,j.mq)(b)||(0,j.gb)(b);if(d.passthroughModels){let e=Object.entries(m).filter(([,a])=>a.startsWith(`${c}/`)).map(([a,b])=>({id:b.replace(`${c}/`,""),name:a,value:b}));if(e.length>0){let f=r.find(a=>a.id===b),g=f?.name||d.name;a[b]={name:g,alias:c,color:d.color,models:e}}}else if(e){let c=g.find(a=>a.provider===b),e=r.find(a=>a.id===b),f=c?.name||e?.name||d.name,h=c?.providerSpecificData?.prefix||e?.prefix||b,i=Object.entries(m).filter(([,a])=>a.startsWith(`${b}/`)).map(([a,c])=>({id:c.replace(`${b}/`,""),name:a,value:`${h}/${c.replace(`${b}/`,"")}`})),j=i.length>0?i:[{id:`__placeholder__${b}`,name:`${h}/model-id`,value:`${h}/model-id`,isPlaceholder:!0}];a[b]={name:f,alias:h,color:d.color,models:j,isCustom:!0,hasModels:i.length>0}}else{let e=(0,i.KC)(b),f=new Set(e.map(a=>a.id)),g=Object.entries(m).filter(([a,b])=>b.startsWith(`${c}/`)&&a===b.replace(`${c}/`,"")&&!f.has(b.replace(`${c}/`,""))).map(([,a])=>{let b=a.replace(`${c}/`,"");return{id:b,name:b,value:a,isCustom:!0}}),h=[...e.map(a=>({id:a.id,name:a.name,value:`${c}/${a.id}`})),...g];h.length>0&&(a[b]={name:d.name,alias:c,color:d.color,models:h})}}),a},[g,m,t,r]),v=(0,e.useMemo)(()=>{if(!n.trim())return p;let a=n.toLowerCase();return p.filter(b=>b.name.toLowerCase().includes(a))},[p,n]),w=(0,e.useMemo)(()=>{if(!n.trim())return u;let a=n.toLowerCase(),b={};return Object.entries(u).forEach(([c,d])=>{let e=d.models.filter(b=>b.name.toLowerCase().includes(a)||b.id.toLowerCase().includes(a)),f=d.name.toLowerCase().includes(a);(e.length>0||f)&&(b[c]={...d,models:e})}),b},[u,n]),x=a=>{c(a),b(),o("")};return(0,d.jsxs)(h.default,{isOpen:a,onClose:()=>{b(),o("")},title:l,size:"md",className:"p-4!",children:[(0,d.jsx)("div",{className:"mb-3",children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"search"}),(0,d.jsx)("input",{type:"text",placeholder:"Search...",value:n,onChange:a=>o(a.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-surface border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"})]})}),(0,d.jsxs)("div",{className:"max-h-[300px] overflow-y-auto space-y-3",children:[v.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[14px]",children:"layers"}),(0,d.jsx)("span",{className:"text-xs font-medium text-primary",children:"Combos"}),(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",v.length,")"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:v.map(a=>{let b=f===a.name;return(0,d.jsx)("button",{onClick:()=>x({id:a.name,name:a.name,value:a.name}),className:`
1
+ "use strict";exports.id=412,exports.ids=[412],exports.modules={267:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(74429),g=c(51126),h=c(99258);let i=a=>({en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (Brasil)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (Portugal)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"}})[a]||{name:a,flag:"\uD83C\uDF10"};function j({className:a=""}){let[b,c]=(0,e.useState)("en"),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(!1),n=(0,e.useRef)(null),o=async a=>{if(a!==b&&!j){k(!0),m(!1);try{await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:a})}),await (0,h.wn)(),c(a)}catch(a){console.error("Failed to set locale:",a)}finally{k(!1)}}};return(0,d.jsxs)("div",{className:a,children:[(0,d.jsxs)("button",{onClick:()=>m(!l),disabled:j,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-text-muted hover:text-text-main hover:bg-surface/60 transition-colors",title:"Language","data-i18n-skip":"true",children:[(0,d.jsx)("span",{className:"text-xl",children:i(b).flag}),(0,d.jsx)("span",{className:"text-sm font-medium",children:i(b).name}),(0,d.jsx)("span",{className:"material-symbols-outlined text-base",children:l?"expand_less":"expand_more"})]}),l&&(0,f.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>m(!1)}),(0,d.jsxs)("div",{ref:n,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-2xl flex flex-col max-h-[80vh]",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,d.jsx)("button",{onClick:()=>m(!1),className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,d.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,d.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:g.YZ.map(a=>{let c=b===a,e=i(a);return(0,d.jsxs)("button",{onClick:()=>o(a),disabled:j,className:`flex flex-col items-center justify-start gap-1 px-2 py-3 rounded-lg text-xs font-medium transition-colors w-full ${c?"bg-primary/15 text-primary ring-2 ring-primary":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"} ${j?"opacity-70 cursor-wait":""}`,title:e.name,children:[(0,d.jsx)("span",{className:"text-2xl",children:e.flag}),(0,d.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:e.name}),c&&(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"})]},a)})})})]})]}),document.body)]})}},4770:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({label:a,options:b=[],value:c,onChange:f,placeholder:g="Select an option",error:h,hint:i,disabled:j=!1,required:k=!1,className:l,selectClassName:m,...n}){return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col gap-1.5",l),children:[a&&(0,d.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[a,k&&(0,d.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsxs)("select",{value:c,onChange:f,disabled:j,className:(0,e.cn)("w-full py-2 px-3 pr-10 text-sm text-text-main","bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md appearance-none","focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none","transition-all disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",h?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"",m),...n,children:[(0,d.jsx)("option",{value:"",disabled:!0,children:g}),b.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))]}),(0,d.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),h&&(0,d.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),h]}),i&&!h&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:i})]})}},5291:(a,b,c)=>{c.d(b,{default:()=>k});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(79346),i=c(86209),j=c(56110);function k({isOpen:a,providerInfo:b,onSuccess:c,onClose:f}){let[g,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(null),p=(0,e.useCallback)((a,b)=>{"builder-id"===a?k("builder-id"):"idc"===a?(k("idc"),o(b)):"social"===a?(k("social"),m(b.provider)):"import"===a&&c?.()},[c]),q=()=>{k(null),m(null),o(null)};return g?"builder-id"===g||"idc"===g?(0,d.jsx)(h.default,{isOpen:a,provider:"kiro",providerInfo:b,onSuccess:()=>{k(null),o(null),c?.(),f?.()},onClose:q,idcConfig:n}):"social"===g&&l?(0,d.jsx)(j.default,{isOpen:a,provider:l,onSuccess:()=>{k(null),m(null),c?.(),f?.()},onClose:q}):null:(0,d.jsx)(i.default,{isOpen:a,onMethodSelect:p,onClose:f})}k.propTypes={isOpen:g().bool.isRequired,providerInfo:g().shape({name:g().string}),onSuccess:g().func,onClose:g().func.isRequired}},17660:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({children:a,title:b,subtitle:c,icon:f,action:g,padding:h="md",hover:i=!1,className:j,...k}){return(0,d.jsxs)("div",{className:(0,e.cn)("bg-surface","border border-black/5 dark:border-white/5","rounded-lg shadow-sm",i&&"hover:shadow-md hover:border-primary/30 transition-all cursor-pointer",{none:"",xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8"}[h],j),...k,children:[(b||g)&&(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[f&&(0,d.jsx)("div",{className:"p-2 rounded-lg bg-bg text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:f})}),(0,d.jsxs)("div",{children:[b&&(0,d.jsx)("h3",{className:"text-text-main font-semibold",children:b}),c&&(0,d.jsx)("p",{className:"text-sm text-text-muted",children:c})]})]}),g]}),a]})}f.Section=function({children:a,className:b,...c}){return(0,d.jsx)("div",{className:(0,e.cn)("p-4 rounded-lg","bg-black/[0.02] dark:bg-white/[0.02]","border border-black/5 dark:border-white/5",b),...c,children:a})},f.Row=function({children:a,className:b,...c}){return(0,d.jsx)("div",{className:(0,e.cn)("p-3 -mx-3 px-3 transition-colors","border-b border-black/5 dark:border-white/5 last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]",b),...c,children:a})},f.ListItem=function({children:a,actions:b,className:c,...f}){return(0,d.jsxs)("div",{className:(0,e.cn)("group flex items-center justify-between p-3 -mx-3 px-3","border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0","hover:bg-black/[0.02] dark:hover:bg-white/[0.02]","transition-colors",c),...f,children:[(0,d.jsx)("div",{className:"flex-1 min-w-0",children:a}),b&&(0,d.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:b})]})}},25919:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({src:a,alt:b="Avatar",name:c,size:f="md",className:g}){let h={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return a?(0,d.jsx)("div",{className:(0,e.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",h[f],g),style:{backgroundImage:`url(${a})`},role:"img","aria-label":b}):(0,d.jsx)("div",{className:(0,e.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",h[f],(a=>{if(!a)return"bg-primary";let b=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],c=a.charCodeAt(0)%b.length;return b[c]})(c),g),role:"img","aria-label":b,children:(a=>{if(!a)return"?";let b=a.split(" ");return b.length>=2?`${b[0][0]}${b[1][0]}`.toUpperCase():a.substring(0,2).toUpperCase()})(c)})}},32971:(a,b,c)=>{c.d(b,{default:()=>e});var d=c(48249);function e({text:a,children:b,position:c="top"}){return(0,d.jsxs)("div",{className:"relative inline-flex group",children:[b,(0,d.jsx)("div",{className:`pointer-events-none absolute ${{top:"bottom-full left-1/2 -translate-x-1/2 mb-1.5",bottom:"top-full left-1/2 -translate-x-1/2 mt-1.5",left:"right-full top-1/2 -translate-y-1/2 mr-1.5",right:"left-full top-1/2 -translate-y-1/2 ml-1.5"}[c]} z-50 w-max max-w-56 rounded px-2 py-1 text-[11px] leading-snug bg-gray-900 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-150 whitespace-normal`,children:a})]})}},39645:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(67484),f=c(95145),g=c(99070);function h({isOpen:a,onClose:b,title:c="Manual Configuration",configs:h=[]}){let[i,j]=(0,e.useState)(null),k=async(a,b)=>{try{await navigator.clipboard.writeText(a),j(b),setTimeout(()=>j(null),2e3)}catch(a){console.log("Failed to copy:",a)}};return(0,d.jsx)(f.default,{isOpen:a,onClose:b,title:c,size:"xl",children:(0,d.jsx)("div",{className:"flex flex-col gap-4",children:h.map((a,b)=>(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:a.filename}),(0,d.jsxs)(g.default,{variant:"ghost",size:"sm",onClick:()=>k(a.content,b),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:i===b?"check":"content_copy"}),i===b?"Copied!":"Copy"]})]}),(0,d.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-60 overflow-y-auto border border-border",children:a.content})]},b))})})}},41371:(a,b,c)=>{c.d(b,{i:()=>f});var d=c(31417);let e=0,f=(0,d.v)((a,b)=>({notifications:[],addNotification:c=>{let d=++e,f={id:d,type:c.type||"info",message:c.message,title:c.title||null,duration:c.duration??5e3,dismissible:c.dismissible??!0,createdAt:Date.now()};return a(a=>({notifications:[...a.notifications,f]})),f.duration>0&&setTimeout(()=>b().removeNotification(d),f.duration),d},removeNotification:b=>{a(a=>({notifications:a.notifications.filter(a=>a.id!==b)}))},clearAll:()=>a({notifications:[]}),success:(a,c)=>b().addNotification({type:"success",message:a,title:c}),error:(a,c)=>b().addNotification({type:"error",message:a,title:c,duration:8e3}),warning:(a,c)=>b().addNotification({type:"warning",message:a,title:c}),info:(a,c)=>b().addNotification({type:"info",message:a,title:c})}))},42118:(a,b,c)=>{c.d(b,{D:()=>i});var d=c(67484),e=c(13033);function f(a){return()=>{}}function g(){return!1}function h(){return!1}function i(){let{theme:a,setTheme:b,toggleTheme:c,initTheme:i}=(0,e.A)(),j=(0,d.useSyncExternalStore)(f,g,h);return{theme:a,setTheme:b,toggleTheme:c,isDark:"dark"===a||"system"===a&&j}}},42196:(a,b,c)=>{c.d(b,{default:()=>r});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(2116),i=c.n(h),j=c(19099),k=c(71404),l=c(12020),m=c(99070),n=c(95145);let o=[{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/combos",label:"Combos",icon:"layers"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/mitm",label:"MITM",icon:"security"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],p=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"}],q=[{href:"/dashboard/profile",label:"Settings",icon:"settings"}];function r({onClose:a}){let b=(0,j.usePathname)(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(null),[v,w]=(0,e.useState)(!1),x=a=>"/dashboard/endpoint"===a?"/dashboard"===b||b.startsWith("/dashboard/endpoint"):b.startsWith(a),y=async()=>{h(!0);try{await fetch("/api/shutdown",{method:"POST"})}catch(a){}h(!1),f(!1),s(!0)};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("aside",{className:"flex w-72 flex-col border-r border-black/5 dark:border-white/5 bg-vibrancy backdrop-blur-xl transition-colors duration-300",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,d.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,d.jsxs)(i(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-9 rounded bg-linear-to-br from-[#f97815] to-[#c2590a]",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-white text-[20px]",children:"hub"})}),(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:l.vQ.name}),(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["v",l.vQ.version]})]})]}),t&&(0,d.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,d.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",t.latestVersion]}),(0,d.jsx)("code",{className:"text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono select-all",children:"npm install -g 9router@latest"})]})]}),(0,d.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-1 overflow-y-auto custom-scrollbar",children:[o.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",x(b.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",x(b.href)?"fill-1":"group-hover:text-primary transition-colors"),children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:b.label})]},b.href)),(0,d.jsxs)("div",{className:"pt-4 mt-2",children:[(0,d.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"Debug"}),v&&(0,d.jsxs)(i(),{href:"/dashboard/translator",onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",x("/dashboard/translator")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",x("/dashboard/translator")?"fill-1":"group-hover:text-primary transition-colors"),children:"translate"}),(0,d.jsx)("span",{className:"text-sm font-medium",children:"Translator"})]}),p.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",x(b.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",x(b.href)?"fill-1":"group-hover:text-primary transition-colors"),children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:b.label})]},b.href))]}),(0,d.jsxs)("div",{className:"pt-4 mt-2",children:[(0,d.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),q.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,className:(0,k.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",x(b.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,d.jsx)("span",{className:(0,k.cn)("material-symbols-outlined text-[18px]",x(b.href)?"fill-1":"group-hover:text-primary transition-colors"),children:b.icon}),(0,d.jsx)("span",{className:"text-sm font-medium",children:b.label})]},b.href))]})]}),(0,d.jsxs)("div",{className:"p-3 border-t border-black/5 dark:border-white/5",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-surface/50 mb-2",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-6 rounded-md bg-blue-500/10 text-blue-500 shrink-0 mt-0.5",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"})}),(0,d.jsx)("div",{className:"flex flex-col",children:(0,d.jsx)("span",{className:"text-xs font-medium text-text-main leading-relaxed",children:"Service is running in terminal. You can close this web page. Shutdown will stop the service."})})]}),(0,d.jsx)(m.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>f(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})]})]}),(0,d.jsx)(n.ConfirmModal,{isOpen:c,onClose:()=>f(!1),onConfirm:y,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:g}),r&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"text-center p-8",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-16 rounded-full bg-red-500/20 text-red-500 mx-auto mb-4",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,d.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,d.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,d.jsx)(m.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}r.propTypes={onClose:g().func}},48781:(a,b,c)=>{c.d(b,{default:()=>k});var d=c(48249),e=c(2116),f=c.n(e),g=c(12020);let h=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],i=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],j=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function k(){return(0,d.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,d.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,d.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,d.jsx)("div",{className:"size-6 text-primary",children:(0,d.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,d.jsx)("path",{clipRule:"evenodd",d:"M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z",fillRule:"evenodd"})})}),(0,d.jsx)("span",{className:"text-xl font-bold text-text-main",children:g.vQ.name})]}),(0,d.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,d.jsxs)("div",{className:"flex gap-4",children:[(0,d.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,d.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:h.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:j.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]})]}),(0,d.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",g.vQ.name," Inc. All rights reserved."]}),(0,d.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,d.jsx)(f(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,d.jsx)(f(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},50377:(a,b,c)=>{c.d(b,{C:()=>e});var d=c(67484);function e(a=2e3){let[b,c]=(0,d.useState)(null),f=(0,d.useRef)(null);return{copied:b,copy:(0,d.useCallback)((b,d="default")=>{navigator.clipboard.writeText(b),c(d),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{c(null)},a)},[a])}}},50412:(a,b,c)=>{c.d(b,{Ex:()=>j.default,$n:()=>d.default,Zp:()=>g.default,Qv:()=>i.CardSkeleton,G9:()=>t.default,vE:()=>u.default,pd:()=>e.default,Mh:()=>s.default,c5:()=>q.default,uR:()=>o.default,aF:()=>h.default,rq:()=>n.default,LF:()=>m.default,gM:()=>r.default,Iz:()=>v.default,l6:()=>f.default,UW:()=>l.default,lM:()=>k.default,m_:()=>w.default,jK:()=>p.default});var d=c(99070),e=c(83552),f=c(4770),g=c(17660),h=c(95145),i=c(74812);c(25919);var j=c(75171),k=c(95514),l=c(53845);c(19308),c(42196),c(86739),c(48781);var m=c(79346),n=c(83352),o=c(39645),p=c(87226),q=c(267),r=c(91809);c(86209);var s=c(5291);c(56110);var t=c(51109),u=c(79488),v=c(91099),w=c(32971);c(85306),c(53838)},51109:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onSuccess:b,onClose:c}){let[f,g]=(0,e.useState)(""),[i,j]=(0,e.useState)(""),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),u=async()=>{p(!0),l(null),r(!1),t(!1);try{let a=await fetch("/api/oauth/cursor/auto-import"),b=await a.json();b.found?(g(b.accessToken),j(b.machineId),r(!0)):b.windowsManual?t(!0):l(b.error||"Could not auto-detect tokens")}catch(a){l("Failed to auto-detect tokens")}finally{p(!1)}},v=async()=>{if(!f.trim())return void l("Please enter an access token");if(!i.trim())return void l("Please enter a machine ID");n(!0),l(null);try{let a=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:f.trim(),machineId:i.trim()})}),d=await a.json();if(!a.ok)throw Error(d.error||"Import failed");b?.(),c()}catch(a){l(a.message)}finally{n(!1)}};return(0,d.jsx)(h.aF,{isOpen:a,title:"Connect Cursor IDE",onClose:c,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[o&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!o&&(0,d.jsxs)(d.Fragment,{children:[q&&(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),s&&(0,d.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800 flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,d.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Run this command in your terminal, then click ",(0,d.jsx)("strong",{children:"Retry"}),":"]}),(0,d.jsx)("pre",{className:"text-xs bg-black/10 dark:bg-white/10 rounded p-2 font-mono select-all",children:"npm i better-sqlite3 -g"}),(0,d.jsx)(h.$n,{onClick:u,variant:"outline",fullWidth:!0,children:"Retry"})]}),!q&&!s&&!k&&(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:f,onChange:a=>g(a.target.value),placeholder:"Access token will be auto-filled...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(h.pd,{value:i,onChange:a=>j(a.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),k&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:k})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:v,fullWidth:!0,disabled:m||!f.trim()||!i.trim(),children:m?"Importing...":"Import Token"}),(0,d.jsx)(h.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}i.propTypes={isOpen:g().bool.isRequired,onSuccess:g().func,onClose:g().func.isRequired}},53838:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(49885),f=c.n(e),g=c(53845);function h({children:a}){return(0,d.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,d.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,d.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,d.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,d.jsx)(g.default,{variant:"card"})}),(0,d.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:a})]})}h.propTypes={children:f().node.isRequired}},53845:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(42118),f=c(71404);function g({className:a,variant:b="default"}){let{theme:c,toggleTheme:g,isDark:h}=(0,e.D)(),i={default:(0,f.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted","hover:bg-black/5","hover:text-text-main","transition-colors"),card:(0,f.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60","hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-md","text-text-muted-light hover:text-primary","hover:text-primary","transition-all group")};return(0,d.jsx)("button",{onClick:g,className:(0,f.cn)(i[b],a),"aria-label":`Switch to ${h?"light":"dark"} mode`,title:`Switch to ${h?"light":"dark"} mode`,children:(0,d.jsx)("span",{className:(0,f.cn)("material-symbols-outlined text-[22px]","card"===b&&"transition-transform duration-300 group-hover:rotate-12"),children:h?"light_mode":"dark_mode"})})}},56110:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(50377);function j({isOpen:a,provider:b,onSuccess:c,onClose:f}){let[g,j]=(0,e.useState)("loading"),[k,l]=(0,e.useState)(""),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(null),{copied:s,copy:t}=(0,i.C)(),u=async()=>{try{let a;r(null);try{a=new URL(o)}catch(a){throw Error("Invalid callback URL format")}let d=a.searchParams.get("code");a.searchParams.get("state");let e=a.searchParams.get("error");if(e)throw Error(a.searchParams.get("error_description")||e);if(!d)throw Error("No authorization code found in URL");let f=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,codeVerifier:m.codeVerifier,provider:b})}),g=await f.json();if(!f.ok)throw Error(g.error);j("success"),c?.()}catch(a){r(a.message),j("error")}},v="google"===b?"Google":"GitHub";return(0,d.jsx)(h.aF,{isOpen:a,title:`Connect Kiro via ${v}`,onClose:f,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",v," authentication"]})]}),"input"===g&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:k,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"auth_url"===s?"check":"content_copy",onClick:()=>t(k,"auth_url"),children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,d.jsx)(h.pd,{value:o,onChange:a=>p(a.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:u,fullWidth:!0,disabled:!o,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",v," has been connected."]}),(0,d.jsx)(h.$n,{onClick:f,fullWidth:!0,children:"Done"})]}),"error"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:q}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:()=>j("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(h.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}j.propTypes={isOpen:g().bool.isRequired,provider:g().oneOf(["google","github"]).isRequired,onSuccess:g().func,onClose:g().func.isRequired}},71404:(a,b,c)=>{c.d(b,{cn:()=>d});function d(...a){return a.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},74812:(a,b,c)=>{c.d(b,{CardSkeleton:()=>i,PageLoading:()=>g,Skeleton:()=>h,Spinner:()=>f,default:()=>j});var d=c(48249),e=c(71404);function f({size:a="md",className:b}){return(0,d.jsx)("span",{className:(0,e.cn)("material-symbols-outlined animate-spin text-primary",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[a],b),children:"progress_activity"})}function g({message:a="Loading..."}){return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,d.jsx)(f,{size:"xl"}),(0,d.jsx)("p",{className:"mt-4 text-text-muted",children:a})]})}function h({className:a,...b}){return(0,d.jsx)("div",{className:(0,e.cn)("animate-pulse rounded-lg bg-border",a),...b})}function i(){return(0,d.jsxs)("div",{className:"p-6 rounded-xl border border-border bg-surface",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsx)(h,{className:"h-4 w-24"}),(0,d.jsx)(h,{className:"size-10 rounded-lg"})]}),(0,d.jsx)(h,{className:"h-8 w-16 mb-2"}),(0,d.jsx)(h,{className:"h-3 w-20"})]})}function j({type:a="spinner",...b}){switch(a){case"page":return(0,d.jsx)(g,{...b});case"skeleton":return(0,d.jsx)(h,{...b});case"card":return(0,d.jsx)(i,{...b});default:return(0,d.jsx)(f,{...b})}}},75171:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(71404);let f={default:"bg-black/5 dark:bg-white/10 text-text-muted",primary:"bg-primary/10 text-primary",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},g={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function h({children:a,variant:b="default",size:c="md",dot:h=!1,icon:i,className:j}){return(0,d.jsxs)("span",{className:(0,e.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",f[b],g[c],j),children:[h&&(0,d.jsx)("span",{className:(0,e.cn)("size-1.5 rounded-full","success"===b&&"bg-green-500","warning"===b&&"bg-yellow-500","error"===b&&"bg-red-500","info"===b&&"bg-blue-500","primary"===b&&"bg-primary","default"===b&&"bg-gray-500")}),i&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:i}),a]})}},79346:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(50377);function j({isOpen:a,provider:b,providerInfo:c,onSuccess:f,onClose:g}){let[j,k]=(0,e.useState)("waiting"),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(null),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(null),[v,w]=(0,e.useState)(!1),x=(0,e.useRef)(null),y=(0,e.useRef)(!1),{copied:z,copy:A}=(0,i.C)(),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)("/callback?code=...");(0,e.useRef)(!1);let F=(0,e.useCallback)(async(a,c)=>{if(l)try{let d=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,redirectUri:l.redirectUri,codeVerifier:l.codeVerifier,state:c})}),e=await d.json();if(!d.ok)throw Error(e.error);k("success"),f?.()}catch(a){q(a.message),k("error")}},[l,b,f]),G=(0,e.useCallback)(async(a,c,d,e)=>{y.current=!1,w(!0);for(let g=0;g<60;g++){if(y.current){console.log("[OAuthModal] Polling aborted"),w(!1);return}if(await new Promise(a=>setTimeout(a,1e3*d)),y.current){console.log("[OAuthModal] Polling aborted after sleep"),w(!1);return}try{let g=await fetch(`/api/oauth/${b}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:a,codeVerifier:c,extraData:e})}),h=await g.json();if(h.success){y.current=!0,k("success"),w(!1),f?.();return}if("expired_token"===h.error||"access_denied"===h.error)throw Error(h.errorDescription||h.error);"slow_down"===h.error&&(d=Math.min(d+5,30))}catch(a){q(a.message),k("error"),w(!1);return}}q("Authorization timeout"),k("error"),w(!1)},[b,f]),H=(0,e.useCallback)(async()=>{if(b)try{let a;if(q(null),["github","qwen","kiro","kimi-coding","kilocode"].includes(b)){s(!0),k("waiting");let a=await fetch(`/api/oauth/${b}/device-code`),c=await a.json();if(!a.ok)throw Error(c.error);u(c);let d=c.verification_uri_complete||c.verification_uri;d&&window.open(d,"_blank");let e="kiro"===b?{_clientId:c._clientId,_clientSecret:c._clientSecret}:null;G(c.device_code,c.codeVerifier,c.interval||5,e);return}if("codex"===b)a="http://localhost:1455/auth/callback";else{let b=window.location.port||("https:"===window.location.protocol?"443":"80");a=`http://localhost:${b}/callback`}let c=await fetch(`/api/oauth/${b}/authorize?redirect_uri=${encodeURIComponent(a)}`),d=await c.json();if(!c.ok)throw Error(d.error);m({...d,redirectUri:a}),"codex"!==b&&B?(k("waiting"),x.current=window.open(d.authUrl,"oauth_popup","width=600,height=700"),x.current||k("input")):(k("input"),window.open(d.authUrl,"_blank"))}catch(a){q(a.message),k("error")}},[b,B,G]),I=async()=>{try{q(null);let a=new URL(n),b=a.searchParams.get("code"),c=a.searchParams.get("state"),d=a.searchParams.get("error");if(d)throw Error(a.searchParams.get("error_description")||d);if(!b)throw Error("No authorization code found in URL");await F(b,c)}catch(a){q(a.message),k("error")}},J=(0,e.useCallback)(()=>{g()},[g]);return b&&c?(0,d.jsx)(h.aF,{isOpen:a,title:`Connect ${c.name}`,onClose:J,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:["waiting"===j&&!r&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Waiting for Authorization"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Complete the authorization in the popup window."}),(0,d.jsx)(h.$n,{variant:"ghost",onClick:()=>k("input"),children:"Popup blocked? Enter URL manually"})]}),"waiting"===j&&r&&t&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"text-center py-4",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the URL below and enter the code:"}),(0,d.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Verification URL"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"flex-1 text-sm break-all",children:t.verification_uri}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"verify_url"===z?"check":"content_copy",onClick:()=>A(t.verification_uri,"verify_url")})]})]}),(0,d.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,d.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:t.user_code}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"user_code"===z?"check":"content_copy",onClick:()=>A(t.user_code,"user_code")})]})]})]}),v&&(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"input"===j&&!r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:l?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"auth_url"===z?"check":"content_copy",onClick:()=>A(l?.authUrl,"auth_url"),children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser."}),(0,d.jsx)(h.pd,{value:n,onChange:a=>o(a.target.value),placeholder:D,className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:I,fullWidth:!0,disabled:!n,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:J,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===j&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",c.name," account has been connected."]}),(0,d.jsx)(h.$n,{onClick:J,fullWidth:!0,children:"Done"})]}),"error"===j&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:p}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:H,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(h.$n,{onClick:J,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}j.propTypes={isOpen:g().bool.isRequired,provider:g().string,providerInfo:g().shape({name:g().string}),onSuccess:g().func,onClose:g().func.isRequired}},79488:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onSuccess:b,onClose:c}){let[f,g]=(0,e.useState)(""),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!1),o=async()=>{if(!f.trim())return void l("Please paste your cookie");j(!0),l(null);try{let a=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:f.trim()})}),c=await a.json();if(!a.ok)throw Error(c.error||"Authentication failed");n(!0),setTimeout(()=>{b?.(),p()},1500)}catch(a){l(a.message)}finally{j(!1)}},p=()=>{g(""),l(null),n(!1),c?.()};return(0,d.jsx)(h.aF,{isOpen:a,onClose:p,title:"iFlow Cookie Authentication",children:(0,d.jsx)("div",{className:"space-y-4",children:m?(0,d.jsxs)("div",{className:"text-center py-8",children:[(0,d.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,d.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,d.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,d.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,d.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,d.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,d.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,d.jsx)("li",{children:"Login to your account"}),(0,d.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,d.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,d.jsx)("li",{children:"Paste it below"})]})]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,d.jsx)("textarea",{value:f,onChange:a=>g(a.target.value),placeholder:"BXAuth=xxx; ...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary resize-none",rows:4,disabled:i})]}),k&&(0,d.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,d.jsx)("p",{className:"text-sm text-error",children:k})}),(0,d.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,d.jsx)(h.$n,{variant:"secondary",onClick:p,disabled:i,fullWidth:!0,children:"Cancel"}),(0,d.jsx)(h.$n,{onClick:o,loading:i,fullWidth:!0,children:"Authenticate"})]})]})})})}i.propTypes={isOpen:g().bool.isRequired,onSuccess:g().func,onClose:g().func}},83352:(a,b,c)=>{c.d(b,{default:()=>l});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(95145),i=c(91431),j=c(96919);let k=[...Object.keys(j.zN),...Object.keys(j.fg)];function l({isOpen:a,onClose:b,onSelect:c,selectedModel:f,activeProviders:g=[],title:l="Select Model",modelAliases:m={}}){let[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)([]),[r,s]=(0,e.useState)([]),t=(0,e.useMemo)(()=>({...j.zN,...j.fg}),[]),u=(0,e.useMemo)(()=>{let a={};return[...new Set([...g.map(a=>a.provider)])].sort((a,b)=>{let c=k.indexOf(a),d=k.indexOf(b);return(-1===c?999:c)-(-1===d?999:d)}).forEach(b=>{let c=i.Xg[b]||b,d=t[b]||{name:b,color:"#666"},e=(0,j.mq)(b)||(0,j.gb)(b);if(d.passthroughModels){let e=Object.entries(m).filter(([,a])=>a.startsWith(`${c}/`)).map(([a,b])=>({id:b.replace(`${c}/`,""),name:a,value:b}));if(e.length>0){let f=r.find(a=>a.id===b),g=f?.name||d.name;a[b]={name:g,alias:c,color:d.color,models:e}}}else if(e){let c=g.find(a=>a.provider===b),e=r.find(a=>a.id===b),f=c?.name||e?.name||d.name,h=c?.providerSpecificData?.prefix||e?.prefix||b,i=Object.entries(m).filter(([,a])=>a.startsWith(`${b}/`)).map(([a,c])=>({id:c.replace(`${b}/`,""),name:a,value:`${h}/${c.replace(`${b}/`,"")}`})),j=i.length>0?i:[{id:`__placeholder__${b}`,name:`${h}/model-id`,value:`${h}/model-id`,isPlaceholder:!0}];a[b]={name:f,alias:h,color:d.color,models:j,isCustom:!0,hasModels:i.length>0}}else{let e=(0,i.KC)(b),f=new Set(e.map(a=>a.id)),g=Object.entries(m).filter(([a,b])=>b.startsWith(`${c}/`)&&a===b.replace(`${c}/`,"")&&!f.has(b.replace(`${c}/`,""))).map(([,a])=>{let b=a.replace(`${c}/`,"");return{id:b,name:b,value:a,isCustom:!0}}),h=[...e.map(a=>({id:a.id,name:a.name,value:`${c}/${a.id}`})),...g];h.length>0&&(a[b]={name:d.name,alias:c,color:d.color,models:h})}}),a},[g,m,t,r]),v=(0,e.useMemo)(()=>{if(!n.trim())return p;let a=n.toLowerCase();return p.filter(b=>b.name.toLowerCase().includes(a))},[p,n]),w=(0,e.useMemo)(()=>{if(!n.trim())return u;let a=n.toLowerCase(),b={};return Object.entries(u).forEach(([c,d])=>{let e=d.models.filter(b=>b.name.toLowerCase().includes(a)||b.id.toLowerCase().includes(a)),f=d.name.toLowerCase().includes(a);(e.length>0||f)&&(b[c]={...d,models:e})}),b},[u,n]),x=a=>{c(a),b(),o("")};return(0,d.jsxs)(h.default,{isOpen:a,onClose:()=>{b(),o("")},title:l,size:"md",className:"p-4!",children:[(0,d.jsx)("div",{className:"mb-3",children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"search"}),(0,d.jsx)("input",{type:"text",placeholder:"Search...",value:n,onChange:a=>o(a.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-surface border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"})]})}),(0,d.jsxs)("div",{className:"max-h-[300px] overflow-y-auto space-y-3",children:[v.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[14px]",children:"layers"}),(0,d.jsx)("span",{className:"text-xs font-medium text-primary",children:"Combos"}),(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",v.length,")"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:v.map(a=>{let b=f===a.name;return(0,d.jsx)("button",{onClick:()=>x({id:a.name,name:a.name,value:a.name}),className:`
2
2
  px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer
3
3
  ${b?"bg-primary text-white border-primary":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
4
4
  `,children:a.name},a.id)})})]}),Object.entries(w).map(([a,b])=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,d.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:b.color}}),(0,d.jsx)("span",{className:"text-xs font-medium text-primary",children:b.name}),(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",b.models.length,")"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.models.map(a=>{let b=f===a.value,c=a.isPlaceholder;return(0,d.jsx)("button",{onClick:()=>x(a),title:c?"Select to pre-fill, then edit model ID in the input":void 0,className:`
@@ -1,4 +1,4 @@
1
- "use strict";exports.id=6182,exports.ids=[6182],exports.modules={8578:(a,b,c)=>{let d=c(33873),e=c(29021),f=c(92470),{MITM_DIR:g}=c(82193),h=d.join(g,"rootCA.key"),i=d.join(g,"rootCA.crt");function j(a){try{let b=f.pki.certificateFromPem(e.readFileSync(a,"utf8")),c=new Date(Date.now()+2592e6);return b.validity.notAfter<c}catch{return!0}}a.exports={generateRootCA:async function a(){let a=e.existsSync(h)&&e.existsSync(i);if(a&&!j(i))return console.log("✅ Root CA already exists"),{key:h,cert:i};if(a){console.log("\uD83D\uDD10 Root CA expired or expiring soon — regenerating...");try{e.unlinkSync(h)}catch{}try{e.unlinkSync(i)}catch{}}e.existsSync(g)||e.mkdirSync(g,{recursive:!0}),console.log("\uD83D\uDD10 Generating Root CA certificate...");let b=f.pki.rsa.generateKeyPair(2048),c=f.pki.createCertificate();c.publicKey=b.publicKey,c.serialNumber="01",c.validity.notBefore=new Date,c.validity.notAfter=new Date,c.validity.notAfter.setFullYear(c.validity.notBefore.getFullYear()+10);let d=[{name:"commonName",value:"9Router MITM Root CA"},{name:"organizationName",value:"9Router"},{name:"countryName",value:"US"}];c.setSubject(d),c.setIssuer(d),c.setExtensions([{name:"basicConstraints",cA:!0,critical:!0},{name:"keyUsage",keyCertSign:!0,cRLSign:!0,critical:!0},{name:"subjectKeyIdentifier"}]),c.sign(b.privateKey,f.md.sha256.create());let k=f.pki.privateKeyToPem(b.privateKey),l=f.pki.certificateToPem(c);return e.writeFileSync(h,k),e.writeFileSync(i,l),console.log("✅ Root CA generated successfully"),{key:h,cert:i}},loadRootCA:function(){if(!e.existsSync(h)||!e.existsSync(i))throw Error("Root CA not found. Generate it first.");let a=e.readFileSync(h,"utf8"),b=e.readFileSync(i,"utf8");return{key:f.pki.privateKeyFromPem(a),cert:f.pki.certificateFromPem(b)}},generateLeafCert:function(a,b){let c=f.pki.rsa.generateKeyPair(2048),d=f.pki.createCertificate();return d.publicKey=c.publicKey,d.serialNumber=Math.floor(1e6*Math.random()).toString(),d.validity.notBefore=new Date,d.validity.notAfter=new Date,d.validity.notAfter.setFullYear(d.validity.notBefore.getFullYear()+1),d.setSubject([{name:"commonName",value:a}]),d.setIssuer(b.cert.subject.attributes),d.setExtensions([{name:"basicConstraints",cA:!1},{name:"keyUsage",digitalSignature:!0,keyEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0},{name:"subjectAltName",altNames:[{type:2,value:a},{type:2,value:`*.${a}`}]}]),d.sign(b.key,f.md.sha256.create()),{key:f.pki.privateKeyToPem(c.privateKey),cert:f.pki.certificateToPem(d)}},isCertExpired:j,ROOT_CA_CERT_PATH:i,ROOT_CA_KEY_PATH:h}},9631:(a,b,c)=>{let d=c(29021),e=c(55511),{exec:f}=c(79646),{execWithPassword:g}=c(66936),{log:h,err:i}=c(87777),j="win32"===process.platform,k="darwin"===process.platform,l="/usr/local/share/ca-certificates";function m(a){let b=d.readFileSync(a,"utf-8"),c=Buffer.from(b.replace(/-----[^-]+-----/g,"").replace(/\s/g,""),"base64");return e.createHash("sha1").update(c).digest("hex").toUpperCase().match(/.{2}/g).join(":")}async function n(a){var b;let c;return j?new Promise(a=>{f('certutil -store Root "9Router MITM Root CA"',{windowsHide:!0},b=>{a(!b)})}):k?(b=a,new Promise(a=>{try{let c=m(b).replace(/:/g,"");f(`security verify-cert -c "${b}" -p ssl -k /Library/Keychains/System.keychain 2>/dev/null`,b=>{if(!b)return a(!0);f(`security dump-trust-settings -d 2>/dev/null | grep -i "${c}"`,(b,c)=>{a(!b&&!!c?.trim())})})}catch{a(!1)}})):(c=`${l}/9router-root-ca.crt`,Promise.resolve(d.existsSync(c)))}async function o(a,b){let c=`security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "${b}"`;try{await g(`security delete-certificate -c "9Router MITM Root CA" /Library/Keychains/System.keychain 2>/dev/null || true && ${c}`,a),h("\uD83D\uDD10 Cert: ✅ installed to system keychain")}catch(a){throw Error(a.message?.includes("canceled")?"User canceled authorization":"Certificate install failed")}}async function p(a){return new Promise((b,c)=>{f(`certutil -addstore Root "${a}"`,{windowsHide:!0},a=>{a?c(Error(`Failed to install certificate: ${a.message}`)):(h("\uD83D\uDD10 Cert: ✅ installed to Windows Root store"),b())})})}async function q(a,b){let c=m(b).replace(/:/g,""),d=`security delete-certificate -Z "${c}" /Library/Keychains/System.keychain`;try{await g(d,a),h("\uD83D\uDD10 Cert: ✅ uninstalled from system keychain")}catch(a){throw Error("Failed to uninstall certificate")}}async function r(){return new Promise((a,b)=>{f('certutil -delstore Root "9Router MITM Root CA"',{windowsHide:!0},c=>{c?b(Error(`Failed to uninstall certificate: ${c.message}`)):(h("\uD83D\uDD10 Cert: ✅ uninstalled from Windows Root store"),a())})})}async function s(a,b){let c=`${l}/9router-root-ca.crt`,d=`cp "${b}" "${c}" && (update-ca-certificates 2>/dev/null || update-ca-trust 2>/dev/null || true)`;try{await g(d,a),h("\uD83D\uDD10 Cert: ✅ installed to Linux trust store")}catch(a){throw Error("Certificate install failed")}}async function t(a){let b=`${l}/9router-root-ca.crt`,c=`rm -f "${b}" && (update-ca-certificates 2>/dev/null || update-ca-trust 2>/dev/null || true)`;try{await g(c,a),h("\uD83D\uDD10 Cert: ✅ uninstalled from Linux trust store")}catch(a){throw Error("Failed to uninstall certificate")}}a.exports={installCert:async function a(a,b){if(!d.existsSync(b))throw Error(`Certificate file not found: ${b}`);await n(b)?h("\uD83D\uDD10 Cert: already trusted ✅"):j?await p(b):k?await o(a,b):await s(a,b)},uninstallCert:async function a(a,b){await n(b)?j?await r():k?await q(a,b):await t(a):h("\uD83D\uDD10 Cert: not found in system store")},checkCertInstalled:n}},26033:(a,b,c)=>{c(33873),c(29021);let{MITM_DIR:d}=c(82193),{generateRootCA:e,loadRootCA:f,generateLeafCert:g}=c(8578);a.exports={generateCert:async function a(){return await e()},getCertForDomain:function(a){try{let b=f(),c=g(a,b);return{key:c.key,cert:c.cert}}catch(b){return console.error(`Failed to generate cert for ${a}:`,b.message),null}}}},66936:(a,b,c)=>{let{exec:d,spawn:e}=c(79646),f=c(29021),g=c(33873),h=c(21820),{log:i,err:j}=c(87777),k={antigravity:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],copilot:["api.individual.githubcopilot.com"]},l="win32"===process.platform,m="darwin"===process.platform,n=l?g.join(process.env.SystemRoot||"C:\\Windows","System32","drivers","etc","hosts"):"/etc/hosts";function o(a,b){return new Promise((c,d)=>{let f=e("sudo",["-S","sh","-c",a],{stdio:["pipe","pipe","pipe"]}),g="",h="";f.stdout.on("data",a=>{g+=a}),f.stderr.on("data",a=>{h+=a}),f.on("close",a=>{0===a?c(g):d(Error(h||`Exit code ${a}`))}),f.stdin.write(`${b}
1
+ "use strict";exports.id=6182,exports.ids=[6182],exports.modules={8578:(a,b,c)=>{let d=c(33873),e=c(29021),f=c(92470),{MITM_DIR:g}=c(82193),h=d.join(g,"rootCA.key"),i=d.join(g,"rootCA.crt");function j(a){try{let b=f.pki.certificateFromPem(e.readFileSync(a,"utf8")),c=new Date(Date.now()+2592e6);return b.validity.notAfter<c}catch{return!0}}a.exports={generateRootCA:async function a(){let a=e.existsSync(h)&&e.existsSync(i);if(a&&!j(i))return console.log("✅ Root CA already exists"),{key:h,cert:i};if(a){console.log("\uD83D\uDD10 Root CA expired or expiring soon — regenerating...");try{e.unlinkSync(h)}catch{}try{e.unlinkSync(i)}catch{}}e.existsSync(g)||e.mkdirSync(g,{recursive:!0}),console.log("\uD83D\uDD10 Generating Root CA certificate...");let b=f.pki.rsa.generateKeyPair(2048),c=f.pki.createCertificate();c.publicKey=b.publicKey,c.serialNumber="01",c.validity.notBefore=new Date,c.validity.notAfter=new Date,c.validity.notAfter.setFullYear(c.validity.notBefore.getFullYear()+10);let d=[{name:"commonName",value:"9Router MITM Root CA"},{name:"organizationName",value:"9Router"},{name:"countryName",value:"US"}];c.setSubject(d),c.setIssuer(d),c.setExtensions([{name:"basicConstraints",cA:!0,critical:!0},{name:"keyUsage",keyCertSign:!0,cRLSign:!0,critical:!0},{name:"subjectKeyIdentifier"}]),c.sign(b.privateKey,f.md.sha256.create());let k=f.pki.privateKeyToPem(b.privateKey),l=f.pki.certificateToPem(c);return e.writeFileSync(h,k),e.writeFileSync(i,l),console.log("✅ Root CA generated successfully"),{key:h,cert:i}},loadRootCA:function(){if(!e.existsSync(h)||!e.existsSync(i))throw Error("Root CA not found. Generate it first.");let a=e.readFileSync(h,"utf8"),b=e.readFileSync(i,"utf8");return{key:f.pki.privateKeyFromPem(a),cert:f.pki.certificateFromPem(b)}},generateLeafCert:function(a,b){let c=f.pki.rsa.generateKeyPair(2048),d=f.pki.createCertificate();return d.publicKey=c.publicKey,d.serialNumber=Math.floor(1e6*Math.random()).toString(),d.validity.notBefore=new Date,d.validity.notAfter=new Date,d.validity.notAfter.setFullYear(d.validity.notBefore.getFullYear()+1),d.setSubject([{name:"commonName",value:a}]),d.setIssuer(b.cert.subject.attributes),d.setExtensions([{name:"basicConstraints",cA:!1},{name:"keyUsage",digitalSignature:!0,keyEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0},{name:"subjectAltName",altNames:[{type:2,value:a},{type:2,value:`*.${a}`}]}]),d.sign(b.key,f.md.sha256.create()),{key:f.pki.privateKeyToPem(c.privateKey),cert:f.pki.certificateToPem(d)}},isCertExpired:j,ROOT_CA_CERT_PATH:i,ROOT_CA_KEY_PATH:h}},9631:(a,b,c)=>{let d=c(29021),e=c(55511),{exec:f}=c(79646),{execWithPassword:g}=c(66936),{log:h,err:i}=c(87777),j="win32"===process.platform,k="darwin"===process.platform,l="/usr/local/share/ca-certificates";function m(a){let b=d.readFileSync(a,"utf-8"),c=Buffer.from(b.replace(/-----[^-]+-----/g,"").replace(/\s/g,""),"base64");return e.createHash("sha1").update(c).digest("hex").toUpperCase().match(/.{2}/g).join(":")}async function n(a){var b;let c;return j?new Promise(a=>{f('certutil -store Root "9Router MITM Root CA"',{windowsHide:!0},b=>{a(!b)})}):k?(b=a,new Promise(a=>{try{let c=m(b).replace(/:/g,"");f(`security verify-cert -c "${b}" -p ssl -k /Library/Keychains/System.keychain 2>/dev/null`,b=>{if(!b)return a(!0);f(`security dump-trust-settings -d 2>/dev/null | grep -i "${c}"`,(b,c)=>{a(!b&&!!c?.trim())})})}catch{a(!1)}})):(c=`${l}/9router-root-ca.crt`,Promise.resolve(d.existsSync(c)))}async function o(a,b){let c=`security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "${b}"`;try{await g(`security delete-certificate -c "9Router MITM Root CA" /Library/Keychains/System.keychain 2>/dev/null || true && ${c}`,a),h("\uD83D\uDD10 Cert: ✅ installed to system keychain")}catch(a){throw Error(a.message?.includes("canceled")?"User canceled authorization":"Certificate install failed")}}async function p(a){return new Promise((b,c)=>{f(`certutil -addstore Root "${a}"`,{windowsHide:!0},a=>{a?c(Error(`Failed to install certificate: ${a.message}`)):(h("\uD83D\uDD10 Cert: ✅ installed to Windows Root store"),b())})})}async function q(a,b){let c=m(b).replace(/:/g,""),d=`security delete-certificate -Z "${c}" /Library/Keychains/System.keychain`;try{await g(d,a),h("\uD83D\uDD10 Cert: ✅ uninstalled from system keychain")}catch(a){throw Error("Failed to uninstall certificate")}}async function r(){return new Promise((a,b)=>{f('certutil -delstore Root "9Router MITM Root CA"',{windowsHide:!0},c=>{c?b(Error(`Failed to uninstall certificate: ${c.message}`)):(h("\uD83D\uDD10 Cert: ✅ uninstalled from Windows Root store"),a())})})}async function s(a,b){let c=`${l}/9router-root-ca.crt`,d=`cp "${b}" "${c}" && (update-ca-certificates 2>/dev/null || update-ca-trust 2>/dev/null || true)`;try{await g(d,a),h("\uD83D\uDD10 Cert: ✅ installed to Linux trust store")}catch(a){throw Error("Certificate install failed")}}async function t(a){let b=`${l}/9router-root-ca.crt`,c=`rm -f "${b}" && (update-ca-certificates 2>/dev/null || update-ca-trust 2>/dev/null || true)`;try{await g(c,a),h("\uD83D\uDD10 Cert: ✅ uninstalled from Linux trust store")}catch(a){throw Error("Failed to uninstall certificate")}}a.exports={installCert:async function a(a,b){if(!d.existsSync(b))throw Error(`Certificate file not found: ${b}`);await n(b)?h("\uD83D\uDD10 Cert: already trusted ✅"):j?await p(b):k?await o(a,b):await s(a,b)},uninstallCert:async function a(a,b){await n(b)?j?await r():k?await q(a,b):await t(a):h("\uD83D\uDD10 Cert: not found in system store")},checkCertInstalled:n}},26033:(a,b,c)=>{c(33873),c(29021);let{MITM_DIR:d}=c(82193),{generateRootCA:e,loadRootCA:f,generateLeafCert:g}=c(8578);a.exports={generateCert:async function a(){return await e()},getCertForDomain:function(a){try{let b=f(),c=g(a,b);return{key:c.key,cert:c.cert}}catch(b){return console.error(`Failed to generate cert for ${a}:`,b.message),null}}}},66936:(a,b,c)=>{let{exec:d,spawn:e}=c(79646),f=c(29021),g=c(33873),h=c(21820),{log:i,err:j}=c(87777),k={antigravity:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],copilot:["api.individual.githubcopilot.com"],kiro:["q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"]},l="win32"===process.platform,m="darwin"===process.platform,n=l?g.join(process.env.SystemRoot||"C:\\Windows","System32","drivers","etc","hosts"):"/etc/hosts";function o(a,b){return new Promise((c,d)=>{let f=e("sudo",["-S","sh","-c",a],{stdio:["pipe","pipe","pipe"]}),g="",h="";f.stdout.on("data",a=>{g+=a}),f.stderr.on("data",a=>{h+=a}),f.on("close",a=>{0===a?c(g):d(Error(h||`Exit code ${a}`))}),f.stdin.write(`${b}
2
2
  `),f.stdin.end()})}async function p(a){l||(m?await o("dscacheutil -flushcache && killall -HUP mDNSResponder",a):await o("resolvectl flush-caches 2>/dev/null || true",a))}function q(a=null){try{let b=f.readFileSync(n,"utf8");if(a)return b.includes(a);return k.antigravity.every(a=>b.includes(a))}catch{return!1}}async function r(a,b){let d=k[a];if(!d)throw Error(`Unknown tool: ${a}`);let e=d.filter(a=>!q(a));if(0===e.length)return void i(`🌐 DNS ${a}: already active`);let g=e.map(a=>`127.0.0.1 ${a}`).join("\n");try{if(l){let a=e.map(a=>`127.0.0.1 ${a}`).join("\r\n")+"\r\n";f.appendFileSync(n,a,"utf8"),c(79646).execSync("ipconfig /flushdns",{windowsHide:!0})}else await o(`echo "${g}" >> ${n}`,b),await p(b);i(`🌐 DNS ${a}: ✅ added ${e.join(", ")}`)}catch(a){throw Error(a.message?.includes("incorrect password")?"Wrong sudo password":"Failed to add DNS entry")}}async function s(a,b){let d=k[a];if(!d)throw Error(`Unknown tool: ${a}`);let e=d.filter(a=>q(a));if(0===e.length)return void i(`🌐 DNS ${a}: already inactive`);try{if(l){let a=f.readFileSync(n,"utf8").split(/\r?\n/).filter(a=>!e.some(b=>a.includes(b))).join("\r\n");f.writeFileSync(n,a,"utf8"),c(79646).execSync("ipconfig /flushdns",{windowsHide:!0})}else{for(let a of e){let c=m?`sed -i '' '/${a}/d' ${n}`:`sed -i '/${a}/d' ${n}`;await o(c,b)}await p(b)}i(`🌐 DNS ${a}: ✅ removed ${e.join(", ")}`)}catch(a){throw Error(a.message?.includes("incorrect password")?"Wrong sudo password":"Failed to remove DNS entry")}}async function t(a){for(let b of Object.keys(k))try{await s(b,a)}catch(a){j(`DNS ${b}: failed to remove — ${a.message}`)}}a.exports={TOOL_HOSTS:k,addDNSEntry:r,removeDNSEntry:s,removeAllDNSEntries:t,execWithPassword:o,executeElevatedPowerShell:function(a,b=3e4){let c=g.join(h.tmpdir(),`ps_done_${Date.now()}.flag`),e=f.readFileSync(a,"utf8");e+=`
3
3
  Set-Content -Path '${c.replace(/'/g,"''")}' -Value 'done' -Encoding UTF8
4
4
  `,f.writeFileSync(a,e,"utf8");let i=`Start-Process powershell -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-WindowStyle','Hidden','-File','${a.replace(/'/g,"''")}' -Verb RunAs -WindowStyle Hidden`;return new Promise((e,g)=>{let h=!1,j=(a,b)=>{h||(h=!0,a(b))};d(`powershell -NoProfile -NonInteractive -WindowStyle Hidden -Command "${i}"`,{windowsHide:!0},()=>{});let k=Date.now()+b,l=()=>{if(!h){if(f.existsSync(c)){try{f.unlinkSync(c),f.unlinkSync(a)}catch{}return j(e)}if(Date.now()>k){try{f.unlinkSync(a)}catch{}return j(g,Error("Timed out waiting for UAC confirmation"))}setTimeout(l,500)}};setTimeout(l,300)})},checkDNSEntry:q,checkAllDNSStatus:function(){try{let a=f.readFileSync(n,"utf8"),b={};for(let[c,d]of Object.entries(k))b[c]=d.every(b=>a.includes(b));return b}catch{return Object.fromEntries(Object.keys(k).map(a=>[a,!1]))}}}},82193:(a,b,c)=>{let d=c(33873),e=c(21820),f=process.env.DATA_DIR?process.env.DATA_DIR:"win32"===process.platform?d.join(process.env.APPDATA||d.join(e.homedir(),"AppData","Roaming"),"9router"):d.join(e.homedir(),".9router"),g=d.join(f,"mitm");a.exports={DATA_DIR:f,MITM_DIR:g}},87777:a=>{function b(){return new Date().toLocaleTimeString("en-US",{hour12:!1})}a.exports={log:a=>console.log(`[${b()}] [MITM] ${a}`),err:a=>console.error(`[${b()}] ❌ [MITM] ${a}`)}},96182:(a,b,c)=>{let{exec:d,spawn:e,execSync:f}=c(79646),g=c(33873),h=c(29021);c(21820);let i=c(91645),j=c(55591),k=c(55511),{addDNSEntry:l,removeDNSEntry:m,removeAllDNSEntries:n,checkAllDNSStatus:o,TOOL_HOSTS:p}=c(66936),q="win32"===process.platform,{generateCert:r}=c(26033),{installCert:s,uninstallCert:t}=c(9631),{isCertExpired:u}=c(8578),{MITM_DIR:v}=c(82193),{log:w,err:x}=c(87777),y=g.join(v,".mitm.pid"),z=[5e3,1e4,2e4,3e4,6e4],A=0,B=0,C=!1,D=function(){if(process.env.MITM_SERVER_PATH)return process.env.MITM_SERVER_PATH;let a=g.join(__dirname,"server.js");if(h.existsSync(a))return a;let b=g.join(process.cwd(),"src","mitm","server.js");if(h.existsSync(b))return b;let c=g.join(process.cwd(),"..","src","mitm","server.js");return h.existsSync(c)?c:b}(),E="aes-256-gcm",F="9router-mitm-pwd",G=null,H=null;function I(){return globalThis.__mitmSudoPassword||null}function J(a){globalThis.__mitmSudoPassword=a}function K(a){try{return process.kill(a,0),!0}catch(a){return"EACCES"===a.code}}function L(a,b=!1,e=null){if(q)d(`taskkill ${b?"/F ":""}/PID ${a}`,{windowsHide:!0},()=>{});else{let f=b?"SIGKILL":"SIGTERM",g=`pkill -${f} -P ${a} 2>/dev/null; kill -${f} ${a} 2>/dev/null`;if(e){let{execWithPassword:a}=c(66936);a(g,e).catch(()=>d(g,()=>{}))}else d(g,()=>{})}}function M(){try{let{machineIdSync:a}=c(19713),b=a();return k.createHash("sha256").update(b+F).digest()}catch{return k.createHash("sha256").update(F).digest()}}let N=null,O=null;async function P(a,b){if(O)try{let c,d,e,f,g,h={mitmEnabled:a};b&&(c=M(),d=k.randomBytes(12),e=k.createCipheriv(E,c,d),f=Buffer.concat([e.update(b,"utf8"),e.final()]),g=e.getAuthTag(),h.mitmSudoEncrypted=`${d.toString("hex")}:${g.toString("hex")}:${f.toString("hex")}`),await O(h)}catch(a){x(`Failed to save settings: ${a.message}`)}}async function Q(){if(!N)return null;try{let a=await N();if(!a.mitmSudoEncrypted)return null;return function(a){try{let[b,c,d]=a.split(":");if(!b||!c||!d)return null;let e=M(),f=k.createDecipheriv(E,e,Buffer.from(b,"hex"));return f.setAuthTag(Buffer.from(c,"hex")),f.update(Buffer.from(d,"hex"))+f.final("utf8")}catch{return null}}(a.mitmSudoEncrypted)}catch{return null}}async function R(a){if(G&&!G.killed){try{G.kill("SIGKILL")}catch{}G=null,H=null}try{if(h.existsSync(y)){let b=parseInt(h.readFileSync(y,"utf-8").trim(),10);b&&K(b)&&(L(b,!0,a),await new Promise(a=>setTimeout(a,500))),h.unlinkSync(y)}}catch{}if(!q&&D)try{let b=D.replace(/'/g,"'\\''");if(a){let{execWithPassword:d}=c(66936);await d(`pkill -SIGKILL -f "${b}" 2>/dev/null || true`,a).catch(()=>{})}else d(`pkill -SIGKILL -f "${b}" 2>/dev/null || true`,()=>{});await new Promise(a=>setTimeout(a,500))}catch{}}async function S(){let a=null!==G&&!G.killed,b=H;if(!a)try{if(h.existsSync(y)){let c=parseInt(h.readFileSync(y,"utf-8").trim(),10);c&&K(c)?(a=!0,b=c):h.unlinkSync(y)}}catch{}let d=o(),e=g.join(v,"rootCA.crt"),f=h.existsSync(e),{checkCertInstalled:i}=c(9631),j=!!f&&await i(e);return{running:a,pid:b,certExists:f,certTrusted:j,dnsStatus:d}}async function T(a){if(C)return;if(Date.now()-B>=6e4&&(A=0),A>=5)return void x("Max restart attempts reached. Giving up.");let b=z[Math.min(A,z.length-1)];A++,C=!0,w(`Restarting in ${b/1e3}s... (${A}/5)`),await new Promise(a=>setTimeout(a,b));try{let b=N?await N():null;if(b&&!b.mitmEnabled){w("MITM disabled, skipping restart"),C=!1;return}let c=I()||await Q();if(!c&&!q){x("No cached password, cannot auto-restart"),C=!1;return}await U(a,c),w("\uD83D\uDD04 Restarted successfully"),A=0,C=!1}catch(b){x(`Restart attempt ${A}/5 failed: ${b.message}`),C=!1,T(a)}}async function U(a,b){if(!G||G.killed)try{if(h.existsSync(y)){let a=parseInt(h.readFileSync(y,"utf-8").trim(),10);if(a&&K(a))return H=a,w(`♻️ Reusing existing process (PID: ${a})`),await P(!0,b),b&&J(b),{running:!0,pid:a};h.unlinkSync(y)}}catch{}if(G&&!G.killed)throw Error("MITM server is already running");if(await R(b),!q){let a=await new Promise(a=>{let b=i.createServer();b.once("error",b=>{"EADDRINUSE"===b.code?a("in-use"):a("no-permission")}),b.once("listening",()=>{b.close(()=>a("free"))}),b.listen(443,"127.0.0.1")});if("in-use"===a||"no-permission"===a){let a=await new Promise(a=>{q?d('powershell -NonInteractive -WindowStyle Hidden -Command "$c = Get-NetTCPConnection -LocalPort 443 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1; if ($c) { $c.OwningProcess } else { 0 }"',{windowsHide:!0},(b,c)=>{if(b)return a(null);let e=parseInt(c.trim(),10);if(!e||e<=4)return a(null);d(`tasklist /FI "PID eq ${e}" /FO CSV /NH`,{windowsHide:!0},(b,c)=>{let d=c?.match(/"([^"]+)"/);a({pid:e,name:d?d[1]:"unknown"})})}):d('ps aux | grep "[s]erver.js"',(b,c)=>{if(!c?.trim())return a(null);for(let b of c.split("\n")){let c=parseInt(b.trim().split(/\s+/)[1],10);if(!isNaN(c))return a({pid:c,name:"node"})}a(null)})});if(a&&"node"===a.name){w(`Killing orphan node process on port 443 (PID ${a.pid})...`);try{let{execWithPassword:d}=c(66936);await d(`kill -9 ${a.pid}`,b),await new Promise(a=>setTimeout(a,800))}catch{}}else if(a){let b=a.name.includes("/")?a.name.split("/").filter(Boolean).pop():a.name;throw Error(`Port 443 is already in use by "${b}" (PID ${a.pid}). Stop that process first.`)}}}let k=g.join(v,"rootCA.crt"),l=g.join(v,"rootCA.key"),m=h.existsSync(k)&&h.existsSync(l);if(!m||u(k)){if(m){w("\uD83D\uDD10 Cert expired — uninstalling old cert...");let a=b||I()||await Q();try{await t(a,k)}catch{}}w("\uD83D\uDD10 Generating Root CA..."),await r()}let{checkCertInstalled:n}=c(9631);if(await n(k))w("\uD83D\uDD10 Cert: already trusted ✅");else{w("\uD83D\uDD10 Cert: not trusted → installing...");let a=b||I()||await Q();if(!a&&!q)throw Error("Sudo password required to install Root CA certificate");try{await s(a,k),w("\uD83D\uDD10 Cert: ✅ trusted")}catch(a){throw Error(`Failed to trust certificate: ${a.message}`)}}if(w("\uD83D\uDE80 Starting server..."),q){try{f('powershell -NonInteractive -WindowStyle Hidden -Command "$c = Get-NetTCPConnection -LocalPort 443 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1; if ($c -and $c.OwningProcess -gt 4) { Stop-Process -Id $c.OwningProcess -Force -ErrorAction SilentlyContinue }"',{windowsHide:!0}),await new Promise(a=>setTimeout(a,500))}catch{}G=e(process.execPath,[D],{detached:!1,windowsHide:!0,stdio:["ignore","pipe","pipe"],env:{...process.env,ROUTER_API_KEY:a,NODE_ENV:"production"}}),O&&await O({mitmCertInstalled:!0}).catch(()=>{})}else(G=e("sudo",["-S","-E","sh","-c",`ROUTER_API_KEY='${a}' NODE_ENV='production' '${process.execPath}' '${D}'`],{detached:!1,stdio:["pipe","pipe","pipe"]})).stdin.write(`${b}
@@ -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}}",
@@ -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,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);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 r(){if(!q)try{await n(),q=!0}catch(a){console.error("[ServerInit] Error initializing app:",a)}return q}"phase-production-build"!==process.env.NEXT_PHASE&&r().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){}}}};