n9router 0.4.41 → 0.4.43

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 (291) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +11 -11
  3. package/app/.next/build-manifest.json +2 -2
  4. package/app/.next/prerender-manifest.json +3 -3
  5. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  6. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  7. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  9. package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  16. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  18. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  19. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  21. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  22. package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  23. package/app/.next/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  24. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  25. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  26. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  27. package/app/.next/server/app/_global-error.html +1 -1
  28. package/app/.next/server/app/_global-error.rsc +1 -1
  29. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  30. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  31. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  32. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  33. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  34. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  35. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  36. package/app/.next/server/app/_not-found.html +1 -1
  37. package/app/.next/server/app/_not-found.rsc +4 -4
  38. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
  39. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  40. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
  41. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  42. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  43. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  44. package/app/.next/server/app/api/cli-tools/all-statuses/route.js +4 -4
  45. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +1 -1
  46. package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
  47. package/app/.next/server/app/api/cli-tools/cline-settings/route.js +2 -2
  48. package/app/.next/server/app/api/cli-tools/codex-settings/route.js +1 -1
  49. package/app/.next/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  50. package/app/.next/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
  51. package/app/.next/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  52. package/app/.next/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  53. package/app/.next/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
  54. package/app/.next/server/app/api/cli-tools/droid-settings/route.js +1 -1
  55. package/app/.next/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  56. package/app/.next/server/app/api/cli-tools/jcode-settings/route.js +1 -1
  57. package/app/.next/server/app/api/cli-tools/kilo-settings/route.js +1 -1
  58. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  59. package/app/.next/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  60. package/app/.next/server/app/api/donate/route.js +1 -1
  61. package/app/.next/server/app/api/models/route.js +1 -1
  62. package/app/.next/server/app/api/models/test/route.js +1 -1
  63. package/app/.next/server/app/api/providers/[id]/test/route.js +1 -1
  64. package/app/.next/server/app/api/providers/[id]/test-models/route.js +1 -1
  65. package/app/.next/server/app/api/providers/route.js +1 -1
  66. package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
  67. package/app/.next/server/app/api/translator/console-logs/stream/route.js +1 -1
  68. package/app/.next/server/app/api/tunnel/tailscale-install/route.js +2 -2
  69. package/app/.next/server/app/api/version/route.js +1 -1
  70. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  71. package/app/.next/server/app/callback.html +1 -1
  72. package/app/.next/server/app/callback.rsc +4 -4
  73. package/app/.next/server/app/callback.segments/_full.segment.rsc +4 -4
  74. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  75. package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
  76. package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
  77. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  78. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  79. package/app/.next/server/app/dashboard/basic-chat.html +1 -1
  80. package/app/.next/server/app/dashboard/basic-chat.rsc +6 -6
  81. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  82. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  83. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  84. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  85. package/app/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
  86. package/app/.next/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  87. package/app/.next/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
  88. package/app/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  89. package/app/.next/server/app/dashboard/cli-tools.html +1 -1
  90. package/app/.next/server/app/dashboard/cli-tools.rsc +6 -6
  91. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  92. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  93. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  94. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  95. package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  96. package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  97. package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
  98. package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  99. package/app/.next/server/app/dashboard/combos.html +1 -1
  100. package/app/.next/server/app/dashboard/combos.rsc +6 -6
  101. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  102. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  103. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  104. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  105. package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
  106. package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  107. package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
  108. package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  109. package/app/.next/server/app/dashboard/endpoint.html +1 -1
  110. package/app/.next/server/app/dashboard/endpoint.rsc +6 -6
  111. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  112. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  113. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  114. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  115. package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
  116. package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  117. package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
  118. package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  119. package/app/.next/server/app/dashboard/media-providers/web.html +1 -1
  120. package/app/.next/server/app/dashboard/media-providers/web.rsc +6 -6
  121. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  122. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  123. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  124. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  125. package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  126. package/app/.next/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
  127. package/app/.next/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  128. package/app/.next/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
  129. package/app/.next/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  130. package/app/.next/server/app/dashboard/mitm.html +1 -1
  131. package/app/.next/server/app/dashboard/mitm.rsc +6 -6
  132. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  133. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  134. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  135. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  136. package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  137. package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  138. package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
  139. package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  140. package/app/.next/server/app/dashboard/profile.html +1 -1
  141. package/app/.next/server/app/dashboard/profile.rsc +6 -6
  142. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  143. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  144. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  145. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  146. package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
  147. package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  148. package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
  149. package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  150. package/app/.next/server/app/dashboard/providers/new.html +1 -1
  151. package/app/.next/server/app/dashboard/providers/new.rsc +6 -6
  152. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  153. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  154. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  155. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  156. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  157. package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
  158. package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  159. package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
  160. package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  161. package/app/.next/server/app/dashboard/providers.html +1 -1
  162. package/app/.next/server/app/dashboard/providers.rsc +6 -6
  163. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  164. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  165. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  166. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  167. package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
  168. package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  169. package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
  170. package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  171. package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
  172. package/app/.next/server/app/dashboard/proxy-pools.rsc +6 -6
  173. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  174. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  175. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  176. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  177. package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
  178. package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  179. package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
  180. package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  181. package/app/.next/server/app/dashboard/quota.html +2 -2
  182. package/app/.next/server/app/dashboard/quota.rsc +7 -7
  183. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  184. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  185. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  186. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  187. package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
  188. package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  189. package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
  190. package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  191. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  192. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  193. package/app/.next/server/app/dashboard/settings/pricing.rsc +4 -4
  194. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  195. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  196. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  197. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  198. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  199. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  200. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  201. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  202. package/app/.next/server/app/dashboard/skills.html +1 -1
  203. package/app/.next/server/app/dashboard/skills.rsc +6 -6
  204. package/app/.next/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  205. package/app/.next/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  206. package/app/.next/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  207. package/app/.next/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  208. package/app/.next/server/app/dashboard/skills.segments/_full.segment.rsc +6 -6
  209. package/app/.next/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  210. package/app/.next/server/app/dashboard/skills.segments/_index.segment.rsc +4 -4
  211. package/app/.next/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  212. package/app/.next/server/app/dashboard/translator.html +1 -1
  213. package/app/.next/server/app/dashboard/translator.rsc +6 -6
  214. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  215. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  216. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  217. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  218. package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
  219. package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  220. package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
  221. package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  222. package/app/.next/server/app/dashboard/usage.html +1 -1
  223. package/app/.next/server/app/dashboard/usage.rsc +6 -6
  224. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  225. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  226. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  227. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  228. package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
  229. package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  230. package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
  231. package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  232. package/app/.next/server/app/dashboard.html +1 -1
  233. package/app/.next/server/app/dashboard.rsc +6 -6
  234. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  235. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  236. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  237. package/app/.next/server/app/dashboard.segments/_full.segment.rsc +6 -6
  238. package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  239. package/app/.next/server/app/dashboard.segments/_index.segment.rsc +4 -4
  240. package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  241. package/app/.next/server/app/index.html +1 -1
  242. package/app/.next/server/app/index.rsc +4 -4
  243. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  244. package/app/.next/server/app/index.segments/_full.segment.rsc +4 -4
  245. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  246. package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
  247. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  248. package/app/.next/server/app/landing/page.js +1 -1
  249. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  250. package/app/.next/server/app/landing.html +1 -1
  251. package/app/.next/server/app/landing.rsc +4 -4
  252. package/app/.next/server/app/landing.segments/_full.segment.rsc +4 -4
  253. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  254. package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
  255. package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
  256. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  257. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  258. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  259. package/app/.next/server/app/login.html +1 -1
  260. package/app/.next/server/app/login.rsc +5 -5
  261. package/app/.next/server/app/login.segments/_full.segment.rsc +5 -5
  262. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  263. package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
  264. package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  265. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  266. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  267. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  268. package/app/.next/server/app-paths-manifest.json +11 -11
  269. package/app/.next/server/chunks/3110.js +1 -1
  270. package/app/.next/server/chunks/3588.js +1 -1
  271. package/app/.next/server/chunks/412.js +1 -1
  272. package/app/.next/server/chunks/5995.js +1 -1
  273. package/app/.next/server/chunks/6251.js +1 -1
  274. package/app/.next/server/chunks/6811.js +1 -1
  275. package/app/.next/server/chunks/9807.js +1 -1
  276. package/app/.next/server/middleware-build-manifest.js +1 -1
  277. package/app/.next/server/pages/404.html +1 -1
  278. package/app/.next/server/pages/500.html +1 -1
  279. package/app/.next/server/server-reference-manifest.js +1 -1
  280. package/app/.next/server/server-reference-manifest.json +1 -1
  281. package/app/.next/static/chunks/{1321-25379bf821e14ce8.js → 1321-03808de72db0a766.js} +1 -1
  282. package/app/.next/static/chunks/{4406-05ac5641472f331e.js → 4406-abc51cf55210026c.js} +5 -5
  283. package/app/.next/static/chunks/{5497-73d5899267432022.js → 5497-6693628388854075.js} +1 -1
  284. package/app/.next/static/css/{440b3581c215aef0.css → 958bcd529c8d4b7c.css} +1 -1
  285. package/app/package.json +1 -1
  286. package/app/src/mitm/server.js +66 -41
  287. package/app/src/mitm/tokenPool.js +147 -13
  288. package/app/src/mitm/tokenSwapRetry.js +108 -0
  289. package/package.json +1 -1
  290. /package/app/.next/static/{II4U3Zq-L5XToPtNDSJfG → p_zZZ7bGM2zUCztNMVhuB}/_buildManifest.js +0 -0
  291. /package/app/.next/static/{II4U3Zq-L5XToPtNDSJfG → p_zZZ7bGM2zUCztNMVhuB}/_ssgManifest.js +0 -0
