9router 0.3.71 → 0.3.72

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 (234) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +2 -2
  3. package/app/.next/build-manifest.json +2 -2
  4. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  5. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  6. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  7. package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  9. package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  16. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  18. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  19. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  21. package/app/.next/server/app/_global-error.html +1 -1
  22. package/app/.next/server/app/_global-error.rsc +1 -1
  23. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  24. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  25. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  26. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  27. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  28. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  29. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  30. package/app/.next/server/app/_not-found.html +1 -1
  31. package/app/.next/server/app/_not-found.rsc +3 -3
  32. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  33. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  34. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  35. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  36. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  37. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  38. package/app/.next/server/app/api/models/route.js +1 -1
  39. package/app/.next/server/app/api/providers/route.js +1 -1
  40. package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
  41. package/app/.next/server/app/api/translator/console-logs/stream/route.js +1 -1
  42. package/app/.next/server/app/api/version/route.js +1 -1
  43. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  44. package/app/.next/server/app/callback.html +1 -1
  45. package/app/.next/server/app/callback.rsc +3 -3
  46. package/app/.next/server/app/callback.segments/_full.segment.rsc +3 -3
  47. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  48. package/app/.next/server/app/callback.segments/_index.segment.rsc +3 -3
  49. package/app/.next/server/app/callback.segments/_tree.segment.rsc +1 -1
  50. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  51. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  52. package/app/.next/server/app/dashboard/basic-chat.html +1 -1
  53. package/app/.next/server/app/dashboard/basic-chat.rsc +5 -5
  54. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  55. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  56. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  57. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  58. package/app/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
  59. package/app/.next/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  60. package/app/.next/server/app/dashboard/basic-chat.segments/_index.segment.rsc +3 -3
  61. package/app/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  62. package/app/.next/server/app/dashboard/cli-tools.html +1 -1
  63. package/app/.next/server/app/dashboard/cli-tools.rsc +5 -5
  64. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  65. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  66. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  67. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  68. package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
  69. package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  70. package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
  71. package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  72. package/app/.next/server/app/dashboard/combos.html +1 -1
  73. package/app/.next/server/app/dashboard/combos.rsc +5 -5
  74. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  75. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  76. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  77. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  78. package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
  79. package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  80. package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
  81. package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  82. package/app/.next/server/app/dashboard/endpoint.html +1 -1
  83. package/app/.next/server/app/dashboard/endpoint.rsc +5 -5
  84. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  85. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  86. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  87. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  88. package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
  89. package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  90. package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
  91. package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  92. package/app/.next/server/app/dashboard/mitm.html +1 -1
  93. package/app/.next/server/app/dashboard/mitm.rsc +5 -5
  94. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  95. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  96. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  97. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  98. package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
  99. package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  100. package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
  101. package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  102. package/app/.next/server/app/dashboard/profile.html +1 -1
  103. package/app/.next/server/app/dashboard/profile.rsc +5 -5
  104. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  105. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  106. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  107. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  108. package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
  109. package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  110. package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
  111. package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  112. package/app/.next/server/app/dashboard/providers/new.html +1 -1
  113. package/app/.next/server/app/dashboard/providers/new.rsc +5 -5
  114. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  115. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  116. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  117. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  118. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  119. package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
  120. package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  121. package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
  122. package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  123. package/app/.next/server/app/dashboard/providers.html +1 -1
  124. package/app/.next/server/app/dashboard/providers.rsc +5 -5
  125. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  126. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  127. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  128. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  129. package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
  130. package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  131. package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
  132. package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  133. package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
  134. package/app/.next/server/app/dashboard/proxy-pools.rsc +5 -5
  135. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  136. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  137. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  138. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  139. package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
  140. package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  141. package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +3 -3
  142. package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  143. package/app/.next/server/app/dashboard/quota.html +2 -2
  144. package/app/.next/server/app/dashboard/quota.rsc +4 -4
  145. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +1 -1
  146. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  147. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  148. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  149. package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +4 -4
  150. package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  151. package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
  152. package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  153. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  154. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  155. package/app/.next/server/app/dashboard/settings/pricing.rsc +3 -3
  156. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  157. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  158. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
  159. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  160. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  161. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  162. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  163. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  164. package/app/.next/server/app/dashboard/translator.html +1 -1
  165. package/app/.next/server/app/dashboard/translator.rsc +5 -5
  166. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  167. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  168. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  169. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  170. package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
  171. package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  172. package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
  173. package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  174. package/app/.next/server/app/dashboard/usage.html +1 -1
  175. package/app/.next/server/app/dashboard/usage.rsc +5 -5
  176. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  177. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  178. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  179. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  180. package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
  181. package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  182. package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
  183. package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  184. package/app/.next/server/app/dashboard.html +1 -1
  185. package/app/.next/server/app/dashboard.rsc +5 -5
  186. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  187. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  188. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  189. package/app/.next/server/app/dashboard.segments/_full.segment.rsc +5 -5
  190. package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  191. package/app/.next/server/app/dashboard.segments/_index.segment.rsc +3 -3
  192. package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  193. package/app/.next/server/app/index.html +1 -1
  194. package/app/.next/server/app/index.rsc +3 -3
  195. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  196. package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
  197. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  198. package/app/.next/server/app/index.segments/_index.segment.rsc +3 -3
  199. package/app/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  200. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  201. package/app/.next/server/app/landing.html +1 -1
  202. package/app/.next/server/app/landing.rsc +3 -3
  203. package/app/.next/server/app/landing.segments/_full.segment.rsc +3 -3
  204. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  205. package/app/.next/server/app/landing.segments/_index.segment.rsc +3 -3
  206. package/app/.next/server/app/landing.segments/_tree.segment.rsc +1 -1
  207. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  208. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  209. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  210. package/app/.next/server/app/login.html +1 -1
  211. package/app/.next/server/app/login.rsc +4 -4
  212. package/app/.next/server/app/login.segments/_full.segment.rsc +4 -4
  213. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  214. package/app/.next/server/app/login.segments/_index.segment.rsc +3 -3
  215. package/app/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  216. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  217. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  218. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  219. package/app/.next/server/app-paths-manifest.json +2 -2
  220. package/app/.next/server/chunks/2049.js +1 -1
  221. package/app/.next/server/chunks/242.js +1 -1
  222. package/app/.next/server/chunks/8202.js +1 -1
  223. package/app/.next/server/middleware-build-manifest.js +1 -1
  224. package/app/.next/server/pages/404.html +1 -1
  225. package/app/.next/server/pages/500.html +1 -1
  226. package/app/.next/static/chunks/{4156-fc5bc8759f73e36d.js → 4156-f8e9c6334c5964b1.js} +1 -1
  227. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-a8c26437a17c1428.js +1 -0
  228. package/app/.next/static/chunks/app/{layout-eef9affc86ced4e1.js → layout-76aaa65ecb33e97d.js} +1 -1
  229. package/app/package.json +1 -1
  230. package/app/src/mitm/server.js +1 -1
  231. package/package.json +1 -1
  232. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-b69c5ffad6baca8c.js +0 -1
  233. /package/app/.next/static/{nQkQ_ms11m4F4Ie_RT--o → _qgNKf11lJ14fXVq78FHz}/_buildManifest.js +0 -0
  234. /package/app/.next/static/{nQkQ_ms11m4F4Ie_RT--o → _qgNKf11lJ14fXVq78FHz}/_ssgManifest.js +0 -0
@@ -4,4 +4,4 @@
4
4
  `,children:e.name},e.id)})})]}),Object.entries(C).map(([e,t])=>(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,r.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:t.color}}),(0,r.jsx)("span",{className:"text-xs font-medium text-primary",children:t.name}),(0,r.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",t.models.length,")"]})]}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.models.map(e=>{let t=l===e.value,s=e.isPlaceholder;return(0,r.jsx)("button",{onClick:()=>S(e),title:s?"Select to pre-fill, then edit model ID in the input":void 0,className:`
5
5
  px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer
6
6
  ${s?"border-dashed border-border text-text-muted hover:border-primary/50 hover:text-primary bg-surface italic":t?"bg-primary text-white border-primary":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
7
- `,children:s?(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),e.name]}):e.isCustom?(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[e.name,(0,r.jsx)("span",{className:"text-[9px] opacity-60 font-normal",children:"custom"})]}):e.name},e.id)})})]},e)),0===Object.keys(C).length&&0===w.length&&(0,r.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,r.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}m.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onSelect:n().func.isRequired,selectedModel:n().string,activeProviders:n().arrayOf(n().shape({provider:n().string.isRequired})),title:n().string,modelAliases:n().object}},27249:(e,t,s)=>{s.d(t,{default:()=>p});var r=s(73365),a=s(1521),l=s(98196);let n="checking",i="not_installed",o="not_running",d="installing",c="starting",m="running",x="error",u=[{icon:"terminal",label:"Terminal",desc:"Full shell access"},{icon:"cast",label:"Desktop",desc:"Screen sharing"},{icon:"folder_open",label:"Files",desc:"Browse & edit files"}],h=[{icon:"qr_code_scanner",text:"Scan QR to connect instantly"},{icon:"wifi_off",text:"No port forwarding needed"},{icon:"devices",text:"Works on any device"}];function p({isOpen:e,onClose:t,onInstalled:s}){let[f,b]=(0,a.useState)(n),[g,j]=(0,a.useState)(""),y=(0,a.useRef)(null),v=()=>{y.current&&(clearTimeout(y.current),y.current=null)},N=(0,a.useCallback)(()=>{v();let e=Date.now(),t=async()=>{if(Date.now()-e>6e4){b(x),j("9Remote is taking too long to start. Try running `9remote ui` manually.");return}try{let e=await fetch("/api/9remote/status");if((await e.json()).running)return void b(m)}catch{}y.current=setTimeout(t,2e3)};t()},[]),k=(0,a.useCallback)(async()=>{b(n),j("");try{let e=await fetch("/api/9remote/status"),t=await e.json();if(t.running)return void b(m);if(!t.installed)return void b(i);b(o)}catch(e){b(x),j(e.message)}},[]),w=(0,a.useCallback)(async()=>{b(c);try{if(!(await fetch("/api/9remote/start",{method:"POST"})).ok)throw Error("Failed to start 9Remote");N()}catch(e){b(x),j(e.message)}},[N]),C=async()=>{b(d),j("");try{let e=await fetch("/api/9remote/install",{method:"POST"});if(!e.ok){let t=await e.json();throw Error(t.error||"Install failed")}s?.(),await w()}catch(e){b(x),j(e.message)}};if((0,a.useEffect)(()=>(e?k():v(),v),[e,k]),(0,a.useEffect)(()=>{if(!e)return;document.body.style.overflow="hidden";let s=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",s),()=>{document.body.style.overflow="",document.removeEventListener("keydown",s)}},[e,t]),!e)return null;let S={[i]:{label:"Install 9Remote",icon:"download",onClick:C,loading:!1},[d]:{label:"Installing...",icon:"hourglass_top",onClick:null,loading:!0},[o]:{label:"Start 9Remote",icon:"play_arrow",onClick:w,loading:!1},[c]:{label:"Starting...",icon:"hourglass_top",onClick:null,loading:!0},[n]:{label:"Checking...",icon:"hourglass_top",onClick:null,loading:!0}}[f];return f===m?(0,l.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),(0,r.jsx)("div",{className:"relative rounded-xl overflow-hidden shadow-2xl animate-in fade-in zoom-in-95 duration-200",style:{width:480,height:"90vh"},children:(0,r.jsx)("iframe",{src:"http://localhost:2208",className:"border-0 block w-full h-full",title:"9Remote UI"})})]}),document.body):f===x?(0,l.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),(0,r.jsxs)("div",{className:"relative w-full max-w-sm rounded-xl overflow-hidden shadow-2xl bg-surface border border-black/10 dark:border-white/10 animate-in fade-in zoom-in-95 duration-200",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-black/5 dark:border-white/5",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-text-main",children:"9Remote"}),(0,r.jsx)("button",{onClick:t,className:"w-7 h-7 flex items-center justify-center rounded-lg bg-black/5 dark:bg-white/5 border border-black/5 dark:border-white/10 text-text-muted hover:text-text-main transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"close"})})]}),(0,r.jsxs)("div",{className:"flex flex-col items-center gap-5 py-12 px-6 text-center",children:[(0,r.jsx)("div",{className:"w-14 h-14 rounded-full bg-red-500/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-red-400 text-[28px]",children:"error"})}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("p",{className:"font-semibold text-text-main",children:"Something went wrong"}),(0,r.jsx)("p",{className:"text-xs text-text-muted font-mono break-all",children:g})]}),(0,r.jsxs)("button",{onClick:k,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-black/5 dark:bg-white/5 border border-black/5 dark:border-white/10 text-sm text-text-main hover:bg-black/10 dark:hover:bg-white/10 transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"refresh"}),"Retry"]})]})]})]}),document.body):(0,l.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),(0,r.jsxs)("div",{className:"relative w-full max-w-sm rounded-xl overflow-hidden shadow-2xl animate-in fade-in zoom-in-95 duration-200 flex flex-col bg-surface border border-black/10 dark:border-white/10",style:{minHeight:"90vh"},children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-black/5 dark:border-white/5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"#FF570A"},children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-base",children:"terminal"})}),(0,r.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider",style:{fontFamily:"monospace",color:"#FF570A"},children:"9Remote"})]}),(0,r.jsx)("button",{onClick:t,className:"w-7 h-7 flex items-center justify-center rounded-lg bg-black/5 dark:bg-white/5 border border-black/5 dark:border-white/10 text-text-muted hover:text-text-main transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"close"})})]}),(0,r.jsxs)("div",{className:"px-7 py-7 pb-9 flex flex-col flex-1 justify-between",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[(0,r.jsx)("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mb-1",style:{background:"#FF570A",boxShadow:"rgba(255,87,10,0.35) 0px 8px 32px"},children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white",style:{fontSize:30},children:"terminal"})}),(0,r.jsx)("h1",{className:"text-lg font-bold text-text-main tracking-tight",children:"9Remote"}),(0,r.jsx)("p",{className:"text-xs text-text-muted leading-5 max-w-[220px]",children:"Access your terminal, desktop & files from anywhere"})]}),(0,r.jsx)("div",{className:"flex gap-2 w-full mt-6",children:u.map(({icon:e,label:t,desc:s})=>(0,r.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-1.5 py-4 px-1 rounded-xl border border-black/10 dark:border-white/10 bg-bg-alt",children:[(0,r.jsx)("span",{className:"material-symbols-outlined",style:{fontSize:22,color:"#ff6e33"},children:e}),(0,r.jsx)("p",{className:"text-xs font-semibold text-text-main",children:t}),(0,r.jsx)("p",{className:"text-[10px] text-text-muted text-center leading-4",children:s})]},t))}),(0,r.jsx)("div",{className:"flex flex-col gap-3 w-full mt-5",children:h.map(({icon:e,text:t})=>(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:16,color:"#ff6e33"},children:e}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:t})]},e))}),S&&(0,r.jsxs)("button",{onClick:S.onClick??void 0,disabled:S.loading,className:`mt-7 w-full py-3.5 flex items-center justify-center gap-2 text-sm font-semibold text-white rounded-xl transition-all ${S.loading?"opacity-60 cursor-not-allowed":"hover:opacity-90 active:scale-[0.98]"}`,style:{background:"#FF570A",boxShadow:S.loading?"none":"0 4px 16px rgba(255,87,10,0.35)"},children:[S.loading?(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-bounce",style:{animationDelay:"0ms"}}),(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-bounce",style:{animationDelay:"150ms"}}),(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-bounce",style:{animationDelay:"300ms"}})]}):(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:S.icon}),S.label]})]})]})]}),document.body)}},32135:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(1521),l=s(292);function n(){let[e,t]=(0,a.useState)([]),[s,n]=(0,a.useState)(!0),[i,o]=(0,a.useState)(!0);(0,a.useEffect)(()=>{d()},[]),(0,a.useEffect)(()=>{let e;return i&&(e=setInterval(()=>{d(!1)},3e3)),()=>clearInterval(e)},[i]);let d=async(e=!0)=>{e&&n(!0);try{let e=await fetch("/api/usage/request-logs");if(e.ok){let s=await e.json();t(s)}}catch(e){console.error("Failed to fetch logs:",e)}finally{e&&n(!1)}};return(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,r.jsx)("span",{children:"Auto Refresh (3s)"}),(0,r.jsx)("div",{onClick:()=>o(!i),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${i?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,r.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${i?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,r.jsx)(l.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,r.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:s&&0===e.length?(0,r.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===e.length?(0,r.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,r.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,r.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,r.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let s=e.split(" | ");if(s.length<7)return null;let a=s[6],l=a.includes("PENDING"),n=a.includes("FAILED"),i=a.includes("OK");return(0,r.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${l?"bg-primary/5":""}`,children:[(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:s[0]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:s[1]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:s[2]})}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:s[3],children:s[3]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:s[4]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:s[5]}),(0,r.jsx)("td",{className:`px-3 py-1.5 font-bold ${i?"text-success":n?"text-error":"text-primary animate-pulse"}`,children:a})]},t)})})]})})}),(0,r.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are saved to log.txt in the application data directory."})]})}},35045:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(73365),a=s(87706);let l={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"},n={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 i({children:e,variant:t="default",size:s="md",dot:o=!1,icon:d,className:c}){return(0,r.jsxs)("span",{className:(0,a.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",l[t],n[s],c),children:[o&&(0,r.jsx)("span",{className:(0,a.cn)("size-1.5 rounded-full","success"===t&&"bg-green-500","warning"===t&&"bg-yellow-500","error"===t&&"bg-red-500","info"===t&&"bg-blue-500","primary"===t&&"bg-primary","default"===t&&"bg-gray-500")}),d&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:d}),e]})}},37066:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(73365),a=s(87706);function l({label:e,options:t=[],value:s,onChange:n,placeholder:i="Select an option",error:o,hint:d,disabled:c=!1,required:m=!1,className:x,selectClassName:u,...h}){return(0,r.jsxs)("div",{className:(0,a.cn)("flex flex-col gap-1.5",x),children:[e&&(0,r.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,m&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("select",{value:s,onChange:n,disabled:c,className:(0,a.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",o?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"",u),...h,children:[(0,r.jsx)("option",{value:"",disabled:!0,children:i}),t.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,r.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),o&&(0,r.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},38230:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(73365),a=s(87706);let l={primary:"bg-gradient-to-b from-primary to-primary-hover text-white shadow-sm",secondary:"bg-white dark:bg-white/10 border border-black/10 dark:border-white/10 text-text-main hover:bg-black/5 dark:hover:bg-white/5",outline:"border border-black/15 dark:border-white/15 text-text-main hover:bg-black/5",ghost:"text-text-muted hover:bg-black/5 dark:hover:bg-white/5 hover:text-text-main",danger:"bg-red-500 text-white hover:bg-red-600 shadow-sm"},n={sm:"h-7 px-3 text-xs rounded-md",md:"h-9 px-4 text-sm rounded-lg",lg:"h-11 px-6 text-sm rounded-lg"};function i({children:e,variant:t="primary",size:s="md",icon:o,iconRight:d,disabled:c=!1,loading:m=!1,fullWidth:x=!1,className:u,...h}){return(0,r.jsxs)("button",{className:(0,a.cn)("inline-flex items-center justify-center gap-2 font-medium transition-all duration-200 cursor-pointer","active:scale-[0.99] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",l[t],n[s],x&&"w-full",u),disabled:c||m,...h,children:[m?(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):o?(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:o}):null,e,d&&!m&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:d})]})}},43202:(e,t,s)=>{s.d(t,{Q2:()=>r.Q2,fg:()=>r.fg,vQ:()=>a,MA:()=>r.MA,UY:()=>n,zN:()=>r.zN,B2:()=>l});var r=s(82495);s(69633);let a={name:"Endpoint Proxy",description:"AI Infrastructure Management",version:"0.3.71"},l={storageKey:"theme",defaultTheme:"system"},n={maxLines:200,pollIntervalMs:1e3}},50136:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);let o="https://gitlab.com";function d({isOpen:e,providerInfo:t,onSuccess:s,onClose:l}){let n,[c,m]=(0,a.useState)(null),[x,u]=(0,a.useState)(o),[h,p]=(0,a.useState)(""),[f,b]=(0,a.useState)(""),[g,j]=(0,a.useState)(""),[y,v]=(0,a.useState)(!1),[N,k]=(0,a.useState)(null),[w,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(null),R=()=>{m(null),u(o),p(""),b(""),j(""),k(null),v(!1),C(!1),T(null),l()},$=async()=>{if(!g.trim())return void k("Personal Access Token is required");v(!0),k(null);try{let e=await fetch("/api/oauth/gitlab/pat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:g.trim(),baseUrl:x.trim()||o})}),t=await e.json();if(!e.ok)throw Error(t.error||"Authentication failed");s?.(),R()}catch(e){k(e.message)}finally{v(!1)}};return e?w&&S?(0,r.jsx)(i.LF,{isOpen:!0,provider:"gitlab",providerInfo:t,oauthMeta:S,onSuccess:()=>{s?.(),R()},onClose:()=>{C(!1),T(null)}}):(0,r.jsx)(i.aF,{isOpen:e,title:"Connect GitLab Duo",onClose:R,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[!c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Choose how to authenticate with GitLab Duo:"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("button",{onClick:()=>m("oauth"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"lock_open"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"OAuth App"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab OAuth application"})]})]}),(0,r.jsxs)("button",{onClick:()=>m("pat"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"key"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"Personal Access Token"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab PAT with api scope"})]})]})]})]}),"oauth"===c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Create an OAuth app at"," ",(0,r.jsx)("a",{href:`${x.trim()||o}/-/profile/applications`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Applications"})," ","with redirect URI"," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:(n=window.location.port||("https:"===window.location.protocol?"443":"80"),`http://localhost:${n}/callback`)})]}),(0,r.jsx)(i.pd,{label:"GitLab Base URL",value:x,onChange:e=>u(e.target.value),placeholder:o}),(0,r.jsx)(i.pd,{label:"Client ID",value:h,onChange:e=>p(e.target.value),placeholder:"Your OAuth application client ID"}),(0,r.jsx)(i.pd,{label:"Client Secret (optional for PKCE)",value:f,onChange:e=>b(e.target.value),placeholder:"Leave empty for public PKCE app"}),N&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:N}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>{h.trim()?(k(null),T({baseUrl:x.trim()||o,clientId:h.trim(),clientSecret:f.trim()}),C(!0)):k("Client ID is required")},fullWidth:!0,disabled:!h.trim(),children:"Authorize"}),(0,r.jsx)(i.$n,{onClick:()=>{m(null),k(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"pat"===c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Create a PAT at"," ",(0,r.jsx)("a",{href:`${x.trim()||o}/-/user_settings/personal_access_tokens`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Access Tokens"})," ","with scopes: ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"api"}),","," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"read_user"}),", and"," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"ai_features"}),"."]}),(0,r.jsx)(i.pd,{label:"GitLab Base URL",value:x,onChange:e=>u(e.target.value),placeholder:o}),(0,r.jsx)(i.pd,{label:"Personal Access Token",value:g,onChange:e=>j(e.target.value),placeholder:"glpat-xxxxxxxxxxxxxxxxxxxx",type:"password"}),N&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:N}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:$,fullWidth:!0,disabled:!g.trim()||y,loading:y,children:"Connect"}),(0,r.jsx)(i.$n,{onClick:()=>{m(null),k(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})}):null}d.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},51123:(e,t,s)=>{s.d(t,{default:()=>p});var r=s(73365),a=s(29717),l=s(1521),n=s(99568),i=s.n(n),o=s(86447),d=s.n(o),c=s(68266),m=s(74156),x=s(67692),u=s(43202),h=s(84502);function p({onMenuClick:e,showMenuButton:t=!0}){let s=(0,a.usePathname)(),n=(0,a.useRouter)(),{title:o,description:d,icon:f,breadcrumbs:b}=(0,l.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/providers\/([^/]+)$/);if(t){let e=t[1],s=u.zN[e]||u.fg[e];if(s)return{title:s.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:s.name,image:`/providers/${s.id}.png`}]}}return e.includes("/providers")?{title:"Providers",description:"Manage your AI provider connections",icon:"dns",breadcrumbs:[]}:e.includes("/combos")?{title:"Combos",description:"Model combos with fallback",icon:"layers",breadcrumbs:[]}:e.includes("/usage")?{title:"Usage & Analytics",description:"Monitor your API usage, token consumption, and request logs",icon:"bar_chart",breadcrumbs:[]}:e.includes("/quota")?{title:"Quota Tracker",description:"Track and manage your API quota limits",icon:"data_usage",breadcrumbs:[]}:e.includes("/mitm")?{title:"MITM Proxy",description:"Intercept CLI tool traffic and route through 9Router",icon:"security",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",icon:"terminal",breadcrumbs:[]}:e.includes("/proxy-pools")?{title:"Proxy Pools",description:"Manage your proxy pool configurations",icon:"lan",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:e.includes("/profile")?{title:"Settings",description:"Manage your preferences",icon:"settings",breadcrumbs:[]}:e.includes("/translator")?{title:"Translator",description:"Debug translation flow between formats",icon:"translate",breadcrumbs:[]}:e.includes("/console-log")?{title:"Console Log",description:"Live server console output",icon:"monitor",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})(s),[s]),g=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&(n.push("/login"),n.refresh())}catch(e){console.error("Failed to logout:",e)}};return(0,r.jsxs)("header",{className:"flex items-center justify-between px-8 py-5 border-b border-black/5 dark:border-white/5 bg-bg/80 backdrop-blur-xl z-10 sticky top-0",children:[(0,r.jsx)("div",{className:"flex items-center gap-3 lg:hidden",children:t&&(0,r.jsx)("button",{onClick:e,className:"text-text-main hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,r.jsx)("div",{className:"hidden lg:flex flex-col",children:b.length>0?(0,r.jsx)("div",{className:"flex items-center gap-2",children:b.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,r.jsx)(i(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,r.jsx)(c.A,{src:e.image,alt:e.label,size:28,className:"object-contain rounded max-w-[28px] max-h-[28px]",fallbackText:e.label.slice(0,2).toUpperCase()}),(0,r.jsx)("h1",{className:"text-2xl font-semibold text-text-main tracking-tight",children:(0,h.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):o?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[f&&(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-2xl",children:f}),(0,r.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:(0,h.Tl)(o)})]}),d&&(0,r.jsx)("p",{className:"text-sm text-text-muted",children:(0,h.Tl)(d)})]}):null}),(0,r.jsxs)("div",{className:"flex items-center gap-3 ml-auto",children:[(0,r.jsx)(x.default,{}),(0,r.jsx)(m.c5,{}),(0,r.jsx)(m.UW,{}),(0,r.jsx)("button",{onClick:g,className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-red-500 hover:bg-red-500/10 transition-all",title:"Logout",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"logout"})})]})]})}p.propTypes={onMenuClick:d().func,showMenuButton:d().bool}},51454:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156),o=s(96459);function d({isOpen:e,provider:t,onSuccess:s,onClose:l}){let[n,c]=(0,a.useState)("loading"),[m,x]=(0,a.useState)(""),[u,h]=(0,a.useState)(null),[p,f]=(0,a.useState)(""),[b,g]=(0,a.useState)(null),{copied:j,copy:y}=(0,o.C)();(0,a.useEffect)(()=>{e&&t&&(async()=>{try{g(null),c("loading");let e=await fetch(`/api/oauth/kiro/social-authorize?provider=${t}`),s=await e.json();if(!e.ok)throw Error(s.error);h(s),x(s.authUrl),c("input"),window.open(s.authUrl,"_blank")}catch(e){g(e.message),c("error")}})()},[e,t]);let v=async()=>{try{let e;g(null);try{e=new URL(p)}catch(e){throw Error("Invalid callback URL format")}let r=e.searchParams.get("code");e.searchParams.get("state");let a=e.searchParams.get("error");if(a)throw Error(e.searchParams.get("error_description")||a);if(!r)throw Error("No authorization code found in URL");let l=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:r,codeVerifier:u.codeVerifier,provider:t})}),n=await l.json();if(!l.ok)throw Error(n.error);c("success"),s?.()}catch(e){g(e.message),c("error")}},N="google"===t?"Google":"GitHub";return(0,r.jsx)(i.aF,{isOpen:e,title:`Connect Kiro via ${N}`,onClose:l,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===n&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",N," authentication"]})]}),"input"===n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.pd,{value:m,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===j?"check":"content_copy",onClick:()=>y(m,"auth_url"),children:"Copy"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,r.jsx)(i.pd,{value:p,onChange:e=>f(e.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:v,fullWidth:!0,disabled:!p,children:"Connect"}),(0,r.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===n&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.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,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,r.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",N," has been connected."]}),(0,r.jsx)(i.$n,{onClick:l,fullWidth:!0,children:"Done"})]}),"error"===n&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.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,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,r.jsx)("p",{className:"text-sm text-red-600 mb-4",children:b}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>c("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,r.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:n().bool.isRequired,provider:n().oneOf(["google","github"]).isRequired,onSuccess:n().func,onClose:n().func.isRequired}},53038:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(73365),a=s(87706);function l({label:e,type:t="text",placeholder:s,value:n,onChange:i,error:o,hint:d,icon:c,disabled:m=!1,required:x=!1,className:u,inputClassName:h,...p}){return(0,r.jsxs)("div",{className:(0,a.cn)("flex flex-col gap-1.5",u),children:[e&&(0,r.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,x&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,r.jsxs)("div",{className:"relative",children:[c&&(0,r.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:c})}),(0,r.jsx)("input",{type:t,placeholder:s,value:n,onChange:i,disabled:m,className:(0,a.cn)("w-full py-2 px-3 text-sm text-text-main","bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md","placeholder-text-muted/60","focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none","transition-all shadow-inner disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",c&&"pl-10",o?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"",h),...p})]}),o&&(0,r.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},54546:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(73365),a=s(86447),l=s.n(a),n=s(84675);function i({children:e}){return(0,r.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,r.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,r.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,r.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,r.jsx)(n.default,{variant:"card"})}),(0,r.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:e})]})}i.propTypes={children:l().node.isRequired}},55348:(e,t,s)=>{s.d(t,{CL:()=>l,QC:()=>n,Xn:()=>a,YZ:()=>r});let r=["en","vi","zh-CN","zh-TW","ja","pt-BR","pt-PT","ko","es","de","fr","he","ar","ru","pl","cs","nl","tr","uk","tl","id","th","hi","bn","ur","ro","sv","it","el","hu","fi","da","no"],a="en",l="locale";function n(e){return"zh"===e||"zh-CN"===e?"zh-CN":"en"===e?"en":"vi"===e?"vi":"zh-TW"===e?"zh-TW":"ja"===e?"ja":"pt-BR"===e?"pt-BR":"pt-PT"===e?"pt-PT":"ko"===e?"ko":"es"===e?"es":"de"===e?"de":"fr"===e?"fr":"he"===e?"he":"ar"===e?"ar":"ru"===e?"ru":"pl"===e?"pl":"cs"===e?"cs":"nl"===e?"nl":"tr"===e?"tr":"uk"===e?"uk":"tl"===e?"tl":"id"===e?"id":"th"===e?"th":"hi"===e?"hi":"bn"===e?"bn":"ur"===e?"ur":"ro"===e?"ro":"sv"===e?"sv":"it"===e?"it":"el"===e?"el":"hu"===e?"hu":"fi"===e?"fi":"da"===e?"da":"no"===e?"no":a}},56550:(e,t,s)=>{s.d(t,{default:()=>b});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(99568),o=s.n(i),d=s(29717),c=s(87706),m=s(43202),x=s(38230),u=s(66911);let h=[{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{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"}],f=[{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/profile",label:"Settings",icon:"settings"}];function b({onClose:e}){let t=(0,d.usePathname)(),[s,l]=(0,a.useState)(!1),[n,i]=(0,a.useState)(!1),[g,j]=(0,a.useState)(!1),[y,v]=(0,a.useState)(null),[N,k]=(0,a.useState)(!1);(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{e.enableTranslator&&k(!0)}).catch(()=>{})},[]),(0,a.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.hasUpdate&&v(e)}).catch(()=>{})},[]);let w=e=>"/dashboard/endpoint"===e?"/dashboard"===t||t.startsWith("/dashboard/endpoint"):t.startsWith(e),C=async()=>{i(!0);try{await fetch("/api/shutdown",{method:"POST"})}catch(e){}i(!1),l(!1),j(!0)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.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 min-h-full",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,r.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,r.jsxs)(o(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-9 rounded bg-linear-to-br from-[#f97815] to-[#c2590a]",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-[20px]",children:"hub"})}),(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:m.vQ.name}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["v",m.vQ.version]})]})]}),y&&(0,r.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",y.latestVersion]}),(0,r.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,r.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-1 overflow-y-auto custom-scrollbar",children:[h.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",w(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",w(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-sm font-medium",children:t.label})]},t.href)),(0,r.jsxs)("div",{className:"pt-4 mt-2",children:[(0,r.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"Debug"}),N&&(0,r.jsxs)(o(),{href:"/dashboard/translator",onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",w("/dashboard/translator")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",w("/dashboard/translator")?"fill-1":"group-hover:text-primary transition-colors"),children:"translate"}),(0,r.jsx)("span",{className:"text-sm font-medium",children:"Translator"})]}),p.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",w(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",w(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-sm font-medium",children:t.label})]},t.href))]}),(0,r.jsxs)("div",{className:"pt-4 mt-2",children:[(0,r.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),f.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",w(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",w(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-sm font-medium",children:t.label})]},t.href))]})]}),(0,r.jsxs)("div",{className:"p-3 border-t border-black/5 dark:border-white/5",children:[(0,r.jsxs)("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-surface/50 mb-2",children:[(0,r.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,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"})}),(0,r.jsx)("div",{className:"flex flex-col",children:(0,r.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,r.jsx)(x.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>l(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})]})]}),(0,r.jsx)(u.ConfirmModal,{isOpen:s,onClose:()=>l(!1),onConfirm:C,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:n}),g&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,r.jsxs)("div",{className:"text-center p-8",children:[(0,r.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,r.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,r.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,r.jsx)(x.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}b.propTypes={onClose:n().func}},63380:(e,t,s)=>{s.d(t,{default:()=>o});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onMethodSelect:t,onClose:s}){let[l,n]=(0,a.useState)(null),[d,c]=(0,a.useState)(""),[m,x]=(0,a.useState)("us-east-1"),[u,h]=(0,a.useState)(""),[p,f]=(0,a.useState)(null),[b,g]=(0,a.useState)(!1),[j,y]=(0,a.useState)(!1),[v,N]=(0,a.useState)(!1);(0,a.useEffect)(()=>{"import"===l&&e&&(async()=>{y(!0),f(null),N(!1);try{let e=await fetch("/api/oauth/kiro/auto-import"),t=await e.json();t.found?(h(t.refreshToken),N(!0)):f(t.error||"Could not auto-detect token")}catch(e){f("Failed to auto-detect token")}finally{y(!1)}})()},[l,e]);let k=e=>{n(e),f(null)},w=()=>{n(null),f(null)},C=async()=>{if(!u.trim())return void f("Please enter a refresh token");g(!0),f(null);try{let e=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:u.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Import failed");t("import")}catch(e){f(e.message)}finally{g(!1)}},S=e=>{t("social",{provider:e})};return(0,r.jsx)(i.aF,{isOpen:e,title:"Connect Kiro",onClose:s,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[!l&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Choose your authentication method:"}),(0,r.jsx)("button",{onClick:()=>t("builder-id"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"shield"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"AWS Builder ID"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,r.jsx)("button",{onClick:()=>k("idc"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"business"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"AWS IAM Identity Center"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,r.jsx)("button",{onClick:()=>k("social-google"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"account_circle"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Google Account"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,r.jsx)("button",{onClick:()=>k("social-github"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"code"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"GitHub Account"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,r.jsx)("button",{onClick:()=>k("import"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"file_upload"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Import Token"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Paste refresh token from Kiro IDE."})]})]})})]}),"idc"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["IDC Start URL ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-2",children:"AWS Region"}),(0,r.jsx)(i.pd,{value:m,onChange:e=>x(e.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"AWS region for your Identity Center (default: us-east-1)"})]}),p&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:p}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>{d.trim()?t("idc",{startUrl:d.trim(),region:m}):f("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,r.jsx)(i.$n,{onClick:w,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsxs)("div",{className:"flex-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,r.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>S("google"),fullWidth:!0,children:"Continue with Google"}),(0,r.jsx)(i.$n,{onClick:w,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsxs)("div",{className:"flex-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,r.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>S("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,r.jsx)(i.$n,{onClick:w,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[j&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting token..."}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!j&&(0,r.jsxs)(r.Fragment,{children:[v&&(0,r.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,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!v&&!p&&(0,r.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,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Refresh Token ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.pd,{value:u,onChange:e=>h(e.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),p&&(0,r.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,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:p})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:C,fullWidth:!0,disabled:b||!u.trim(),children:b?"Importing...":"Import Token"}),(0,r.jsx)(i.$n,{onClick:w,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})]})})}o.propTypes={isOpen:n().bool.isRequired,onMethodSelect:n().func.isRequired,onClose:n().func.isRequired}},66911:(e,t,s)=>{s.d(t,{ConfirmModal:()=>o,default:()=>i});var r=s(73365),a=s(1521),l=s(87706),n=s(38230);function i({isOpen:e,onClose:t,title:s,children:n,footer:o,size:d="md",closeOnOverlay:c=!0,showCloseButton:m=!0,className:x}){return((0,a.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,a.useEffect)(()=>{let s=s=>{"Escape"===s.key&&e&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),e)?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:c?t:void 0}),(0,r.jsxs)("div",{className:(0,l.cn)("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",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[d],x),children:[(s||m)&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-black/5 dark:border-white/5",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mr-4",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),s&&(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:s})]}),m&&(0,r.jsx)("button",{onClick:t,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsx)("div",{className:"p-6 max-h-[calc(80vh-140px)] overflow-y-auto",children:n}),o&&(0,r.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-black/5 dark:border-white/5",children:o})]})]}):null}function o({isOpen:e,onClose:t,onConfirm:s,title:a="Confirm",message:l,confirmText:d="Confirm",cancelText:c="Cancel",variant:m="danger",loading:x=!1}){return(0,r.jsx)(i,{isOpen:e,onClose:t,title:a,size:"sm",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.default,{variant:"ghost",onClick:t,disabled:x,children:c}),(0,r.jsx)(n.default,{variant:m,onClick:s,loading:x,children:d})]}),children:(0,r.jsx)("p",{className:"text-text-muted",children:l})})}},67692:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(1521),l=s(27249);function n(){let[e,t]=(0,a.useState)(!1),[s,n]=(0,a.useState)(!1),[i,o]=(0,a.useState)(0),d=(0,a.useRef)(null),c=(0,a.useRef)(null),m=()=>{d.current?.close(),clearTimeout(c.current);let e=new EventSource("http://localhost:2208/api/ui/events");e.onmessage=e=>{try{let t=JSON.parse(e.data);"state"===t.type&&(n(!0),o(t.step??0))}catch{}},e.onerror=()=>{e.close(),o(0),clearTimeout(c.current),c.current=setTimeout(m,3e4)},d.current=e};(0,a.useEffect)(()=>(fetch("/api/9remote/status").then(e=>e.json()).then(e=>n(e.installed)).catch(()=>{}),m(),()=>{d.current?.close(),clearTimeout(c.current)}),[]);let{color:x,glow:u}=((e,t)=>{if(!t)return{color:"text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5",glow:null};switch(e){case 4:return{color:"text-emerald-500 hover:bg-emerald-500/10",glow:"drop-shadow(0 0 6px rgb(16 185 129 / 0.7))"};case 0:return{color:"text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5",glow:null};default:return{color:"text-amber-400 hover:bg-amber-400/10",glow:null}}})(i,s),h=s&&i>=1&&i<=3;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{onClick:()=>t(!0),className:`relative flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-all ${x}`,style:u?{filter:u}:{},title:"9Remote",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[18px]${h?" animate-pulse":""}`,children:"computer"}),(0,r.jsx)("span",{className:"text-xs font-medium",children:"Remote"})]}),(0,r.jsx)(l.default,{isOpen:e,onClose:()=>{t(!1),setTimeout(m,800)},onInstalled:()=>n(!0)})]})}},68266:(e,t,s)=>{s.d(t,{A:()=>i});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l);function i({src:e,alt:t,size:s=32,className:l="",fallbackText:n="?",fallbackColor:o}){let[d,c]=(0,a.useState)(!1);return!e||d?(0,r.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${l}`.trim(),style:{width:s,height:s,color:o,fontSize:Math.max(10,Math.floor(.38*s))},children:n}):(0,r.jsx)("img",{src:e,alt:t,width:s,height:s,className:l,onError:()=>c(!0)})}i.propTypes={src:n().string,alt:n().string,size:n().number,className:n().string,fallbackText:n().string,fallbackColor:n().string}},68600:(e,t,s)=>{s.d(t,{default:()=>o});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onSuccess:t,onClose:s}){let[l,n]=(0,a.useState)(""),[d,c]=(0,a.useState)(!1),[m,x]=(0,a.useState)(null),[u,h]=(0,a.useState)(!1),p=async()=>{if(!l.trim())return void x("Please paste your cookie");c(!0),x(null);try{let e=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:l.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Authentication failed");h(!0),setTimeout(()=>{t?.(),f()},1500)}catch(e){x(e.message)}finally{c(!1)}},f=()=>{n(""),x(null),h(!1),s?.()};return(0,r.jsx)(i.aF,{isOpen:e,onClose:f,title:"iFlow Cookie Authentication",children:(0,r.jsx)("div",{className:"space-y-4",children:u?(0,r.jsxs)("div",{className:"text-center py-8",children:[(0,r.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,r.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,r.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,r.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,r.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,r.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,r.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,r.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,r.jsx)("li",{children:"Login to your account"}),(0,r.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,r.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,r.jsx)("li",{children:"Paste it below"})]})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,r.jsx)("textarea",{value:l,onChange:e=>n(e.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:d})]}),m&&(0,r.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-error",children:m})}),(0,r.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,r.jsx)(i.$n,{variant:"secondary",onClick:f,disabled:d,fullWidth:!0,children:"Cancel"}),(0,r.jsx)(i.$n,{onClick:p,loading:d,fullWidth:!0,children:"Authenticate"})]})]})})})}o.propTypes={isOpen:n().bool.isRequired,onSuccess:n().func,onClose:n().func}},69633:(e,t,s)=>{s.d(t,{KC:()=>r.KC,Xg:()=>r.Xg});var r=s(94718);Object.entries(s(82495).Q2).filter(([,e])=>e.passthroughModels).map(([e])=>e),Object.entries(r.vq).flatMap(([e,t])=>t.map(t=>({provider:e,model:t.id,name:t.name})))},70391:(e,t,s)=>{s.d(t,{default:()=>o});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onSuccess:t,onClose:s}){let[l,n]=(0,a.useState)(""),[d,c]=(0,a.useState)(""),[m,x]=(0,a.useState)(null),[u,h]=(0,a.useState)(!1),[p,f]=(0,a.useState)(!1),[b,g]=(0,a.useState)(!1),[j,y]=(0,a.useState)(!1),v=async()=>{f(!0),x(null),g(!1),y(!1);try{let e=await fetch("/api/oauth/cursor/auto-import"),t=await e.json();t.found?(n(t.accessToken),c(t.machineId),g(!0)):t.windowsManual?y(!0):x(t.error||"Could not auto-detect tokens")}catch(e){x("Failed to auto-detect tokens")}finally{f(!1)}};(0,a.useEffect)(()=>{e&&v()},[e]);let N=async()=>{if(!l.trim())return void x("Please enter an access token");if(!d.trim())return void x("Please enter a machine ID");h(!0),x(null);try{let e=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:l.trim(),machineId:d.trim()})}),r=await e.json();if(!e.ok)throw Error(r.error||"Import failed");t?.(),s()}catch(e){x(e.message)}finally{h(!1)}};return(0,r.jsx)(i.aF,{isOpen:e,title:"Connect Cursor IDE",onClose:s,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[p&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!p&&(0,r.jsxs)(r.Fragment,{children:[b&&(0,r.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,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),j&&(0,r.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,r.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,r.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Make sure Cursor IDE has been opened at least once, then click ",(0,r.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,r.jsx)(i.$n,{onClick:v,variant:"outline",fullWidth:!0,children:"Retry"})]}),!b&&!j&&!m&&(0,r.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,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)("textarea",{value:l,onChange:e=>n(e.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,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),m&&(0,r.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,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:m})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:N,fullWidth:!0,disabled:u||!l.trim()||!d.trim(),children:u?"Importing...":"Import Token"}),(0,r.jsx)(i.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}o.propTypes={isOpen:n().bool.isRequired,onSuccess:n().func,onClose:n().func.isRequired}},70789:(e,t,s)=>{s.d(t,{default:()=>c});var r=s(73365),a=s(99568),l=s.n(a),n=s(43202);let i=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],o=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],d=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function c(){return(0,r.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,r.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,r.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,r.jsx)("div",{className:"size-6 text-primary",children:(0,r.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,r.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,r.jsx)("span",{className:"text-xl font-bold text-text-main",children:n.vQ.name})]}),(0,r.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,r.jsxs)("div",{className:"flex gap-4",children:[(0,r.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.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,r.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.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,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:o.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:d.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]})]}),(0,r.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",n.vQ.name," Inc. All rights reserved."]}),(0,r.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,r.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,r.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},73531:(e,t,s)=>{s.d(t,{default:()=>c});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(3242),o=s(63380),d=s(51454);function c({isOpen:e,providerInfo:t,onSuccess:s,onClose:l}){let[n,m]=(0,a.useState)(null),[x,u]=(0,a.useState)(null),[h,p]=(0,a.useState)(null),f=(0,a.useCallback)((e,t)=>{"builder-id"===e?m("builder-id"):"idc"===e?(m("idc"),p(t)):"social"===e?(m("social"),u(t.provider)):"import"===e&&s?.()},[s]),b=()=>{m(null),u(null),p(null)};return n?"builder-id"===n||"idc"===n?(0,r.jsx)(i.default,{isOpen:e,provider:"kiro",providerInfo:t,onSuccess:()=>{m(null),p(null),s?.(),l?.()},onClose:b,idcConfig:h}):"social"===n&&x?(0,r.jsx)(d.default,{isOpen:e,provider:x,onSuccess:()=>{m(null),u(null),s?.(),l?.()},onClose:b}):null:(0,r.jsx)(o.default,{isOpen:e,onMethodSelect:f,onClose:l})}c.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},74156:(e,t,s)=>{s.d(t,{Ex:()=>d.default,$n:()=>r.default,Zp:()=>n.default,Qv:()=>o.CardSkeleton,G9:()=>j.default,vj:()=>v.default,vE:()=>y.default,pd:()=>a.default,Mh:()=>g.default,c5:()=>f.default,uR:()=>h.default,aF:()=>i.default,rq:()=>u.default,LF:()=>x.default,gM:()=>b.default,Iz:()=>N.default,l6:()=>l.default,UW:()=>m.default,lM:()=>c.default,m_:()=>k.default,jK:()=>p.default});var r=s(38230),a=s(53038),l=s(37066),n=s(292),i=s(66911),o=s(91494);s(82455);var d=s(35045),c=s(14406),m=s(84675);s(98814),s(56550),s(51123),s(70789);var x=s(3242),u=s(24372),h=s(5671),p=s(3412),f=s(12003);s(67692),s(27249);var b=s(32135);s(63380);var g=s(73531);s(51454);var j=s(70391),y=s(68600),v=s(50136),N=s(1755),k=s(13333);s(13048),s(54546)},82455:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(73365),a=s(87706);function l({src:e,alt:t="Avatar",name:s,size:n="md",className:i}){let o={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 e?(0,r.jsx)("div",{className:(0,a.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],i),style:{backgroundImage:`url(${e})`},role:"img","aria-label":t}):(0,r.jsx)("div",{className:(0,a.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],(e=>{if(!e)return"bg-primary";let t=["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"],s=e.charCodeAt(0)%t.length;return t[s]})(s),i),role:"img","aria-label":t,children:(e=>{if(!e)return"?";let t=e.split(" ");return t.length>=2?`${t[0][0]}${t[1][0]}`.toUpperCase():e.substring(0,2).toUpperCase()})(s)})}},83789:(e,t,s)=>{s.d(t,{A:()=>i});var r=s(2074),a=s(11472),l=s(43202);function n(e){let t=document.documentElement,s=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";"dark"===("system"===e?s:e)?t.classList.add("dark"):t.classList.remove("dark")}let i=(0,r.v)((0,a.Zr)((e,t)=>({theme:l.B2.defaultTheme,setTheme:t=>{e({theme:t}),n(t)},toggleTheme:()=>{let s="dark"===t().theme?"light":"dark";e({theme:s}),n(s)},initTheme:()=>{n(t().theme)}}),{name:l.B2.storageKey}))},84502:(e,t,s)=>{s.d(t,{FE:()=>x,Tl:()=>d,wn:()=>u});var r=s(55348);let a={},l=r.Xn,n=[];function i(){if("u"<typeof document)return r.Xn;let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${r.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):r.Xn;return(0,r.QC)(t)}async function o(e){if("en"===e){a={};return}try{let t=await fetch(`/i18n/literals/${e}.json`);a=await t.json()}catch(e){console.error("Failed to load translations:",e),a={}}}function d(e){if(!e||"string"!=typeof e)return e;let t=e.trim();return t&&"en"!==l&&a[t]||e}function c(e){if(!e.nodeValue||!e.nodeValue.trim())return;let t=e.parentElement;if(!t)return;let s=t;for(;s;){if(s.hasAttribute&&s.hasAttribute("data-i18n-skip"))return;s=s.parentElement}if(["script","style","code","pre","colgroup","table","thead","tbody","tfoot","tr","select","datalist","optgroup"].includes(t.tagName?.toLowerCase()))return;e._originalText||(e._originalText=e.nodeValue);let r=d(e._originalText);r!==e.nodeValue&&(e.nodeValue=r)}function m(e){let t;if(!e)return;let s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),r=[];for(;t=s.nextNode();)r.push(t);r.forEach(c)}async function x(){l=i(),await o(l),m(document.body),new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e.nodeType===Node.ELEMENT_NODE?m(e):e.nodeType===Node.TEXT_NODE&&c(e)})})}).observe(document.body,{childList:!0,subtree:!0})}async function u(){l=i(),await o(l),n.forEach(e=>e()),m(document.body)}},84675:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(89036),l=s(87706);function n({className:e,variant:t="default"}){let{theme:s,toggleTheme:i,isDark:o}=(0,a.D)(),d={default:(0,l.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,l.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,r.jsx)("button",{onClick:i,className:(0,l.cn)(d[t],e),"aria-label":`Switch to ${o?"light":"dark"} mode`,title:`Switch to ${o?"light":"dark"} mode`,children:(0,r.jsx)("span",{className:(0,l.cn)("material-symbols-outlined text-[22px]","card"===t&&"transition-transform duration-300 group-hover:rotate-12"),children:o?"light_mode":"dark_mode"})})}},87706:(e,t,s)=>{s.d(t,{cn:()=>r});function r(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},89036:(e,t,s)=>{s.d(t,{D:()=>o});var r=s(1521),a=s(83789);function l(e){let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function n(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function i(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:s,initTheme:o}=(0,a.A)(),d=(0,r.useSyncExternalStore)(l,n,i);(0,r.useEffect)(()=>{o()},[o]),(0,r.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>o();return t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[e,o]);let c="dark"===e||"system"===e&&d;return{theme:e,setTheme:t,toggleTheme:s,isDark:c}}},91494:(e,t,s)=>{s.d(t,{CardSkeleton:()=>o,PageLoading:()=>n,Skeleton:()=>i,Spinner:()=>l,default:()=>d});var r=s(73365),a=s(87706);function l({size:e="md",className:t}){return(0,r.jsx)("span",{className:(0,a.cn)("material-symbols-outlined animate-spin text-primary",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function n({message:e="Loading..."}){return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,r.jsx)(l,{size:"xl"}),(0,r.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function i({className:e,...t}){return(0,r.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-lg bg-border",e),...t})}function o(){return(0,r.jsxs)("div",{className:"p-6 rounded-xl border border-border bg-surface",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)(i,{className:"h-4 w-24"}),(0,r.jsx)(i,{className:"size-10 rounded-lg"})]}),(0,r.jsx)(i,{className:"h-8 w-16 mb-2"}),(0,r.jsx)(i,{className:"h-3 w-20"})]})}function d({type:e="spinner",...t}){switch(e){case"page":return(0,r.jsx)(n,{...t});case"skeleton":return(0,r.jsx)(i,{...t});case"card":return(0,r.jsx)(o,{...t});default:return(0,r.jsx)(l,{...t})}}},96459:(e,t,s)=>{s.d(t,{C:()=>a});var r=s(1521);function a(e=2e3){let[t,s]=(0,r.useState)(null),l=(0,r.useRef)(null);return{copied:t,copy:(0,r.useCallback)((t,r="default")=>{navigator.clipboard.writeText(t),s(r),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s(null)},e)},[e])}}},98814:(e,t,s)=>{s.d(t,{ThemeProvider:()=>n});var r=s(73365),a=s(1521),l=s(83789);function n({children:e}){let{initTheme:t}=(0,l.A)();return(0,a.useEffect)(()=>{t()},[t]),(0,r.jsx)(r.Fragment,{children:e})}}}]);
7
+ `,children:s?(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),e.name]}):e.isCustom?(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[e.name,(0,r.jsx)("span",{className:"text-[9px] opacity-60 font-normal",children:"custom"})]}):e.name},e.id)})})]},e)),0===Object.keys(C).length&&0===w.length&&(0,r.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,r.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}m.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onSelect:n().func.isRequired,selectedModel:n().string,activeProviders:n().arrayOf(n().shape({provider:n().string.isRequired})),title:n().string,modelAliases:n().object}},27249:(e,t,s)=>{s.d(t,{default:()=>p});var r=s(73365),a=s(1521),l=s(98196);let n="checking",i="not_installed",o="not_running",d="installing",c="starting",m="running",x="error",u=[{icon:"terminal",label:"Terminal",desc:"Full shell access"},{icon:"cast",label:"Desktop",desc:"Screen sharing"},{icon:"folder_open",label:"Files",desc:"Browse & edit files"}],h=[{icon:"qr_code_scanner",text:"Scan QR to connect instantly"},{icon:"wifi_off",text:"No port forwarding needed"},{icon:"devices",text:"Works on any device"}];function p({isOpen:e,onClose:t,onInstalled:s}){let[f,b]=(0,a.useState)(n),[g,j]=(0,a.useState)(""),y=(0,a.useRef)(null),v=()=>{y.current&&(clearTimeout(y.current),y.current=null)},N=(0,a.useCallback)(()=>{v();let e=Date.now(),t=async()=>{if(Date.now()-e>6e4){b(x),j("9Remote is taking too long to start. Try running `9remote ui` manually.");return}try{let e=await fetch("/api/9remote/status");if((await e.json()).running)return void b(m)}catch{}y.current=setTimeout(t,2e3)};t()},[]),k=(0,a.useCallback)(async()=>{b(n),j("");try{let e=await fetch("/api/9remote/status"),t=await e.json();if(t.running)return void b(m);if(!t.installed)return void b(i);b(o)}catch(e){b(x),j(e.message)}},[]),w=(0,a.useCallback)(async()=>{b(c);try{if(!(await fetch("/api/9remote/start",{method:"POST"})).ok)throw Error("Failed to start 9Remote");N()}catch(e){b(x),j(e.message)}},[N]),C=async()=>{b(d),j("");try{let e=await fetch("/api/9remote/install",{method:"POST"});if(!e.ok){let t=await e.json();throw Error(t.error||"Install failed")}s?.(),await w()}catch(e){b(x),j(e.message)}};if((0,a.useEffect)(()=>(e?k():v(),v),[e,k]),(0,a.useEffect)(()=>{if(!e)return;document.body.style.overflow="hidden";let s=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",s),()=>{document.body.style.overflow="",document.removeEventListener("keydown",s)}},[e,t]),!e)return null;let S={[i]:{label:"Install 9Remote",icon:"download",onClick:C,loading:!1},[d]:{label:"Installing...",icon:"hourglass_top",onClick:null,loading:!0},[o]:{label:"Start 9Remote",icon:"play_arrow",onClick:w,loading:!1},[c]:{label:"Starting...",icon:"hourglass_top",onClick:null,loading:!0},[n]:{label:"Checking...",icon:"hourglass_top",onClick:null,loading:!0}}[f];return f===m?(0,l.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),(0,r.jsx)("div",{className:"relative rounded-xl overflow-hidden shadow-2xl animate-in fade-in zoom-in-95 duration-200",style:{width:480,height:"90vh"},children:(0,r.jsx)("iframe",{src:"http://localhost:2208",className:"border-0 block w-full h-full",title:"9Remote UI"})})]}),document.body):f===x?(0,l.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),(0,r.jsxs)("div",{className:"relative w-full max-w-sm rounded-xl overflow-hidden shadow-2xl bg-surface border border-black/10 dark:border-white/10 animate-in fade-in zoom-in-95 duration-200",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-black/5 dark:border-white/5",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-text-main",children:"9Remote"}),(0,r.jsx)("button",{onClick:t,className:"w-7 h-7 flex items-center justify-center rounded-lg bg-black/5 dark:bg-white/5 border border-black/5 dark:border-white/10 text-text-muted hover:text-text-main transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"close"})})]}),(0,r.jsxs)("div",{className:"flex flex-col items-center gap-5 py-12 px-6 text-center",children:[(0,r.jsx)("div",{className:"w-14 h-14 rounded-full bg-red-500/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-red-400 text-[28px]",children:"error"})}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("p",{className:"font-semibold text-text-main",children:"Something went wrong"}),(0,r.jsx)("p",{className:"text-xs text-text-muted font-mono break-all",children:g})]}),(0,r.jsxs)("button",{onClick:k,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-black/5 dark:bg-white/5 border border-black/5 dark:border-white/10 text-sm text-text-main hover:bg-black/10 dark:hover:bg-white/10 transition-colors",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"refresh"}),"Retry"]})]})]})]}),document.body):(0,l.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),(0,r.jsxs)("div",{className:"relative w-full max-w-sm rounded-xl overflow-hidden shadow-2xl animate-in fade-in zoom-in-95 duration-200 flex flex-col bg-surface border border-black/10 dark:border-white/10",style:{minHeight:"90vh"},children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-black/5 dark:border-white/5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"#FF570A"},children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-base",children:"terminal"})}),(0,r.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider",style:{fontFamily:"monospace",color:"#FF570A"},children:"9Remote"})]}),(0,r.jsx)("button",{onClick:t,className:"w-7 h-7 flex items-center justify-center rounded-lg bg-black/5 dark:bg-white/5 border border-black/5 dark:border-white/10 text-text-muted hover:text-text-main transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:"close"})})]}),(0,r.jsxs)("div",{className:"px-7 py-7 pb-9 flex flex-col flex-1 justify-between",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[(0,r.jsx)("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mb-1",style:{background:"#FF570A",boxShadow:"rgba(255,87,10,0.35) 0px 8px 32px"},children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white",style:{fontSize:30},children:"terminal"})}),(0,r.jsx)("h1",{className:"text-lg font-bold text-text-main tracking-tight",children:"9Remote"}),(0,r.jsx)("p",{className:"text-xs text-text-muted leading-5 max-w-[220px]",children:"Access your terminal, desktop & files from anywhere"})]}),(0,r.jsx)("div",{className:"flex gap-2 w-full mt-6",children:u.map(({icon:e,label:t,desc:s})=>(0,r.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-1.5 py-4 px-1 rounded-xl border border-black/10 dark:border-white/10 bg-bg-alt",children:[(0,r.jsx)("span",{className:"material-symbols-outlined",style:{fontSize:22,color:"#ff6e33"},children:e}),(0,r.jsx)("p",{className:"text-xs font-semibold text-text-main",children:t}),(0,r.jsx)("p",{className:"text-[10px] text-text-muted text-center leading-4",children:s})]},t))}),(0,r.jsx)("div",{className:"flex flex-col gap-3 w-full mt-5",children:h.map(({icon:e,text:t})=>(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:16,color:"#ff6e33"},children:e}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:t})]},e))}),S&&(0,r.jsxs)("button",{onClick:S.onClick??void 0,disabled:S.loading,className:`mt-7 w-full py-3.5 flex items-center justify-center gap-2 text-sm font-semibold text-white rounded-xl transition-all ${S.loading?"opacity-60 cursor-not-allowed":"hover:opacity-90 active:scale-[0.98]"}`,style:{background:"#FF570A",boxShadow:S.loading?"none":"0 4px 16px rgba(255,87,10,0.35)"},children:[S.loading?(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-bounce",style:{animationDelay:"0ms"}}),(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-bounce",style:{animationDelay:"150ms"}}),(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-bounce",style:{animationDelay:"300ms"}})]}):(0,r.jsx)("span",{className:"material-symbols-outlined text-base",children:S.icon}),S.label]})]})]})]}),document.body)}},32135:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(1521),l=s(292);function n(){let[e,t]=(0,a.useState)([]),[s,n]=(0,a.useState)(!0),[i,o]=(0,a.useState)(!0);(0,a.useEffect)(()=>{d()},[]),(0,a.useEffect)(()=>{let e;return i&&(e=setInterval(()=>{d(!1)},3e3)),()=>clearInterval(e)},[i]);let d=async(e=!0)=>{e&&n(!0);try{let e=await fetch("/api/usage/request-logs");if(e.ok){let s=await e.json();t(s)}}catch(e){console.error("Failed to fetch logs:",e)}finally{e&&n(!1)}};return(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,r.jsx)("span",{children:"Auto Refresh (3s)"}),(0,r.jsx)("div",{onClick:()=>o(!i),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${i?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,r.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${i?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,r.jsx)(l.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,r.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:s&&0===e.length?(0,r.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===e.length?(0,r.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,r.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,r.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,r.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,r.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let s=e.split(" | ");if(s.length<7)return null;let a=s[6],l=a.includes("PENDING"),n=a.includes("FAILED"),i=a.includes("OK");return(0,r.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${l?"bg-primary/5":""}`,children:[(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:s[0]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:s[1]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:s[2]})}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:s[3],children:s[3]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:s[4]}),(0,r.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:s[5]}),(0,r.jsx)("td",{className:`px-3 py-1.5 font-bold ${i?"text-success":n?"text-error":"text-primary animate-pulse"}`,children:a})]},t)})})]})})}),(0,r.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are saved to log.txt in the application data directory."})]})}},35045:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(73365),a=s(87706);let l={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"},n={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 i({children:e,variant:t="default",size:s="md",dot:o=!1,icon:d,className:c}){return(0,r.jsxs)("span",{className:(0,a.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",l[t],n[s],c),children:[o&&(0,r.jsx)("span",{className:(0,a.cn)("size-1.5 rounded-full","success"===t&&"bg-green-500","warning"===t&&"bg-yellow-500","error"===t&&"bg-red-500","info"===t&&"bg-blue-500","primary"===t&&"bg-primary","default"===t&&"bg-gray-500")}),d&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:d}),e]})}},37066:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(73365),a=s(87706);function l({label:e,options:t=[],value:s,onChange:n,placeholder:i="Select an option",error:o,hint:d,disabled:c=!1,required:m=!1,className:x,selectClassName:u,...h}){return(0,r.jsxs)("div",{className:(0,a.cn)("flex flex-col gap-1.5",x),children:[e&&(0,r.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,m&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("select",{value:s,onChange:n,disabled:c,className:(0,a.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",o?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"",u),...h,children:[(0,r.jsx)("option",{value:"",disabled:!0,children:i}),t.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,r.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),o&&(0,r.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},38230:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(73365),a=s(87706);let l={primary:"bg-gradient-to-b from-primary to-primary-hover text-white shadow-sm",secondary:"bg-white dark:bg-white/10 border border-black/10 dark:border-white/10 text-text-main hover:bg-black/5 dark:hover:bg-white/5",outline:"border border-black/15 dark:border-white/15 text-text-main hover:bg-black/5",ghost:"text-text-muted hover:bg-black/5 dark:hover:bg-white/5 hover:text-text-main",danger:"bg-red-500 text-white hover:bg-red-600 shadow-sm"},n={sm:"h-7 px-3 text-xs rounded-md",md:"h-9 px-4 text-sm rounded-lg",lg:"h-11 px-6 text-sm rounded-lg"};function i({children:e,variant:t="primary",size:s="md",icon:o,iconRight:d,disabled:c=!1,loading:m=!1,fullWidth:x=!1,className:u,...h}){return(0,r.jsxs)("button",{className:(0,a.cn)("inline-flex items-center justify-center gap-2 font-medium transition-all duration-200 cursor-pointer","active:scale-[0.99] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",l[t],n[s],x&&"w-full",u),disabled:c||m,...h,children:[m?(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):o?(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:o}):null,e,d&&!m&&(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:d})]})}},43202:(e,t,s)=>{s.d(t,{Q2:()=>r.Q2,fg:()=>r.fg,vQ:()=>a,MA:()=>r.MA,UY:()=>n,zN:()=>r.zN,B2:()=>l});var r=s(82495);s(69633);let a={name:"Endpoint Proxy",description:"AI Infrastructure Management",version:"0.3.72"},l={storageKey:"theme",defaultTheme:"system"},n={maxLines:200,pollIntervalMs:1e3}},50136:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);let o="https://gitlab.com";function d({isOpen:e,providerInfo:t,onSuccess:s,onClose:l}){let n,[c,m]=(0,a.useState)(null),[x,u]=(0,a.useState)(o),[h,p]=(0,a.useState)(""),[f,b]=(0,a.useState)(""),[g,j]=(0,a.useState)(""),[y,v]=(0,a.useState)(!1),[N,k]=(0,a.useState)(null),[w,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(null),R=()=>{m(null),u(o),p(""),b(""),j(""),k(null),v(!1),C(!1),T(null),l()},$=async()=>{if(!g.trim())return void k("Personal Access Token is required");v(!0),k(null);try{let e=await fetch("/api/oauth/gitlab/pat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:g.trim(),baseUrl:x.trim()||o})}),t=await e.json();if(!e.ok)throw Error(t.error||"Authentication failed");s?.(),R()}catch(e){k(e.message)}finally{v(!1)}};return e?w&&S?(0,r.jsx)(i.LF,{isOpen:!0,provider:"gitlab",providerInfo:t,oauthMeta:S,onSuccess:()=>{s?.(),R()},onClose:()=>{C(!1),T(null)}}):(0,r.jsx)(i.aF,{isOpen:e,title:"Connect GitLab Duo",onClose:R,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[!c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Choose how to authenticate with GitLab Duo:"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("button",{onClick:()=>m("oauth"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"lock_open"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"OAuth App"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab OAuth application"})]})]}),(0,r.jsxs)("button",{onClick:()=>m("pat"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"key"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"Personal Access Token"}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab PAT with api scope"})]})]})]})]}),"oauth"===c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Create an OAuth app at"," ",(0,r.jsx)("a",{href:`${x.trim()||o}/-/profile/applications`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Applications"})," ","with redirect URI"," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:(n=window.location.port||("https:"===window.location.protocol?"443":"80"),`http://localhost:${n}/callback`)})]}),(0,r.jsx)(i.pd,{label:"GitLab Base URL",value:x,onChange:e=>u(e.target.value),placeholder:o}),(0,r.jsx)(i.pd,{label:"Client ID",value:h,onChange:e=>p(e.target.value),placeholder:"Your OAuth application client ID"}),(0,r.jsx)(i.pd,{label:"Client Secret (optional for PKCE)",value:f,onChange:e=>b(e.target.value),placeholder:"Leave empty for public PKCE app"}),N&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:N}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>{h.trim()?(k(null),T({baseUrl:x.trim()||o,clientId:h.trim(),clientSecret:f.trim()}),C(!0)):k("Client ID is required")},fullWidth:!0,disabled:!h.trim(),children:"Authorize"}),(0,r.jsx)(i.$n,{onClick:()=>{m(null),k(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"pat"===c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-xs text-text-muted",children:["Create a PAT at"," ",(0,r.jsx)("a",{href:`${x.trim()||o}/-/user_settings/personal_access_tokens`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Access Tokens"})," ","with scopes: ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"api"}),","," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"read_user"}),", and"," ",(0,r.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"ai_features"}),"."]}),(0,r.jsx)(i.pd,{label:"GitLab Base URL",value:x,onChange:e=>u(e.target.value),placeholder:o}),(0,r.jsx)(i.pd,{label:"Personal Access Token",value:g,onChange:e=>j(e.target.value),placeholder:"glpat-xxxxxxxxxxxxxxxxxxxx",type:"password"}),N&&(0,r.jsx)("p",{className:"text-sm text-red-500",children:N}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:$,fullWidth:!0,disabled:!g.trim()||y,loading:y,children:"Connect"}),(0,r.jsx)(i.$n,{onClick:()=>{m(null),k(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})}):null}d.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},51123:(e,t,s)=>{s.d(t,{default:()=>p});var r=s(73365),a=s(29717),l=s(1521),n=s(99568),i=s.n(n),o=s(86447),d=s.n(o),c=s(68266),m=s(74156),x=s(67692),u=s(43202),h=s(84502);function p({onMenuClick:e,showMenuButton:t=!0}){let s=(0,a.usePathname)(),n=(0,a.useRouter)(),{title:o,description:d,icon:f,breadcrumbs:b}=(0,l.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/providers\/([^/]+)$/);if(t){let e=t[1],s=u.zN[e]||u.fg[e];if(s)return{title:s.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:s.name,image:`/providers/${s.id}.png`}]}}return e.includes("/providers")?{title:"Providers",description:"Manage your AI provider connections",icon:"dns",breadcrumbs:[]}:e.includes("/combos")?{title:"Combos",description:"Model combos with fallback",icon:"layers",breadcrumbs:[]}:e.includes("/usage")?{title:"Usage & Analytics",description:"Monitor your API usage, token consumption, and request logs",icon:"bar_chart",breadcrumbs:[]}:e.includes("/quota")?{title:"Quota Tracker",description:"Track and manage your API quota limits",icon:"data_usage",breadcrumbs:[]}:e.includes("/mitm")?{title:"MITM Proxy",description:"Intercept CLI tool traffic and route through 9Router",icon:"security",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",icon:"terminal",breadcrumbs:[]}:e.includes("/proxy-pools")?{title:"Proxy Pools",description:"Manage your proxy pool configurations",icon:"lan",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:e.includes("/profile")?{title:"Settings",description:"Manage your preferences",icon:"settings",breadcrumbs:[]}:e.includes("/translator")?{title:"Translator",description:"Debug translation flow between formats",icon:"translate",breadcrumbs:[]}:e.includes("/console-log")?{title:"Console Log",description:"Live server console output",icon:"monitor",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})(s),[s]),g=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&(n.push("/login"),n.refresh())}catch(e){console.error("Failed to logout:",e)}};return(0,r.jsxs)("header",{className:"flex items-center justify-between px-8 py-5 border-b border-black/5 dark:border-white/5 bg-bg/80 backdrop-blur-xl z-10 sticky top-0",children:[(0,r.jsx)("div",{className:"flex items-center gap-3 lg:hidden",children:t&&(0,r.jsx)("button",{onClick:e,className:"text-text-main hover:text-primary transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,r.jsx)("div",{className:"hidden lg:flex flex-col",children:b.length>0?(0,r.jsx)("div",{className:"flex items-center gap-2",children:b.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,r.jsx)(i(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,r.jsx)(c.A,{src:e.image,alt:e.label,size:28,className:"object-contain rounded max-w-[28px] max-h-[28px]",fallbackText:e.label.slice(0,2).toUpperCase()}),(0,r.jsx)("h1",{className:"text-2xl font-semibold text-text-main tracking-tight",children:(0,h.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):o?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[f&&(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-2xl",children:f}),(0,r.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:(0,h.Tl)(o)})]}),d&&(0,r.jsx)("p",{className:"text-sm text-text-muted",children:(0,h.Tl)(d)})]}):null}),(0,r.jsxs)("div",{className:"flex items-center gap-3 ml-auto",children:[(0,r.jsx)(x.default,{}),(0,r.jsx)(m.c5,{}),(0,r.jsx)(m.UW,{}),(0,r.jsx)("button",{onClick:g,className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-red-500 hover:bg-red-500/10 transition-all",title:"Logout",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"logout"})})]})]})}p.propTypes={onMenuClick:d().func,showMenuButton:d().bool}},51454:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156),o=s(96459);function d({isOpen:e,provider:t,onSuccess:s,onClose:l}){let[n,c]=(0,a.useState)("loading"),[m,x]=(0,a.useState)(""),[u,h]=(0,a.useState)(null),[p,f]=(0,a.useState)(""),[b,g]=(0,a.useState)(null),{copied:j,copy:y}=(0,o.C)();(0,a.useEffect)(()=>{e&&t&&(async()=>{try{g(null),c("loading");let e=await fetch(`/api/oauth/kiro/social-authorize?provider=${t}`),s=await e.json();if(!e.ok)throw Error(s.error);h(s),x(s.authUrl),c("input"),window.open(s.authUrl,"_blank")}catch(e){g(e.message),c("error")}})()},[e,t]);let v=async()=>{try{let e;g(null);try{e=new URL(p)}catch(e){throw Error("Invalid callback URL format")}let r=e.searchParams.get("code");e.searchParams.get("state");let a=e.searchParams.get("error");if(a)throw Error(e.searchParams.get("error_description")||a);if(!r)throw Error("No authorization code found in URL");let l=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:r,codeVerifier:u.codeVerifier,provider:t})}),n=await l.json();if(!l.ok)throw Error(n.error);c("success"),s?.()}catch(e){g(e.message),c("error")}},N="google"===t?"Google":"GitHub";return(0,r.jsx)(i.aF,{isOpen:e,title:`Connect Kiro via ${N}`,onClose:l,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===n&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",N," authentication"]})]}),"input"===n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.pd,{value:m,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===j?"check":"content_copy",onClick:()=>y(m,"auth_url"),children:"Copy"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,r.jsx)(i.pd,{value:p,onChange:e=>f(e.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:v,fullWidth:!0,disabled:!p,children:"Connect"}),(0,r.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===n&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.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,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,r.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",N," has been connected."]}),(0,r.jsx)(i.$n,{onClick:l,fullWidth:!0,children:"Done"})]}),"error"===n&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.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,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,r.jsx)("p",{className:"text-sm text-red-600 mb-4",children:b}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>c("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,r.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:n().bool.isRequired,provider:n().oneOf(["google","github"]).isRequired,onSuccess:n().func,onClose:n().func.isRequired}},53038:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(73365),a=s(87706);function l({label:e,type:t="text",placeholder:s,value:n,onChange:i,error:o,hint:d,icon:c,disabled:m=!1,required:x=!1,className:u,inputClassName:h,...p}){return(0,r.jsxs)("div",{className:(0,a.cn)("flex flex-col gap-1.5",u),children:[e&&(0,r.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,x&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,r.jsxs)("div",{className:"relative",children:[c&&(0,r.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:c})}),(0,r.jsx)("input",{type:t,placeholder:s,value:n,onChange:i,disabled:m,className:(0,a.cn)("w-full py-2 px-3 text-sm text-text-main","bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md","placeholder-text-muted/60","focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none","transition-all shadow-inner disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",c&&"pl-10",o?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"",h),...p})]}),o&&(0,r.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,r.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},54546:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(73365),a=s(86447),l=s.n(a),n=s(84675);function i({children:e}){return(0,r.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,r.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,r.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,r.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,r.jsx)(n.default,{variant:"card"})}),(0,r.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:e})]})}i.propTypes={children:l().node.isRequired}},55348:(e,t,s)=>{s.d(t,{CL:()=>l,QC:()=>n,Xn:()=>a,YZ:()=>r});let r=["en","vi","zh-CN","zh-TW","ja","pt-BR","pt-PT","ko","es","de","fr","he","ar","ru","pl","cs","nl","tr","uk","tl","id","th","hi","bn","ur","ro","sv","it","el","hu","fi","da","no"],a="en",l="locale";function n(e){return"zh"===e||"zh-CN"===e?"zh-CN":"en"===e?"en":"vi"===e?"vi":"zh-TW"===e?"zh-TW":"ja"===e?"ja":"pt-BR"===e?"pt-BR":"pt-PT"===e?"pt-PT":"ko"===e?"ko":"es"===e?"es":"de"===e?"de":"fr"===e?"fr":"he"===e?"he":"ar"===e?"ar":"ru"===e?"ru":"pl"===e?"pl":"cs"===e?"cs":"nl"===e?"nl":"tr"===e?"tr":"uk"===e?"uk":"tl"===e?"tl":"id"===e?"id":"th"===e?"th":"hi"===e?"hi":"bn"===e?"bn":"ur"===e?"ur":"ro"===e?"ro":"sv"===e?"sv":"it"===e?"it":"el"===e?"el":"hu"===e?"hu":"fi"===e?"fi":"da"===e?"da":"no"===e?"no":a}},56550:(e,t,s)=>{s.d(t,{default:()=>b});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(99568),o=s.n(i),d=s(29717),c=s(87706),m=s(43202),x=s(38230),u=s(66911);let h=[{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{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"}],f=[{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/profile",label:"Settings",icon:"settings"}];function b({onClose:e}){let t=(0,d.usePathname)(),[s,l]=(0,a.useState)(!1),[n,i]=(0,a.useState)(!1),[g,j]=(0,a.useState)(!1),[y,v]=(0,a.useState)(null),[N,k]=(0,a.useState)(!1);(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{e.enableTranslator&&k(!0)}).catch(()=>{})},[]),(0,a.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.hasUpdate&&v(e)}).catch(()=>{})},[]);let w=e=>"/dashboard/endpoint"===e?"/dashboard"===t||t.startsWith("/dashboard/endpoint"):t.startsWith(e),C=async()=>{i(!0);try{await fetch("/api/shutdown",{method:"POST"})}catch(e){}i(!1),l(!1),j(!0)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.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 min-h-full",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,r.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,r.jsxs)(o(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-9 rounded bg-linear-to-br from-[#f97815] to-[#c2590a]",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-white text-[20px]",children:"hub"})}),(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:m.vQ.name}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["v",m.vQ.version]})]})]}),y&&(0,r.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",y.latestVersion]}),(0,r.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,r.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-1 overflow-y-auto custom-scrollbar",children:[h.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",w(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",w(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-sm font-medium",children:t.label})]},t.href)),(0,r.jsxs)("div",{className:"pt-4 mt-2",children:[(0,r.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"Debug"}),N&&(0,r.jsxs)(o(),{href:"/dashboard/translator",onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",w("/dashboard/translator")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",w("/dashboard/translator")?"fill-1":"group-hover:text-primary transition-colors"),children:"translate"}),(0,r.jsx)("span",{className:"text-sm font-medium",children:"Translator"})]}),p.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",w(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",w(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-sm font-medium",children:t.label})]},t.href))]}),(0,r.jsxs)("div",{className:"pt-4 mt-2",children:[(0,r.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),f.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-2 rounded-lg transition-all group",w(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",w(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-sm font-medium",children:t.label})]},t.href))]})]}),(0,r.jsxs)("div",{className:"p-3 border-t border-black/5 dark:border-white/5",children:[(0,r.jsxs)("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-surface/50 mb-2",children:[(0,r.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,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"info"})}),(0,r.jsx)("div",{className:"flex flex-col",children:(0,r.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,r.jsx)(x.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>l(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})]})]}),(0,r.jsx)(u.ConfirmModal,{isOpen:s,onClose:()=>l(!1),onConfirm:C,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:n}),g&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,r.jsxs)("div",{className:"text-center p-8",children:[(0,r.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,r.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,r.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,r.jsx)(x.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}b.propTypes={onClose:n().func}},63380:(e,t,s)=>{s.d(t,{default:()=>o});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onMethodSelect:t,onClose:s}){let[l,n]=(0,a.useState)(null),[d,c]=(0,a.useState)(""),[m,x]=(0,a.useState)("us-east-1"),[u,h]=(0,a.useState)(""),[p,f]=(0,a.useState)(null),[b,g]=(0,a.useState)(!1),[j,y]=(0,a.useState)(!1),[v,N]=(0,a.useState)(!1);(0,a.useEffect)(()=>{"import"===l&&e&&(async()=>{y(!0),f(null),N(!1);try{let e=await fetch("/api/oauth/kiro/auto-import"),t=await e.json();t.found?(h(t.refreshToken),N(!0)):f(t.error||"Could not auto-detect token")}catch(e){f("Failed to auto-detect token")}finally{y(!1)}})()},[l,e]);let k=e=>{n(e),f(null)},w=()=>{n(null),f(null)},C=async()=>{if(!u.trim())return void f("Please enter a refresh token");g(!0),f(null);try{let e=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:u.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Import failed");t("import")}catch(e){f(e.message)}finally{g(!1)}},S=e=>{t("social",{provider:e})};return(0,r.jsx)(i.aF,{isOpen:e,title:"Connect Kiro",onClose:s,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[!l&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Choose your authentication method:"}),(0,r.jsx)("button",{onClick:()=>t("builder-id"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"shield"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"AWS Builder ID"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,r.jsx)("button",{onClick:()=>k("idc"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"business"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"AWS IAM Identity Center"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,r.jsx)("button",{onClick:()=>k("social-google"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"account_circle"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Google Account"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,r.jsx)("button",{onClick:()=>k("social-github"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"code"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"GitHub Account"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,r.jsx)("button",{onClick:()=>k("import"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"file_upload"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"font-semibold mb-1",children:"Import Token"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Paste refresh token from Kiro IDE."})]})]})})]}),"idc"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["IDC Start URL ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-2",children:"AWS Region"}),(0,r.jsx)(i.pd,{value:m,onChange:e=>x(e.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"AWS region for your Identity Center (default: us-east-1)"})]}),p&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:p}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>{d.trim()?t("idc",{startUrl:d.trim(),region:m}):f("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,r.jsx)(i.$n,{onClick:w,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsxs)("div",{className:"flex-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,r.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>S("google"),fullWidth:!0,children:"Continue with Google"}),(0,r.jsx)(i.$n,{onClick:w,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsxs)("div",{className:"flex-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,r.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:()=>S("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,r.jsx)(i.$n,{onClick:w,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===l&&(0,r.jsxs)("div",{className:"space-y-4",children:[j&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting token..."}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!j&&(0,r.jsxs)(r.Fragment,{children:[v&&(0,r.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,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!v&&!p&&(0,r.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,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Refresh Token ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.pd,{value:u,onChange:e=>h(e.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),p&&(0,r.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,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:p})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:C,fullWidth:!0,disabled:b||!u.trim(),children:b?"Importing...":"Import Token"}),(0,r.jsx)(i.$n,{onClick:w,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})]})})}o.propTypes={isOpen:n().bool.isRequired,onMethodSelect:n().func.isRequired,onClose:n().func.isRequired}},66911:(e,t,s)=>{s.d(t,{ConfirmModal:()=>o,default:()=>i});var r=s(73365),a=s(1521),l=s(87706),n=s(38230);function i({isOpen:e,onClose:t,title:s,children:n,footer:o,size:d="md",closeOnOverlay:c=!0,showCloseButton:m=!0,className:x}){return((0,a.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,a.useEffect)(()=>{let s=s=>{"Escape"===s.key&&e&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),e)?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:c?t:void 0}),(0,r.jsxs)("div",{className:(0,l.cn)("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",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[d],x),children:[(s||m)&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-black/5 dark:border-white/5",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mr-4",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),s&&(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:s})]}),m&&(0,r.jsx)("button",{onClick:t,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsx)("div",{className:"p-6 max-h-[calc(80vh-140px)] overflow-y-auto",children:n}),o&&(0,r.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-black/5 dark:border-white/5",children:o})]})]}):null}function o({isOpen:e,onClose:t,onConfirm:s,title:a="Confirm",message:l,confirmText:d="Confirm",cancelText:c="Cancel",variant:m="danger",loading:x=!1}){return(0,r.jsx)(i,{isOpen:e,onClose:t,title:a,size:"sm",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.default,{variant:"ghost",onClick:t,disabled:x,children:c}),(0,r.jsx)(n.default,{variant:m,onClick:s,loading:x,children:d})]}),children:(0,r.jsx)("p",{className:"text-text-muted",children:l})})}},67692:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(1521),l=s(27249);function n(){let[e,t]=(0,a.useState)(!1),[s,n]=(0,a.useState)(!1),[i,o]=(0,a.useState)(0),d=(0,a.useRef)(null),c=(0,a.useRef)(null),m=()=>{d.current?.close(),clearTimeout(c.current);let e=new EventSource("http://localhost:2208/api/ui/events");e.onmessage=e=>{try{let t=JSON.parse(e.data);"state"===t.type&&(n(!0),o(t.step??0))}catch{}},e.onerror=()=>{e.close(),o(0),clearTimeout(c.current),c.current=setTimeout(m,3e4)},d.current=e};(0,a.useEffect)(()=>(fetch("/api/9remote/status").then(e=>e.json()).then(e=>n(e.installed)).catch(()=>{}),m(),()=>{d.current?.close(),clearTimeout(c.current)}),[]);let{color:x,glow:u}=((e,t)=>{if(!t)return{color:"text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5",glow:null};switch(e){case 4:return{color:"text-emerald-500 hover:bg-emerald-500/10",glow:"drop-shadow(0 0 6px rgb(16 185 129 / 0.7))"};case 0:return{color:"text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5",glow:null};default:return{color:"text-amber-400 hover:bg-amber-400/10",glow:null}}})(i,s),h=s&&i>=1&&i<=3;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{onClick:()=>t(!0),className:`relative flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-all ${x}`,style:u?{filter:u}:{},title:"9Remote",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[18px]${h?" animate-pulse":""}`,children:"computer"}),(0,r.jsx)("span",{className:"text-xs font-medium",children:"Remote"})]}),(0,r.jsx)(l.default,{isOpen:e,onClose:()=>{t(!1),setTimeout(m,800)},onInstalled:()=>n(!0)})]})}},68266:(e,t,s)=>{s.d(t,{A:()=>i});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l);function i({src:e,alt:t,size:s=32,className:l="",fallbackText:n="?",fallbackColor:o}){let[d,c]=(0,a.useState)(!1);return!e||d?(0,r.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${l}`.trim(),style:{width:s,height:s,color:o,fontSize:Math.max(10,Math.floor(.38*s))},children:n}):(0,r.jsx)("img",{src:e,alt:t,width:s,height:s,className:l,onError:()=>c(!0)})}i.propTypes={src:n().string,alt:n().string,size:n().number,className:n().string,fallbackText:n().string,fallbackColor:n().string}},68600:(e,t,s)=>{s.d(t,{default:()=>o});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onSuccess:t,onClose:s}){let[l,n]=(0,a.useState)(""),[d,c]=(0,a.useState)(!1),[m,x]=(0,a.useState)(null),[u,h]=(0,a.useState)(!1),p=async()=>{if(!l.trim())return void x("Please paste your cookie");c(!0),x(null);try{let e=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:l.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Authentication failed");h(!0),setTimeout(()=>{t?.(),f()},1500)}catch(e){x(e.message)}finally{c(!1)}},f=()=>{n(""),x(null),h(!1),s?.()};return(0,r.jsx)(i.aF,{isOpen:e,onClose:f,title:"iFlow Cookie Authentication",children:(0,r.jsx)("div",{className:"space-y-4",children:u?(0,r.jsxs)("div",{className:"text-center py-8",children:[(0,r.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,r.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,r.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,r.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,r.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,r.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,r.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,r.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,r.jsx)("li",{children:"Login to your account"}),(0,r.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,r.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,r.jsx)("li",{children:"Paste it below"})]})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,r.jsx)("textarea",{value:l,onChange:e=>n(e.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:d})]}),m&&(0,r.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-error",children:m})}),(0,r.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,r.jsx)(i.$n,{variant:"secondary",onClick:f,disabled:d,fullWidth:!0,children:"Cancel"}),(0,r.jsx)(i.$n,{onClick:p,loading:d,fullWidth:!0,children:"Authenticate"})]})]})})})}o.propTypes={isOpen:n().bool.isRequired,onSuccess:n().func,onClose:n().func}},69633:(e,t,s)=>{s.d(t,{KC:()=>r.KC,Xg:()=>r.Xg});var r=s(94718);Object.entries(s(82495).Q2).filter(([,e])=>e.passthroughModels).map(([e])=>e),Object.entries(r.vq).flatMap(([e,t])=>t.map(t=>({provider:e,model:t.id,name:t.name})))},70391:(e,t,s)=>{s.d(t,{default:()=>o});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onSuccess:t,onClose:s}){let[l,n]=(0,a.useState)(""),[d,c]=(0,a.useState)(""),[m,x]=(0,a.useState)(null),[u,h]=(0,a.useState)(!1),[p,f]=(0,a.useState)(!1),[b,g]=(0,a.useState)(!1),[j,y]=(0,a.useState)(!1),v=async()=>{f(!0),x(null),g(!1),y(!1);try{let e=await fetch("/api/oauth/cursor/auto-import"),t=await e.json();t.found?(n(t.accessToken),c(t.machineId),g(!0)):t.windowsManual?y(!0):x(t.error||"Could not auto-detect tokens")}catch(e){x("Failed to auto-detect tokens")}finally{f(!1)}};(0,a.useEffect)(()=>{e&&v()},[e]);let N=async()=>{if(!l.trim())return void x("Please enter an access token");if(!d.trim())return void x("Please enter a machine ID");h(!0),x(null);try{let e=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:l.trim(),machineId:d.trim()})}),r=await e.json();if(!e.ok)throw Error(r.error||"Import failed");t?.(),s()}catch(e){x(e.message)}finally{h(!1)}};return(0,r.jsx)(i.aF,{isOpen:e,title:"Connect Cursor IDE",onClose:s,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[p&&(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!p&&(0,r.jsxs)(r.Fragment,{children:[b&&(0,r.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,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,r.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),j&&(0,r.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,r.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,r.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Make sure Cursor IDE has been opened at least once, then click ",(0,r.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,r.jsx)(i.$n,{onClick:v,variant:"outline",fullWidth:!0,children:"Retry"})]}),!b&&!j&&!m&&(0,r.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,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,r.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)("textarea",{value:l,onChange:e=>n(e.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,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),m&&(0,r.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,r.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:m})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:N,fullWidth:!0,disabled:u||!l.trim()||!d.trim(),children:u?"Importing...":"Import Token"}),(0,r.jsx)(i.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}o.propTypes={isOpen:n().bool.isRequired,onSuccess:n().func,onClose:n().func.isRequired}},70789:(e,t,s)=>{s.d(t,{default:()=>c});var r=s(73365),a=s(99568),l=s.n(a),n=s(43202);let i=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],o=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],d=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function c(){return(0,r.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,r.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,r.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,r.jsx)("div",{className:"size-6 text-primary",children:(0,r.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,r.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,r.jsx)("span",{className:"text-xl font-bold text-text-main",children:n.vQ.name})]}),(0,r.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,r.jsxs)("div",{className:"flex gap-4",children:[(0,r.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.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,r.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.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,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:o.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,r.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:d.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]})]}),(0,r.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,r.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",n.vQ.name," Inc. All rights reserved."]}),(0,r.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,r.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,r.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},73531:(e,t,s)=>{s.d(t,{default:()=>c});var r=s(73365),a=s(1521),l=s(86447),n=s.n(l),i=s(3242),o=s(63380),d=s(51454);function c({isOpen:e,providerInfo:t,onSuccess:s,onClose:l}){let[n,m]=(0,a.useState)(null),[x,u]=(0,a.useState)(null),[h,p]=(0,a.useState)(null),f=(0,a.useCallback)((e,t)=>{"builder-id"===e?m("builder-id"):"idc"===e?(m("idc"),p(t)):"social"===e?(m("social"),u(t.provider)):"import"===e&&s?.()},[s]),b=()=>{m(null),u(null),p(null)};return n?"builder-id"===n||"idc"===n?(0,r.jsx)(i.default,{isOpen:e,provider:"kiro",providerInfo:t,onSuccess:()=>{m(null),p(null),s?.(),l?.()},onClose:b,idcConfig:h}):"social"===n&&x?(0,r.jsx)(d.default,{isOpen:e,provider:x,onSuccess:()=>{m(null),u(null),s?.(),l?.()},onClose:b}):null:(0,r.jsx)(o.default,{isOpen:e,onMethodSelect:f,onClose:l})}c.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},74156:(e,t,s)=>{s.d(t,{Ex:()=>d.default,$n:()=>r.default,Zp:()=>n.default,Qv:()=>o.CardSkeleton,G9:()=>j.default,vj:()=>v.default,vE:()=>y.default,pd:()=>a.default,Mh:()=>g.default,c5:()=>f.default,uR:()=>h.default,aF:()=>i.default,rq:()=>u.default,LF:()=>x.default,gM:()=>b.default,Iz:()=>N.default,l6:()=>l.default,UW:()=>m.default,lM:()=>c.default,m_:()=>k.default,jK:()=>p.default});var r=s(38230),a=s(53038),l=s(37066),n=s(292),i=s(66911),o=s(91494);s(82455);var d=s(35045),c=s(14406),m=s(84675);s(98814),s(56550),s(51123),s(70789);var x=s(3242),u=s(24372),h=s(5671),p=s(3412),f=s(12003);s(67692),s(27249);var b=s(32135);s(63380);var g=s(73531);s(51454);var j=s(70391),y=s(68600),v=s(50136),N=s(1755),k=s(13333);s(13048),s(54546)},82455:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(73365),a=s(87706);function l({src:e,alt:t="Avatar",name:s,size:n="md",className:i}){let o={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 e?(0,r.jsx)("div",{className:(0,a.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],i),style:{backgroundImage:`url(${e})`},role:"img","aria-label":t}):(0,r.jsx)("div",{className:(0,a.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],(e=>{if(!e)return"bg-primary";let t=["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"],s=e.charCodeAt(0)%t.length;return t[s]})(s),i),role:"img","aria-label":t,children:(e=>{if(!e)return"?";let t=e.split(" ");return t.length>=2?`${t[0][0]}${t[1][0]}`.toUpperCase():e.substring(0,2).toUpperCase()})(s)})}},83789:(e,t,s)=>{s.d(t,{A:()=>i});var r=s(2074),a=s(11472),l=s(43202);function n(e){let t=document.documentElement,s=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";"dark"===("system"===e?s:e)?t.classList.add("dark"):t.classList.remove("dark")}let i=(0,r.v)((0,a.Zr)((e,t)=>({theme:l.B2.defaultTheme,setTheme:t=>{e({theme:t}),n(t)},toggleTheme:()=>{let s="dark"===t().theme?"light":"dark";e({theme:s}),n(s)},initTheme:()=>{n(t().theme)}}),{name:l.B2.storageKey}))},84502:(e,t,s)=>{s.d(t,{FE:()=>x,Tl:()=>d,wn:()=>u});var r=s(55348);let a={},l=r.Xn,n=[];function i(){if("u"<typeof document)return r.Xn;let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${r.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):r.Xn;return(0,r.QC)(t)}async function o(e){if("en"===e){a={};return}try{let t=await fetch(`/i18n/literals/${e}.json`);a=await t.json()}catch(e){console.error("Failed to load translations:",e),a={}}}function d(e){if(!e||"string"!=typeof e)return e;let t=e.trim();return t&&"en"!==l&&a[t]||e}function c(e){if(!e.nodeValue||!e.nodeValue.trim())return;let t=e.parentElement;if(!t)return;let s=t;for(;s;){if(s.hasAttribute&&s.hasAttribute("data-i18n-skip"))return;s=s.parentElement}if(["script","style","code","pre","colgroup","table","thead","tbody","tfoot","tr","select","datalist","optgroup"].includes(t.tagName?.toLowerCase()))return;e._originalText||(e._originalText=e.nodeValue);let r=d(e._originalText);r!==e.nodeValue&&(e.nodeValue=r)}function m(e){let t;if(!e)return;let s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),r=[];for(;t=s.nextNode();)r.push(t);r.forEach(c)}async function x(){l=i(),await o(l),m(document.body),new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e.nodeType===Node.ELEMENT_NODE?m(e):e.nodeType===Node.TEXT_NODE&&c(e)})})}).observe(document.body,{childList:!0,subtree:!0})}async function u(){l=i(),await o(l),n.forEach(e=>e()),m(document.body)}},84675:(e,t,s)=>{s.d(t,{default:()=>n});var r=s(73365),a=s(89036),l=s(87706);function n({className:e,variant:t="default"}){let{theme:s,toggleTheme:i,isDark:o}=(0,a.D)(),d={default:(0,l.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,l.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,r.jsx)("button",{onClick:i,className:(0,l.cn)(d[t],e),"aria-label":`Switch to ${o?"light":"dark"} mode`,title:`Switch to ${o?"light":"dark"} mode`,children:(0,r.jsx)("span",{className:(0,l.cn)("material-symbols-outlined text-[22px]","card"===t&&"transition-transform duration-300 group-hover:rotate-12"),children:o?"light_mode":"dark_mode"})})}},87706:(e,t,s)=>{s.d(t,{cn:()=>r});function r(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},89036:(e,t,s)=>{s.d(t,{D:()=>o});var r=s(1521),a=s(83789);function l(e){let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function n(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function i(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:s,initTheme:o}=(0,a.A)(),d=(0,r.useSyncExternalStore)(l,n,i);(0,r.useEffect)(()=>{o()},[o]),(0,r.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>o();return t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[e,o]);let c="dark"===e||"system"===e&&d;return{theme:e,setTheme:t,toggleTheme:s,isDark:c}}},91494:(e,t,s)=>{s.d(t,{CardSkeleton:()=>o,PageLoading:()=>n,Skeleton:()=>i,Spinner:()=>l,default:()=>d});var r=s(73365),a=s(87706);function l({size:e="md",className:t}){return(0,r.jsx)("span",{className:(0,a.cn)("material-symbols-outlined animate-spin text-primary",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function n({message:e="Loading..."}){return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,r.jsx)(l,{size:"xl"}),(0,r.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function i({className:e,...t}){return(0,r.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-lg bg-border",e),...t})}function o(){return(0,r.jsxs)("div",{className:"p-6 rounded-xl border border-border bg-surface",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)(i,{className:"h-4 w-24"}),(0,r.jsx)(i,{className:"size-10 rounded-lg"})]}),(0,r.jsx)(i,{className:"h-8 w-16 mb-2"}),(0,r.jsx)(i,{className:"h-3 w-20"})]})}function d({type:e="spinner",...t}){switch(e){case"page":return(0,r.jsx)(n,{...t});case"skeleton":return(0,r.jsx)(i,{...t});case"card":return(0,r.jsx)(o,{...t});default:return(0,r.jsx)(l,{...t})}}},96459:(e,t,s)=>{s.d(t,{C:()=>a});var r=s(1521);function a(e=2e3){let[t,s]=(0,r.useState)(null),l=(0,r.useRef)(null);return{copied:t,copy:(0,r.useCallback)((t,r="default")=>{navigator.clipboard.writeText(t),s(r),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s(null)},e)},[e])}}},98814:(e,t,s)=>{s.d(t,{ThemeProvider:()=>n});var r=s(73365),a=s(1521),l=s(83789);function n({children:e}){let{initTheme:t}=(0,l.A)();return(0,a.useEffect)(()=>{t()},[t]),(0,r.jsx)(r.Fragment,{children:e})}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{7207:(e,t,i)=>{Promise.resolve().then(i.bind(i,31660))},31660:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>g});var s=i(73365),a=i(1521),r=i(86447),n=i.n(r),o=i(29717),l=i(99568),d=i.n(l),c=i(58872),p=i(74156),x=i(82495),m=i(69633),u=i(96459);let h=new Map,y={"openrouter-free":e=>e.filter(e=>e.pricing?.prompt==="0"&&e.pricing?.completion==="0"&&e.context_length>=2e5).map(e=>({id:e.id,name:e.name,contextLength:e.context_length})).sort((e,t)=>t.contextLength-e.contextLength)};async function f(e){if(!e?.url||!e?.type)return[];let t=h.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=await fetch(e.url);if(!t.ok)return[];let i=await t.json(),s=i.data??i.models??i,a=y[e.type],r=a?a(Array.isArray(s)?s:[]):[];return h.set(e.url,{data:r,expiresAt:Date.now()+6e5}),r}catch{return[]}}function g(){let e=(0,o.useParams)(),t=(0,o.useRouter)(),i=e.id,[r,n]=(0,a.useState)([]),[l,h]=(0,a.useState)(!0),[y,g]=(0,a.useState)(null),[v,N]=(0,a.useState)([]),[$,P]=(0,a.useState)(!1),[T,O]=(0,a.useState)(!1),[E,R]=(0,a.useState)(!1),[_,I]=(0,a.useState)(!1),[D,q]=(0,a.useState)(!1),[U,K]=(0,a.useState)(!1),[M,L]=(0,a.useState)(null),[F,J]=(0,a.useState)({}),[z,W]=(0,a.useState)(!1),[V,B]=(0,a.useState)({}),[G,Z]=(0,a.useState)(""),[Q,H]=(0,a.useState)(null),[X,Y]=(0,a.useState)(!1),[ee,et]=(0,a.useState)([]),[ei,es]=(0,a.useState)("__none__"),[ea,er]=(0,a.useState)(!1),[en,eo]=(0,a.useState)(null),[el,ed]=(0,a.useState)(""),[ec,ep]=(0,a.useState)([]),[ex,em]=(0,a.useState)([]),{copied:eu,copy:eh}=(0,u.C)(),ey=y?{id:y.id,name:y.name||("anthropic-compatible"===y.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===y.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===y.type?"AC":"OC",apiType:y.apiType,baseUrl:y.baseUrl,type:y.type}:x.zN[i]||x.fg[i]||x.IS[i]||x.nJ[i],ef=!!x.zN[i]||!!x.IS[i],eg=(0,m.KC)(i),eb=(0,x.wG)(i),ev=(0,x.mq)(i),ej=(0,x.gb)(i),eN=ev||ej,ek=eN?i:eb,ew=eN?y?.prefix||i:eb,eC=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&J(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]);(0,a.useEffect)(()=>{"kilocode"===i&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&em(e.models)}).catch(()=>{})},[i]);let eS=(0,a.useCallback)(async()=>{try{let[e,t,s,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),r=await e.json(),o=await t.json(),l=await s.json(),d=a.ok?await a.json():{};if(e.ok){let e=(r.connections||[]).filter(e=>e.provider===i);n(e)}s.ok&&N(l.proxyPools||[]);let c=(d.providerStrategies||{})[i]||{};if(eo(c.fallbackStrategy||null),ed(null!=c.stickyRoundRobinLimit?String(c.stickyRoundRobinLimit):"1"),t.ok){let e=(o.nodes||[]).find(e=>e.id===i)||null;if(!e&&eN)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===i)||null))break}g(e)}}catch(e){console.log("Error fetching connections:",e)}finally{h(!1)}},[i,eN]),eA=async e=>{try{let t=await fetch(`/api/provider-nodes/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(g(s.node),await eS(),q(!1))}catch(e){console.log("Error updating provider node:",e)}},e$=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},r={};e&&(r.fallbackStrategy=e),"round-robin"===e&&""!==t&&(r.stickyRoundRobinLimit=Number(t)||3);let n={...a};0===Object.keys(r).length?delete n[i]:n[i]=r,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:n})})}catch(e){console.log("Error saving provider strategy:",e)}};(0,a.useEffect)(()=>{eS(),eC()},[eS,eC]),(0,a.useEffect)(()=>{let e=(x.zN[i]||x.fg[i]||x.IS[i]||x.nJ[i])?.modelsFetcher;e&&f(e).then(ep)},[i]);let eP=async(e,t,i=eb)=>{let s=`${i}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})});if(e.ok)await eC();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},eT=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await eC()}catch(e){console.log("Error deleting alias:",e)}},eO=async e=>{if(confirm("Delete this connection?"))try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&n(r.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},eE=()=>{eS(),P(!1)},eR=async e=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i,...e})})).ok&&(await eS(),R(!1))}catch(e){console.log("Error saving connection:",e)}},e_=async e=>{try{(await fetch(`/api/providers/${M.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eS(),I(!1))}catch(e){console.log("Error updating connection:",e)}},eI=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&n(i=>i.map(i=>i.id===e?{...i,isActive:t}:i))}catch(e){console.log("Error updating connection status:",e)}},eD=async(e,t)=>{let i=[...r];[i[e],i[t]]=[i[t],i[e]],n(i);try{await Promise.all([fetch(`/api/providers/${i[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${i[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch(e){console.log("Error swapping priority:",e),await eS()}},eq=r.filter(e=>ee.includes(e.id));r.length>0&&(ee.length,r.length),(0,a.useEffect)(()=>{et(e=>e.filter(e=>r.some(t=>t.id===e)))},[r]);let eU=(()=>{if(0===eq.length)return"";let e=new Set(eq.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return"All selected currently unbound";let i=v.find(e=>e.id===t);return`All selected currently bound to ${i?.name||t}`}return"Selected connections have mixed proxy bindings"})(),eK=()=>{ea||K(!1)},eM=async()=>{if(0===ee.length)return;let e="__none__"===ei?null:ei;er(!0);try{let t=[];for(let i of ee)try{let s=await fetch(`/api/providers/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:e})});t.push(s.ok)}catch(e){console.log("Error applying bulk proxy pool for",i,e),t.push(!1)}let i=t.filter(e=>!e).length;i>0&&alert(`Updated with ${i} failed request(s).`),await eS(),et([]),es("__none__"),K(!1)}catch(e){console.log("Error applying bulk proxy pool:",e)}finally{er(!1)}},eL=(0,s.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:r.map((e,t)=>(0,s.jsx)("div",{className:"flex items-stretch",children:(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsx)(k,{connection:e,proxyPools:v,isOAuth:ef,isFirst:0===t,isLast:t===r.length-1,onMoveUp:()=>eD(t,t-1),onMoveDown:()=>eD(t,t+1),onToggleActive:t=>eI(e.id,t),onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&n(i=>i.map(i=>i.id===e.id?{...i,providerSpecificData:{...i.providerSpecificData,proxyPoolId:t||null}}:i))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{L(e),I(!0)},onDelete:()=>eO(e.id)})})},e.id))}),eF=[{value:"__none__",label:"None"},...v.map(e=>({value:e.id,label:e.name}))],eJ=0===ee.length?"Select one or more connections, then click Proxy Action.":eU,ez=ee.length>0&&!ea,eW=(0,s.jsx)(p.aF,{isOpen:U,onClose:eK,title:`Proxy Action (${ee.length} selected)`,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.l6,{label:"Proxy Pool",value:ei,onChange:e=>es(e.target.value),options:eF,placeholder:"None"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:eJ}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Selecting None will unbind selected connections from proxy pool."}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:eM,fullWidth:!0,disabled:!ez,children:ea?"Applying...":"Apply"}),(0,s.jsx)(p.$n,{onClick:eK,variant:"ghost",fullWidth:!0,disabled:ea,children:"Cancel"})]})]})}),eV=async e=>{if(!Q){H(e);try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${ek}/${e}`})}),i=await t.json();B(t=>({...t,[e]:i.ok?"ok":"error"})),Z(i.ok?"":i.error||"Model not reachable")}catch{B(t=>({...t,[e]:"error"})),Z("Network error")}finally{H(null)}}};return l?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsx)(p.Qv,{}),(0,s.jsx)(p.Qv,{})]}):ey?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("div",{className:"rounded-lg flex items-center justify-center",style:{backgroundColor:`${ey.color}15`},children:z?(0,s.jsx)("span",{className:"text-sm font-bold",style:{color:ey.color},children:ey.textIcon||ey.id.slice(0,2).toUpperCase()}):(0,s.jsx)(c.default,{src:ev&&ey.apiType?"responses"===ey.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":ej?"/providers/anthropic-m.png":`/providers/${ey.id}.png`,alt:ey.name,width:48,height:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",sizes:"48px",onError:()=>W(!0)})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:ey.name}),(0,s.jsxs)("p",{className:"text-text-muted",children:[r.length," connection",1===r.length?"":"s"]})]})]})]}),ey.deprecated&&(0,s.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02] border border-black/[0.05] dark:border-white/[0.05]",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted mt-0.5 shrink-0",children:"info"}),(0,s.jsx)("p",{className:"text-xs text-text-muted leading-relaxed",children:ey.deprecationNotice})]}),ey.notice&&!ey.deprecated&&(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02] border border-black/[0.05] dark:border-white/[0.05]",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted shrink-0",children:"info"}),(0,s.jsx)("p",{className:"text-xs text-text-muted leading-relaxed",children:ey.notice.text}),ey.notice.apiKeyUrl&&(0,s.jsx)("a",{href:ey.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline shrink-0",children:"Get API Key →"})]}),eN&&y&&(0,s.jsxs)(p.Zp,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:ej?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:[ej?"Messages API":"responses"===y.apiType?"Responses API":"Chat Completions"," \xb7 ",(y.baseUrl||"").replace(/\/$/,""),"/",ej?"messages":"responses"===y.apiType?"responses":"chat/completions"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>R(!0),disabled:r.length>0,children:"Add"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>q(!0),children:"Edit"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{if(confirm(`Delete this ${ej?"Anthropic":"OpenAI"} Compatible node?`))try{(await fetch(`/api/provider-nodes/${i}`,{method:"DELETE"})).ok&&t.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}},children:"Delete"})]})]}),r.length>0&&(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Only one connection is allowed per compatible node. Add another node if you need more connections."})]}),(0,s.jsxs)(p.Zp,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,s.jsx)(p.lM,{checked:"round-robin"===en,onChange:e=>{let t=e?"round-robin":null,i=e?el||"1":el;e&&!el&&ed("1"),eo(t),e$(t,i)}}),"round-robin"===en&&(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,s.jsx)("input",{type:"number",min:1,value:el,onChange:e=>{var t;ed(t=e.target.value),e$("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]}),0===r.length?(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:ef?"lock":"key"})}),(0,s.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No connections yet"}),(0,s.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Add your first connection to get started"}),!eN&&(0,s.jsxs)("div",{className:"flex gap-2 justify-center",children:["iflow"===i&&(0,s.jsx)(p.$n,{icon:"cookie",variant:"secondary",onClick:()=>O(!0),children:"Cookie Auth"}),(0,s.jsx)(p.$n,{icon:"add",onClick:()=>ef?P(!0):R(!0),children:"iflow"===i?"OAuth":"Add Connection"})]})]}):(0,s.jsxs)(s.Fragment,{children:[eL,!eN&&(0,s.jsxs)("div",{className:"flex gap-2 mt-4",children:["iflow"===i&&(0,s.jsx)(p.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>O(!0),title:"Add connection using browser cookie",children:"Cookie"}),(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>ef?P(!0):R(!0),children:"Add"})]})]})]}),(0,s.jsxs)(p.Zp,{children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"})}),!!G&&(0,s.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:G}),(()=>{let e,t;if(eN)return(0,s.jsx)(j,{providerStorageAlias:ek,providerDisplayAlias:ew,modelAliases:F,copied:eu,onCopy:eh,onSetAlias:eP,onDeleteAlias:eT,connections:r,isAnthropic:ej});let a=[...eg,...ex.filter(e=>!eg.some(t=>t.id===e.id))],n=Object.entries(F).filter(([e,t])=>{let i=`${ek}/`;if(!t.startsWith(i))return!1;let s=t.slice(i.length);return ey.passthroughModels?!eg.some(e=>e.id===s):!eg.some(e=>e.id===s)&&e===s}).map(([e,t])=>({id:t.slice(`${ek}/`.length),alias:e,fullModel:t}));return(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[a.map(e=>{let t=`${ek}/${e.id}`,a=`${i}/${e.id}`,n=Object.entries(F).find(([,e])=>e===t||e===a)?.[0];return(0,s.jsx)(b,{model:e,fullModel:`${ew}/${e.id}`,alias:n,copied:eu,onCopy:eh,onSetAlias:t=>eP(e.id,t,ek),onDeleteAlias:()=>eT(n),testStatus:V[e.id],onTest:r.length>0?()=>eV(e.id):void 0,isTesting:Q===e.id,isFree:e.isFree},e.id)}),n.map(e=>(0,s.jsx)(b,{model:{id:e.id},fullModel:`${ew}/${e.id}`,alias:e.alias,copied:eu,onCopy:eh,onSetAlias:()=>{},onDeleteAlias:()=>eT(e.alias),testStatus:V[e.id],onTest:r.length>0?()=>eV(e.id):void 0,isTesting:Q===e.id,isCustom:!0},e.id)),(0,s.jsxs)("button",{onClick:()=>Y(!0),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg border border-dashed border-black/15 dark:border-white/15 text-xs text-text-muted hover:text-primary hover:border-primary/40 transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),ec.length>0&&(e=new Set(Object.values(F)),0===(t=ec.filter(t=>!e.has(`${ek}/${t.id}`))).length?null:(0,s.jsxs)("div",{className:"w-full mt-2",children:[(0,s.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:t.map(e=>(0,s.jsxs)("button",{onClick:async()=>{let t=e.id.split("/").pop();await eP(e.id,t,ek)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]}))]})})()]}),eW,"kiro"===i?(0,s.jsx)(p.Mh,{isOpen:$,providerInfo:ey,onSuccess:eE,onClose:()=>P(!1)}):"cursor"===i?(0,s.jsx)(p.G9,{isOpen:$,onSuccess:eE,onClose:()=>P(!1)}):"gitlab"===i?(0,s.jsx)(p.vj,{isOpen:$,providerInfo:ey,onSuccess:eE,onClose:()=>P(!1)}):(0,s.jsx)(p.LF,{isOpen:$,provider:i,providerInfo:ey,onSuccess:eE,onClose:()=>P(!1)}),"iflow"===i&&(0,s.jsx)(p.vE,{isOpen:T,onSuccess:()=>{eS(),O(!1)},onClose:()=>O(!1)}),(0,s.jsx)(w,{isOpen:E,provider:i,providerName:ey.name,isCompatible:eN,isAnthropic:ej,proxyPools:v,onSave:eR,onClose:()=>R(!1)}),(0,s.jsx)(C,{isOpen:_,connection:M,proxyPools:v,onSave:e_,onClose:()=>I(!1)}),eN&&(0,s.jsx)(S,{isOpen:D,node:y,onSave:eA,onClose:()=>q(!1),isAnthropic:ej}),!eN&&(0,s.jsx)(A,{isOpen:X,providerAlias:ek,providerDisplayAlias:ew,onSave:async e=>{let t=ey?.passthroughModels?e.split("/").pop():e;await eP(e,t,ek),Y(!1)},onClose:()=>Y(!1)})]}):(0,s.jsxs)("div",{className:"text-center py-20",children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,s.jsx)(d(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}function b({model:e,fullModel:t,alias:i,copied:a,onCopy:r,testStatus:n,isCustom:o,isFree:l,onDeleteAlias:d,onTest:c,isTesting:p}){let x="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0;return(0,s.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===n?"border-green-500/40":"error"===n?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base",style:x?{color:x}:void 0,children:"ok"===n?"check_circle":"error"===n?"cancel":"smart_toy"}),(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),c&&(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:c,disabled:p,className:`p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-opacity ${p?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",style:p?{animation:"spin 1s linear infinite"}:void 0,children:p?"progress_activity":"science"})}),(0,s.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:p?"Testing...":"Test"})]}),(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:()=>r(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})}),(0,s.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:a===`model-${e.id}`?"Copied!":"Copy"})]}),o&&(0,s.jsx)("button",{onClick:d,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity ml-auto",title:"Remove custom model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})})]})})}function v({modelId:e,fullModel:t,copied:i,onCopy:a,onDeleteAlias:r,onTest:n,testStatus:o,isTesting:l}){let d="ok"===o?"#22c55e":"error"===o?"#ef4444":void 0;return(0,s.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===o?"border-green-500/40":"error"===o?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:d?{color:d}:void 0,children:"ok"===o?"check_circle":"error"===o?"cancel":"smart_toy"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:()=>a(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:i===`model-${e}`?"check":"content_copy"})}),(0,s.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:i===`model-${e}`?"Copied!":"Copy"})]}),n&&(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:n,disabled:l,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",style:l?{animation:"spin 1s linear infinite"}:void 0,children:l?"progress_activity":"science"})}),(0,s.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:l?"Testing...":"Test"})]})]})]}),(0,s.jsx)("button",{onClick:r,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function j({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:i,copied:r,onCopy:n,onSetAlias:o,onDeleteAlias:l,connections:d,isAnthropic:c}){let[x,m]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(!1),[g,b]=(0,a.useState)(null),[N,k]=(0,a.useState)({}),w=async t=>{if(!g){b(t);try{let i=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${e}/${t}`})}),s=await i.json();k(e=>({...e,[t]:s.ok?"ok":"error"}))}catch{k(e=>({...e,[t]:"error"}))}finally{b(null)}}},C=Object.entries(i).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,i])=>({modelId:i.replace(`${e}/`,""),fullModel:i,alias:t})),S=s=>{let a,r=`${e}/${s}`;if(Object.values(i).includes(r))return null;let n=(a=s.split("/"))[a.length-1];if(!i[n])return n;let o=`${t}-${n}`;return i[o]?null:o},A=async()=>{if(!x.trim()||u)return;let t=x.trim(),i=S(t);if(!i)return void alert("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");h(!0);try{await o(t,i,e),m("")}catch(e){console.log("Error adding model:",e)}finally{h(!1)}},$=async()=>{if(y)return;let t=d.find(e=>!1!==e.isActive);if(t){f(!0);try{let i=await fetch(`/api/providers/${t.id}/models`),s=await i.json();if(!i.ok)return void alert(s.error||"Failed to import models");let a=s.models||[];if(0===a.length)return void alert("No models returned from /models.");let r=0;for(let t of a){let i=t.id||t.name||t.model;if(!i)continue;let s=S(i);s&&(await o(i,s,e),r+=1)}0===r&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{f(!1)}}},P=d.some(e=>!1!==e.isActive);return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",c?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,s.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,s.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{id:"new-compatible-model-input",type:"text",value:x,onChange:e=>m(e.target.value),onKeyDown:e=>"Enter"===e.key&&A(),placeholder:c?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,s.jsx)(p.$n,{size:"sm",icon:"add",onClick:A,disabled:!x.trim()||u,children:u?"Adding...":"Add"}),(0,s.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"download",onClick:$,disabled:!P||y,children:y?"Importing...":"Import from /models"})]}),!P&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),C.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:C.map(({modelId:e,fullModel:i,alias:a})=>(0,s.jsx)(v,{modelId:e,fullModel:`${t}/${e}`,copied:r,onCopy:n,onDeleteAlias:()=>l(a),onTest:d.length>0?()=>w(e):void 0,testStatus:N[e],isTesting:g===e},i))})]})}function N({until:e}){let[t,i]=(0,a.useState)("");return((0,a.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void i("");let s=Math.floor(t/1e3);if(s<60)i(`${s}s`);else if(s<3600)i(`${Math.floor(s/60)}m ${s%60}s`);else{let e=Math.floor(s/3600),t=Math.floor(s%3600/60);i(`${e}h ${t}m`)}};t();let s=setInterval(t,1e3);return()=>clearInterval(s)},[e]),t)?(0,s.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function k({connection:e,proxyPools:t,isOAuth:i,isFirst:r,isLast:n,onMoveUp:o,onMoveDown:l,onToggleActive:d,onUpdateProxy:c,onEdit:x,onDelete:m}){let[u,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(!1),g=(0,a.useRef)(null),b=new Map((t||[]).map(e=>[e.id,e])),v=e.providerSpecificData?.proxyPoolId||null,j=v?b.get(v):null,w=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,C=!!v||w,S=j?`Pool: ${j.name}`:v?`Pool: ${v} (inactive/missing)`:w?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",A="";if(j?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=j?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);A=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{A=t}}let $=j?.noProxy||e.providerSpecificData?.connectionNoProxy||"",P="default";j?.isActive===!0?P="success":(v||w)&&(P="error"),(0,a.useEffect)(()=>{if(!u)return;let e=e=>{g.current&&!g.current.contains(e.target)&&h(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u]);let T=async e=>{f(!0);try{await c("__none__"===e?null:e)}finally{f(!1),h(!1)}},O=i?e.name||e.email||e.displayName||"OAuth Account":e.name,[E,R]=(0,a.useState)(!1),_=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,a.useEffect)(()=>{let t=()=>{R(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let i=_?setInterval(t,1e3):null;return()=>{i&&clearInterval(i)}},[_]);let I="unavailable"!==e.testStatus||E?e.testStatus:"active";return(0,s.jsxs)("div",{className:`group flex items-center justify-between p-3 rounded-lg hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("button",{onClick:o,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:l,disabled:n,className:`p-0.5 rounded ${n?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:i?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:O}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,s.jsx)(p.Ex,{variant:!1===e.isActive?"default":"active"===I||"success"===I?"success":"error"===I||"expired"===I||"unavailable"===I?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":I||"Unknown"}),C&&(0,s.jsx)(p.Ex,{variant:P,size:"sm",children:"Proxy"}),E&&!1!==e.isActive&&(0,s.jsx)(N,{until:_}),e.lastError&&!1!==e.isActive&&(0,s.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:e.lastError,children:e.lastError}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]})]}),C&&(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,s.jsx)("span",{className:"text-[11px] text-text-muted truncate max-w-[420px]",title:S,children:S}),A&&(0,s.jsx)("code",{className:"text-[10px] font-mono bg-black/5 dark:bg-white/5 px-1 py-0.5 rounded text-text-muted",children:A}),$&&(0,s.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:$,children:["no_proxy: ",$]})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("div",{className:"flex gap-1",children:[(t||[]).length>0&&(0,s.jsxs)("div",{className:"relative",ref:g,children:[(0,s.jsxs)("button",{onClick:()=>h(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${C?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),u&&(0,s.jsxs)("div",{className:"absolute right-0 top-full mt-1 z-50 bg-bg border border-border rounded-lg shadow-lg py-1 min-w-[160px]",children:[(0,s.jsx)("button",{onClick:()=>T("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!v?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,s.jsx)("button",{onClick:()=>T(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${v===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,s.jsxs)("button",{onClick:x,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,s.jsxs)("button",{onClick:m,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-red-500/10 text-red-500",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,s.jsx)(p.lM,{size:"sm",checked:e.isActive??!0,onChange:d,title:e.isActive??!0?"Disable connection":"Enable connection"})]})]})}function w({isOpen:e,provider:t,providerName:i,isCompatible:r,isAnthropic:n,proxyPools:o,onSave:l,onClose:d}){let c="__none__",[x,m]=(0,a.useState)({name:"",apiKey:"",priority:1,proxyPoolId:c}),[u,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(null),[g,b]=(0,a.useState)(!1),v=async()=>{h(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:x.apiKey})}),i=await e.json();f(i.valid?"success":"failed")}catch{f("failed")}finally{h(!1)}},j=async()=>{if(t&&x.apiKey){b(!0);try{let e=!1;try{h(!0),f(null);let i=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:x.apiKey})});e=!!(await i.json()).valid,f(e?"success":"failed")}catch{f("failed")}finally{h(!1)}await l({name:x.name,apiKey:x.apiKey,priority:x.priority,proxyPoolId:x.proxyPoolId===c?null:x.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:void 0})}finally{b(!1)}}};return t?(0,s.jsx)(p.aF,{isOpen:e,title:`Add ${i||t} API Key`,onClose:d,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:x.name,onChange:e=>m({...x,name:e.target.value}),placeholder:"Production Key"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.pd,{label:"API Key",type:"password",value:x.apiKey,onChange:e=>m({...x,apiKey:e.target.value}),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:v,disabled:!x.apiKey||u||g,variant:"secondary",children:u?"Checking...":"Check"})})]}),y&&(0,s.jsx)(p.Ex,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"}),r&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:n?`Validation checks ${i||"Anthropic Compatible"} by verifying the API key.`:`Validation checks ${i||"OpenAI Compatible"} via /models on your base URL.`}),(0,s.jsx)(p.pd,{label:"Priority",type:"number",value:x.priority,onChange:e=>m({...x,priority:Number.parseInt(e.target.value)||1})}),(0,s.jsx)(p.l6,{label:"Proxy Pool",value:x.proxyPoolId,onChange:e=>m({...x,proxyPoolId:e.target.value}),options:[{value:c,label:"None"},...(o||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(o||[]).length&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:j,fullWidth:!0,disabled:!x.name||!x.apiKey||g,children:g?"Saving...":"Save"}),(0,s.jsx)(p.$n,{onClick:d,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function C({isOpen:e,connection:t,proxyPools:i,onSave:r,onClose:n}){let[o,l]=(0,a.useState)({name:"",priority:1,apiKey:""}),[d,c]=(0,a.useState)(!1),[m,u]=(0,a.useState)(null),[h,y]=(0,a.useState)(!1),[f,g]=(0,a.useState)(null),[b,v]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(l({name:t.name||"",priority:t.priority||1,apiKey:""}),u(null),g(null))},[t]);let j=async()=>{if(t?.provider){c(!0),u(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),i=await e.json();u(i.valid?"success":"failed")}catch{u("failed")}finally{c(!1)}}},N=async()=>{if(t?.provider&&o.apiKey){y(!0),g(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:o.apiKey})}),i=await e.json();g(i.valid?"success":"failed")}catch{g("failed")}finally{y(!1)}}},k=async()=>{v(!0);try{let e={name:o.name,priority:o.priority};if(!w&&o.apiKey){e.apiKey=o.apiKey;let i="success"===f;if(!i)try{y(!0),g(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:o.apiKey})});i=!!(await e.json()).valid,g(i?"success":"failed")}catch{g("failed")}finally{y(!1)}i&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null)}await r(e)}finally{v(!1)}};if(!t)return null;let w="oauth"===t.authType,S=(0,x.mq)(t.provider)||(0,x.gb)(t.provider);return(0,s.jsx)(p.aF,{isOpen:e,title:"Edit Connection",onClose:n,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:o.name,onChange:e=>l({...o,name:e.target.value}),placeholder:w?"Account name":"Production Key"}),w&&t.email&&(0,s.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,s.jsx)("p",{className:"font-medium",children:t.email})]}),(0,s.jsx)(p.pd,{label:"Priority",type:"number",value:o.priority,onChange:e=>l({...o,priority:Number.parseInt(e.target.value)||1})}),!w&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.pd,{label:"API Key",type:"password",value:o.apiKey,onChange:e=>l({...o,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:N,disabled:!o.apiKey||h||b,variant:"secondary",children:h?"Checking...":"Check"})})]}),f&&(0,s.jsx)(p.Ex,{variant:"success"===f?"success":"error",children:"success"===f?"Valid":"Invalid"})]}),!S&&(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(p.$n,{onClick:j,variant:"secondary",disabled:d,children:d?"Testing...":"Test Connection"}),m&&(0,s.jsx)(p.Ex,{variant:"success"===m?"success":"error",children:"success"===m?"Valid":"Failed"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:k,fullWidth:!0,disabled:b,children:b?"Saving...":"Save"}),(0,s.jsx)(p.$n,{onClick:n,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function S({isOpen:e,node:t,onSave:i,onClose:r,isAnthropic:n}){let[o,l]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[d,c]=(0,a.useState)(!1),[x,m]=(0,a.useState)(""),[u,h]=(0,a.useState)(""),[y,f]=(0,a.useState)(!1),[g,b]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&l({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(n?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,n]);let v=async()=>{if(o.name.trim()&&o.prefix.trim()&&o.baseUrl.trim()){c(!0);try{let e={name:o.name,prefix:o.prefix,baseUrl:o.baseUrl};n||(e.apiType=o.apiType),await i(e)}finally{c(!1)}}},j=async()=>{f(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:o.baseUrl,apiKey:x,type:n?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{f(!1)}};return t?(0,s.jsx)(p.aF,{isOpen:e,title:`Edit ${n?"Anthropic":"OpenAI"} Compatible`,onClose:r,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(p.pd,{label:"Name",value:o.name,onChange:e=>l({...o,name:e.target.value}),placeholder:`${n?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,s.jsx)(p.pd,{label:"Prefix",value:o.prefix,onChange:e=>l({...o,prefix:e.target.value}),placeholder:n?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!n&&(0,s.jsx)(p.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:o.apiType,onChange:e=>l({...o,apiType:e.target.value})}),(0,s.jsx)(p.pd,{label:"Base URL",value:o.baseUrl,onChange:e=>l({...o,baseUrl:e.target.value}),placeholder:n?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${n?"Anthropic":"OpenAI"}-compatible API.`}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.pd,{label:"API Key (for Check)",type:"password",value:x,onChange:e=>m(e.target.value),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(p.$n,{onClick:j,disabled:!x||y||!o.baseUrl.trim(),variant:"secondary",children:y?"Checking...":"Check"})})]}),(0,s.jsx)(p.pd,{label:"Model ID (optional)",value:u,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),g&&(0,s.jsx)(p.Ex,{variant:"success"===g?"success":"error",children:"success"===g?"Valid":"Invalid"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.$n,{onClick:v,fullWidth:!0,disabled:!o.name.trim()||!o.prefix.trim()||!o.baseUrl.trim()||d,children:d?"Saving...":"Save"}),(0,s.jsx)(p.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function A({isOpen:e,providerAlias:t,providerDisplayAlias:i,onSave:r,onClose:n}){let[o,l]=(0,a.useState)(""),[d,c]=(0,a.useState)(null),[x,m]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e&&(l(""),c(null),m(""))},[e]);let y=async()=>{if(o.trim()){c("testing"),m("");try{let e=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${o.trim()}`})}),i=await e.json();c(i.ok?"ok":"error"),m(i.error||"")}catch(e){c("error"),m(e.message)}}},f=async()=>{if(o.trim()&&!u){h(!0);try{await r(o.trim())}finally{h(!1)}}};return(0,s.jsx)(p.aF,{isOpen:e,onClose:n,title:"Add Custom Model",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:o,onChange:e=>{l(e.target.value),c(null),m("")},onKeyDown:e=>{"Enter"===e.key&&y()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,s.jsx)(p.$n,{variant:"secondary",icon:"science",loading:"testing"===d,onClick:y,disabled:!o.trim()||"testing"===d,children:"testing"===d?"Testing...":"Test"})]}),(0,s.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,s.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:o.trim()||"model-id"})]})]}),"ok"===d&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===d&&(0,s.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,s.jsx)("span",{children:x||"Model not reachable"})]}),(0,s.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,s.jsx)(p.$n,{onClick:n,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,s.jsx)(p.$n,{onClick:f,fullWidth:!0,size:"sm",disabled:!o.trim()||u,children:u?"Adding...":"Add Model"})]})]})})}b.propTypes={model:n().shape({id:n().string.isRequired}).isRequired,fullModel:n().string.isRequired,alias:n().string,copied:n().string,onCopy:n().func.isRequired,testStatus:n().oneOf(["ok","error"]),isCustom:n().bool,isFree:n().bool,onDeleteAlias:n().func,onTest:n().func,isTesting:n().bool},n().string.isRequired,n().object.isRequired,n().string,n().func.isRequired,n().func.isRequired,n().func.isRequired,v.propTypes={modelId:n().string.isRequired,fullModel:n().string.isRequired,copied:n().string,onCopy:n().func.isRequired,onDeleteAlias:n().func.isRequired,onTest:n().func,testStatus:n().oneOf(["ok","error"]),isTesting:n().bool},j.propTypes={providerStorageAlias:n().string.isRequired,providerDisplayAlias:n().string.isRequired,modelAliases:n().object.isRequired,copied:n().string,onCopy:n().func.isRequired,onSetAlias:n().func.isRequired,onDeleteAlias:n().func.isRequired,connections:n().arrayOf(n().shape({id:n().string,isActive:n().bool})).isRequired,isAnthropic:n().bool},N.propTypes={until:n().string.isRequired},k.propTypes={connection:n().shape({id:n().string,name:n().string,email:n().string,displayName:n().string,modelLockUntil:n().string,testStatus:n().string,isActive:n().bool,lastError:n().string,priority:n().number,globalPriority:n().number}).isRequired,proxyPools:n().arrayOf(n().shape({id:n().string,name:n().string,proxyUrl:n().string,noProxy:n().string,isActive:n().bool})),isOAuth:n().bool.isRequired,isFirst:n().bool.isRequired,isLast:n().bool.isRequired,onMoveUp:n().func.isRequired,onMoveDown:n().func.isRequired,onToggleActive:n().func.isRequired,onUpdateProxy:n().func,onEdit:n().func.isRequired,onDelete:n().func.isRequired},w.propTypes={isOpen:n().bool.isRequired,provider:n().string,providerName:n().string,isCompatible:n().bool,isAnthropic:n().bool,proxyPools:n().arrayOf(n().shape({id:n().string,name:n().string})),onSave:n().func.isRequired,onClose:n().func.isRequired},C.propTypes={isOpen:n().bool.isRequired,connection:n().shape({id:n().string,name:n().string,email:n().string,priority:n().number,authType:n().string,provider:n().string,providerSpecificData:n().object}),proxyPools:n().arrayOf(n().shape({id:n().string,name:n().string})),onSave:n().func.isRequired,onClose:n().func.isRequired},S.propTypes={isOpen:n().bool.isRequired,node:n().shape({id:n().string,name:n().string,prefix:n().string,apiType:n().string,baseUrl:n().string}),onSave:n().func.isRequired,onClose:n().func.isRequired,isAnthropic:n().bool},A.propTypes={isOpen:n().bool.isRequired,providerAlias:n().string.isRequired,providerDisplayAlias:n().string.isRequired,onSave:n().func.isRequired,onClose:n().func.isRequired}}},e=>{e.O(0,[7848,4335,2599,8872,350,4156,2347,5158,7358],()=>e(e.s=7207)),_N_E=e.O()}]);