@@ -4,4 +4,4 @@
4
4
  `,children:[g.includes(e.name)&&(0,r.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),e.name]},e.id)})})]}),Object.entries(z).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)(o.A,{src:`/providers/${e}.png`,alt:t.name,size:14,fallbackText:(t.name||e).slice(0,2).toUpperCase(),fallbackColor: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=n===e.value,s=e.isPlaceholder;return(0,r.jsx)("button",{onClick:()=>q(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":g.includes(e.value)?"bg-primary border-primary text-white hover:bg-primary-hover":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
7
- `,children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[g.includes(e.value)&&!s&&(0,r.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),e.name]}):e.isCustom?(0,r.jsxs)(r.Fragment,{children:[e.name,(0,r.jsx)("span",{className:"text-[9px] opacity-60 font-normal",children:"custom"})]}):e.name]})},e.value)})})]},e)),0===Object.keys(z).length&&0===L.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"})]})]})]})}u.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onSelect:n().func.isRequired,onDeselect:n().func,selectedModel:n().string,activeProviders:n().arrayOf(n().shape({provider:n().string.isRequired})),title:n().string,modelAliases:n().object,kindFilter:n().string,addedModelValues:n().arrayOf(n().string),closeOnSelect:n().bool}},73579:(e,t,s)=>{s.d(t,{default:()=>p});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(81127),o=s(11910),d=s(92542),c=s(56061),m=s(52679),x=s(98),u=s(11017);function p({isOpen:e,connection:t,proxyPools:s,onSave:l,onClose:n}){let[h,f]=(0,a.useState)({name:"",priority:1,apiKey:"",accountType:""}),[b,g]=(0,a.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[j,y]=(0,a.useState)({accountId:""}),[v,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null),[C,S]=(0,a.useState)(!1),[T,P]=(0,a.useState)(null),[O,R]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(f({name:t.name||"",priority:t.priority||1,apiKey:"",accountType:t.accountType||""}),"azure"===t.provider&&t.providerSpecificData&&g({azureEndpoint:t.providerSpecificData.azureEndpoint||"",apiVersion:t.providerSpecificData.apiVersion||"2024-10-01-preview",deployment:t.providerSpecificData.deployment||"",organization:t.providerSpecificData.organization||""}),"cloudflare-ai"===t.provider&&t.providerSpecificData&&y({accountId:t.providerSpecificData.accountId||""}),k(null),P(null))},[t]);let $=t?.authType==="oauth",E=t?.provider==="azure",I=t?.provider==="cloudflare-ai",A=!!t&&((0,m.mq)(t.provider)||(0,m.gb)(t.provider)),_=async()=>{if(t?.provider){N(!0),k(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),s=await e.json();k(s.valid?"success":"failed")}catch{k("failed")}finally{N(!1)}}},M=async()=>{if(t?.provider&&h.apiKey){S(!0),P(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:h.apiKey,...E?{providerSpecificData:b}:{},...I?{providerSpecificData:j}:{}})}),s=await e.json();P(s.valid?"success":"failed")}catch{P("failed")}finally{S(!1)}}},L=async()=>{if(t){R(!0);try{let e={name:h.name,priority:h.priority};if("antigravity"===t.provider&&(e.accountType=h.accountType||null),!$&&h.apiKey){e.apiKey=h.apiKey;let s="success"===T;if(!s)try{S(!0),P(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:h.apiKey,...E?{providerSpecificData:b}:{},...I?{providerSpecificData:j}:{}})});s=!!(await e.json()).valid,P(s?"success":"failed")}catch{P("failed")}finally{S(!1)}s&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null)}E&&(e.providerSpecificData={azureEndpoint:b.azureEndpoint,apiVersion:b.apiVersion,deployment:b.deployment,organization:b.organization}),I&&(e.providerSpecificData={accountId:j.accountId}),await l(e)}finally{R(!1)}}};return t?(0,r.jsx)(i.default,{isOpen:e,title:"Edit Connection",onClose:n,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(o.default,{label:"Name",value:h.name,onChange:e=>f({...h,name:e.target.value}),placeholder:$?"Account name":"Production Key"}),$&&t.email&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,r.jsx)("p",{className:"font-medium",children:t.email})]}),(0,r.jsx)(o.default,{label:"Priority",type:"number",value:h.priority,onChange:e=>f({...h,priority:Number.parseInt(e.target.value,10)||1})}),t?.provider==="antigravity"&&(0,r.jsx)(x.default,{label:"Account Tier",value:h.accountType,onChange:e=>f({...h,accountType:e.target.value}),options:[{value:"",label:"None"},...u.ji]}),!$&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(o.default,{label:"API Key",type:"password",value:h.apiKey,onChange:e=>f({...h,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(d.default,{onClick:M,disabled:!h.apiKey||C||O,variant:"secondary",children:C?"Checking...":"Check"})})]}),T&&(0,r.jsx)(c.default,{variant:"success"===T?"success":"error",children:"success"===T?"Valid":"Invalid"})]}),E&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,r.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)(o.default,{label:"Azure Endpoint",value:b.azureEndpoint,onChange:e=>g({...b,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com",hint:"Your Azure OpenAI resource endpoint URL"}),(0,r.jsx)(o.default,{label:"Deployment Name",value:b.deployment,onChange:e=>g({...b,deployment:e.target.value}),placeholder:"gpt-4",hint:"The deployment name in your Azure resource"}),(0,r.jsx)(o.default,{label:"API Version",value:b.apiVersion,onChange:e=>g({...b,apiVersion:e.target.value}),placeholder:"2024-10-01-preview",hint:"Azure OpenAI API version to use"}),(0,r.jsx)(o.default,{label:"Organization",value:b.organization,onChange:e=>g({...b,organization:e.target.value}),placeholder:"Organization ID",hint:"Required for billing"})]})]}),!A&&!E&&!I&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(d.default,{onClick:_,variant:"secondary",disabled:v,children:v?"Testing...":"Test Connection"}),w&&(0,r.jsx)(c.default,{variant:"success"===w?"success":"error",children:"success"===w?"Valid":"Failed"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.default,{onClick:L,fullWidth:!0,disabled:O,children:O?"Saving...":"Save"}),(0,r.jsx)(d.default,{onClick:n,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}p.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}},80752:(e,t,s)=>{s.d(t,{default:()=>p});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(93308),o=s(1620),d=s(40197),c=s(14932),m=s(21931);let x={en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (BR)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (PT)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"}};function u({icon:e,label:t,onClick:s,trailing:a,danger:l}){return(0,r.jsxs)("button",{onClick:s,className:`flex items-center gap-3 w-full px-4 py-2.5 text-sm transition-colors ${l?"text-red-500 hover:bg-red-500/10":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[20px] ${l?"":"text-text-muted"}`,children:e}),(0,r.jsx)("span",{className:"flex-1 text-left",children:t}),a&&(0,r.jsx)("span",{className:"text-base",children:a})]})}function p({onLogout:e}){let[t,s]=(0,a.useState)(!1),[l,n]=(0,a.useState)(!1),[h,f]=(0,a.useState)(!1),[b,g]=(0,a.useState)(!1),[j,y]=(0,a.useState)("en"),{toggleTheme:v,isDark:N}=(0,o.D)(),w=(0,a.useRef)(null);return(0,a.useEffect)(()=>{y(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${i.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,i.QC)(t)}())},[b]),(0,a.useEffect)(()=>{let e=e=>{w.current&&!w.current.contains(e.target)&&s(!1)};if(t)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"relative",ref:w,children:[(0,r.jsx)("button",{onClick:()=>s(e=>!e),className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-all",title:"Menu",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"grid_view"})}),t&&(0,r.jsxs)("div",{className:"absolute right-0 top-full mt-2 w-60 bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl z-50 animate-in fade-in zoom-in-95 duration-150 overflow-hidden py-1",children:[(0,r.jsx)(u,{icon:"history",label:"Change Log",onClick:()=>{s(!1),n(!0)}}),(0,r.jsx)(u,{icon:"language",label:x[j]?.name||j,trailing:x[j]?.flag||"\uD83C\uDF10",onClick:()=>{s(!1),g(!0)}}),(0,r.jsx)(u,{icon:N?"light_mode":"dark_mode",label:"Theme",onClick:()=>{v(),s(!1)}}),(0,r.jsx)(u,{icon:"computer",label:"Remote",onClick:()=>{s(!1),f(!0)}}),(0,r.jsx)(u,{icon:"logout",label:"Logout",danger:!0,onClick:()=>{s(!1),e()}})]})]}),(0,r.jsx)(d.default,{isOpen:l,onClose:()=>n(!1)}),(0,r.jsx)(c.A,{isOpen:h,onClose:()=>f(!1)}),(0,r.jsx)(m.default,{hideTrigger:!0,isOpen:b,onClose:e=>{g(!1),y(e)}})]})}u.propTypes={icon:n().string.isRequired,label:n().string.isRequired,onClick:n().func.isRequired,trailing:n().node,danger:n().bool},p.propTypes={onLogout:n().func.isRequired}},81127:(e,t,s)=>{s.d(t,{ConfirmModal:()=>d,default:()=>o});var r=s(95155),a=s(12115),l=s(31474),n=s(92542),i=s(97677);function o({isOpen:e,onClose:t,title:s,children:n,footer:d,size:c="md",closeOnOverlay:m=!0,showTrafficLights:x=!0,className:u}){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/50 backdrop-blur-[2px] fade-in",onClick:m?t:void 0}),(0,r.jsxs)("div",{className:(0,l.cn)("relative w-full bg-surface","border border-border-subtle","rounded-[14px] shadow-[var(--shadow-elev)]","fade-in",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[c],u),children:[(s||x)&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[x&&(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,r.jsx)(i.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,r.jsx)("button",{onClick:t,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,r.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),s&&(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:s})]}),(0,r.jsx)("button",{onClick:t,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main 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(85vh-100px)] overflow-y-auto custom-scrollbar",children:n}),d&&(0,r.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:d})]})]}):null}function d({isOpen:e,onClose:t,onConfirm:s,title:a="Confirm",message:l,confirmText:i="Confirm",cancelText:c="Cancel",variant:m="danger",loading:x=!1}){return(0,r.jsx)(o,{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:i})]}),children:(0,r.jsx)("p",{className:"text-text-muted",children:l})})}},84588:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(95155),a=s(31474);function l({children:e,title:t,subtitle:s,icon:n,action:i,padding:o="md",hover:d=!1,elev:c=!1,className:m,...x}){return(0,r.jsxs)("div",{className:(0,a.cn)("bg-surface border border-border-subtle",c?"rounded-[14px] shadow-[var(--shadow-elev)]":"rounded-[14px] shadow-[var(--shadow-soft)]",d&&"hover:shadow-[var(--shadow-warm)] hover:border-brand-500/30 transition-all cursor-pointer",{none:"",xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8"}[o],m),...x,children:[(t||i)&&(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[n&&(0,r.jsx)("div",{className:"p-2 rounded-[10px] bg-bg text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:n})}),(0,r.jsxs)("div",{children:[t&&(0,r.jsx)("h3",{className:"text-text-main font-semibold",children:t}),s&&(0,r.jsx)("p",{className:"text-sm text-text-muted",children:s})]})]}),i]}),e]})}l.Section=function({children:e,className:t,...s}){return(0,r.jsx)("div",{className:(0,a.cn)("p-4 rounded-[10px]","bg-bg border border-border-subtle",t),...s,children:e})},l.Row=function({children:e,className:t,...s}){return(0,r.jsx)("div",{className:(0,a.cn)("p-3 -mx-3 px-3 transition-colors","border-b border-border-subtle last:border-b-0","hover:bg-surface-2/50",t),...s,children:e})},l.ListItem=function({children:e,actions:t,className:s,...l}){return(0,r.jsxs)("div",{className:(0,a.cn)("group flex items-center justify-between p-3 -mx-3 px-3","border-b border-border-subtle last:border-b-0","hover:bg-surface-2/50 transition-colors",s),...l,children:[(0,r.jsx)("div",{className:"flex-1 min-w-0",children:e}),t&&(0,r.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:t})]})}},90882:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(35497),o=s(11059);function d({isOpen:e,provider:t,providerInfo:s,onSuccess:l,onClose:n,oauthMeta:c,idcConfig:m}){let[x,u]=(0,a.useState)("waiting"),[p,h]=(0,a.useState)(null),[f,b]=(0,a.useState)(""),[g,j]=(0,a.useState)(null),[y,v]=(0,a.useState)(!1),[N,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(!1),S=(0,a.useRef)(null),T=(0,a.useRef)(!1),{copied:P,copy:O}=(0,o.C)(),[R,$]=(0,a.useState)(!1),[E,I]=(0,a.useState)("/callback?code=..."),A=(0,a.useRef)(!1);(0,a.useEffect)(()=>{$("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname),I(`${window.location.origin}/callback?code=...`)},[]);let _=(0,a.useCallback)(async(e,s)=>{if(p)try{let r=await fetch(`/api/oauth/${t}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,redirectUri:p.redirectUri,codeVerifier:p.codeVerifier,state:s,...c?{meta:c}:{}})}),a=await r.json();if(!r.ok)throw Error(a.error);u("success"),l?.()}catch(e){j(e.message),u("error")}},[p,t,l]),M=(0,a.useCallback)(async e=>{if(p?.state)try{let t=await fetch("/api/oauth/xai/manual-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,state:p.state})}),s=await t.json();if(!t.ok)throw Error(s.error);u("success"),l?.()}catch(e){j(e.message),u("error")}},[p,l]),L=(0,a.useCallback)(async(e,s,r,a,n)=>{T.current=!1,C(!0);let i=Date.now()+(Number.isFinite(n)&&n>0?n:12e4);for(;Date.now()<i;){if(T.current){console.log("[OAuthModal] Polling aborted"),C(!1);return}if(await new Promise(e=>setTimeout(e,1e3*r)),T.current){console.log("[OAuthModal] Polling aborted after sleep"),C(!1);return}try{let n=await fetch(`/api/oauth/${t}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:e,codeVerifier:s,extraData:a})}),i=await n.json();if(i.success){T.current=!0,u("success"),C(!1),l?.();return}if("expired_token"===i.error||"access_denied"===i.error)throw Error(i.errorDescription||i.error);"slow_down"===i.error&&(r=Math.min(r+5,30))}catch(e){j(e.message),u("error"),C(!1);return}}j("Authorization timeout"),u("error"),C(!1)},[t,l]),z=(0,a.useCallback)(async()=>{if(t)try{let e;if(j(null),["github","qwen","kiro","kimi-coding","kilocode","codebuddy","qoder"].includes(t)){v(!0),u("waiting");let e=new URL(`/api/oauth/${t}/device-code`,window.location.origin);"kiro"===t&&m?.startUrl&&(e.searchParams.set("start_url",m.startUrl),m.region&&e.searchParams.set("region",m.region),e.searchParams.set("auth_method","idc"));let s=await fetch(e.toString()),r=await s.json();if(!s.ok)throw Error(r.error);w(r);let a=r.verification_uri_complete||r.verification_uri;a&&window.open(a,"_blank","noopener,noreferrer");let l="kiro"===t?{_clientId:r._clientId,_clientSecret:r._clientSecret,_region:r._region,_authMethod:r._authMethod,_startUrl:r._startUrl}:"qoder"===t?{_qoderNonce:r._qoderNonce,_qoderMachineId:r._qoderMachineId,_qoderVerifier:r.codeVerifier}:null;L(r.device_code,r.codeVerifier,r.interval||5,l,Number.isFinite(r.expires_in)&&r.expires_in>0?1e3*r.expires_in:void 0);return}let s=window.location.port||("https:"===window.location.protocol?"443":"80");e="codex"===t?"http://localhost:1455/auth/callback":"xai"===t?"http://127.0.0.1:56121/callback":`http://localhost:${s}/callback`;let r=new URL(`/api/oauth/${t}/authorize`,window.location.origin);r.searchParams.set("redirect_uri",e),c&&Object.entries(c).forEach(([e,t])=>{t&&r.searchParams.set(e,t)});let a=await fetch(r.toString()),l=await a.json();if(!a.ok)throw Error(l.error);let n=!1,i=!1;if("codex"===t)try{let t=new URL("/api/oauth/codex/start-proxy",window.location.origin);t.searchParams.set("app_port",s),t.searchParams.set("state",l.state),t.searchParams.set("code_verifier",l.codeVerifier),t.searchParams.set("redirect_uri",e);let r=await fetch(t.toString()),a=await r.json();n=a.success,i=!!a.serverSide}catch{n=!1}let o=!1,d=!1;if("xai"===t)try{let t=new URL("/api/oauth/xai/start-proxy",window.location.origin);t.searchParams.set("app_port",s),t.searchParams.set("state",l.state),t.searchParams.set("code_verifier",l.codeVerifier),t.searchParams.set("redirect_uri",e);let r=await fetch(t.toString()),a=await r.json();if(o=a.success,d=!!a.serverSide,!o&&"port_busy"===a.reason)throw Error("Port 56121 in use; close the conflicting process and retry")}catch(e){if(e?.message)throw e;o=!1}h({...l,redirectUri:e,codexServerSide:i,xaiServerSide:d}),"codex"===t&&n||"xai"===t&&o||R&&"codex"!==t&&"xai"!==t?(u("waiting"),S.current=window.open(l.authUrl,"oauth_popup","width=600,height=700"),S.current||u("input")):(u("input"),window.open(l.authUrl,"_blank"))}catch(e){j(e.message),u("error")}},[t,R,L,c,m]);(0,a.useEffect)(()=>{e&&t?(h(null),b(""),j(null),v(!1),w(null),C(!1),T.current=!1,z()):e||(T.current=!0,"codex"===t?fetch("/api/oauth/codex/stop-proxy").catch(()=>{}):"xai"===t&&fetch("/api/oauth/xai/stop-proxy").catch(()=>{}))},[e,t,z]),(0,a.useEffect)(()=>{let e=p?.codexServerSide?"codex":p?.xaiServerSide?"xai":null;if(!e||!p?.state||A.current)return;let t=!1,s=0,r=async()=>{if(!t&&!A.current){s+=1;try{let s=await fetch(`/api/oauth/${e}/poll-status?state=${encodeURIComponent(p.state)}`),r=await s.json();if(t||A.current)return;if("done"===r.status){A.current=!0,u("success"),l?.();return}if("error"===r.status){A.current=!0,j(r.error||"Authentication failed"),u("error");return}}catch{}if(s>=200){A.current=!0,j("Authentication timeout"),u("error");return}setTimeout(r,1500)}};return setTimeout(r,1500),()=>{t=!0}},[p,l]),(0,a.useEffect)(()=>{let e;if(!p)return;A.current=!1;let t=async e=>{if(A.current)return;let{code:t,state:s,error:r,errorDescription:a}=e;if(r){A.current=!0,j(a||r),u("error");return}t&&(A.current=!0,await _(t,s))},s=e=>{let s=e.origin.includes("localhost")||e.origin.includes("127.0.0.1"),r=e.origin===window.location.origin;(s||r)&&e.data?.type==="oauth_callback"&&t(e.data.data)};window.addEventListener("message",s);try{(e=new BroadcastChannel("oauth_callback")).onmessage=e=>t(e.data)}catch(e){console.log("BroadcastChannel not supported")}let r=e=>{if("oauth_callback"===e.key&&e.newValue)try{let s=JSON.parse(e.newValue);t(s),localStorage.removeItem("oauth_callback")}catch(e){console.log("Failed to parse localStorage data")}};window.addEventListener("storage",r);try{let e=localStorage.getItem("oauth_callback");if(e){let s=JSON.parse(e);s.timestamp&&Date.now()-s.timestamp<3e4&&t(s),localStorage.removeItem("oauth_callback")}}catch{}return()=>{window.removeEventListener("message",s),window.removeEventListener("storage",r),e&&e.close()}},[p,_]);let q=async()=>{try{j(null);let e=f.trim();if(e.startsWith("eyJ")&&e.includes("."))return void await _(e,null);if("xai"===t&&e&&!e.includes("://")&&!e.includes("?")&&!e.includes("code="))return void await M(e);let s=new URL(e),r=s.searchParams.get("code"),a=s.searchParams.get("state"),l=s.searchParams.get("error");if(l)throw Error(s.searchParams.get("error_description")||l);if(!r)throw Error("xai"===t?"Paste the callback URL or copied xAI code":"No authorization code found in URL");await _(r,a)}catch(e){j(e.message),u("error")}},U=(0,a.useCallback)(()=>{"codex"===t?fetch("/api/oauth/codex/stop-proxy").catch(()=>{}):"xai"===t&&fetch("/api/oauth/xai/stop-proxy").catch(()=>{}),n()},[n,t]);if(!t||!s)return null;let F="xai"===t,D=N?.verification_uri_complete||N?.verification_uri||"",W=F?"Connect Grok Build OAuth":`Connect ${s.name}`;return(0,r.jsx)(i.aF,{isOpen:e,title:W,onClose:U,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[("waiting"===x||"input"===x)&&!y&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,r.jsx)("span",{className:"text-sm",children:F?"Waiting for Grok Build OAuth…":"Waiting for popup authorization…"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,r.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,r.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,r.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 1: Open this ",F?"Grok Build OAuth URL":"URL"," in your browser"]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.pd,{value:p?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===P?"check":"content_copy",onClick:()=>O(p?.authUrl,"auth_url"),disabled:!p?.authUrl,children:"Copy"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 2: Paste the ","xai"===t?"callback URL or copied code":"callback URL"," here"]}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"xai"===t?"If xAI shows a code instead of redirecting, paste that code here.":"After authorization, copy the full URL from your browser."}),(0,r.jsx)(i.pd,{value:f,onChange:e=>b(e.target.value),placeholder:F?"http://127.0.0.1:56121/callback?code=... or copied code":E,className:"font-mono text-xs"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:q,fullWidth:!0,disabled:!f,children:"Connect"}),(0,r.jsx)(i.$n,{onClick:U,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"waiting"===x&&y&&N&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"text-center py-4",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the login URL below and authorize:"}),(0,r.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,r.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Login URL"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("code",{className:"flex-1 text-sm break-all",children:D}),(0,r.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"login_url"===P?"check":"content_copy",onClick:()=>O(D,"login_url"),disabled:!D}),(0,r.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"open_in_new",onClick:()=>window.open(D,"_blank","noopener,noreferrer"),disabled:!D,children:"Open"})]})]}),(0,r.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,r.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:N.user_code}),(0,r.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"user_code"===P?"check":"content_copy",onClick:()=>O(N.user_code,"user_code")})]})]})]}),k&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"success"===x&&(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 ",s.name," account has been connected."]}),(0,r.jsx)(i.$n,{onClick:U,fullWidth:!0,children:"Done"})]}),"error"===x&&(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:g}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:z,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,r.jsx)(i.$n,{onClick:U,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:n().bool.isRequired,provider:n().string,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired,oauthMeta:n().object,idcConfig:n().shape({startUrl:n().string,region:n().string})}},91450:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(95155),a=s(14051),l=s.n(a),n=s(38587);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}},92173:(e,t,s)=>{s.d(t,{default:()=>c});var r=s(95155),a=s(98500),l=s.n(a),n=s(90620);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"})]})]})]})})}},92542:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(95155),a=s(31474);let l={primary:"bg-brand-500 hover:bg-brand-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",secondary:"bg-surface-2 hover:bg-surface-3 text-text-main border border-border disabled:opacity-50",outline:"border border-border text-text-main hover:bg-surface-2 hover:border-brand-500/40",ghost:"text-text-muted hover:bg-surface-2 hover:text-text-main",danger:"bg-red-500 hover:bg-red-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",success:"bg-green-600 hover:bg-green-700 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted"},n={sm:"h-7 px-3 text-xs rounded-[8px]",md:"h-9 px-4 text-sm rounded-[10px]",lg:"h-11 px-6 text-sm rounded-[10px]"};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,...p}){return(0,r.jsxs)("button",{className:(0,a.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",l[t],n[s],x&&"w-full",u),disabled:c||m,...p,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})]})}},92622:(e,t,s)=>{s.d(t,{default:()=>v});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(98500),o=s.n(i),d=s(73321),c=s(31474),m=s(90620),x=s(52679),u=s(11059),p=s(92542),h=s(81127);let f=["embedding","image","tts","stt"],b="/dashboard/media-providers/web",g=[{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"}],j=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"},{href:"/dashboard/translator",label:"Translator",icon:"translate"}],y=[{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/skills",label:"Skills",icon:"extension"}];function v({onClose:e}){let t=(0,d.usePathname)(),[s,l]=(0,a.useState)(!1),[n,i]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),[T,P]=(0,a.useState)(null),[O,R]=(0,a.useState)(!1),[$,E]=(0,a.useState)(!1),[I,A]=(0,a.useState)(0),[_,M]=(0,a.useState)(!1),{copied:L,copy:z}=(0,u.C)(2e3),q=m.h0.installCmdLatest;(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{e.enableTranslator&&M(!0)}).catch(()=>{})},[]),(0,a.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.hasUpdate&&P(e)}).catch(()=>{})},[]);let U=e=>"/dashboard/endpoint"===e?"/dashboard"===t||t.startsWith("/dashboard/endpoint"):t.startsWith(e),F=async()=>{try{await navigator.clipboard.writeText(q)}catch{}z(q);let e=m.h0.shutdownCountdownSec;A(e);let t=setInterval(()=>{A(e-=1),e<=0&&(clearInterval(t),fetch("/api/version/shutdown",{method:"POST"}).catch(()=>{}),S(!0))},1e3)},D=async()=>{k(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(e){}k(!1),i(!1),S(!0)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("aside",{className:"flex w-72 flex-col border-r border-border-subtle 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-[10px] bg-gradient-to-br from-brand-500 to-brand-700 shadow-[var(--shadow-warm)]",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]})]})]}),T&&(0,r.jsxs)("div",{className:"flex flex-col gap-1.5 rounded p-1 -m-1",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",T.latestVersion]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>R(!0),className:"px-2 py-1 rounded bg-green-600 hover:bg-green-700 dark:bg-amber-500 dark:hover:bg-amber-600 text-white text-[11px] font-semibold transition-colors cursor-pointer",children:"Update now"}),(0,r.jsx)("button",{onClick:()=>z(q),title:"Copy install command",className:"flex-1 text-left hover:opacity-80 transition-opacity cursor-pointer min-w-0",children:(0,r.jsx)("code",{className:"block text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono truncate",children:L?"✓ copied!":q})})]})]})]}),(0,r.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-0.5 overflow-y-auto custom-scrollbar",children:[g.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),(0,r.jsxs)("div",{className:"pt-3 mt-2 space-y-0.5",children:[(0,r.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),(0,r.jsxs)("button",{onClick:()=>l(e=>!e),className:(0,c.cn)("w-full flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",t.startsWith("/dashboard/media-providers")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"perm_media"}),(0,r.jsx)("span",{className:"text-[13px] font-medium flex-1 text-left",children:"Media Providers"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"},children:"expand_more"})]}),s&&(0,r.jsxs)("div",{className:"pl-4",children:[x.rj.filter(e=>f.includes(e.id)).map(s=>(0,r.jsxs)(o(),{href:`/dashboard/media-providers/${s.id}`,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(`/dashboard/media-providers/${s.id}`)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:s.icon}),(0,r.jsx)("span",{className:"text-sm",children:s.label})]},s.id)),(0,r.jsxs)(o(),{href:b,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(b)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"travel_explore"}),(0,r.jsx)("span",{className:"text-sm",children:"Web Fetch & Search"})]},"web")]}),y.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),j.map(t=>"/dashboard/translator"!==t.href||_?(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href):null),(0,r.jsxs)(o(),{href:"/dashboard/profile",onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U("/dashboard/profile")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U("/dashboard/profile")?"fill-1":"group-hover:text-primary transition-colors"),children:"settings"}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:"Settings"})]})]})]}),(0,r.jsx)("div",{className:"p-3 border-t border-border-subtle",children:(0,r.jsx)(p.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>i(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})})]}),(0,r.jsx)(h.ConfirmModal,{isOpen:n,onClose:()=>i(!1),onConfirm:D,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:w}),(0,r.jsx)(h.ConfirmModal,{isOpen:O,onClose:()=>R(!1),onConfirm:()=>{R(!1),E(!0)},title:"Update 9Router",message:`Show install command for v${T?.latestVersion||""}? You can copy it and shutdown to install manually.`,confirmText:"Show Command",cancelText:"Cancel",variant:"primary"}),(C||$)&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-6",children:$?(0,r.jsx)(N,{latestVersion:T?.latestVersion,installCmd:q,copied:L,onCopyAndShutdown:F,onCancel:()=>{E(!1),A(0)},countdown:I,isDisconnected:C}):(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)(p.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}function N({latestVersion:e,installCmd:t,copied:s,onCopyAndShutdown:a,onCancel:l,countdown:n,isDisconnected:i}){let o=n>0;return(0,r.jsxs)("div",{className:"w-full max-w-lg rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-500/20 text-amber-400",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"content_copy"})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("h2",{className:"text-lg font-semibold",children:["Update 9Router",e?` to v${e}`:""]}),(0,r.jsx)("p",{className:"text-xs text-white/60",children:i?"Server stopped. Paste the command into a terminal to install.":o?`Command copied. Server will stop in ${n}s...`:"Click the button below to copy the install command and shutdown."})]})]}),(0,r.jsx)("p",{className:"text-sm text-white/80 mb-2",children:"Install command:"}),(0,r.jsx)("div",{className:"w-full px-3 py-2 rounded bg-white/5 mb-4",children:(0,r.jsx)("code",{className:"text-xs font-mono text-amber-400 break-all",children:t})}),(0,r.jsxs)("ol",{className:"text-xs text-white/70 space-y-1 list-decimal list-inside mb-4",children:[(0,r.jsxs)("li",{children:["Click ",(0,r.jsx)("strong",{children:"Copy & Shutdown"})," below."]}),(0,r.jsx)("li",{children:"Paste the command into your terminal and press Enter."}),(0,r.jsxs)("li",{children:["Run ",(0,r.jsx)("code",{className:"px-1 rounded bg-white/10 text-green-400",children:"9router"})," again after install."]})]}),i?(0,r.jsx)(p.default,{variant:"secondary",fullWidth:!0,onClick:()=>globalThis.location.reload(),children:"Reload Page"}):(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(p.default,{variant:"secondary",onClick:l,disabled:o,children:"Cancel"}),(0,r.jsx)(p.default,{variant:"primary",fullWidth:!0,onClick:a,disabled:o,children:s?"✓ Copied — shutting down...":o?`Shutting down in ${n}s`:"Copy & Shutdown"})]})]})}v.propTypes={onClose:n().func},N.propTypes={latestVersion:n().string,installCmd:n().string.isRequired,copied:n().bool,onCopyAndShutdown:n().func.isRequired,onCancel:n().func.isRequired,countdown:n().number,isDisconnected:n().bool}},94230:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(35497),o=s(11059);function d({isOpen:e,provider:t,onSuccess:s,onClose:l}){let[n,c]=(0,a.useState)("loading"),[m,x]=(0,a.useState)(""),[u,p]=(0,a.useState)(null),[h,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);p(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(h)}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:h,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:!h,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}},95088:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(35497);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),[p,h]=(0,a.useState)(""),[f,b]=(0,a.useState)(""),[g,j]=(0,a.useState)(""),[y,v]=(0,a.useState)(!1),[N,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(null),P=()=>{m(null),u(o),h(""),b(""),j(""),w(null),v(!1),C(!1),T(null),l()},O=async()=>{if(!g.trim())return void w("Personal Access Token is required");v(!0),w(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?.(),P()}catch(e){w(e.message)}finally{v(!1)}};return e?k&&S?(0,r.jsx)(i.LF,{isOpen:!0,provider:"gitlab",providerInfo:t,oauthMeta:S,onSuccess:()=>{s?.(),P()},onClose:()=>{C(!1),T(null)}}):(0,r.jsx)(i.aF,{isOpen:e,title:"Connect GitLab Duo",onClose:P,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:p,onChange:e=>h(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:()=>{p.trim()?(w(null),T({baseUrl:x.trim()||o,clientId:p.trim(),clientSecret:f.trim()}),C(!0)):w("Client ID is required")},fullWidth:!0,disabled:!p.trim(),children:"Authorize"}),(0,r.jsx)(i.$n,{onClick:()=>{m(null),w(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:O,fullWidth:!0,disabled:!g.trim()||y,loading:y,children:"Connect"}),(0,r.jsx)(i.$n,{onClick:()=>{m(null),w(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}},96748:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(35497);let o="https://api.openai.com/v1";function d({isOpen:e,onClose:t,onCreated:s,onSaved:l,node:n}){let c=!!n,[m,x]=(0,a.useState)({name:"",prefix:"",baseUrl:o}),[u,p]=(0,a.useState)(!1),[h,f]=(0,a.useState)(""),[b,g]=(0,a.useState)(""),[j,y]=(0,a.useState)(!1),[v,N]=(0,a.useState)(null);(0,a.useEffect)(()=>{e&&(N(null),f(""),g(""),c?x({name:n.name||"",prefix:n.prefix||"",baseUrl:n.baseUrl||o}):x({name:"",prefix:"",baseUrl:o}))},[e,c,n]);let w=async()=>{if(m.name.trim()&&m.prefix.trim()&&m.baseUrl.trim()){p(!0);try{let e=c?`/api/provider-nodes/${n.id}`:"/api/provider-nodes",t=c?"PUT":"POST",r={name:m.name,prefix:m.prefix,baseUrl:m.baseUrl};c||(r.type="custom-embedding");let a=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),i=await a.json();a.ok&&(c?l?.(i.node):s?.(i.node))}catch(e){console.log("Error saving custom embedding node:",e)}finally{p(!1)}}},k=async()=>{y(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:m.baseUrl,apiKey:h,type:"custom-embedding",modelId:b.trim()||void 0})}),t=await e.json();N(t)}catch{N({valid:!1,error:"Network error"})}finally{y(!1)}};return(0,r.jsx)(i.aF,{isOpen:e,title:c?"Edit Custom Embedding":"Add Custom Embedding",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(i.pd,{label:"Name",value:m.name,onChange:e=>x({...m,name:e.target.value}),placeholder:"Voyage AI",hint:"Required. A friendly label for this embedding provider."}),(0,r.jsx)(i.pd,{label:"Prefix",value:m.prefix,onChange:e=>x({...m,prefix:e.target.value}),placeholder:"voyage",hint:"Required. Used as the provider prefix for model IDs (e.g. voyage/voyage-3)."}),(0,r.jsx)(i.pd,{label:"Base URL",value:m.baseUrl,onChange:e=>x({...m,baseUrl:e.target.value}),placeholder:"https://api.voyageai.com/v1",hint:"Most embedding APIs are OpenAI-compatible: Voyage, Cohere, Jina, Mistral, Together..."}),(0,r.jsx)(i.pd,{label:"API Key (for Check)",type:"password",value:h,onChange:e=>f(e.target.value)}),(0,r.jsx)(i.pd,{label:"Model ID (for Check)",value:b,onChange:e=>g(e.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",hint:"Required for validation. Will send a test embeddings request."}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(i.$n,{onClick:k,disabled:!h||!b.trim()||j||!m.baseUrl.trim(),variant:"secondary",children:j?"Checking...":"Check"}),(()=>{if(!v)return null;let{valid:e,error:t,dimensions:s}=v;return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Ex,{variant:"success",children:"Valid"}),s&&(0,r.jsxs)("span",{className:"text-sm text-text-muted",children:[s," dims"]})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(i.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:w,fullWidth:!0,disabled:!m.name.trim()||!m.prefix.trim()||!m.baseUrl.trim()||u,children:u?c?"Saving...":"Creating...":c?"Save":"Create"}),(0,r.jsx)(i.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}d.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onCreated:n().func,onSaved:n().func,node:n().shape({id:n().string,name:n().string,prefix:n().string,baseUrl:n().string})}},97677:(e,t,s)=>{s.d(t,{default:()=>a});var r=s(95155);function a({text:e,children:t,position:s="top",color:l}){let n=l?"":"bg-gray-900";return(0,r.jsxs)("div",{className:"relative inline-flex group",children:[t,(0,r.jsx)("div",{className:`pointer-events-none absolute ${{top:"bottom-full left-1/2 -translate-x-1/2 mb-1.5",bottom:"top-full left-1/2 -translate-x-1/2 mt-1.5",left:"right-full top-1/2 -translate-y-1/2 mr-1.5",right:"left-full top-1/2 -translate-y-1/2 ml-1.5"}[s]} z-50 w-max max-w-56 rounded px-2 py-1 text-[11px] leading-snug ${n} text-white opacity-0 group-hover:opacity-100 transition-opacity duration-150 whitespace-normal`,style:l?{backgroundColor:l}:{},children:e})]})}},98542:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(95155),a=s(31474);function l({checked:e=!1,onChange:t,label:s,description:n,disabled:i=!1,size:o="md",className:d}){let c={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}};return(0,r.jsxs)("div",{className:(0,a.cn)("flex items-center gap-3",i&&"opacity-50 cursor-not-allowed",d),children:[(0,r.jsx)("button",{type:"button",role:"switch","aria-checked":e,disabled:i,onClick:()=>{!i&&t&&t(!e)},className:(0,a.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-brand-500/30",e?"bg-brand-500":"bg-surface-3",c[o].track,i&&"cursor-not-allowed"),children:(0,r.jsx)("span",{className:(0,a.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",e?c[o].translate:"translate-x-0.5",c[o].thumb,"mt-0.5")})}),(s||n)&&(0,r.jsxs)("div",{className:"flex flex-col",children:[s&&(0,r.jsx)("span",{className:"text-sm font-medium text-text-main",children:s}),n&&(0,r.jsx)("span",{className:"text-xs text-text-muted",children:n})]})]})}},99257:(e,t,s)=>{s.d(t,{default:()=>y});var r=s(95155),a=s(12115),l=s(73321),n=s(98500),i=s.n(n),o=s(14051),d=s.n(o),c=s(57250),m=s(80752),x=s(38587),u=s(47650),p=s(90620);function h({isOpen:e,onClose:t}){let[s,l]=(0,a.useState)(null),[n,i]=(0,a.useState)(!1),[o,d]=(0,a.useState)(""),c=(0,a.useRef)(null);return((0,a.useEffect)(()=>{e&&!s&&(i(!0),d(""),fetch(p.Nu.donateUrl,{cache:"no-store"}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>l(e)).catch(e=>d(e.message||"Failed to load")).finally(()=>i(!1)))},[e,s]),(0,a.useEffect)(()=>{let s=e=>{c.current&&!c.current.contains(e.target)&&t()};if(e)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[e,t]),!e||"u"<typeof document)?null:(0,u.createPortal)((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:t}),(0,r.jsxs)("div",{ref:c,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-3xl flex flex-col max-h-[85vh]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,r.jsxs)("h2",{className:"text-lg font-semibold text-text-main flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-pink-500",children:"volunteer_activism"}),s?.title||"Support n9Router"]}),(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","aria-label":"Close",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsxs)("div",{className:"p-6 overflow-y-auto flex-1",children:[n&&(0,r.jsxs)("div",{className:"flex items-center justify-center py-10 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"progress_activity"}),"Loading..."]}),o&&(0,r.jsxs)("div",{className:"text-red-500 py-4",children:["Failed to load donate info: ",o]}),!n&&!o&&s&&(0,r.jsxs)(r.Fragment,{children:[s.message&&(0,r.jsx)("p",{className:"text-text-muted text-sm mb-6 text-center",children:s.message}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:s.channels?.map(e=>(0,r.jsx)(f,{channel:e},e.id))})]})]})]})]}),document.body)}function f({channel:e}){let{label:t,description:s,icon:a,color:l,url:n,qr:i}=e,o=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-full flex items-center justify-center mb-3",style:{backgroundColor:`${l}20`,color:l},children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[26px]",children:a})}),(0,r.jsx)("div",{className:"font-semibold text-text-main mb-1",children:t}),s&&(0,r.jsx)("div",{className:"text-xs text-text-muted mb-3 text-center",children:s}),i&&(0,r.jsx)("img",{src:i,alt:`${t} QR`,className:"w-full max-w-[180px] aspect-square object-contain rounded-lg bg-white p-1"})]});return(0,r.jsxs)("div",{className:"flex flex-col items-center p-4 rounded-xl border border-black/10 dark:border-white/10 bg-surface/50 hover:border-pink-500/40 transition-colors",children:[o,n&&(0,r.jsxs)("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"mt-3 inline-flex items-center gap-1 px-3 py-1.5 rounded-lg text-sm font-medium text-white hover:opacity-90 transition-opacity",style:{backgroundColor:l},children:["Open",(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"open_in_new"})]})]})}h.propTypes={isOpen:d().bool.isRequired,onClose:d().func.isRequired};var b=s(38003),g=s(52679),j=s(73006);function y({onMenuClick:e,showMenuButton:t=!0}){let s=(0,l.usePathname)(),n=(0,l.useRouter)(),[o,d]=(0,a.useState)(""),[u,f]=(0,a.useState)(""),[b,N]=(0,a.useState)(!1),{title:w,description:k,icon:C,breadcrumbs:S}=(0,a.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/media-providers\/([^/]+)\/([^/]+)$/);if(t){let e=t[1],s=t[2],r=g.rj.find(t=>t.id===e),a=g.Q2[s];return{title:a?.name||s,description:"",breadcrumbs:[{label:"Media Providers",href:`/dashboard/media-providers/${e}`},{label:r?.label||e,href:`/dashboard/media-providers/${e}`},{label:a?.name||s,image:`/providers/${s}.png`}]}}let s=e.match(/\/media-providers\/([^/]+)$/);if(s){let e=s[1],t=g.rj.find(t=>t.id===e);return{title:t?.label||e,description:`Manage your ${t?.label||e} providers`,icon:t?.icon||"perm_media",breadcrumbs:[]}}let r=e.match(/\/providers\/([^/]+)$/);if(r){let e=r[1],t=p.zN[e]||p.fg[e];if(t)return{title:t.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:t.name,image:`/providers/${t.id}.png`}]}}return e.includes("/providers")&&!e.includes("/media-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("/auth-files")?{title:"Auth Files",description:"Map provider credentials stored in the local database",icon:"vpn_key",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("/skills")?{title:"Agent Skills",description:"Copy a link and paste to your AI to use 9Router — no install needed",icon:"extension",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]);(0,a.useEffect)(()=>{let e=!1;return async function(){try{let t=await fetch("/api/auth/status",{cache:"no-store"});if(!t.ok)return;let s=await t.json();e||(d(s?.displayName||s?.oidcName||s?.oidcEmail||""),f(s?.loginMethod||""))}catch{e||(d(""),f(""))}}(),()=>{e=!0}},[]);let T=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:"shrink-0 flex items-center justify-between gap-3 px-4 lg:px-8 pt-3 pb-2 border-b border-border-subtle bg-surface/60 backdrop-blur-xl lg:bg-transparent lg:backdrop-blur-none z-20",children:[(0,r.jsx)("div",{className:"flex items-center gap-3 lg:hidden shrink-0",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:"flex flex-col min-w-0 flex-1",children:S.length>0?(0,r.jsx)("div",{className:"flex items-center gap-2",children:S.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-base lg:text-2xl font-semibold text-text-main tracking-tight truncate",children:(0,j.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):w?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[C&&(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-xl lg:text-2xl",children:C}),(0,r.jsx)("h1",{className:"text-base lg:text-2xl font-semibold tracking-tight truncate",children:(0,j.Tl)(w)})]}),k&&(0,r.jsx)("p",{className:"hidden lg:block text-sm text-text-muted truncate",children:(0,j.Tl)(k)})]}):null}),(0,r.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[o&&"OIDC"===u&&(0,r.jsxs)("div",{className:"hidden sm:flex items-center max-w-[220px] px-3 py-1.5 rounded-full border border-border bg-surface/70 text-xs text-text-muted truncate",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1.5 text-primary",children:"person"}),(0,r.jsx)("span",{className:"truncate",children:o}),(0,r.jsx)("span",{className:"ml-2 shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary",children:"OIDC"})]}),(0,r.jsx)(v,{}),(0,r.jsxs)("button",{onClick:()=>N(!0),className:"flex items-center gap-1.5 px-3 h-8 rounded-lg border border-pink-500/30 bg-pink-500/10 text-pink-600 dark:text-pink-400 hover:bg-pink-500/20 transition-colors text-sm font-medium","aria-label":"Donate",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"volunteer_activism"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Donate"})]}),(0,r.jsx)(x.default,{}),(0,r.jsx)(m.default,{onLogout:T})]}),(0,r.jsx)(h,{isOpen:b,onClose:()=>N(!1)})]})}function v(){let e=(0,b.C)(e=>e.visible),t=(0,b.C)(e=>e.query),s=(0,b.C)(e=>e.placeholder),a=(0,b.C)(e=>e.setQuery);return e?(0,r.jsxs)("div",{className:"relative w-[160px] sm:w-[220px]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined absolute left-2 top-1/2 -translate-y-1/2 text-text-muted text-[16px] pointer-events-none",children:"search"}),(0,r.jsx)("input",{type:"text",value:t,onChange:e=>a(e.target.value),placeholder:s,className:"w-full h-8 pl-7 pr-7 rounded-lg border border-border bg-surface/60 text-sm focus:outline-none focus:border-primary/50 transition-colors"}),t&&(0,r.jsx)("button",{type:"button",onClick:()=>a(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-main p-0.5 rounded","aria-label":"Clear search",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}):null}y.propTypes={onMenuClick:d().func,showMenuButton:d().bool}}}]);
7
+ `,children:(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[g.includes(e.value)&&!s&&(0,r.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),e.name]}):e.isCustom?(0,r.jsxs)(r.Fragment,{children:[e.name,(0,r.jsx)("span",{className:"text-[9px] opacity-60 font-normal",children:"custom"})]}):e.name]})},e.value)})})]},e)),0===Object.keys(z).length&&0===L.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"})]})]})]})}u.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onSelect:n().func.isRequired,onDeselect:n().func,selectedModel:n().string,activeProviders:n().arrayOf(n().shape({provider:n().string.isRequired})),title:n().string,modelAliases:n().object,kindFilter:n().string,addedModelValues:n().arrayOf(n().string),closeOnSelect:n().bool}},73579:(e,t,s)=>{s.d(t,{default:()=>p});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(81127),o=s(11910),d=s(92542),c=s(56061),m=s(52679),x=s(98),u=s(11017);function p({isOpen:e,connection:t,proxyPools:s,onSave:l,onClose:n}){let[h,f]=(0,a.useState)({name:"",priority:1,apiKey:"",accountType:""}),[b,g]=(0,a.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[j,y]=(0,a.useState)({accountId:""}),[v,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null),[C,S]=(0,a.useState)(!1),[T,P]=(0,a.useState)(null),[O,R]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(f({name:t.name||"",priority:t.priority||1,apiKey:"",accountType:t.accountType||""}),"azure"===t.provider&&t.providerSpecificData&&g({azureEndpoint:t.providerSpecificData.azureEndpoint||"",apiVersion:t.providerSpecificData.apiVersion||"2024-10-01-preview",deployment:t.providerSpecificData.deployment||"",organization:t.providerSpecificData.organization||""}),"cloudflare-ai"===t.provider&&t.providerSpecificData&&y({accountId:t.providerSpecificData.accountId||""}),k(null),P(null))},[t]);let $=t?.authType==="oauth",E=t?.provider==="azure",I=t?.provider==="cloudflare-ai",A=!!t&&((0,m.mq)(t.provider)||(0,m.gb)(t.provider)),_=async()=>{if(t?.provider){N(!0),k(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),s=await e.json();k(s.valid?"success":"failed")}catch{k("failed")}finally{N(!1)}}},M=async()=>{if(t?.provider&&h.apiKey){S(!0),P(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:h.apiKey,...E?{providerSpecificData:b}:{},...I?{providerSpecificData:j}:{}})}),s=await e.json();P(s.valid?"success":"failed")}catch{P("failed")}finally{S(!1)}}},L=async()=>{if(t){R(!0);try{let e={name:h.name,priority:h.priority};if("antigravity"===t.provider&&(e.accountType=h.accountType||null),!$&&h.apiKey){e.apiKey=h.apiKey;let s="success"===T;if(!s)try{S(!0),P(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:h.apiKey,...E?{providerSpecificData:b}:{},...I?{providerSpecificData:j}:{}})});s=!!(await e.json()).valid,P(s?"success":"failed")}catch{P("failed")}finally{S(!1)}s&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null)}E&&(e.providerSpecificData={azureEndpoint:b.azureEndpoint,apiVersion:b.apiVersion,deployment:b.deployment,organization:b.organization}),I&&(e.providerSpecificData={accountId:j.accountId}),await l(e)}finally{R(!1)}}};return t?(0,r.jsx)(i.default,{isOpen:e,title:"Edit Connection",onClose:n,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(o.default,{label:"Name",value:h.name,onChange:e=>f({...h,name:e.target.value}),placeholder:$?"Account name":"Production Key"}),$&&t.email&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,r.jsx)("p",{className:"font-medium",children:t.email})]}),(0,r.jsx)(o.default,{label:"Priority",type:"number",value:h.priority,onChange:e=>f({...h,priority:Number.parseInt(e.target.value,10)||1})}),t?.provider==="antigravity"&&(0,r.jsx)(x.default,{label:"Account Tier",value:h.accountType,onChange:e=>f({...h,accountType:e.target.value}),options:[{value:"",label:"None"},...u.ji]}),!$&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(o.default,{label:"API Key",type:"password",value:h.apiKey,onChange:e=>f({...h,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)(d.default,{onClick:M,disabled:!h.apiKey||C||O,variant:"secondary",children:C?"Checking...":"Check"})})]}),T&&(0,r.jsx)(c.default,{variant:"success"===T?"success":"error",children:"success"===T?"Valid":"Invalid"})]}),E&&(0,r.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,r.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsx)(o.default,{label:"Azure Endpoint",value:b.azureEndpoint,onChange:e=>g({...b,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com",hint:"Your Azure OpenAI resource endpoint URL"}),(0,r.jsx)(o.default,{label:"Deployment Name",value:b.deployment,onChange:e=>g({...b,deployment:e.target.value}),placeholder:"gpt-4",hint:"The deployment name in your Azure resource"}),(0,r.jsx)(o.default,{label:"API Version",value:b.apiVersion,onChange:e=>g({...b,apiVersion:e.target.value}),placeholder:"2024-10-01-preview",hint:"Azure OpenAI API version to use"}),(0,r.jsx)(o.default,{label:"Organization",value:b.organization,onChange:e=>g({...b,organization:e.target.value}),placeholder:"Organization ID",hint:"Required for billing"})]})]}),!A&&!E&&!I&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(d.default,{onClick:_,variant:"secondary",disabled:v,children:v?"Testing...":"Test Connection"}),w&&(0,r.jsx)(c.default,{variant:"success"===w?"success":"error",children:"success"===w?"Valid":"Failed"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.default,{onClick:L,fullWidth:!0,disabled:O,children:O?"Saving...":"Save"}),(0,r.jsx)(d.default,{onClick:n,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}p.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}},80752:(e,t,s)=>{s.d(t,{default:()=>p});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(93308),o=s(1620),d=s(40197),c=s(14932),m=s(21931);let x={en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (BR)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (PT)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"}};function u({icon:e,label:t,onClick:s,trailing:a,danger:l}){return(0,r.jsxs)("button",{onClick:s,className:`flex items-center gap-3 w-full px-4 py-2.5 text-sm transition-colors ${l?"text-red-500 hover:bg-red-500/10":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[20px] ${l?"":"text-text-muted"}`,children:e}),(0,r.jsx)("span",{className:"flex-1 text-left",children:t}),a&&(0,r.jsx)("span",{className:"text-base",children:a})]})}function p({onLogout:e}){let[t,s]=(0,a.useState)(!1),[l,n]=(0,a.useState)(!1),[h,f]=(0,a.useState)(!1),[b,g]=(0,a.useState)(!1),[j,y]=(0,a.useState)("en"),{toggleTheme:v,isDark:N}=(0,o.D)(),w=(0,a.useRef)(null);return(0,a.useEffect)(()=>{y(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${i.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,i.QC)(t)}())},[b]),(0,a.useEffect)(()=>{let e=e=>{w.current&&!w.current.contains(e.target)&&s(!1)};if(t)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"relative",ref:w,children:[(0,r.jsx)("button",{onClick:()=>s(e=>!e),className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-all",title:"Menu",children:(0,r.jsx)("span",{className:"material-symbols-outlined",children:"grid_view"})}),t&&(0,r.jsxs)("div",{className:"absolute right-0 top-full mt-2 w-60 bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl z-50 animate-in fade-in zoom-in-95 duration-150 overflow-hidden py-1",children:[(0,r.jsx)(u,{icon:"history",label:"Change Log",onClick:()=>{s(!1),n(!0)}}),(0,r.jsx)(u,{icon:"language",label:x[j]?.name||j,trailing:x[j]?.flag||"\uD83C\uDF10",onClick:()=>{s(!1),g(!0)}}),(0,r.jsx)(u,{icon:N?"light_mode":"dark_mode",label:"Theme",onClick:()=>{v(),s(!1)}}),(0,r.jsx)(u,{icon:"computer",label:"Remote",onClick:()=>{s(!1),f(!0)}}),(0,r.jsx)(u,{icon:"logout",label:"Logout",danger:!0,onClick:()=>{s(!1),e()}})]})]}),(0,r.jsx)(d.default,{isOpen:l,onClose:()=>n(!1)}),(0,r.jsx)(c.A,{isOpen:h,onClose:()=>f(!1)}),(0,r.jsx)(m.default,{hideTrigger:!0,isOpen:b,onClose:e=>{g(!1),y(e)}})]})}u.propTypes={icon:n().string.isRequired,label:n().string.isRequired,onClick:n().func.isRequired,trailing:n().node,danger:n().bool},p.propTypes={onLogout:n().func.isRequired}},81127:(e,t,s)=>{s.d(t,{ConfirmModal:()=>d,default:()=>o});var r=s(95155),a=s(12115),l=s(31474),n=s(92542),i=s(97677);function o({isOpen:e,onClose:t,title:s,children:n,footer:d,size:c="md",closeOnOverlay:m=!0,showTrafficLights:x=!0,className:u}){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/50 backdrop-blur-[2px] fade-in",onClick:m?t:void 0}),(0,r.jsxs)("div",{className:(0,l.cn)("relative w-full bg-surface","border border-border-subtle","rounded-[14px] shadow-[var(--shadow-elev)]","fade-in",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[c],u),children:[(s||x)&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[x&&(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,r.jsx)(i.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,r.jsx)("button",{onClick:t,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,r.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),s&&(0,r.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:s})]}),(0,r.jsx)("button",{onClick:t,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main 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(85vh-100px)] overflow-y-auto custom-scrollbar",children:n}),d&&(0,r.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:d})]})]}):null}function d({isOpen:e,onClose:t,onConfirm:s,title:a="Confirm",message:l,confirmText:i="Confirm",cancelText:c="Cancel",variant:m="danger",loading:x=!1}){return(0,r.jsx)(o,{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:i})]}),children:(0,r.jsx)("p",{className:"text-text-muted",children:l})})}},84588:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(95155),a=s(31474);function l({children:e,title:t,subtitle:s,icon:n,action:i,padding:o="md",hover:d=!1,elev:c=!1,className:m,...x}){return(0,r.jsxs)("div",{className:(0,a.cn)("bg-surface border border-border-subtle",c?"rounded-[14px] shadow-[var(--shadow-elev)]":"rounded-[14px] shadow-[var(--shadow-soft)]",d&&"hover:shadow-[var(--shadow-warm)] hover:border-brand-500/30 transition-all cursor-pointer",{none:"",xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8"}[o],m),...x,children:[(t||i)&&(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[n&&(0,r.jsx)("div",{className:"p-2 rounded-[10px] bg-bg text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:n})}),(0,r.jsxs)("div",{children:[t&&(0,r.jsx)("h3",{className:"text-text-main font-semibold",children:t}),s&&(0,r.jsx)("p",{className:"text-sm text-text-muted",children:s})]})]}),i]}),e]})}l.Section=function({children:e,className:t,...s}){return(0,r.jsx)("div",{className:(0,a.cn)("p-4 rounded-[10px]","bg-bg border border-border-subtle",t),...s,children:e})},l.Row=function({children:e,className:t,...s}){return(0,r.jsx)("div",{className:(0,a.cn)("p-3 -mx-3 px-3 transition-colors","border-b border-border-subtle last:border-b-0","hover:bg-surface-2/50",t),...s,children:e})},l.ListItem=function({children:e,actions:t,className:s,...l}){return(0,r.jsxs)("div",{className:(0,a.cn)("group flex items-center justify-between p-3 -mx-3 px-3","border-b border-border-subtle last:border-b-0","hover:bg-surface-2/50 transition-colors",s),...l,children:[(0,r.jsx)("div",{className:"flex-1 min-w-0",children:e}),t&&(0,r.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:t})]})}},90882:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(35497),o=s(11059);function d({isOpen:e,provider:t,providerInfo:s,onSuccess:l,onClose:n,oauthMeta:c,idcConfig:m}){let[x,u]=(0,a.useState)("waiting"),[p,h]=(0,a.useState)(null),[f,b]=(0,a.useState)(""),[g,j]=(0,a.useState)(null),[y,v]=(0,a.useState)(!1),[N,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(!1),S=(0,a.useRef)(null),T=(0,a.useRef)(!1),{copied:P,copy:O}=(0,o.C)(),[R,$]=(0,a.useState)(!1),[E,I]=(0,a.useState)("/callback?code=..."),A=(0,a.useRef)(!1);(0,a.useEffect)(()=>{$("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname),I(`${window.location.origin}/callback?code=...`)},[]);let _=(0,a.useCallback)(async(e,s)=>{if(p)try{let r=await fetch(`/api/oauth/${t}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,redirectUri:p.redirectUri,codeVerifier:p.codeVerifier,state:s,...c?{meta:c}:{}})}),a=await r.json();if(!r.ok)throw Error(a.error);u("success"),l?.()}catch(e){j(e.message),u("error")}},[p,t,l]),M=(0,a.useCallback)(async e=>{if(p?.state)try{let t=await fetch("/api/oauth/xai/manual-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,state:p.state})}),s=await t.json();if(!t.ok)throw Error(s.error);u("success"),l?.()}catch(e){j(e.message),u("error")}},[p,l]),L=(0,a.useCallback)(async(e,s,r,a,n)=>{T.current=!1,C(!0);let i=Date.now()+(Number.isFinite(n)&&n>0?n:12e4);for(;Date.now()<i;){if(T.current){console.log("[OAuthModal] Polling aborted"),C(!1);return}if(await new Promise(e=>setTimeout(e,1e3*r)),T.current){console.log("[OAuthModal] Polling aborted after sleep"),C(!1);return}try{let n=await fetch(`/api/oauth/${t}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:e,codeVerifier:s,extraData:a})}),i=await n.json();if(i.success){T.current=!0,u("success"),C(!1),l?.();return}if("expired_token"===i.error||"access_denied"===i.error)throw Error(i.errorDescription||i.error);"slow_down"===i.error&&(r=Math.min(r+5,30))}catch(e){j(e.message),u("error"),C(!1);return}}j("Authorization timeout"),u("error"),C(!1)},[t,l]),z=(0,a.useCallback)(async()=>{if(t)try{let e;if(j(null),["github","qwen","kiro","kimi-coding","kilocode","codebuddy","qoder"].includes(t)){v(!0),u("waiting");let e=new URL(`/api/oauth/${t}/device-code`,window.location.origin);"kiro"===t&&m?.startUrl&&(e.searchParams.set("start_url",m.startUrl),m.region&&e.searchParams.set("region",m.region),e.searchParams.set("auth_method","idc"));let s=await fetch(e.toString()),r=await s.json();if(!s.ok)throw Error(r.error);w(r);let a=r.verification_uri_complete||r.verification_uri;a&&window.open(a,"_blank","noopener,noreferrer");let l="kiro"===t?{_clientId:r._clientId,_clientSecret:r._clientSecret,_region:r._region,_authMethod:r._authMethod,_startUrl:r._startUrl}:"qoder"===t?{_qoderNonce:r._qoderNonce,_qoderMachineId:r._qoderMachineId,_qoderVerifier:r.codeVerifier}:null;L(r.device_code,r.codeVerifier,r.interval||5,l,Number.isFinite(r.expires_in)&&r.expires_in>0?1e3*r.expires_in:void 0);return}let s=window.location.port||("https:"===window.location.protocol?"443":"80");e="codex"===t?"http://localhost:1455/auth/callback":"xai"===t?"http://127.0.0.1:56121/callback":`http://localhost:${s}/callback`;let r=new URL(`/api/oauth/${t}/authorize`,window.location.origin);r.searchParams.set("redirect_uri",e),c&&Object.entries(c).forEach(([e,t])=>{t&&r.searchParams.set(e,t)});let a=await fetch(r.toString()),l=await a.json();if(!a.ok)throw Error(l.error);let n=!1,i=!1;if("codex"===t)try{let t=new URL("/api/oauth/codex/start-proxy",window.location.origin);t.searchParams.set("app_port",s),t.searchParams.set("state",l.state),t.searchParams.set("code_verifier",l.codeVerifier),t.searchParams.set("redirect_uri",e);let r=await fetch(t.toString()),a=await r.json();n=a.success,i=!!a.serverSide}catch{n=!1}let o=!1,d=!1;if("xai"===t)try{let t=new URL("/api/oauth/xai/start-proxy",window.location.origin);t.searchParams.set("app_port",s),t.searchParams.set("state",l.state),t.searchParams.set("code_verifier",l.codeVerifier),t.searchParams.set("redirect_uri",e);let r=await fetch(t.toString()),a=await r.json();if(o=a.success,d=!!a.serverSide,!o&&"port_busy"===a.reason)throw Error("Port 56121 in use; close the conflicting process and retry")}catch(e){if(e?.message)throw e;o=!1}h({...l,redirectUri:e,codexServerSide:i,xaiServerSide:d}),"codex"===t&&n||"xai"===t&&o||R&&"codex"!==t&&"xai"!==t?(u("waiting"),S.current=window.open(l.authUrl,"oauth_popup","width=600,height=700"),S.current||u("input")):(u("input"),window.open(l.authUrl,"_blank"))}catch(e){j(e.message),u("error")}},[t,R,L,c,m]);(0,a.useEffect)(()=>{e&&t?(h(null),b(""),j(null),v(!1),w(null),C(!1),T.current=!1,z()):e||(T.current=!0,"codex"===t?fetch("/api/oauth/codex/stop-proxy").catch(()=>{}):"xai"===t&&fetch("/api/oauth/xai/stop-proxy").catch(()=>{}))},[e,t,z]),(0,a.useEffect)(()=>{let e=p?.codexServerSide?"codex":p?.xaiServerSide?"xai":null;if(!e||!p?.state||A.current)return;let t=!1,s=0,r=async()=>{if(!t&&!A.current){s+=1;try{let s=await fetch(`/api/oauth/${e}/poll-status?state=${encodeURIComponent(p.state)}`),r=await s.json();if(t||A.current)return;if("done"===r.status){A.current=!0,u("success"),l?.();return}if("error"===r.status){A.current=!0,j(r.error||"Authentication failed"),u("error");return}}catch{}if(s>=200){A.current=!0,j("Authentication timeout"),u("error");return}setTimeout(r,1500)}};return setTimeout(r,1500),()=>{t=!0}},[p,l]),(0,a.useEffect)(()=>{let e;if(!p)return;A.current=!1;let t=async e=>{if(A.current)return;let{code:t,state:s,error:r,errorDescription:a}=e;if(r){A.current=!0,j(a||r),u("error");return}t&&(A.current=!0,await _(t,s))},s=e=>{let s=e.origin.includes("localhost")||e.origin.includes("127.0.0.1"),r=e.origin===window.location.origin;(s||r)&&e.data?.type==="oauth_callback"&&t(e.data.data)};window.addEventListener("message",s);try{(e=new BroadcastChannel("oauth_callback")).onmessage=e=>t(e.data)}catch(e){console.log("BroadcastChannel not supported")}let r=e=>{if("oauth_callback"===e.key&&e.newValue)try{let s=JSON.parse(e.newValue);t(s),localStorage.removeItem("oauth_callback")}catch(e){console.log("Failed to parse localStorage data")}};window.addEventListener("storage",r);try{let e=localStorage.getItem("oauth_callback");if(e){let s=JSON.parse(e);s.timestamp&&Date.now()-s.timestamp<3e4&&t(s),localStorage.removeItem("oauth_callback")}}catch{}return()=>{window.removeEventListener("message",s),window.removeEventListener("storage",r),e&&e.close()}},[p,_]);let q=async()=>{try{j(null);let e=f.trim();if(e.startsWith("eyJ")&&e.includes("."))return void await _(e,null);if("xai"===t&&e&&!e.includes("://")&&!e.includes("?")&&!e.includes("code="))return void await M(e);let s=new URL(e),r=s.searchParams.get("code"),a=s.searchParams.get("state"),l=s.searchParams.get("error");if(l)throw Error(s.searchParams.get("error_description")||l);if(!r)throw Error("xai"===t?"Paste the callback URL or copied xAI code":"No authorization code found in URL");await _(r,a)}catch(e){j(e.message),u("error")}},U=(0,a.useCallback)(()=>{"codex"===t?fetch("/api/oauth/codex/stop-proxy").catch(()=>{}):"xai"===t&&fetch("/api/oauth/xai/stop-proxy").catch(()=>{}),n()},[n,t]);if(!t||!s)return null;let F="xai"===t,D=N?.verification_uri_complete||N?.verification_uri||"",W=F?"Connect Grok Build OAuth":`Connect ${s.name}`;return(0,r.jsx)(i.aF,{isOpen:e,title:W,onClose:U,size:"lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[("waiting"===x||"input"===x)&&!y&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,r.jsx)("span",{className:"text-sm",children:F?"Waiting for Grok Build OAuth…":"Waiting for popup authorization…"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,r.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,r.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,r.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 1: Open this ",F?"Grok Build OAuth URL":"URL"," in your browser"]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.pd,{value:p?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,r.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===P?"check":"content_copy",onClick:()=>O(p?.authUrl,"auth_url"),disabled:!p?.authUrl,children:"Copy"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 2: Paste the ","xai"===t?"callback URL or copied code":"callback URL"," here"]}),(0,r.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"xai"===t?"If xAI shows a code instead of redirecting, paste that code here.":"After authorization, copy the full URL from your browser."}),(0,r.jsx)(i.pd,{value:f,onChange:e=>b(e.target.value),placeholder:F?"http://127.0.0.1:56121/callback?code=... or copied code":E,className:"font-mono text-xs"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:q,fullWidth:!0,disabled:!f,children:"Connect"}),(0,r.jsx)(i.$n,{onClick:U,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"waiting"===x&&y&&N&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"text-center py-4",children:[(0,r.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the login URL below and authorize:"}),(0,r.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,r.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Login URL"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("code",{className:"flex-1 text-sm break-all",children:D}),(0,r.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"login_url"===P?"check":"content_copy",onClick:()=>O(D,"login_url"),disabled:!D}),(0,r.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"open_in_new",onClick:()=>window.open(D,"_blank","noopener,noreferrer"),disabled:!D,children:"Open"})]})]}),(0,r.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,r.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:N.user_code}),(0,r.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"user_code"===P?"check":"content_copy",onClick:()=>O(N.user_code,"user_code")})]})]})]}),k&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"success"===x&&(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 ",s.name," account has been connected."]}),(0,r.jsx)(i.$n,{onClick:U,fullWidth:!0,children:"Done"})]}),"error"===x&&(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:g}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:z,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,r.jsx)(i.$n,{onClick:U,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:n().bool.isRequired,provider:n().string,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired,oauthMeta:n().object,idcConfig:n().shape({startUrl:n().string,region:n().string})}},91450:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(95155),a=s(14051),l=s.n(a),n=s(38587);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}},92173:(e,t,s)=>{s.d(t,{default:()=>c});var r=s(95155),a=s(98500),l=s.n(a),n=s(90620);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"})]})]})]})})}},92542:(e,t,s)=>{s.d(t,{default:()=>i});var r=s(95155),a=s(31474);let l={primary:"bg-brand-500 hover:bg-brand-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",secondary:"bg-surface-2 hover:bg-surface-3 text-text-main border border-border disabled:opacity-50",outline:"border border-border text-text-main hover:bg-surface-2 hover:border-brand-500/40",ghost:"text-text-muted hover:bg-surface-2 hover:text-text-main",danger:"bg-red-500 hover:bg-red-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",success:"bg-green-600 hover:bg-green-700 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted"},n={sm:"h-7 px-3 text-xs rounded-[8px]",md:"h-9 px-4 text-sm rounded-[10px]",lg:"h-11 px-6 text-sm rounded-[10px]"};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,...p}){return(0,r.jsxs)("button",{className:(0,a.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",l[t],n[s],x&&"w-full",u),disabled:c||m,...p,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})]})}},92622:(e,t,s)=>{s.d(t,{default:()=>v});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(98500),o=s.n(i),d=s(73321),c=s(31474),m=s(90620),x=s(52679),u=s(11059),p=s(92542),h=s(81127);let f=["embedding","image","tts","stt"],b="/dashboard/media-providers/web",g=[{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"}],j=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"},{href:"/dashboard/translator",label:"Translator",icon:"translate"}],y=[{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/skills",label:"Skills",icon:"extension"}];function v({onClose:e}){let t=(0,d.usePathname)(),[s,l]=(0,a.useState)(!1),[n,i]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),[T,P]=(0,a.useState)(null),[O,R]=(0,a.useState)(!1),[$,E]=(0,a.useState)(!1),[I,A]=(0,a.useState)(0),[_,M]=(0,a.useState)(!1),{copied:L,copy:z}=(0,u.C)(2e3),q=m.h0.installCmdLatest;(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{e.enableTranslator&&M(!0)}).catch(()=>{})},[]),(0,a.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.hasUpdate&&P(e)}).catch(()=>{})},[]);let U=e=>"/dashboard/endpoint"===e?"/dashboard"===t||t.startsWith("/dashboard/endpoint"):t.startsWith(e),F=async()=>{try{await navigator.clipboard.writeText(q)}catch{}z(q);let e=m.h0.shutdownCountdownSec;A(e);let t=setInterval(()=>{A(e-=1),e<=0&&(clearInterval(t),fetch("/api/version/shutdown",{method:"POST"}).catch(()=>{}),S(!0))},1e3)},D=async()=>{k(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(e){}k(!1),i(!1),S(!0)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("aside",{className:"flex w-72 flex-col border-r border-border-subtle 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-[10px] bg-gradient-to-br from-brand-500 to-brand-700 shadow-[var(--shadow-warm)]",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]})]})]}),T&&(0,r.jsxs)("div",{className:"flex flex-col gap-1.5 rounded p-1 -m-1",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",T.latestVersion]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>R(!0),className:"px-2 py-1 rounded bg-green-600 hover:bg-green-700 dark:bg-amber-500 dark:hover:bg-amber-600 text-white text-[11px] font-semibold transition-colors cursor-pointer",children:"Update now"}),(0,r.jsx)("button",{onClick:()=>z(q),title:"Copy install command",className:"flex-1 text-left hover:opacity-80 transition-opacity cursor-pointer min-w-0",children:(0,r.jsx)("code",{className:"block text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono truncate",children:L?"✓ copied!":q})})]})]})]}),(0,r.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-0.5 overflow-y-auto custom-scrollbar",children:[g.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),(0,r.jsxs)("div",{className:"pt-3 mt-2 space-y-0.5",children:[(0,r.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),(0,r.jsxs)("button",{onClick:()=>l(e=>!e),className:(0,c.cn)("w-full flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",t.startsWith("/dashboard/media-providers")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"perm_media"}),(0,r.jsx)("span",{className:"text-[13px] font-medium flex-1 text-left",children:"Media Providers"}),(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"},children:"expand_more"})]}),s&&(0,r.jsxs)("div",{className:"pl-4",children:[x.rj.filter(e=>f.includes(e.id)).map(s=>(0,r.jsxs)(o(),{href:`/dashboard/media-providers/${s.id}`,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(`/dashboard/media-providers/${s.id}`)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:s.icon}),(0,r.jsx)("span",{className:"text-sm",children:s.label})]},s.id)),(0,r.jsxs)(o(),{href:b,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(b)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"travel_explore"}),(0,r.jsx)("span",{className:"text-sm",children:"Web Fetch & Search"})]},"web")]}),y.map(t=>(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),j.map(t=>"/dashboard/translator"!==t.href||_?(0,r.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href):null),(0,r.jsxs)(o(),{href:"/dashboard/profile",onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",U("/dashboard/profile")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,r.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",U("/dashboard/profile")?"fill-1":"group-hover:text-primary transition-colors"),children:"settings"}),(0,r.jsx)("span",{className:"text-[13px] font-medium",children:"Settings"})]})]})]}),(0,r.jsx)("div",{className:"p-3 border-t border-border-subtle",children:(0,r.jsx)(p.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>i(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})})]}),(0,r.jsx)(h.ConfirmModal,{isOpen:n,onClose:()=>i(!1),onConfirm:D,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:w}),(0,r.jsx)(h.ConfirmModal,{isOpen:O,onClose:()=>R(!1),onConfirm:()=>{R(!1),E(!0)},title:"Update 9Router",message:`Show install command for v${T?.latestVersion||""}? You can copy it and shutdown to install manually.`,confirmText:"Show Command",cancelText:"Cancel",variant:"primary"}),(C||$)&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-6",children:$?(0,r.jsx)(N,{latestVersion:T?.latestVersion,installCmd:q,copied:L,onCopyAndShutdown:F,onCancel:()=>{E(!1),A(0)},countdown:I,isDisconnected:C}):(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)(p.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}function N({latestVersion:e,installCmd:t,copied:s,onCopyAndShutdown:a,onCancel:l,countdown:n,isDisconnected:i}){let o=n>0;return(0,r.jsxs)("div",{className:"w-full max-w-lg rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-500/20 text-amber-400",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"content_copy"})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("h2",{className:"text-lg font-semibold",children:["Update 9Router",e?` to v${e}`:""]}),(0,r.jsx)("p",{className:"text-xs text-white/60",children:i?"Server stopped. Paste the command into a terminal to install.":o?`Command copied. Server will stop in ${n}s...`:"Click the button below to copy the install command and shutdown."})]})]}),(0,r.jsx)("p",{className:"text-sm text-white/80 mb-2",children:"Install command:"}),(0,r.jsx)("div",{className:"w-full px-3 py-2 rounded bg-white/5 mb-4",children:(0,r.jsx)("code",{className:"text-xs font-mono text-amber-400 break-all",children:t})}),(0,r.jsxs)("ol",{className:"text-xs text-white/70 space-y-1 list-decimal list-inside mb-4",children:[(0,r.jsxs)("li",{children:["Click ",(0,r.jsx)("strong",{children:"Copy & Shutdown"})," below."]}),(0,r.jsx)("li",{children:"Paste the command into your terminal and press Enter."}),(0,r.jsxs)("li",{children:["Run ",(0,r.jsx)("code",{className:"px-1 rounded bg-white/10 text-green-400",children:"n9router"})," again after install."]})]}),i?(0,r.jsx)(p.default,{variant:"secondary",fullWidth:!0,onClick:()=>globalThis.location.reload(),children:"Reload Page"}):(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(p.default,{variant:"secondary",onClick:l,disabled:o,children:"Cancel"}),(0,r.jsx)(p.default,{variant:"primary",fullWidth:!0,onClick:a,disabled:o,children:s?"✓ Copied — shutting down...":o?`Shutting down in ${n}s`:"Copy & Shutdown"})]})]})}v.propTypes={onClose:n().func},N.propTypes={latestVersion:n().string,installCmd:n().string.isRequired,copied:n().bool,onCopyAndShutdown:n().func.isRequired,onCancel:n().func.isRequired,countdown:n().number,isDisconnected:n().bool}},94230:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(35497),o=s(11059);function d({isOpen:e,provider:t,onSuccess:s,onClose:l}){let[n,c]=(0,a.useState)("loading"),[m,x]=(0,a.useState)(""),[u,p]=(0,a.useState)(null),[h,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);p(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(h)}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:h,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:!h,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}},95088:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(35497);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),[p,h]=(0,a.useState)(""),[f,b]=(0,a.useState)(""),[g,j]=(0,a.useState)(""),[y,v]=(0,a.useState)(!1),[N,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(null),P=()=>{m(null),u(o),h(""),b(""),j(""),w(null),v(!1),C(!1),T(null),l()},O=async()=>{if(!g.trim())return void w("Personal Access Token is required");v(!0),w(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?.(),P()}catch(e){w(e.message)}finally{v(!1)}};return e?k&&S?(0,r.jsx)(i.LF,{isOpen:!0,provider:"gitlab",providerInfo:t,oauthMeta:S,onSuccess:()=>{s?.(),P()},onClose:()=>{C(!1),T(null)}}):(0,r.jsx)(i.aF,{isOpen:e,title:"Connect GitLab Duo",onClose:P,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:p,onChange:e=>h(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:()=>{p.trim()?(w(null),T({baseUrl:x.trim()||o,clientId:p.trim(),clientSecret:f.trim()}),C(!0)):w("Client ID is required")},fullWidth:!0,disabled:!p.trim(),children:"Authorize"}),(0,r.jsx)(i.$n,{onClick:()=>{m(null),w(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:O,fullWidth:!0,disabled:!g.trim()||y,loading:y,children:"Connect"}),(0,r.jsx)(i.$n,{onClick:()=>{m(null),w(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}},96748:(e,t,s)=>{s.d(t,{default:()=>d});var r=s(95155),a=s(12115),l=s(14051),n=s.n(l),i=s(35497);let o="https://api.openai.com/v1";function d({isOpen:e,onClose:t,onCreated:s,onSaved:l,node:n}){let c=!!n,[m,x]=(0,a.useState)({name:"",prefix:"",baseUrl:o}),[u,p]=(0,a.useState)(!1),[h,f]=(0,a.useState)(""),[b,g]=(0,a.useState)(""),[j,y]=(0,a.useState)(!1),[v,N]=(0,a.useState)(null);(0,a.useEffect)(()=>{e&&(N(null),f(""),g(""),c?x({name:n.name||"",prefix:n.prefix||"",baseUrl:n.baseUrl||o}):x({name:"",prefix:"",baseUrl:o}))},[e,c,n]);let w=async()=>{if(m.name.trim()&&m.prefix.trim()&&m.baseUrl.trim()){p(!0);try{let e=c?`/api/provider-nodes/${n.id}`:"/api/provider-nodes",t=c?"PUT":"POST",r={name:m.name,prefix:m.prefix,baseUrl:m.baseUrl};c||(r.type="custom-embedding");let a=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),i=await a.json();a.ok&&(c?l?.(i.node):s?.(i.node))}catch(e){console.log("Error saving custom embedding node:",e)}finally{p(!1)}}},k=async()=>{y(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:m.baseUrl,apiKey:h,type:"custom-embedding",modelId:b.trim()||void 0})}),t=await e.json();N(t)}catch{N({valid:!1,error:"Network error"})}finally{y(!1)}};return(0,r.jsx)(i.aF,{isOpen:e,title:c?"Edit Custom Embedding":"Add Custom Embedding",onClose:t,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)(i.pd,{label:"Name",value:m.name,onChange:e=>x({...m,name:e.target.value}),placeholder:"Voyage AI",hint:"Required. A friendly label for this embedding provider."}),(0,r.jsx)(i.pd,{label:"Prefix",value:m.prefix,onChange:e=>x({...m,prefix:e.target.value}),placeholder:"voyage",hint:"Required. Used as the provider prefix for model IDs (e.g. voyage/voyage-3)."}),(0,r.jsx)(i.pd,{label:"Base URL",value:m.baseUrl,onChange:e=>x({...m,baseUrl:e.target.value}),placeholder:"https://api.voyageai.com/v1",hint:"Most embedding APIs are OpenAI-compatible: Voyage, Cohere, Jina, Mistral, Together..."}),(0,r.jsx)(i.pd,{label:"API Key (for Check)",type:"password",value:h,onChange:e=>f(e.target.value)}),(0,r.jsx)(i.pd,{label:"Model ID (for Check)",value:b,onChange:e=>g(e.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",hint:"Required for validation. Will send a test embeddings request."}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(i.$n,{onClick:k,disabled:!h||!b.trim()||j||!m.baseUrl.trim(),variant:"secondary",children:j?"Checking...":"Check"}),(()=>{if(!v)return null;let{valid:e,error:t,dimensions:s}=v;return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Ex,{variant:"success",children:"Valid"}),s&&(0,r.jsxs)("span",{className:"text-sm text-text-muted",children:[s," dims"]})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(i.Ex,{variant:"error",children:"Invalid"}),t&&(0,r.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{onClick:w,fullWidth:!0,disabled:!m.name.trim()||!m.prefix.trim()||!m.baseUrl.trim()||u,children:u?c?"Saving...":"Creating...":c?"Save":"Create"}),(0,r.jsx)(i.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}d.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onCreated:n().func,onSaved:n().func,node:n().shape({id:n().string,name:n().string,prefix:n().string,baseUrl:n().string})}},97677:(e,t,s)=>{s.d(t,{default:()=>a});var r=s(95155);function a({text:e,children:t,position:s="top",color:l}){let n=l?"":"bg-gray-900";return(0,r.jsxs)("div",{className:"relative inline-flex group",children:[t,(0,r.jsx)("div",{className:`pointer-events-none absolute ${{top:"bottom-full left-1/2 -translate-x-1/2 mb-1.5",bottom:"top-full left-1/2 -translate-x-1/2 mt-1.5",left:"right-full top-1/2 -translate-y-1/2 mr-1.5",right:"left-full top-1/2 -translate-y-1/2 ml-1.5"}[s]} z-50 w-max max-w-56 rounded px-2 py-1 text-[11px] leading-snug ${n} text-white opacity-0 group-hover:opacity-100 transition-opacity duration-150 whitespace-normal`,style:l?{backgroundColor:l}:{},children:e})]})}},98542:(e,t,s)=>{s.d(t,{default:()=>l});var r=s(95155),a=s(31474);function l({checked:e=!1,onChange:t,label:s,description:n,disabled:i=!1,size:o="md",className:d}){let c={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}};return(0,r.jsxs)("div",{className:(0,a.cn)("flex items-center gap-3",i&&"opacity-50 cursor-not-allowed",d),children:[(0,r.jsx)("button",{type:"button",role:"switch","aria-checked":e,disabled:i,onClick:()=>{!i&&t&&t(!e)},className:(0,a.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-brand-500/30",e?"bg-brand-500":"bg-surface-3",c[o].track,i&&"cursor-not-allowed"),children:(0,r.jsx)("span",{className:(0,a.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",e?c[o].translate:"translate-x-0.5",c[o].thumb,"mt-0.5")})}),(s||n)&&(0,r.jsxs)("div",{className:"flex flex-col",children:[s&&(0,r.jsx)("span",{className:"text-sm font-medium text-text-main",children:s}),n&&(0,r.jsx)("span",{className:"text-xs text-text-muted",children:n})]})]})}},99257:(e,t,s)=>{s.d(t,{default:()=>y});var r=s(95155),a=s(12115),l=s(73321),n=s(98500),i=s.n(n),o=s(14051),d=s.n(o),c=s(57250),m=s(80752),x=s(38587),u=s(47650),p=s(90620);function h({isOpen:e,onClose:t}){let[s,l]=(0,a.useState)(null),[n,i]=(0,a.useState)(!1),[o,d]=(0,a.useState)(""),c=(0,a.useRef)(null);return((0,a.useEffect)(()=>{e&&!s&&(i(!0),d(""),fetch(p.Nu.donateUrl,{cache:"no-store"}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>l(e)).catch(e=>d(e.message||"Failed to load")).finally(()=>i(!1)))},[e,s]),(0,a.useEffect)(()=>{let s=e=>{c.current&&!c.current.contains(e.target)&&t()};if(e)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[e,t]),!e||"u"<typeof document)?null:(0,u.createPortal)((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:t}),(0,r.jsxs)("div",{ref:c,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-3xl flex flex-col max-h-[85vh]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,r.jsxs)("h2",{className:"text-lg font-semibold text-text-main flex items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-pink-500",children:"volunteer_activism"}),s?.title||"Support n9Router"]}),(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","aria-label":"Close",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,r.jsxs)("div",{className:"p-6 overflow-y-auto flex-1",children:[n&&(0,r.jsxs)("div",{className:"flex items-center justify-center py-10 text-text-muted",children:[(0,r.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"progress_activity"}),"Loading..."]}),o&&(0,r.jsxs)("div",{className:"text-red-500 py-4",children:["Failed to load donate info: ",o]}),!n&&!o&&s&&(0,r.jsxs)(r.Fragment,{children:[s.message&&(0,r.jsx)("p",{className:"text-text-muted text-sm mb-6 text-center",children:s.message}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:s.channels?.map(e=>(0,r.jsx)(f,{channel:e},e.id))})]})]})]})]}),document.body)}function f({channel:e}){let{label:t,description:s,icon:a,color:l,url:n,qr:i}=e,o=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-full flex items-center justify-center mb-3",style:{backgroundColor:`${l}20`,color:l},children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[26px]",children:a})}),(0,r.jsx)("div",{className:"font-semibold text-text-main mb-1",children:t}),s&&(0,r.jsx)("div",{className:"text-xs text-text-muted mb-3 text-center",children:s}),i&&(0,r.jsx)("img",{src:i,alt:`${t} QR`,className:"w-full max-w-[180px] aspect-square object-contain rounded-lg bg-white p-1"})]});return(0,r.jsxs)("div",{className:"flex flex-col items-center p-4 rounded-xl border border-black/10 dark:border-white/10 bg-surface/50 hover:border-pink-500/40 transition-colors",children:[o,n&&(0,r.jsxs)("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"mt-3 inline-flex items-center gap-1 px-3 py-1.5 rounded-lg text-sm font-medium text-white hover:opacity-90 transition-opacity",style:{backgroundColor:l},children:["Open",(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"open_in_new"})]})]})}h.propTypes={isOpen:d().bool.isRequired,onClose:d().func.isRequired};var b=s(38003),g=s(52679),j=s(73006);function y({onMenuClick:e,showMenuButton:t=!0}){let s=(0,l.usePathname)(),n=(0,l.useRouter)(),[o,d]=(0,a.useState)(""),[u,f]=(0,a.useState)(""),[b,N]=(0,a.useState)(!1),{title:w,description:k,icon:C,breadcrumbs:S}=(0,a.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/media-providers\/([^/]+)\/([^/]+)$/);if(t){let e=t[1],s=t[2],r=g.rj.find(t=>t.id===e),a=g.Q2[s];return{title:a?.name||s,description:"",breadcrumbs:[{label:"Media Providers",href:`/dashboard/media-providers/${e}`},{label:r?.label||e,href:`/dashboard/media-providers/${e}`},{label:a?.name||s,image:`/providers/${s}.png`}]}}let s=e.match(/\/media-providers\/([^/]+)$/);if(s){let e=s[1],t=g.rj.find(t=>t.id===e);return{title:t?.label||e,description:`Manage your ${t?.label||e} providers`,icon:t?.icon||"perm_media",breadcrumbs:[]}}let r=e.match(/\/providers\/([^/]+)$/);if(r){let e=r[1],t=p.zN[e]||p.fg[e];if(t)return{title:t.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:t.name,image:`/providers/${t.id}.png`}]}}return e.includes("/providers")&&!e.includes("/media-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("/auth-files")?{title:"Auth Files",description:"Map provider credentials stored in the local database",icon:"vpn_key",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("/skills")?{title:"Agent Skills",description:"Copy a link and paste to your AI to use 9Router — no install needed",icon:"extension",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]);(0,a.useEffect)(()=>{let e=!1;return async function(){try{let t=await fetch("/api/auth/status",{cache:"no-store"});if(!t.ok)return;let s=await t.json();e||(d(s?.displayName||s?.oidcName||s?.oidcEmail||""),f(s?.loginMethod||""))}catch{e||(d(""),f(""))}}(),()=>{e=!0}},[]);let T=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:"shrink-0 flex items-center justify-between gap-3 px-4 lg:px-8 pt-3 pb-2 border-b border-border-subtle bg-surface/60 backdrop-blur-xl lg:bg-transparent lg:backdrop-blur-none z-20",children:[(0,r.jsx)("div",{className:"flex items-center gap-3 lg:hidden shrink-0",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:"flex flex-col min-w-0 flex-1",children:S.length>0?(0,r.jsx)("div",{className:"flex items-center gap-2",children:S.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-base lg:text-2xl font-semibold text-text-main tracking-tight truncate",children:(0,j.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):w?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[C&&(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-xl lg:text-2xl",children:C}),(0,r.jsx)("h1",{className:"text-base lg:text-2xl font-semibold tracking-tight truncate",children:(0,j.Tl)(w)})]}),k&&(0,r.jsx)("p",{className:"hidden lg:block text-sm text-text-muted truncate",children:(0,j.Tl)(k)})]}):null}),(0,r.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[o&&"OIDC"===u&&(0,r.jsxs)("div",{className:"hidden sm:flex items-center max-w-[220px] px-3 py-1.5 rounded-full border border-border bg-surface/70 text-xs text-text-muted truncate",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1.5 text-primary",children:"person"}),(0,r.jsx)("span",{className:"truncate",children:o}),(0,r.jsx)("span",{className:"ml-2 shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary",children:"OIDC"})]}),(0,r.jsx)(v,{}),(0,r.jsxs)("button",{onClick:()=>N(!0),className:"flex items-center gap-1.5 px-3 h-8 rounded-lg border border-pink-500/30 bg-pink-500/10 text-pink-600 dark:text-pink-400 hover:bg-pink-500/20 transition-colors text-sm font-medium","aria-label":"Donate",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"volunteer_activism"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Donate"})]}),(0,r.jsx)(x.default,{}),(0,r.jsx)(m.default,{onLogout:T})]}),(0,r.jsx)(h,{isOpen:b,onClose:()=>N(!1)})]})}function v(){let e=(0,b.C)(e=>e.visible),t=(0,b.C)(e=>e.query),s=(0,b.C)(e=>e.placeholder),a=(0,b.C)(e=>e.setQuery);return e?(0,r.jsxs)("div",{className:"relative w-[160px] sm:w-[220px]",children:[(0,r.jsx)("span",{className:"material-symbols-outlined absolute left-2 top-1/2 -translate-y-1/2 text-text-muted text-[16px] pointer-events-none",children:"search"}),(0,r.jsx)("input",{type:"text",value:t,onChange:e=>a(e.target.value),placeholder:s,className:"w-full h-8 pl-7 pr-7 rounded-lg border border-border bg-surface/60 text-sm focus:outline-none focus:border-primary/50 transition-colors"}),t&&(0,r.jsx)("button",{type:"button",onClick:()=>a(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-main p-0.5 rounded","aria-label":"Clear search",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}):null}y.propTypes={onMenuClick:d().func,showMenuButton:d().bool}}}]);