9router 0.2.13 → 0.2.15

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 (395) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +74 -0
  3. package/app/.next/static/chunks/1055.0f91ab6513ec317b.js +1 -0
  4. package/app/.next/static/chunks/1393-c0bf788a0bc19102.js +1 -0
  5. package/app/.next/static/chunks/1441.7b9fc2e539f71e56.js +1 -0
  6. package/app/.next/static/chunks/197.83743acbae435446.js +1 -0
  7. package/app/.next/static/chunks/3433.dfc71de88505c41d.js +1 -0
  8. package/app/.next/static/chunks/3592.2bc2e6e506f250e3.js +1 -0
  9. package/app/.next/static/chunks/4244-0a98cf2e73799efe.js +1 -0
  10. package/app/.next/static/chunks/5812.5dc8861d62b394fe.js +1 -0
  11. package/app/.next/static/chunks/6899.44ddb324d06f2b00.js +1 -0
  12. package/app/.next/static/chunks/8456.50ee5fc36ad7054f.js +1 -0
  13. package/app/.next/static/chunks/9955-a027f64b1a9bf4e5.js +1 -0
  14. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-9009a2a4fdcd878c.js +1 -0
  15. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-60e73b7047f9e428.js +1 -0
  16. package/app/.next/static/chunks/app/api/cli-tools/claude-settings/{route-0084262e28f0dd3b.js → route-a51a32870fa386f8.js} +1 -1
  17. package/app/.next/static/chunks/app/api/cli-tools/codex-settings/{route-0084262e28f0dd3b.js → route-a51a32870fa386f8.js} +1 -1
  18. package/app/.next/static/chunks/app/api/cloud/auth/{route-0084262e28f0dd3b.js → route-a51a32870fa386f8.js} +1 -1
  19. package/app/.next/static/chunks/app/api/cloud/credentials/update/{route-0084262e28f0dd3b.js → route-a51a32870fa386f8.js} +1 -1
  20. package/app/.next/static/chunks/app/api/cloud/model/resolve/route-a51a32870fa386f8.js +1 -0
  21. package/app/.next/static/chunks/app/api/cloud/models/alias/route-a51a32870fa386f8.js +1 -0
  22. package/app/.next/static/chunks/app/api/combos/[id]/route-a51a32870fa386f8.js +1 -0
  23. package/app/.next/static/chunks/app/api/combos/route-a51a32870fa386f8.js +1 -0
  24. package/app/.next/static/chunks/app/api/init/route-a51a32870fa386f8.js +1 -0
  25. package/app/.next/static/chunks/app/api/keys/[id]/route-a51a32870fa386f8.js +1 -0
  26. package/app/.next/static/chunks/app/api/keys/route-a51a32870fa386f8.js +1 -0
  27. package/app/.next/static/chunks/app/api/models/alias/route-a51a32870fa386f8.js +1 -0
  28. package/app/.next/static/chunks/app/api/models/route-a51a32870fa386f8.js +1 -0
  29. package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-a51a32870fa386f8.js +1 -0
  30. package/app/.next/static/chunks/app/api/providers/[id]/models/route-a51a32870fa386f8.js +1 -0
  31. package/app/.next/static/chunks/app/api/providers/[id]/route-a51a32870fa386f8.js +1 -0
  32. package/app/.next/static/chunks/app/api/providers/[id]/test/route-a51a32870fa386f8.js +1 -0
  33. package/app/.next/static/chunks/app/api/providers/client/route-a51a32870fa386f8.js +1 -0
  34. package/app/.next/static/chunks/app/api/providers/route-a51a32870fa386f8.js +1 -0
  35. package/app/.next/static/chunks/app/api/providers/validate/route-a51a32870fa386f8.js +1 -0
  36. package/app/.next/static/chunks/app/api/settings/route-a51a32870fa386f8.js +1 -0
  37. package/app/.next/static/chunks/app/api/shutdown/route-a51a32870fa386f8.js +1 -0
  38. package/app/.next/static/chunks/app/api/sync/cloud/route-a51a32870fa386f8.js +1 -0
  39. package/app/.next/static/chunks/app/api/sync/initialize/route-a51a32870fa386f8.js +1 -0
  40. package/app/.next/static/chunks/app/api/tags/route-a51a32870fa386f8.js +1 -0
  41. package/app/.next/static/chunks/app/api/usage/[connectionId]/route-a51a32870fa386f8.js +1 -0
  42. package/app/.next/static/chunks/app/api/v1/api/chat/route-a51a32870fa386f8.js +1 -0
  43. package/app/.next/static/chunks/app/api/v1/chat/completions/route-a51a32870fa386f8.js +1 -0
  44. package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-a51a32870fa386f8.js +1 -0
  45. package/app/.next/static/chunks/app/api/v1/messages/route-a51a32870fa386f8.js +1 -0
  46. package/app/.next/static/chunks/app/api/v1/responses/route-a51a32870fa386f8.js +1 -0
  47. package/app/.next/static/chunks/app/api/v1/route-a51a32870fa386f8.js +1 -0
  48. package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-a51a32870fa386f8.js +1 -0
  49. package/app/.next/static/chunks/app/api/v1beta/models/route-a51a32870fa386f8.js +1 -0
  50. package/app/.next/static/chunks/app/landing/page-c9ff4225b9e48650.js +1 -0
  51. package/app/.next/static/chunks/app/page-a51a32870fa386f8.js +1 -0
  52. package/app/.next/static/chunks/webpack-e009a29a8139b7cb.js +1 -0
  53. package/app/.next/static/css/d88eaa46491bd5c8.css +3 -0
  54. package/app/app/.next/BUILD_ID +1 -1
  55. package/app/app/.next/app-build-manifest.json +156 -160
  56. package/app/app/.next/app-path-routes-manifest.json +21 -21
  57. package/app/app/.next/build-manifest.json +5 -5
  58. package/app/app/.next/prerender-manifest.json +45 -45
  59. package/app/app/.next/react-loadable-manifest.json +27 -27
  60. package/app/app/.next/required-server-files.json +1 -1
  61. package/app/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +4 -4
  62. package/app/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  63. package/app/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  64. package/app/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  65. package/app/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  66. package/app/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  67. package/app/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  68. package/app/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  69. package/app/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  70. package/app/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  71. package/app/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  72. package/app/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  73. package/app/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  74. package/app/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  75. package/app/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  76. package/app/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  77. package/app/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  78. package/app/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  79. package/app/app/.next/server/app/_not-found/page.js.nft.json +1 -1
  80. package/app/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  81. package/app/app/.next/server/app/_not-found.html +1 -1
  82. package/app/app/.next/server/app/_not-found.rsc +4 -4
  83. package/app/app/.next/server/app/api/cli-tools/claude-settings/route.js +1 -1
  84. package/app/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
  85. package/app/app/.next/server/app/api/cli-tools/codex-settings/route.js +1 -1
  86. package/app/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
  87. package/app/app/.next/server/app/api/cloud/auth/route.js +1 -1
  88. package/app/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
  89. package/app/app/.next/server/app/api/cloud/credentials/update/route.js +1 -1
  90. package/app/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
  91. package/app/app/.next/server/app/api/cloud/model/resolve/route.js +1 -1
  92. package/app/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
  93. package/app/app/.next/server/app/api/cloud/models/alias/route.js +1 -1
  94. package/app/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
  95. package/app/app/.next/server/app/api/combos/[id]/route.js +1 -1
  96. package/app/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
  97. package/app/app/.next/server/app/api/combos/route.js +1 -1
  98. package/app/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
  99. package/app/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  100. package/app/app/.next/server/app/api/keys/[id]/route.js +1 -1
  101. package/app/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
  102. package/app/app/.next/server/app/api/keys/route.js +1 -1
  103. package/app/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
  104. package/app/app/.next/server/app/api/models/alias/route.js +1 -1
  105. package/app/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
  106. package/app/app/.next/server/app/api/models/route.js +1 -1
  107. package/app/app/.next/server/app/api/models/route.js.nft.json +1 -1
  108. package/app/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  109. package/app/app/.next/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  110. package/app/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
  111. package/app/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
  112. package/app/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
  113. package/app/app/.next/server/app/api/providers/[id]/route.js +1 -1
  114. package/app/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
  115. package/app/app/.next/server/app/api/providers/[id]/test/route.js +1 -1
  116. package/app/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
  117. package/app/app/.next/server/app/api/providers/client/route.js +1 -1
  118. package/app/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
  119. package/app/app/.next/server/app/api/providers/route.js +1 -1
  120. package/app/app/.next/server/app/api/providers/route.js.nft.json +1 -1
  121. package/app/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
  122. package/app/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
  123. package/app/app/.next/server/app/api/settings/route.js +1 -1
  124. package/app/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  125. package/app/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  126. package/app/app/.next/server/app/api/sync/cloud/route.js +1 -1
  127. package/app/app/.next/server/app/api/sync/cloud/route.js.nft.json +1 -1
  128. package/app/app/.next/server/app/api/sync/cloud/route_client-reference-manifest.js +1 -1
  129. package/app/app/.next/server/app/api/sync/initialize/route.js +1 -1
  130. package/app/app/.next/server/app/api/sync/initialize/route_client-reference-manifest.js +1 -1
  131. package/app/app/.next/server/app/api/tags/route.js +1 -1
  132. package/app/app/.next/server/app/api/tags/route.js.nft.json +1 -1
  133. package/app/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
  134. package/app/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
  135. package/app/app/.next/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  136. package/app/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
  137. package/app/app/.next/server/app/api/v1/api/chat/route.js +1 -1
  138. package/app/app/.next/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  139. package/app/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
  140. package/app/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
  141. package/app/app/.next/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  142. package/app/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
  143. package/app/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
  144. package/app/app/.next/server/app/api/v1/messages/route.js +1 -1
  145. package/app/app/.next/server/app/api/v1/messages/route.js.nft.json +1 -1
  146. package/app/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
  147. package/app/app/.next/server/app/api/v1/responses/route.js +1 -1
  148. package/app/app/.next/server/app/api/v1/responses/route.js.nft.json +1 -1
  149. package/app/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
  150. package/app/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
  151. package/app/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
  152. package/app/app/.next/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  153. package/app/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
  154. package/app/app/.next/server/app/api/v1beta/models/route.js +1 -1
  155. package/app/app/.next/server/app/api/v1beta/models/route.js.nft.json +1 -1
  156. package/app/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
  157. package/app/app/.next/server/app/callback/page.js.nft.json +1 -1
  158. package/app/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  159. package/app/app/.next/server/app/callback.html +1 -1
  160. package/app/app/.next/server/app/callback.rsc +4 -4
  161. package/app/app/.next/server/app/dashboard/cli-tools.html +1 -1
  162. package/app/app/.next/server/app/dashboard/cli-tools.rsc +6 -6
  163. package/app/app/.next/server/app/dashboard/combos.html +1 -1
  164. package/app/app/.next/server/app/dashboard/combos.rsc +6 -6
  165. package/app/app/.next/server/app/dashboard/endpoint.html +1 -1
  166. package/app/app/.next/server/app/dashboard/endpoint.rsc +6 -6
  167. package/app/app/.next/server/app/dashboard/profile.html +1 -1
  168. package/app/app/.next/server/app/dashboard/profile.rsc +6 -6
  169. package/app/app/.next/server/app/dashboard/providers/new.html +1 -1
  170. package/app/app/.next/server/app/dashboard/providers/new.rsc +6 -6
  171. package/app/app/.next/server/app/dashboard/providers.html +1 -1
  172. package/app/app/.next/server/app/dashboard/providers.rsc +6 -6
  173. package/app/app/.next/server/app/dashboard.html +1 -1
  174. package/app/app/.next/server/app/dashboard.rsc +6 -6
  175. package/app/app/.next/server/app/index.html +1 -1
  176. package/app/app/.next/server/app/index.meta +2 -0
  177. package/app/app/.next/server/app/index.rsc +5 -5
  178. package/app/app/.next/server/app/landing/page.js +2 -2
  179. package/app/app/.next/server/app/landing/page.js.nft.json +1 -1
  180. package/app/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  181. package/app/app/.next/server/app/landing.html +1 -1
  182. package/app/app/.next/server/app/landing.rsc +5 -5
  183. package/app/app/.next/server/app/page.js +2 -2
  184. package/app/app/.next/server/app/page.js.nft.json +1 -1
  185. package/app/app/.next/server/app/page_client-reference-manifest.js +1 -1
  186. package/app/app/.next/server/app-paths-manifest.json +21 -21
  187. package/app/app/.next/server/chunks/1104.js +1 -0
  188. package/app/app/.next/server/chunks/{4498.js → 1178.js} +1 -1
  189. package/app/app/.next/server/chunks/1354.js +1 -1
  190. package/app/app/.next/server/chunks/1582.js +1 -1
  191. package/app/app/.next/server/chunks/1717.js +1 -0
  192. package/app/app/.next/server/chunks/{5051.js → 2045.js} +1 -1
  193. package/app/app/.next/server/chunks/{6380.js → 2328.js} +1 -1
  194. package/app/app/.next/server/chunks/3103.js +1 -1
  195. package/app/app/.next/server/chunks/{1325.js → 3563.js} +1 -1
  196. package/app/app/.next/server/chunks/3576.js +1 -0
  197. package/app/app/.next/server/chunks/{5331.js → 3809.js} +1 -1
  198. package/app/app/.next/server/chunks/4515.js +1 -1
  199. package/app/app/.next/server/chunks/4656.js +1 -0
  200. package/app/app/.next/server/chunks/5170.js +1 -1
  201. package/app/app/.next/server/chunks/{8609.js → 5587.js} +1 -1
  202. package/app/app/.next/server/chunks/5977.js +1 -1
  203. package/app/app/.next/server/chunks/6367.js +1 -0
  204. package/app/app/.next/server/chunks/6689.js +9 -0
  205. package/app/app/.next/server/chunks/6814.js +1 -0
  206. package/app/app/.next/server/chunks/{9676.js → 7374.js} +1 -1
  207. package/app/app/.next/server/chunks/{1492.js → 8611.js} +1 -1
  208. package/app/app/.next/server/chunks/{2662.js → 8764.js} +1 -1
  209. package/app/app/.next/server/middleware-build-manifest.js +1 -1
  210. package/app/app/.next/server/middleware-react-loadable-manifest.js +1 -1
  211. package/app/app/.next/server/pages/404.html +1 -1
  212. package/app/app/.next/server/pages/500.html +1 -1
  213. package/app/app/.next/server/server-reference-manifest.js +1 -1
  214. package/app/app/.next/server/server-reference-manifest.json +1 -1
  215. package/app/app/.next/static/chunks/1055.0f91ab6513ec317b.js +1 -0
  216. package/app/app/.next/static/chunks/1393-c0bf788a0bc19102.js +1 -0
  217. package/app/app/.next/static/chunks/1441.7b9fc2e539f71e56.js +1 -0
  218. package/app/app/.next/static/chunks/197.83743acbae435446.js +1 -0
  219. package/app/app/.next/static/chunks/3433.dfc71de88505c41d.js +1 -0
  220. package/app/app/.next/static/chunks/3592.2bc2e6e506f250e3.js +1 -0
  221. package/app/app/.next/static/chunks/4244-0a98cf2e73799efe.js +1 -0
  222. package/app/app/.next/static/chunks/5812.5dc8861d62b394fe.js +1 -0
  223. package/app/app/.next/static/chunks/6899.44ddb324d06f2b00.js +1 -0
  224. package/app/app/.next/static/chunks/8456.50ee5fc36ad7054f.js +1 -0
  225. package/app/app/.next/static/chunks/9955-a027f64b1a9bf4e5.js +1 -0
  226. package/app/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-9009a2a4fdcd878c.js +1 -0
  227. package/app/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-60e73b7047f9e428.js +1 -0
  228. package/app/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-a51a32870fa386f8.js +1 -0
  229. package/app/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-a51a32870fa386f8.js +1 -0
  230. package/app/app/.next/static/chunks/app/api/cloud/auth/route-a51a32870fa386f8.js +1 -0
  231. package/app/app/.next/static/chunks/app/api/cloud/credentials/update/route-a51a32870fa386f8.js +1 -0
  232. package/app/app/.next/static/chunks/app/api/cloud/model/resolve/route-a51a32870fa386f8.js +1 -0
  233. package/app/app/.next/static/chunks/app/api/cloud/models/alias/route-a51a32870fa386f8.js +1 -0
  234. package/app/app/.next/static/chunks/app/api/combos/[id]/route-a51a32870fa386f8.js +1 -0
  235. package/app/app/.next/static/chunks/app/api/combos/route-a51a32870fa386f8.js +1 -0
  236. package/app/app/.next/static/chunks/app/api/init/route-a51a32870fa386f8.js +1 -0
  237. package/app/app/.next/static/chunks/app/api/keys/[id]/route-a51a32870fa386f8.js +1 -0
  238. package/app/app/.next/static/chunks/app/api/keys/route-a51a32870fa386f8.js +1 -0
  239. package/app/app/.next/static/chunks/app/api/models/alias/route-a51a32870fa386f8.js +1 -0
  240. package/app/app/.next/static/chunks/app/api/models/route-a51a32870fa386f8.js +1 -0
  241. package/app/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-a51a32870fa386f8.js +1 -0
  242. package/app/app/.next/static/chunks/app/api/providers/[id]/models/route-a51a32870fa386f8.js +1 -0
  243. package/app/app/.next/static/chunks/app/api/providers/[id]/route-a51a32870fa386f8.js +1 -0
  244. package/app/app/.next/static/chunks/app/api/providers/[id]/test/route-a51a32870fa386f8.js +1 -0
  245. package/app/app/.next/static/chunks/app/api/providers/client/route-a51a32870fa386f8.js +1 -0
  246. package/app/app/.next/static/chunks/app/api/providers/route-a51a32870fa386f8.js +1 -0
  247. package/app/app/.next/static/chunks/app/api/providers/validate/route-a51a32870fa386f8.js +1 -0
  248. package/app/app/.next/static/chunks/app/api/settings/route-a51a32870fa386f8.js +1 -0
  249. package/app/app/.next/static/chunks/app/api/shutdown/route-a51a32870fa386f8.js +1 -0
  250. package/app/app/.next/static/chunks/app/api/sync/cloud/route-a51a32870fa386f8.js +1 -0
  251. package/app/app/.next/static/chunks/app/api/sync/initialize/route-a51a32870fa386f8.js +1 -0
  252. package/app/app/.next/static/chunks/app/api/tags/route-a51a32870fa386f8.js +1 -0
  253. package/app/app/.next/static/chunks/app/api/usage/[connectionId]/route-a51a32870fa386f8.js +1 -0
  254. package/app/app/.next/static/chunks/app/api/v1/api/chat/route-a51a32870fa386f8.js +1 -0
  255. package/app/app/.next/static/chunks/app/api/v1/chat/completions/route-a51a32870fa386f8.js +1 -0
  256. package/app/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-a51a32870fa386f8.js +1 -0
  257. package/app/app/.next/static/chunks/app/api/v1/messages/route-a51a32870fa386f8.js +1 -0
  258. package/app/app/.next/static/chunks/app/api/v1/responses/route-a51a32870fa386f8.js +1 -0
  259. package/app/app/.next/static/chunks/app/api/v1/route-a51a32870fa386f8.js +1 -0
  260. package/app/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-a51a32870fa386f8.js +1 -0
  261. package/app/app/.next/static/chunks/app/api/v1beta/models/route-a51a32870fa386f8.js +1 -0
  262. package/app/app/.next/static/chunks/app/landing/page-c9ff4225b9e48650.js +1 -0
  263. package/app/app/.next/static/chunks/app/page-a51a32870fa386f8.js +1 -0
  264. package/app/app/.next/static/chunks/webpack-e009a29a8139b7cb.js +1 -0
  265. package/app/app/.next/static/css/d88eaa46491bd5c8.css +3 -0
  266. package/app/app/package.json +1 -9
  267. package/app/app/public/favicon.svg +11 -0
  268. package/app/app/server.js +1 -1
  269. package/app/package.json +2 -10
  270. package/app/public/favicon.svg +11 -0
  271. package/hooks/model-websearch.cjs +11 -11
  272. package/package.json +4 -2
  273. package/app/.next/static/chunks/1108.dfb5c59c23b4ad41.js +0 -1
  274. package/app/.next/static/chunks/1393-7288fec519c2e8bd.js +0 -1
  275. package/app/.next/static/chunks/252-cb6f99bd45e4e12b.js +0 -1
  276. package/app/.next/static/chunks/4244-699e2d023e54f7eb.js +0 -1
  277. package/app/.next/static/chunks/6360.0c430a4f52aa56a1.js +0 -1
  278. package/app/.next/static/chunks/6765.602b5bd2b6d6d21c.js +0 -1
  279. package/app/.next/static/chunks/7332.a4365ce6cc35978d.js +0 -1
  280. package/app/.next/static/chunks/7647.c62006182fa7eaa9.js +0 -1
  281. package/app/.next/static/chunks/8325.6269b283e886fd9b.js +0 -1
  282. package/app/.next/static/chunks/8717.c8dc7698be4136f1.js +0 -1
  283. package/app/.next/static/chunks/9817.655825f161ddc664.js +0 -1
  284. package/app/.next/static/chunks/9955-6d41cf5902a69a61.js +0 -1
  285. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-ff3ccae28ee7e6c5.js +0 -1
  286. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-b855a6ae07591f1f.js +0 -1
  287. package/app/.next/static/chunks/app/api/cloud/model/resolve/route-0084262e28f0dd3b.js +0 -1
  288. package/app/.next/static/chunks/app/api/cloud/models/alias/route-0084262e28f0dd3b.js +0 -1
  289. package/app/.next/static/chunks/app/api/combos/[id]/route-0084262e28f0dd3b.js +0 -1
  290. package/app/.next/static/chunks/app/api/combos/route-0084262e28f0dd3b.js +0 -1
  291. package/app/.next/static/chunks/app/api/init/route-0084262e28f0dd3b.js +0 -1
  292. package/app/.next/static/chunks/app/api/keys/[id]/route-0084262e28f0dd3b.js +0 -1
  293. package/app/.next/static/chunks/app/api/keys/route-0084262e28f0dd3b.js +0 -1
  294. package/app/.next/static/chunks/app/api/models/alias/route-0084262e28f0dd3b.js +0 -1
  295. package/app/.next/static/chunks/app/api/models/route-0084262e28f0dd3b.js +0 -1
  296. package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-0084262e28f0dd3b.js +0 -1
  297. package/app/.next/static/chunks/app/api/providers/[id]/models/route-0084262e28f0dd3b.js +0 -1
  298. package/app/.next/static/chunks/app/api/providers/[id]/route-0084262e28f0dd3b.js +0 -1
  299. package/app/.next/static/chunks/app/api/providers/[id]/test/route-0084262e28f0dd3b.js +0 -1
  300. package/app/.next/static/chunks/app/api/providers/client/route-0084262e28f0dd3b.js +0 -1
  301. package/app/.next/static/chunks/app/api/providers/route-0084262e28f0dd3b.js +0 -1
  302. package/app/.next/static/chunks/app/api/providers/validate/route-0084262e28f0dd3b.js +0 -1
  303. package/app/.next/static/chunks/app/api/settings/route-0084262e28f0dd3b.js +0 -1
  304. package/app/.next/static/chunks/app/api/shutdown/route-0084262e28f0dd3b.js +0 -1
  305. package/app/.next/static/chunks/app/api/sync/cloud/route-0084262e28f0dd3b.js +0 -1
  306. package/app/.next/static/chunks/app/api/sync/initialize/route-0084262e28f0dd3b.js +0 -1
  307. package/app/.next/static/chunks/app/api/tags/route-0084262e28f0dd3b.js +0 -1
  308. package/app/.next/static/chunks/app/api/usage/[connectionId]/route-0084262e28f0dd3b.js +0 -1
  309. package/app/.next/static/chunks/app/api/v1/api/chat/route-0084262e28f0dd3b.js +0 -1
  310. package/app/.next/static/chunks/app/api/v1/chat/completions/route-0084262e28f0dd3b.js +0 -1
  311. package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-0084262e28f0dd3b.js +0 -1
  312. package/app/.next/static/chunks/app/api/v1/messages/route-0084262e28f0dd3b.js +0 -1
  313. package/app/.next/static/chunks/app/api/v1/responses/route-0084262e28f0dd3b.js +0 -1
  314. package/app/.next/static/chunks/app/api/v1/route-0084262e28f0dd3b.js +0 -1
  315. package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-0084262e28f0dd3b.js +0 -1
  316. package/app/.next/static/chunks/app/api/v1beta/models/route-0084262e28f0dd3b.js +0 -1
  317. package/app/.next/static/chunks/app/landing/page-1f54485eea138967.js +0 -1
  318. package/app/.next/static/chunks/app/page-3126678fc8370f4f.js +0 -1
  319. package/app/.next/static/chunks/webpack-f8817ed5cc2611bf.js +0 -1
  320. package/app/.next/static/css/12c46cc8881ce1ef.css +0 -3
  321. package/app/app/.next/server/chunks/1220.js +0 -1
  322. package/app/app/.next/server/chunks/308.js +0 -1
  323. package/app/app/.next/server/chunks/4208.js +0 -1
  324. package/app/app/.next/server/chunks/4696.js +0 -1
  325. package/app/app/.next/server/chunks/6161.js +0 -1
  326. package/app/app/.next/server/chunks/6697.js +0 -1
  327. package/app/app/.next/server/chunks/6918.js +0 -1
  328. package/app/app/.next/server/chunks/8272.js +0 -9
  329. package/app/app/.next/server/chunks/8487.js +0 -1
  330. package/app/app/.next/static/chunks/1108.dfb5c59c23b4ad41.js +0 -1
  331. package/app/app/.next/static/chunks/1393-7288fec519c2e8bd.js +0 -1
  332. package/app/app/.next/static/chunks/252-cb6f99bd45e4e12b.js +0 -1
  333. package/app/app/.next/static/chunks/4244-699e2d023e54f7eb.js +0 -1
  334. package/app/app/.next/static/chunks/6360.0c430a4f52aa56a1.js +0 -1
  335. package/app/app/.next/static/chunks/6765.602b5bd2b6d6d21c.js +0 -1
  336. package/app/app/.next/static/chunks/7332.a4365ce6cc35978d.js +0 -1
  337. package/app/app/.next/static/chunks/7647.c62006182fa7eaa9.js +0 -1
  338. package/app/app/.next/static/chunks/8325.6269b283e886fd9b.js +0 -1
  339. package/app/app/.next/static/chunks/8717.c8dc7698be4136f1.js +0 -1
  340. package/app/app/.next/static/chunks/9817.655825f161ddc664.js +0 -1
  341. package/app/app/.next/static/chunks/9955-6d41cf5902a69a61.js +0 -1
  342. package/app/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-ff3ccae28ee7e6c5.js +0 -1
  343. package/app/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-b855a6ae07591f1f.js +0 -1
  344. package/app/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-0084262e28f0dd3b.js +0 -1
  345. package/app/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-0084262e28f0dd3b.js +0 -1
  346. package/app/app/.next/static/chunks/app/api/cloud/auth/route-0084262e28f0dd3b.js +0 -1
  347. package/app/app/.next/static/chunks/app/api/cloud/credentials/update/route-0084262e28f0dd3b.js +0 -1
  348. package/app/app/.next/static/chunks/app/api/cloud/model/resolve/route-0084262e28f0dd3b.js +0 -1
  349. package/app/app/.next/static/chunks/app/api/cloud/models/alias/route-0084262e28f0dd3b.js +0 -1
  350. package/app/app/.next/static/chunks/app/api/combos/[id]/route-0084262e28f0dd3b.js +0 -1
  351. package/app/app/.next/static/chunks/app/api/combos/route-0084262e28f0dd3b.js +0 -1
  352. package/app/app/.next/static/chunks/app/api/init/route-0084262e28f0dd3b.js +0 -1
  353. package/app/app/.next/static/chunks/app/api/keys/[id]/route-0084262e28f0dd3b.js +0 -1
  354. package/app/app/.next/static/chunks/app/api/keys/route-0084262e28f0dd3b.js +0 -1
  355. package/app/app/.next/static/chunks/app/api/models/alias/route-0084262e28f0dd3b.js +0 -1
  356. package/app/app/.next/static/chunks/app/api/models/route-0084262e28f0dd3b.js +0 -1
  357. package/app/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-0084262e28f0dd3b.js +0 -1
  358. package/app/app/.next/static/chunks/app/api/providers/[id]/models/route-0084262e28f0dd3b.js +0 -1
  359. package/app/app/.next/static/chunks/app/api/providers/[id]/route-0084262e28f0dd3b.js +0 -1
  360. package/app/app/.next/static/chunks/app/api/providers/[id]/test/route-0084262e28f0dd3b.js +0 -1
  361. package/app/app/.next/static/chunks/app/api/providers/client/route-0084262e28f0dd3b.js +0 -1
  362. package/app/app/.next/static/chunks/app/api/providers/route-0084262e28f0dd3b.js +0 -1
  363. package/app/app/.next/static/chunks/app/api/providers/validate/route-0084262e28f0dd3b.js +0 -1
  364. package/app/app/.next/static/chunks/app/api/settings/route-0084262e28f0dd3b.js +0 -1
  365. package/app/app/.next/static/chunks/app/api/shutdown/route-0084262e28f0dd3b.js +0 -1
  366. package/app/app/.next/static/chunks/app/api/sync/cloud/route-0084262e28f0dd3b.js +0 -1
  367. package/app/app/.next/static/chunks/app/api/sync/initialize/route-0084262e28f0dd3b.js +0 -1
  368. package/app/app/.next/static/chunks/app/api/tags/route-0084262e28f0dd3b.js +0 -1
  369. package/app/app/.next/static/chunks/app/api/usage/[connectionId]/route-0084262e28f0dd3b.js +0 -1
  370. package/app/app/.next/static/chunks/app/api/v1/api/chat/route-0084262e28f0dd3b.js +0 -1
  371. package/app/app/.next/static/chunks/app/api/v1/chat/completions/route-0084262e28f0dd3b.js +0 -1
  372. package/app/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-0084262e28f0dd3b.js +0 -1
  373. package/app/app/.next/static/chunks/app/api/v1/messages/route-0084262e28f0dd3b.js +0 -1
  374. package/app/app/.next/static/chunks/app/api/v1/responses/route-0084262e28f0dd3b.js +0 -1
  375. package/app/app/.next/static/chunks/app/api/v1/route-0084262e28f0dd3b.js +0 -1
  376. package/app/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-0084262e28f0dd3b.js +0 -1
  377. package/app/app/.next/static/chunks/app/api/v1beta/models/route-0084262e28f0dd3b.js +0 -1
  378. package/app/app/.next/static/chunks/app/landing/page-1f54485eea138967.js +0 -1
  379. package/app/app/.next/static/chunks/app/page-3126678fc8370f4f.js +0 -1
  380. package/app/app/.next/static/chunks/webpack-f8817ed5cc2611bf.js +0 -1
  381. package/app/app/.next/static/css/12c46cc8881ce1ef.css +0 -3
  382. package/app/app/images/router4.png +0 -0
  383. package/app/images/router4.png +0 -0
  384. package/app/open-sse/package.json +0 -44
  385. /package/app/.next/static/{akJVQvPZ51z4gv6qe5ZHN → _gC7vRgPAPGHB1TBB8KL2}/_buildManifest.js +0 -0
  386. /package/app/.next/static/{akJVQvPZ51z4gv6qe5ZHN → _gC7vRgPAPGHB1TBB8KL2}/_ssgManifest.js +0 -0
  387. /package/app/app/.next/static/{akJVQvPZ51z4gv6qe5ZHN → _gC7vRgPAPGHB1TBB8KL2}/_buildManifest.js +0 -0
  388. /package/app/app/.next/static/{akJVQvPZ51z4gv6qe5ZHN → _gC7vRgPAPGHB1TBB8KL2}/_ssgManifest.js +0 -0
  389. /package/app/{open-sse → app/open-sse}/translator/from-openai/claude.js +0 -0
  390. /package/app/{open-sse → app/open-sse}/translator/from-openai/gemini.js +0 -0
  391. /package/app/{open-sse → app/open-sse}/translator/from-openai/openai-responses.js +0 -0
  392. /package/app/{open-sse → app/open-sse}/translator/to-openai/claude.js +0 -0
  393. /package/app/{open-sse → app/open-sse}/translator/to-openai/gemini.js +0 -0
  394. /package/app/{open-sse → app/open-sse}/translator/to-openai/openai-responses.js +0 -0
  395. /package/app/{open-sse → app/open-sse}/translator/to-openai/openai.js +0 -0
package/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 9Router Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+
24
+
25
+
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # 9Router CLI
2
+
3
+ [![npm version](https://img.shields.io/npm/v/9router.svg)](https://www.npmjs.com/package/9router)
4
+ [![License](https://img.shields.io/npm/l/9router.svg)](LICENSE)
5
+
6
+ **9Router** - AI endpoint proxy with web dashboard. Unified access to 15+ AI providers (Claude, OpenAI, Gemini, GitHub Copilot, and more) through a single endpoint.
7
+
8
+ ## 📦 Installation
9
+
10
+ ```bash
11
+ # Run directly with npx (recommended)
12
+ npx 9router
13
+
14
+ # Or install globally
15
+ npm install -g 9router
16
+ 9router
17
+ ```
18
+
19
+ ## 🚀 Usage
20
+
21
+ ```bash
22
+ 9router # Start server with default settings
23
+ 9router --port 8080 # Custom port
24
+ 9router --no-browser # Don't open browser
25
+ 9router --skip-update # Skip auto-update check
26
+ 9router --help # Show all options
27
+ ```
28
+
29
+ **Dashboard**: Open `http://localhost:20128/dashboard` in your browser
30
+
31
+ ## ✨ Features
32
+
33
+ - 🔄 **Multi-Provider Support**: Claude, OpenAI, Gemini, GitHub Copilot, Qwen, iFlow, DeepSeek, and more
34
+ - 🔐 **OAuth & API Key Auth**: Support both OAuth2 and API key authentication
35
+ - 🎯 **Format Translation**: Auto-translate between OpenAI, Claude, Gemini, Codex formats
36
+ - 🌐 **Web Dashboard**: Manage providers, combos, API keys, and settings
37
+ - 🎲 **Combo System**: Create model combos with automatic fallback
38
+ - ♻️ **Intelligent Fallback**: Auto account rotation on rate limits/errors
39
+ - 📊 **Usage Tracking**: Real-time monitoring for all API requests
40
+ - 🔍 **WebSearch Hook**: Model-based web search for Claude Code CLI
41
+
42
+ ## 🛠️ CLI Integration
43
+
44
+ Works seamlessly with:
45
+ - **Claude Code** (Anthropic)
46
+ - **OpenAI Codex**
47
+ - **Cline, RooCode, AmpCode**
48
+ - **Cursor IDE**
49
+ - Any tool supporting OpenAI-compatible API
50
+
51
+ ## 💾 Data Location
52
+
53
+ User data stored at:
54
+ - **macOS/Linux**: `~/.9router/db.json`
55
+ - **Windows**: `%APPDATA%/9router/db.json`
56
+
57
+ ## 📚 Documentation
58
+
59
+ For full documentation, advanced configuration, and development guide, visit:
60
+ - **GitHub**: [https://github.com/decolua/9router](https://github.com/decolua/9router)
61
+ - **Full README**: [https://github.com/decolua/9router/blob/main/app/README.md](https://github.com/decolua/9router/blob/main/app/README.md)
62
+
63
+ ## 🙏 Acknowledgments
64
+
65
+ - **[CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI)**: Original Go implementation
66
+ - **[ccs](https://github.com/kaitranntt/ccs)**: WebSearch hook reference
67
+
68
+ ## 📄 License
69
+
70
+ MIT License - see [LICENSE](LICENSE) for details.
71
+
72
+
73
+
74
+
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1055],{1055:(e,t,n)=>{var o=n(4427),l=n(6775);let s=["minLength","maxLength","exclusiveMinimum","exclusiveMaximum","pattern","minItems","maxItems","format","default","examples","$schema","const"],a=[{category:"HARM_CATEGORY_HATE_SPEECH",threshold:"OFF"},{category:"HARM_CATEGORY_DANGEROUS_CONTENT",threshold:"OFF"},{category:"HARM_CATEGORY_SEXUALLY_EXPLICIT",threshold:"OFF"},{category:"HARM_CATEGORY_HARASSMENT",threshold:"OFF"},{category:"HARM_CATEGORY_CIVIC_INTEGRITY",threshold:"OFF"}];function i(e){return"string"==typeof e?e:Array.isArray(e)?e.filter(e=>"text"===e.type).map(e=>e.text).join(""):""}function r(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(e){return null}}function c(e,t,n){var o,l;let s={model:e,contents:[],generationConfig:{},safetySettings:a};void 0!==t.temperature&&(s.generationConfig.temperature=t.temperature),void 0!==t.top_p&&(s.generationConfig.topP=t.top_p),void 0!==t.top_k&&(s.generationConfig.topK=t.top_k),void 0!==t.max_tokens&&(s.generationConfig.maxOutputTokens=t.max_tokens);let c={};if(t.messages&&Array.isArray(t.messages)){for(let e of t.messages)if("assistant"===e.role&&e.tool_calls)for(let t of e.tool_calls)"function"===t.type&&t.id&&(null==(o=t.function)?void 0:o.name)&&(c[t.id]=t.function.name)}let u={};if(t.messages&&Array.isArray(t.messages))for(let e of t.messages)"tool"===e.role&&e.tool_call_id&&(u[e.tool_call_id]=e.content);if(t.messages&&Array.isArray(t.messages))for(let e=0;e<t.messages.length;e++){let n=t.messages[e],o=n.role,a=n.content;if("system"===o&&t.messages.length>1)s.systemInstruction={role:"user",parts:[{text:"string"==typeof a?a:i(a)}]};else if("user"===o||"system"===o&&1===t.messages.length){let e=function(e){let t=[];if("string"==typeof e)t.push({text:e});else if(Array.isArray(e))for(let l of e){var n,o;if("text"===l.type)t.push({text:l.text});else if("image_url"===l.type&&(null==(o=l.image_url)||null==(n=o.url)?void 0:n.startsWith("data:"))){let e=l.image_url.url.match(/^data:([^;]+);base64,(.+)$/);e&&t.push({inlineData:{mime_type:e[1],data:e[2]}})}}return t}(a);e.length>0&&s.contents.push({role:"user",parts:e})}else if("assistant"===o){let e=[];if(a){let t="string"==typeof a?a:i(a);t&&e.push({text:t})}if(n.tool_calls&&Array.isArray(n.tool_calls)){let t=[];for(let o of n.tool_calls){if("function"!==o.type)continue;let n=r((null==(l=o.function)?void 0:l.arguments)||"{}");e.push({thoughtSignature:"EuwGCukGAXLI2nxwZIq54WWSoL/YN0P3TsDZ7zRnLi8g0S4aVr2HUGxvaHKySuY6HAVzcE0GPGjXrytLIldxthSvfxgUlJh6Qa9Z+Oj5QZBlYdg6HaJ6yuY5R7waE6rdwBsRf7Ft2j3DJ9rMi9qhWFqApewYtPhls3VHtuvND3l8Rm09+lbAXQs6KKWEWrxNLKTBkfpMgXhRERc/TQRMZu1twAablm6/Zk1tsYRvfWKLsNbeKF+CCojJdXJKvnR/8Ouuoa+Y2Ti20hcW7aZIIjZDFYPU//k6Ybmhg69J/imbFai2ckhfLaisqdDkdoIiBJScTOUvYqP6AE9d4MsydSC+UlhIMk4hoP76R8vUSCZRMkjOaDXstf/QoVZKbt94wyRZgAJ1G0BqI8L5ow86kLpA4wJEtxsRGymOE4bKUvApveBakYDNM9APkf+LbtbzWSseGjoZcSlycF9iN8Q2XNYKRrHbv3Lr5Y8JjdH/5y/6SHkNehTEZugaeGnSPSyCTWto1kQgHpxdWmhkLfJGNUGLmue7Mesj4TSms4J33mRpYVhNB/J333FCqIP0hr/E7BkkjEn7yZ4X7SQlh+xKPurapsnHRwiKmtsilmEFrnTE9iQr+pMr6M29qqFNv1tr5yumbaJw8JW9sB15tNsRv+dW6BjNanbsKz7HCgKUBc8tGy+7YuhXzAfViyRefcjK7eZW0Fbyt7AbybJTKz78W8NH7ye6LAwzOebXpeZ4D43fNIt8bKh26qgduSQv/7o+pAflkuqHZ99YWgHQ8h8OkZFi3eOiSYjsjhdZ/czWOdoPI/OnqIldzMPF5YlrKBLFX8VhRKVmqgsmWf5PHGulHhMkVlS+XG2UIseGy69ARa93D78Gsa+1n1kJr7EEB7Rh+27vUMxVYLdz1yMSvE5nalTAlg/ZeG8+XQ0cHuAI3KbQpHW2Q++RdXfm5JzD5WdJZUU+Zn8t8UUn85BH4RxZLeE0qJikgSsKoYVBc6YhiMjhPgkR95ReimY4Z0xCJdRo1gjexOFeODZMpQF6Yxnoic7IrdgsFA3iePTbFnPp3IAM1fAThWhXJUn3QInUOTd5o1qmTmn6REbL15g/JQNl+dqUoPkhleeb2V3kjqp1okmO3wMZbPknR3S1LZNmlS72/iBQUm+n2b/RCn4PjmM2",functionCall:{id:o.id,name:o.function.name,args:n}}),t.push(o.id)}e.length>0&&s.contents.push({role:"model",parts:e});let o=[];for(let e of t){let t=c[e];if(!t){let n=e.split("-");t=n.length>2?n.slice(0,-2).join("-"):e}let n=u[e]||"{}",l=r(n);null===l?l={result:n}:"object"!=typeof l&&(l={result:l}),o.push({functionResponse:{id:e,name:t,response:{result:l}}})}o.length>0&&s.contents.push({role:"user",parts:o})}else e.length>0&&s.contents.push({role:"model",parts:e})}}if(t.tools&&Array.isArray(t.tools)&&t.tools.length>0){let e=[];for(let n of t.tools)if("function"===n.type&&n.function){let t=n.function;e.push({name:t.name,description:t.description||"",parameters:t.parameters||{type:"object",properties:{}}})}e.length>0&&(s.tools=[{functionDeclarations:e}])}return s}function u(e,t,n){var o,l,a;let i=c(e,t,n),r=e.toLowerCase().includes("claude");if(t.reasoning_effort){let e={low:1024,medium:8192,high:32768}[t.reasoning_effort]||8192;i.generationConfig.thinkingConfig={thinkingBudget:e,include_thoughts:!0}}if((null==(o=t.thinking)?void 0:o.type)==="enabled"&&t.thinking.budget_tokens&&(i.generationConfig.thinkingConfig={thinkingBudget:t.thinking.budget_tokens,include_thoughts:!0}),null==(a=i.tools)||null==(l=a[0])?void 0:l.functionDeclarations){for(let e of i.tools[0].functionDeclarations)if(e.parameters){let t=function e(t){if(!t||"object"!=typeof t)return t;let n=Array.isArray(t)?[]:{};for(let[o,l]of Object.entries(t))if(!s.includes(o)){if("type"===o&&Array.isArray(l)){let e=l.find(e=>"null"!==e)||"string";n[o]=e;continue}l&&"object"==typeof l?n[o]=e(l):n[o]=l}if(n.required&&Array.isArray(n.required)&&n.properties){let e=n.required.filter(e=>Object.prototype.hasOwnProperty.call(n.properties,e));0===e.length?delete n.required:n.required=e}return"object"!==n.type||n.properties&&0!==Object.keys(n.properties).length||(n.properties={reason:{type:"string",description:"Brief explanation of why you are calling this tool"}},n.required=["reason"]),n}(e.parameters);r?e.parameters=t:(e.parametersJsonSchema=t,delete e.parameters)}}return i}function h(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return{project:(null==n?void 0:n.projectId)||function(){let e=["useful","bright","swift","calm","bold"],t=["fuze","wave","spark","flow","core"],n=e[Math.floor(Math.random()*e.length)],o=t[Math.floor(Math.random()*t.length)];return"".concat(n,"-").concat(o,"-").concat(crypto.randomUUID().slice(0,5))}(),model:e,userAgent:"gemini-cli",requestId:"agent-".concat(crypto.randomUUID()),request:{sessionId:"-".concat(Math.floor(9e18*Math.random())),contents:t.contents,systemInstruction:t.systemInstruction,generationConfig:t.generationConfig,safetySettings:t.safetySettings,tools:t.tools}}}function f(e,t){var n;if(!e)return null;let o=e.response||e;if(!o||!(null==(n=o.candidates)?void 0:n[0]))return null;let l=[],s=o.candidates[0],a=s.content;if(t.messageId||(t.messageId=o.responseId||"msg_".concat(Date.now()),t.model=o.modelVersion||"gemini",t.functionIndex=0,l.push({id:"chatcmpl-".concat(t.messageId),object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t.model,choices:[{index:0,delta:{role:"assistant"},finish_reason:null}]})),null==a?void 0:a.parts)for(let e of a.parts){let n=e.thoughtSignature||e.thought_signature,o=!0===e.thought;if(n){let n=void 0!==e.text&&""!==e.text,s=!!e.functionCall;if(n&&l.push({id:"chatcmpl-".concat(t.messageId),object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t.model,choices:[{index:0,delta:o?{reasoning_content:e.text}:{content:e.text},finish_reason:null}]}),s){let n=e.functionCall.name,o=e.functionCall.args||{},s=t.functionIndex++,a={id:"".concat(n,"-").concat(Date.now(),"-").concat(s),index:s,type:"function",function:{name:n,arguments:JSON.stringify(o)}};t.toolCalls.set(s,a),l.push({id:"chatcmpl-".concat(t.messageId),object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t.model,choices:[{index:0,delta:{tool_calls:[a]},finish_reason:null}]})}continue}if(void 0!==e.text&&""!==e.text&&l.push({id:"chatcmpl-".concat(t.messageId),object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t.model,choices:[{index:0,delta:{content:e.text},finish_reason:null}]}),e.functionCall){let n=e.functionCall.name,o=e.functionCall.args||{},s=t.functionIndex++,a={id:"".concat(n,"-").concat(Date.now(),"-").concat(s),index:s,type:"function",function:{name:n,arguments:JSON.stringify(o)}};t.toolCalls.set(s,a),l.push({id:"chatcmpl-".concat(t.messageId),object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t.model,choices:[{index:0,delta:{tool_calls:[a]},finish_reason:null}]})}let s=e.inlineData||e.inline_data;if(null==s?void 0:s.data){let e=s.mimeType||s.mime_type||"image/png";l.push({id:"chatcmpl-".concat(t.messageId),object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t.model,choices:[{index:0,delta:{images:[{type:"image_url",image_url:{url:"data:".concat(e,";base64,").concat(s.data)}}]},finish_reason:null}]})}}if(s.finishReason){let e=s.finishReason.toLowerCase();"stop"===e&&t.toolCalls.size>0&&(e="tool_calls"),l.push({id:"chatcmpl-".concat(t.messageId),object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t.model,choices:[{index:0,delta:{},finish_reason:e}]}),t.finishReason=e}let i=o.usageMetadata||e.usageMetadata;return i&&(t.usage={prompt_tokens:(i.promptTokenCount||0)+(i.thoughtsTokenCount||0),completion_tokens:i.candidatesTokenCount||0,total_tokens:i.totalTokenCount||0},i.thoughtsTokenCount>0&&(t.usage.completion_tokens_details={reasoning_tokens:i.thoughtsTokenCount})),l.length>0?l:null}(0,o.kz)(l.h.OPENAI,l.h.GEMINI,function(e,t,n){return c(e,t,n)},null),(0,o.kz)(l.h.OPENAI,l.h.GEMINI_CLI,(e,t,n,o)=>h(e,u(e,t,n),o),null),(0,o.kz)(l.h.OPENAI,l.h.ANTIGRAVITY,function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,l=u(e,t,n);return h(e,l,o)},null),(0,o.kz)(l.h.GEMINI,l.h.OPENAI,null,f),(0,o.kz)(l.h.GEMINI_CLI,l.h.OPENAI,null,f),(0,o.kz)(l.h.ANTIGRAVITY,l.h.OPENAI,null,f)}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1393],{1393:(e,s,l)=>{Promise.resolve().then(l.bind(l,1902))},1902:(e,s,l)=>{"use strict";l.d(s,{default:()=>d});var t=l(5155),a=l(2115),i=l(4244),r=l(2694);let n="https://9router.com";function d(e){let{machineId:s}=e,[l,d]=(0,a.useState)([]),[c,o]=(0,a.useState)(!0),[x,m]=(0,a.useState)(!1),[h,y]=(0,a.useState)(""),[p,u]=(0,a.useState)(null),[b,g]=(0,a.useState)(!1),[f,j]=(0,a.useState)(!1),[N,v]=(0,a.useState)(!1),[k,w]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),[_,E]=(0,a.useState)(""),{copied:P,copy:O}=(0,r.C)();(0,a.useEffect)(()=>{A(),$()},[]);let $=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let s=await e.json();g(s.cloudEnabled||!1)}}catch(e){console.log("Error loading cloud settings:",e)}},A=async()=>{try{let e=await fetch("/api/keys"),s=await e.json();e.ok&&d(s.keys||[])}catch(e){console.log("Error fetching data:",e)}finally{o(!1)}},D=e=>{e?j(!0):v(!0)},T=async()=>{w(!0),E("syncing");try{let e=await fetch("/api/sync/cloud",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"enable"})}),s=await e.json();e.ok?(E("verifying"),s.verified?(g(!0),S({type:"success",message:"Cloud Proxy connected and verified!"})):(g(!0),S({type:"warning",message:s.verifyError||"Connected but verification failed"})),j(!1),s.createdKey&&await A()):S({type:"error",message:s.error||"Failed to enable cloud"})}catch(e){S({type:"error",message:e.message})}finally{w(!1),E("")}},W=async()=>{w(!0),E("syncing");try{await fetch("/api/sync/cloud",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"sync"})}),E("disabling"),(await fetch("/api/sync/cloud",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"disable"})})).ok&&(g(!1),S({type:"success",message:"Cloud disabled"}),v(!1))}catch(e){console.log("Error disabling cloud:",e),S({type:"error",message:"Failed to disable cloud"})}finally{w(!1),E("")}},I=async()=>{if(h.trim())try{let e=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:h})}),s=await e.json();e.ok&&(u(s.key),await A(),y(""),m(!1))}catch(e){console.log("Error creating key:",e)}},K=async e=>{if(confirm("Delete this API key?"))try{(await fetch("/api/keys/".concat(e),{method:"DELETE"})).ok&&d(l.filter(s=>s.id!==e))}catch(e){console.log("Error deleting key:",e)}};"localhost"===window.location.hostname||window.location.hostname;let F="".concat(window.location.origin,"/v1");if("".concat(n,"/").concat(s,"/v1"),c)return(0,t.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,t.jsx)(i.Qv,{}),(0,t.jsx)(i.Qv,{})]});let J=b?"".concat(n,"/v1"):F;return(0,t.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,t.jsxs)(i.Zp,{className:"",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-lg font-semibold",children:"API Endpoint"}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:b?"Using Cloud Proxy":"Using Local Server"})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:b?(0,t.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"cloud_off",onClick:()=>D(!1),disabled:k,className:"!bg-red-500/10 !text-red-500 hover:!bg-red-500/20 !border-red-500/30",children:"Disable Cloud"}):(0,t.jsx)(i.$n,{variant:"primary",icon:"cloud_upload",onClick:()=>D(!0),disabled:k,className:"bg-gradient-to-r from-primary to-blue-500 hover:from-primary-hover hover:to-blue-600",children:"Enable Cloud"})})]}),(0,t.jsxs)("div",{className:"flex gap-2 mb-3",children:[(0,t.jsx)(i.pd,{value:J,readOnly:!0,className:"flex-1 font-mono text-sm ".concat(b?"animate-border-glow":"")}),(0,t.jsx)(i.$n,{variant:"secondary",icon:"endpoint_url"===P?"check":"content_copy",onClick:()=>O(J,"endpoint_url"),children:"endpoint_url"===P?"Copied!":"Copy"})]})]}),(0,t.jsxs)(i.Zp,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold",children:"API Keys"}),(0,t.jsx)(i.$n,{icon:"add",onClick:()=>m(!0),children:"Create Key"})]}),0===l.length?(0,t.jsxs)("div",{className:"text-center py-8",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-4xl text-text-muted mb-2",children:"vpn_key"}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"No API keys yet"})]}):(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b border-border",children:[(0,t.jsx)("th",{className:"text-left p-3 font-medium",children:"Name"}),(0,t.jsx)("th",{className:"text-left p-3 font-medium",children:"Key"}),(0,t.jsx)("th",{className:"text-left p-3 font-medium",children:"Created"}),(0,t.jsx)("th",{className:"text-left p-3 font-medium",children:"Actions"})]})}),(0,t.jsx)("tbody",{children:l.map(e=>(0,t.jsxs)("tr",{className:"border-b border-border hover:bg-sidebar/30",children:[(0,t.jsx)("td",{className:"p-3 text-sm",children:e.name}),(0,t.jsx)("td",{className:"p-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-mono text-xs text-text-muted",children:e.key}),(0,t.jsx)(i.$n,{size:"sm",variant:"ghost",icon:P===e.id?"check":"content_copy",onClick:()=>O(e.key,e.id)})]})}),(0,t.jsx)("td",{className:"p-3 text-sm text-text-muted",children:new Date(e.createdAt).toLocaleDateString()}),(0,t.jsx)("td",{className:"p-3",children:(0,t.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"delete",className:"text-red-500",onClick:()=>K(e.id),children:"Delete"})})]},e.id))})]})})]}),!1,(0,t.jsx)(i.aF,{isOpen:f,title:"Enable Cloud Proxy",onClose:()=>j(!1),children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[(0,t.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium mb-2",children:"What you will get"}),(0,t.jsxs)("ul",{className:"text-sm text-blue-700 dark:text-blue-300 space-y-1",children:[(0,t.jsx)("li",{children:"• Access your API from anywhere in the world"}),(0,t.jsx)("li",{children:"• Share endpoint with your team easily"}),(0,t.jsx)("li",{children:"• No need to open ports or configure firewall"}),(0,t.jsx)("li",{children:"• Fast global edge network"})]})]}),(0,t.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,t.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium mb-1",children:"Note"}),(0,t.jsxs)("ul",{className:"text-sm text-yellow-700 dark:text-yellow-300 space-y-1",children:[(0,t.jsx)("li",{children:"• Cloud will keep your auth session for 1 day. If not used, it will be automatically deleted."}),(0,t.jsx)("li",{children:"• Cloud is currently unstable with Claude Code OAuth in some cases."})]})]}),k&&(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-primary/10 border border-primary/30 rounded-lg",children:[(0,t.jsx)("span",{className:"material-symbols-outlined animate-spin text-primary",children:"progress_activity"}),(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsxs)("p",{className:"text-sm font-medium text-primary",children:["syncing"===_&&"Syncing data to cloud...","verifying"===_&&"Verifying connection..."]})})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.$n,{onClick:T,fullWidth:!0,disabled:k,children:k?(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"syncing"===_?"Syncing...":"Verifying..."]}):"Enable Cloud"}),(0,t.jsx)(i.$n,{onClick:()=>j(!1),variant:"ghost",fullWidth:!0,disabled:k,children:"Cancel"})]})]})}),(0,t.jsx)(i.aF,{isOpen:x,title:"Create API Key",onClose:()=>{m(!1),y("")},children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)(i.pd,{label:"Key Name",value:h,onChange:e=>y(e.target.value),placeholder:"Production Key"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.$n,{onClick:I,fullWidth:!0,disabled:!h.trim(),children:"Create"}),(0,t.jsx)(i.$n,{onClick:()=>{m(!1),y("")},variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,t.jsx)(i.aF,{isOpen:!!p,title:"API Key Created",onClose:()=>u(null),children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,t.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 mb-2 font-medium",children:"Save this key now!"}),(0,t.jsx)("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"This is the only time you will see this key. Store it securely."})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.pd,{value:p||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,t.jsx)(i.$n,{variant:"secondary",icon:"created_key"===P?"check":"content_copy",onClick:()=>O(p,"created_key"),children:"created_key"===P?"Copied!":"Copy"})]}),(0,t.jsx)(i.$n,{onClick:()=>u(null),fullWidth:!0,children:"Done"})]})}),(0,t.jsx)(i.aF,{isOpen:N,title:"Disable Cloud Proxy",onClose:()=>!k&&v(!1),children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-red-600 dark:text-red-400",children:"warning"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium mb-1",children:"Warning"}),(0,t.jsx)("p",{className:"text-sm text-red-700 dark:text-red-300",children:"All auth sessions will be deleted from cloud."})]})]})}),k&&(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-primary/10 border border-primary/30 rounded-lg",children:[(0,t.jsx)("span",{className:"material-symbols-outlined animate-spin text-primary",children:"progress_activity"}),(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsxs)("p",{className:"text-sm font-medium text-primary",children:["syncing"===_&&"Syncing latest data...","disabling"===_&&"Disabling cloud..."]})})]}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"Are you sure you want to disable cloud proxy?"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.$n,{onClick:W,fullWidth:!0,disabled:k,className:"!bg-red-500 hover:!bg-red-600 !text-white",children:k?(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"syncing"===_?"Syncing...":"Disabling..."]}):"Disable Cloud"}),(0,t.jsx)(i.$n,{onClick:()=>v(!1),variant:"ghost",fullWidth:!0,disabled:k,children:"Cancel"})]})]})})]})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1441],{1441:(e,t,n)=>{n.r(t);var o=n(4427),l=n(6775);function s(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return{id:"chatcmpl-".concat(e.messageId),object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:e.model,choices:[{index:0,delta:t,finish_reason:n}]}}function a(e,t){e.thinkingBlockStarted&&(t.push({type:"content_block_stop",index:e.thinkingBlockIndex}),e.thinkingBlockStarted=!1)}function i(e,t){e.textBlockStarted&&!e.textBlockClosed&&(e.textBlockClosed=!0,t.push({type:"content_block_stop",index:e.textBlockIndex}),e.textBlockStarted=!1)}(0,o.kz)(l.h.CLAUDE,l.h.OPENAI,null,function(e,t){var n,o,l,a;if(!e)return null;let i=[];switch(e.type){case"message_start":t.messageId=(null==(n=e.message)?void 0:n.id)||"msg_".concat(Date.now()),t.model=null==(o=e.message)?void 0:o.model,t.toolCallIndex=0,console.log("\uD83D\uDD0D ----------- toolCallIndex",t.toolCallIndex),i.push(s(t,{role:"assistant"}));break;case"content_block_start":{let n=e.content_block;if((null==n?void 0:n.type)==="text")t.textBlockStarted=!0;else if((null==n?void 0:n.type)==="thinking")t.inThinkingBlock=!0,t.currentBlockIndex=e.index,i.push(s(t,{content:"<think>"}));else if((null==n?void 0:n.type)==="tool_use"){let o={index:t.toolCallIndex++,id:n.id,type:"function",function:{name:n.name,arguments:""}};t.toolCalls.set(e.index,o),i.push(s(t,{tool_calls:[o]}))}break}case"content_block_delta":{let n=e.delta;if((null==n?void 0:n.type)==="text_delta"&&n.text)i.push(s(t,{content:n.text}));else if((null==n?void 0:n.type)==="thinking_delta"&&n.thinking)i.push(s(t,{content:n.thinking}));else if((null==n?void 0:n.type)==="input_json_delta"&&n.partial_json){let o=t.toolCalls.get(e.index);o&&(o.function.arguments+=n.partial_json,i.push(s(t,{tool_calls:[{index:o.index,id:o.id,function:{arguments:n.partial_json}}]})))}break}case"content_block_stop":t.inThinkingBlock&&e.index===t.currentBlockIndex&&(i.push(s(t,{content:"</think>"})),t.inThinkingBlock=!1),t.textBlockStarted=!1,t.thinkingBlockStarted=!1;break;case"message_delta":(null==(l=e.delta)?void 0:l.stop_reason)&&(t.finishReason=function(e){switch(e){case"end_turn":case"stop_sequence":default:return"stop";case"max_tokens":return"length";case"tool_use":return"tool_calls"}}(e.delta.stop_reason),i.push({id:"chatcmpl-".concat(t.messageId),object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t.model,choices:[{index:0,delta:{},finish_reason:t.finishReason}]}),t.finishReasonSent=!0);break;case"message_stop":if(!t.finishReasonSent){let e=t.finishReason||((null==(a=t.toolCalls)?void 0:a.size)>0?"tool_calls":"stop");i.push({id:"chatcmpl-".concat(t.messageId),object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t.model,choices:[{index:0,delta:{},finish_reason:e}],...t.usage&&{usage:{prompt_tokens:t.usage.input_tokens||0,completion_tokens:t.usage.output_tokens||0,total_tokens:(t.usage.input_tokens||0)+(t.usage.output_tokens||0)}}}),t.finishReasonSent=!0}}return i.length>0?i:null}),(0,o.kz)(l.h.OPENAI,l.h.CLAUDE,null,function(e,t){var n,o,l,s,c,d,u,k;if(!e||!(null==(n=e.choices)?void 0:n[0]))return null;let _=[],p=e.choices[0],r=p.delta;t.messageStartSent||(t.messageStartSent=!0,t.messageId=(null==(o=e.id)?void 0:o.replace("chatcmpl-",""))||"msg_".concat(Date.now()),(!t.messageId||"chat"===t.messageId||t.messageId.length<8)&&(t.messageId=(null==(l=e.extend_fields)?void 0:l.requestId)||(null==(s=e.extend_fields)?void 0:s.traceId)||"msg_".concat(Date.now())),t.model=e.model||"unknown",t.nextBlockIndex=0,_.push({type:"message_start",message:{id:t.messageId,type:"message",role:"assistant",model:t.model,content:[],stop_reason:null,stop_sequence:null,usage:{input_tokens:0,output_tokens:0}}}));let h=(null==r?void 0:r.reasoning_content)||(null==r?void 0:r.reasoning);if(h&&(i(t,_),t.thinkingBlockStarted||(t.thinkingBlockIndex=t.nextBlockIndex++,t.thinkingBlockStarted=!0,_.push({type:"content_block_start",index:t.thinkingBlockIndex,content_block:{type:"thinking",thinking:""}})),_.push({type:"content_block_delta",index:t.thinkingBlockIndex,delta:{type:"thinking_delta",thinking:h}})),(null==r?void 0:r.content)&&(a(t,_),t.textBlockStarted||(t.textBlockIndex=t.nextBlockIndex++,t.textBlockStarted=!0,t.textBlockClosed=!1,_.push({type:"content_block_start",index:t.textBlockIndex,content_block:{type:"text",text:""}})),_.push({type:"content_block_delta",index:t.textBlockIndex,delta:{type:"text_delta",text:r.content}})),null==r?void 0:r.tool_calls)for(let e of r.tool_calls){let n=null!=(d=e.index)?d:0;if(e.id){a(t,_),i(t,_);let o=t.nextBlockIndex++;t.toolCalls.set(n,{id:e.id,name:(null==(u=e.function)?void 0:u.name)||"",blockIndex:o}),_.push({type:"content_block_start",index:o,content_block:{type:"tool_use",id:e.id,name:(null==(k=e.function)?void 0:k.name)||"",input:{}}})}if(null==(c=e.function)?void 0:c.arguments){let o=t.toolCalls.get(n);o&&_.push({type:"content_block_delta",index:o.blockIndex,delta:{type:"input_json_delta",partial_json:e.function.arguments}})}}if(p.finish_reason){for(let[,e]of(a(t,_),i(t,_),t.toolCalls))_.push({type:"content_block_stop",index:e.blockIndex});_.push({type:"message_delta",delta:{stop_reason:function(e){switch(e){case"stop":default:return"end_turn";case"length":return"max_tokens";case"tool_calls":return"tool_use"}}(p.finish_reason)},usage:{output_tokens:0}}),_.push({type:"message_stop"})}return _.length>0?_:null})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[197],{197:(t,e,n)=>{n.r(e);var o=n(4427),s=n(6775),r=n(6981);function a(t,e,n){let o={model:t,messages:[],stream:n};if(e.generationConfig){let t=e.generationConfig;if(t.maxOutputTokens){let n={max_tokens:t.maxOutputTokens,tools:e.tools};o.max_tokens=(0,r.M)(n)}void 0!==t.temperature&&(o.temperature=t.temperature),void 0!==t.topP&&(o.top_p=t.topP)}if(e.systemInstruction){var s;let t="string"==typeof(s=e.systemInstruction)?s:s.parts&&Array.isArray(s.parts)?s.parts.map(t=>t.text||"").join(""):"";t&&o.messages.push({role:"system",content:t})}if(e.contents&&Array.isArray(e.contents))for(let t of e.contents){let e=function(t){let e="user"===t.role?"user":"assistant";if(!t.parts||!Array.isArray(t.parts))return null;let n=[],o=[];for(let e of t.parts)if(void 0!==e.text&&n.push({type:"text",text:e.text}),e.inlineData&&n.push({type:"image_url",image_url:{url:"data:".concat(e.inlineData.mimeType,";base64,").concat(e.inlineData.data)}}),e.functionCall&&o.push({id:"call_".concat(Date.now(),"_").concat(Math.random().toString(36).slice(2,8)),type:"function",function:{name:e.functionCall.name,arguments:JSON.stringify(e.functionCall.args||{})}}),e.functionResponse){var s;return{role:"tool",tool_call_id:e.functionResponse.id||e.functionResponse.name,content:JSON.stringify((null==(s=e.functionResponse.response)?void 0:s.result)||e.functionResponse.response||{})}}if(o.length>0){let t={role:"assistant"};return n.length>0&&(t.content=1===n.length?n[0].text:n),t.tool_calls=o,t}return n.length>0?{role:e,content:1===n.length&&"text"===n[0].type?n[0].text:n}:null}(t);e&&o.messages.push(e)}if(e.tools&&Array.isArray(e.tools)){for(let t of(o.tools=[],e.tools))if(t.functionDeclarations)for(let e of t.functionDeclarations)o.tools.push({type:"function",function:{name:e.name,description:e.description||"",parameters:e.parameters||{type:"object",properties:{}}}})}return o}(0,o.kz)(s.h.GEMINI,s.h.OPENAI,a,null),(0,o.kz)(s.h.GEMINI_CLI,s.h.OPENAI,a,null)},6981:(t,e,n)=>{n.d(e,{M:()=>s});var o=n(9562);function s(t){let e=t.max_tokens||o.Uc;return t.tools&&Array.isArray(t.tools)&&t.tools.length>0&&e<o.eo&&(console.log("[AUTO-ADJUST] max_tokens: ".concat(e," → ").concat(o.eo," (tool calling detected)")),e=o.eo),e}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3433],{3433:(e,t,s)=>{s.r(t);var n=s(4427),l=s(6775);(0,n.kz)(l.h.OPENAI_RESPONSES,l.h.OPENAI,function(e,t,s,n){if(!t.input)return t;let l={...t};l.messages=[],t.instructions&&l.messages.push({role:"system",content:t.instructions});let o=null,u=[];for(let e of t.input)if("message"===e.type){if(o&&(l.messages.push(o),o=null),u.length>0){for(let e of u)l.messages.push(e);u=[]}let t=Array.isArray(e.content)?e.content.map(e=>"input_text"===e.type||"output_text"===e.type?{type:"text",text:e.text}:e):e.content;l.messages.push({role:e.role,content:t})}else if("function_call"===e.type)o||(o={role:"assistant",content:null,tool_calls:[]}),o.tool_calls.push({id:e.call_id,type:"function",function:{name:e.name,arguments:e.arguments}});else if("function_call_output"===e.type){if(o&&(l.messages.push(o),o=null),u.length>0){for(let e of u)l.messages.push(e);u=[]}l.messages.push({role:"tool",tool_call_id:e.call_id,content:"string"==typeof e.output?e.output:JSON.stringify(e.output)})}else if("reasoning"===e.type)continue;if(o&&l.messages.push(o),u.length>0)for(let e of u)l.messages.push(e);return t.tools&&Array.isArray(t.tools)&&(l.tools=t.tools.map(e=>e.function?e:{type:"function",function:{name:e.name,description:e.description,parameters:e.parameters,strict:e.strict}})),delete l.input,delete l.instructions,delete l.include,delete l.prompt_cache_key,delete l.store,delete l.reasoning,l},null)}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3592],{3592:(t,e,o)=>{o.r(e);var n=o(4427),s=o(6775),r=o(9562),l=o(6981);function a(t,e,o){let n={contents:[],generationConfig:{}};if(e.max_tokens&&(n.generationConfig.maxOutputTokens=e.max_tokens),void 0!==e.temperature&&(n.generationConfig.temperature=e.temperature),void 0!==e.top_p&&(n.generationConfig.topP=e.top_p),e.messages&&Array.isArray(e.messages))for(let t of e.messages)if("system"===t.role)n.systemInstruction={parts:[{text:"string"==typeof t.content?t.content:i(t.content)}]};else if("tool"===t.role)n.contents.push({role:"function",parts:[{functionResponse:{name:t.tool_call_id,response:c(t.content)}}]});else{let e=function(t){let e="assistant"===t.role?"model":"user",o=[];if("string"==typeof t.content)t.content&&o.push({text:t.content});else if(Array.isArray(t.content)){for(let e of t.content)if("text"===e.type)o.push({text:e.text});else if("image_url"===e.type){let t=e.image_url.url;if(t.startsWith("data:")){let e=t.match(/^data:([^;]+);base64,(.+)$/);e&&o.push({inlineData:{mimeType:e[1],data:e[2]}})}}}if(t.tool_calls&&Array.isArray(t.tool_calls))for(let e of t.tool_calls)o.push({functionCall:{name:e.function.name,args:c(e.function.arguments)}});return 0===o.length?null:{role:e,parts:o}}(t);e&&n.contents.push(e)}if(e.tools&&Array.isArray(e.tools)){let t=e.tools.filter(t=>t&&t.function&&t.function.name);t.length>0&&(n.tools=[{functionDeclarations:t.map(t=>({name:t.function.name,description:t.function.description||"",parameters:t.function.parameters||{type:"object",properties:{}}}))}])}return n}function i(t){return"string"==typeof t?t:Array.isArray(t)?t.filter(t=>"text"===t.type).map(t=>t.text).join("\n"):""}function c(t){if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}}(0,n.kz)(s.h.OPENAI,s.h.CLAUDE,function(t,e,o){var n;let s={model:t,max_tokens:(0,l.M)(e),stream:o};void 0!==e.temperature&&(s.temperature=e.temperature),s.messages=[];let a=[];if(e.messages&&Array.isArray(e.messages)){let t;for(let t of e.messages)"system"===t.role&&a.push("string"==typeof t.content?t.content:i(t.content));let o=e.messages.filter(t=>"system"!==t.role),n=[],r=()=>{t&&n.length>0&&(s.messages.push({role:t,content:n}),n=[])};for(let e of o){let o="user"===e.role||"tool"===e.role?"user":"assistant",l=function(t){let e=[];if("tool"===t.role)e.push({type:"tool_result",tool_use_id:t.tool_call_id,content:t.content});else if("user"===t.role){if("string"==typeof t.content)t.content&&e.push({type:"text",text:t.content});else if(Array.isArray(t.content))for(let o of t.content)if("text"===o.type&&o.text)e.push({type:"text",text:o.text});else if("tool_result"===o.type)e.push({type:"tool_result",tool_use_id:o.tool_use_id,content:o.content,...o.is_error&&{is_error:o.is_error}});else if("image_url"===o.type){let t=o.image_url.url.match(/^data:([^;]+);base64,(.+)$/);t&&e.push({type:"image",source:{type:"base64",media_type:t[1],data:t[2]}})}else"image"===o.type&&o.source&&e.push({type:"image",source:o.source})}else if("assistant"===t.role){if(Array.isArray(t.content))for(let o of t.content)"text"===o.type&&o.text?e.push({type:"text",text:o.text}):"tool_use"===o.type&&e.push({type:"tool_use",id:o.id,name:o.name,input:o.input});else if(t.content){let o="string"==typeof t.content?t.content:i(t.content);o&&e.push({type:"text",text:o})}if(t.tool_calls&&Array.isArray(t.tool_calls))for(let o of t.tool_calls)"function"===o.type&&e.push({type:"tool_use",id:o.id,name:o.function.name,input:c(o.function.arguments)})}return e}(e),a=l.some(t=>"tool_use"===t.type);if(l.some(t=>"tool_result"===t.type)){let e=l.filter(t=>"tool_result"===t.type),a=l.filter(t=>"tool_result"!==t.type);r(),e.length>0&&s.messages.push({role:"user",content:e}),a.length>0&&(t=o,n.push(...a));continue}t!==o&&(r(),t=o),n.push(...l),a&&r()}r();for(let t=s.messages.length-1;t>=0;t--){let e=s.messages[t];if("assistant"===e.role&&Array.isArray(e.content)&&e.content.length>0){let t=e.content[e.content.length-1];if(t){t.cache_control={type:"ephemeral"};break}}}}let u={type:"text",text:r.Co};return a.length>0?s.system=[u,{type:"text",text:a.join("\n"),cache_control:{type:"ephemeral",ttl:"1h"}}]:s.system=[u],e.tools&&Array.isArray(e.tools)&&(s.tools=e.tools.map(t=>{let e="function"===t.type&&t.function?t.function:t;return{name:e.name,description:e.description||"",input_schema:e.parameters||e.input_schema||{type:"object",properties:{},required:[]}}}),s.tools.length>0&&(s.tools[s.tools.length-1].cache_control={type:"ephemeral",ttl:"1h"})),e.tool_choice&&(s.tool_choice=(n=e.tool_choice)?"object"==typeof n&&n.type?n:"auto"===n||"none"===n?{type:"auto"}:"required"===n?{type:"any"}:"object"==typeof n&&n.function?{type:"tool",name:n.function.name}:{type:"auto"}:{type:"auto"}),s},null),(0,n.kz)(s.h.OPENAI,s.h.GEMINI,a,null),(0,n.kz)(s.h.OPENAI,s.h.GEMINI_CLI,a,null)},6981:(t,e,o)=>{o.d(e,{M:()=>s});var n=o(9562);function s(t){let e=t.max_tokens||n.Uc;return t.tools&&Array.isArray(t.tools)&&t.tools.length>0&&e<n.eo&&(console.log("[AUTO-ADJUST] max_tokens: ".concat(e," → ").concat(n.eo," (tool calling detected)")),e=n.eo),e}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4244],{709:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(5155),a=r(2115),l=r(3439),n=r(1620);function i(e){let{children:t}=e,[r,i]=(0,a.useState)(!1);return(0,s.jsxs)("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[r&&(0,s.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>i(!1)}),(0,s.jsx)("div",{className:"hidden lg:flex",children:(0,s.jsx)(l.default,{})}),(0,s.jsx)("div",{className:"fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ".concat(r?"translate-x-0":"-translate-x-full"),children:(0,s.jsx)(l.default,{onClose:()=>i(!1)})}),(0,s.jsxs)("main",{className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300",children:[(0,s.jsx)(n.default,{onMenuClick:()=>i(!0)}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 lg:p-10",children:(0,s.jsx)("div",{className:"max-w-7xl mx-auto",children:t})})]})]})}},1255:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(6319);function l(e){let{children:t,title:r,subtitle:l,icon:n,action:i,padding:o="md",hover:c=!1,className:d,...m}=e;return(0,s.jsxs)("div",{className:(0,a.cn)("bg-surface","border border-border","rounded-xl shadow-soft",c&&"hover:shadow-warm hover:border-primary/30 transition-all cursor-pointer",{none:"",sm:"p-4",md:"p-6",lg:"p-8"}[o],d),...m,children:[(r||i)&&(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[n&&(0,s.jsx)("div",{className:"p-2 rounded-lg bg-bg text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:n})}),(0,s.jsxs)("div",{children:[r&&(0,s.jsx)("h3",{className:"text-text-main font-semibold",children:r}),l&&(0,s.jsx)("p",{className:"text-sm text-text-muted",children:l})]})]}),i]}),t]})}l.Section=function(e){let{children:t,className:r,...l}=e;return(0,s.jsx)("div",{className:(0,a.cn)("p-4 rounded-lg","bg-surface","border border-border",r),...l,children:t})},l.Row=function(e){let{children:t,className:r,...l}=e;return(0,s.jsx)("div",{className:(0,a.cn)("p-3 -mx-3 px-3 border-b border-border last:border-b-0 transition-colors","hover:bg-sidebar",r),...l,children:t})}},1553:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(5155),a=r(2115),l=r(4244),n=r(2694);function i(e){let{isOpen:t,provider:r,providerInfo:i,onSuccess:o,onClose:c}=e,[d,m]=(0,a.useState)("waiting"),[x,u]=(0,a.useState)(null),[h,b]=(0,a.useState)(""),[f,p]=(0,a.useState)(null),[g,j]=(0,a.useState)(!1),[v,y]=(0,a.useState)(null),[N,w]=(0,a.useState)(!1),k=(0,a.useRef)(null),{copied:C,copy:z}=(0,n.C)(),_="localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname;(0,a.useEffect)(()=>{t&&r&&(u(null),b(""),p(null),j(!1),y(null),w(!1),E())},[t,r]);let S=(0,a.useRef)(!1);(0,a.useEffect)(()=>{let e;if(!x)return;S.current=!1;let t=async e=>{if(S.current)return;let{code:t,state:r,error:s,errorDescription:a}=e;if(s){S.current=!0,p(a||s),m("error");return}t&&(S.current=!0,await L(t,r))},r=e=>{var r;e.origin===window.location.origin&&(null==(r=e.data)?void 0:r.type)==="oauth_callback"&&t(e.data.data)};window.addEventListener("message",r);try{(e=new BroadcastChannel("oauth_callback")).onmessage=e=>t(e.data)}catch(e){console.log("BroadcastChannel not supported")}let s=e=>{if("oauth_callback"===e.key&&e.newValue)try{let r=JSON.parse(e.newValue);t(r),localStorage.removeItem("oauth_callback")}catch(e){console.log("Failed to parse localStorage data")}};window.addEventListener("storage",s);try{let e=localStorage.getItem("oauth_callback");if(e){let r=JSON.parse(e);r.timestamp&&Date.now()-r.timestamp<3e4&&(t(r),localStorage.removeItem("oauth_callback"))}}catch(e){}return()=>{window.removeEventListener("message",r),window.removeEventListener("storage",s),e&&e.close()}},[x]);let L=async(e,t)=>{try{let s=await fetch("/api/oauth/".concat(r,"/exchange"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,redirectUri:x.redirectUri,codeVerifier:x.codeVerifier,state:t})}),a=await s.json();if(!s.ok)throw Error(a.error);m("success"),null==o||o()}catch(e){p(e.message),m("error")}},E=async()=>{if(r)try{let e;if(p(null),"github"===r||"qwen"===r){j(!0),m("waiting");let e=await fetch("/api/oauth/".concat(r,"/device-code")),t=await e.json();if(!e.ok)throw Error(t.error);y(t);let s=t.verification_uri_complete||t.verification_uri;s&&window.open(s,"_blank"),P(t.device_code,t.codeVerifier,t.interval||5);return}if("codex"===r)e="http://localhost:1455/auth/callback";else{let t=window.location.port||("https:"===window.location.protocol?"443":"80");e="http://localhost:".concat(t,"/callback")}let t=await fetch("/api/oauth/".concat(r,"/authorize?redirect_uri=").concat(encodeURIComponent(e))),s=await t.json();if(!t.ok)throw Error(s.error);u({...s,redirectUri:e}),"codex"===r?(m("input"),window.open(s.authUrl,"_blank")):_?(m("waiting"),k.current=window.open(s.authUrl,"oauth_popup","width=600,height=700"),k.current||m("input")):(m("input"),window.open(s.authUrl,"_blank"))}catch(e){p(e.message),m("error")}},P=async(e,t,s)=>{w(!0);for(let a=0;a<60;a++){await new Promise(e=>setTimeout(e,1e3*s));try{let a=await fetch("/api/oauth/".concat(r,"/poll"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:e,codeVerifier:t})}),l=await a.json();if(l.success){m("success"),w(!1),null==o||o();return}if("expired_token"===l.error||"access_denied"===l.error)throw Error(l.errorDescription||l.error);"slow_down"===l.error&&(s=Math.min(s+5,30))}catch(e){p(e.message),m("error"),w(!1);return}}p("Authorization timeout"),m("error"),w(!1)},U=async()=>{try{p(null);let e=new URL(h),t=e.searchParams.get("code"),r=e.searchParams.get("state"),s=e.searchParams.get("error");if(s)throw Error(e.searchParams.get("error_description")||s);if(!t)throw Error("No authorization code found in URL");await L(t,r)}catch(e){p(e.message),m("error")}};return r&&i?(0,s.jsx)(l.aF,{isOpen:t,title:"Connect ".concat(i.name),onClose:c,size:"lg",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:["waiting"===d&&!g&&(0,s.jsxs)("div",{className:"text-center py-6",children:[(0,s.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Waiting for Authorization"}),(0,s.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Complete the authorization in the popup window."}),(0,s.jsx)(l.$n,{variant:"ghost",onClick:()=>m("input"),children:"Popup blocked? Enter URL manually"})]}),"waiting"===d&&g&&v&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"text-center py-4",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the URL below and enter the code:"}),(0,s.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,s.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Verification URL"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("code",{className:"flex-1 text-sm break-all",children:v.verification_uri}),(0,s.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"verify_url"===C?"check":"content_copy",onClick:()=>z(v.verification_uri,"verify_url")})]})]}),(0,s.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,s.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,s.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:v.user_code}),(0,s.jsx)(l.$n,{size:"sm",variant:"ghost",icon:"user_code"===C?"check":"content_copy",onClick:()=>z(v.user_code,"user_code")})]})]})]}),N&&(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"input"===d&&!g&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.pd,{value:(null==x?void 0:x.authUrl)||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,s.jsx)(l.$n,{variant:"secondary",icon:"auth_url"===C?"check":"content_copy",onClick:()=>z(null==x?void 0:x.authUrl,"auth_url"),children:"Copy"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,s.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser."}),(0,s.jsx)(l.pd,{value:h,onChange:e=>b(e.target.value),placeholder:"".concat(window.location.origin,"/callback?code=..."),className:"font-mono text-xs"})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.$n,{onClick:U,fullWidth:!0,disabled:!h,children:"Connect"}),(0,s.jsx)(l.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===d&&(0,s.jsxs)("div",{className:"text-center py-6",children:[(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,s.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",i.name," account has been connected."]}),(0,s.jsx)(l.$n,{onClick:c,fullWidth:!0,children:"Done"})]}),"error"===d&&(0,s.jsxs)("div",{className:"text-center py-6",children:[(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,s.jsx)("p",{className:"text-sm text-red-600 mb-4",children:f}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.$n,{onClick:E,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,s.jsx)(l.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}},1620:(e,t,r)=>{r.d(t,{default:()=>c});var s=r(5155),a=r(63),l=r(2619),n=r.n(l),i=r(4244),o=r(4156);function c(e){let{onMenuClick:t,showMenuButton:r=!0}=e,{title:l,description:c,breadcrumbs:d}=(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/providers\/([^/]+)$/);if(t){let e=t[1],r=o.zN[e]||o.fg[e];if(r)return{title:r.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:r.name,image:"/providers/".concat(r.id,".png")}]}}return e.includes("/providers")?{title:"Providers",description:"Manage your AI provider connections",breadcrumbs:[]}:e.includes("/combos")?{title:"Combos",description:"Model combos with fallback",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",breadcrumbs:[]}:e.includes("/profile")?{title:"Settings",description:"Manage your preferences",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})((0,a.usePathname)());return(0,s.jsxs)("header",{className:"flex items-center justify-between px-8 py-5 border-b border-border bg-bg/80 backdrop-blur-md z-10 sticky top-0",children:[(0,s.jsx)("div",{className:"flex items-center gap-3 lg:hidden",children:r&&(0,s.jsx)("button",{onClick:t,className:"text-text-main hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,s.jsx)("div",{className:"hidden lg:flex flex-col",children:d.length>0?(0,s.jsx)("div",{className:"flex items-center gap-2",children:d.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,s.jsx)(n(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,s.jsx)("img",{src:e.image,alt:e.label,className:"size-7 object-contain rounded",onError:e=>{e.target.style.display="none"}}),(0,s.jsx)("h1",{className:"text-2xl font-semibold text-text-main tracking-tight",children:e.label})]})]},t))}):l?(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-semibold text-text-main tracking-tight",children:l}),c&&(0,s.jsx)("p",{className:"text-sm text-text-muted",children:c})]}):null}),(0,s.jsx)("div",{className:"flex items-center gap-3 ml-auto",children:(0,s.jsx)(i.UW,{})})]})}},1980:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(6319);function l(e){let{src:t,alt:r="Avatar",name:l,size:n="md",className:i}=e,o={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return t?(0,s.jsx)("div",{className:(0,a.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],i),style:{backgroundImage:"url(".concat(t,")")},role:"img","aria-label":r}):(0,s.jsx)("div",{className:(0,a.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],(e=>{if(!e)return"bg-primary";let t=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],r=e.charCodeAt(0)%t.length;return t[r]})(l),i),role:"img","aria-label":r,children:(e=>{if(!e)return"?";let t=e.split(" ");return t.length>=2?"".concat(t[0][0]).concat(t[1][0]).toUpperCase():e.substring(0,2).toUpperCase()})(l)})}},2411:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(6319);function l(e){let{label:t,type:r="text",placeholder:l,value:n,onChange:i,error:o,hint:c,icon:d,disabled:m=!1,required:x=!1,className:u,inputClassName:h,...b}=e;return(0,s.jsxs)("div",{className:(0,a.cn)("flex flex-col gap-1.5",u),children:[t&&(0,s.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[t,x&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[d&&(0,s.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:d})}),(0,s.jsx)("input",{type:r,placeholder:l,value:n,onChange:i,disabled:m,className:(0,a.cn)("w-full py-2.5 px-4 text-sm text-text-main","bg-surface border rounded-lg","placeholder-text-muted/60","focus:ring-2 focus:ring-primary/20 focus:border-primary focus:outline-none","transition-all shadow-sm disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",d&&"pl-10",o?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"border-border",h),...b})]}),o&&(0,s.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),c&&!o&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:c})]})}},2513:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(5155),a=r(6319);let l={primary:"bg-primary text-white hover:bg-primary-hover shadow-warm",secondary:"bg-surface border border-border text-text-main hover:bg-black/5 shadow-sm",outline:"border border-border text-text-main hover:bg-black/5",ghost:"text-text-muted hover:bg-black/5 hover:text-text-main",danger:"bg-red-500 text-white hover:bg-red-600 shadow-sm"},n={sm:"h-8 px-3 text-xs rounded-md",md:"h-10 px-5 text-sm rounded-lg",lg:"h-12 px-8 text-base rounded-xl"};function i(e){let{children:t,variant:r="primary",size:i="md",icon:o,iconRight:c,disabled:d=!1,loading:m=!1,fullWidth:x=!1,className:u,...h}=e;return(0,s.jsxs)("button",{className:(0,a.cn)("inline-flex items-center justify-center gap-2 font-medium transition-all duration-200 cursor-pointer","active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",l[r],n[i],x&&"w-full",u),disabled:d||m,...h,children:[m?(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):o?(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:o}):null,t,c&&!m&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:c})]})}},2694:(e,t,r)=>{r.d(t,{C:()=>a});var s=r(2115);function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3,[t,r]=(0,s.useState)(null),a=(0,s.useRef)(null);return{copied:t,copy:(0,s.useCallback)(function(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";navigator.clipboard.writeText(t),r(s),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{r(null)},e)},[e])}}},2923:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(5155),a=r(2115),l=r(4202),n=r(505),i=r(9608);function o(e){let{isOpen:t,onClose:r,onSelect:o,selectedModel:c,activeProviders:d=[],title:m="Select Model",modelAliases:x={}}=e,[u,h]=(0,a.useState)(""),b=(0,a.useMemo)(()=>{let e={};return(d.length>0?d.map(e=>e.provider):Object.keys(i.Q2)).forEach(t=>{let r=n.Xg[t]||t,s=i.Q2[t]||{name:t,color:"#666"};if(s.passthroughModels){let a=Object.entries(x).filter(e=>{let[,t]=e;return t.startsWith("".concat(r,"/"))}).map(e=>{let[t,s]=e;return{id:s.replace("".concat(r,"/"),""),name:t,value:s}});a.length>0&&(e[t]={name:s.name,alias:r,color:s.color,models:a})}else{let a=(0,n.KC)(t);a.length>0&&(e[t]={name:s.name,alias:r,color:s.color,models:a.map(e=>({id:e.id,name:e.name,value:"".concat(r,"/").concat(e.id)}))})}}),e},[d,x]),f=(0,a.useMemo)(()=>{if(!u.trim())return b;let e=u.toLowerCase(),t={};return Object.entries(b).forEach(r=>{let[s,a]=r,l=a.models.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||a.name.toLowerCase().includes(e));l.length>0&&(t[s]={...a,models:l})}),t},[b,u]);return(0,s.jsxs)(l.default,{isOpen:t,onClose:()=>{r(),h("")},title:m,size:"md",className:"!p-4",children:[(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"search"}),(0,s.jsx)("input",{type:"text",placeholder:"Search...",value:u,onChange:e=>h(e.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-surface border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"})]})}),(0,s.jsxs)("div",{className:"max-h-[300px] overflow-y-auto space-y-3",children:[Object.entries(f).map(e=>{let[t,a]=e;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:a.color}}),(0,s.jsx)("span",{className:"text-xs font-medium text-primary",children:a.name}),(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",a.models.length,")"]})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.models.map(e=>{let t=c===e.value;return(0,s.jsx)("button",{onClick:()=>{o(e),r(),h("")},className:"\n px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer\n ".concat(t?"bg-primary text-white border-primary":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5","\n "),children:e.name},e.id)})})]},t)}),0===Object.keys(f).length&&(0,s.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,s.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}},3222:(e,t,r)=>{r.d(t,{default:()=>n});var s=r(5155),a=r(5157),l=r(6319);function n(e){let{className:t,variant:r="default"}=e,{theme:n,toggleTheme:i,isDark:o}=(0,a.D)(),c={default:(0,l.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted","hover:bg-black/5","hover:text-text-main","transition-colors"),card:(0,l.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60","hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-md","text-text-muted-light hover:text-primary","hover:text-primary","transition-all group")};return(0,s.jsx)("button",{onClick:i,className:(0,l.cn)(c[r],t),"aria-label":"Switch to ".concat(o?"light":"dark"," mode"),title:"Switch to ".concat(o?"light":"dark"," mode"),children:(0,s.jsx)("span",{className:(0,l.cn)("material-symbols-outlined text-[22px]","card"===r&&"transition-transform duration-300 group-hover:rotate-12"),children:o?"light_mode":"dark_mode"})})}},3367:(e,t,r)=>{r.d(t,{CardSkeleton:()=>o,PageLoading:()=>n,Skeleton:()=>i,Spinner:()=>l,default:()=>c});var s=r(5155),a=r(6319);function l(e){let{size:t="md",className:r}=e;return(0,s.jsx)("span",{className:(0,a.cn)("material-symbols-outlined animate-spin text-primary",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[t],r),children:"progress_activity"})}function n(e){let{message:t="Loading..."}=e;return(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,s.jsx)(l,{size:"xl"}),(0,s.jsx)("p",{className:"mt-4 text-text-muted",children:t})]})}function i(e){let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-lg bg-border",t),...r})}function o(){return(0,s.jsxs)("div",{className:"p-6 rounded-xl border border-border bg-surface",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)(i,{className:"h-4 w-24"}),(0,s.jsx)(i,{className:"size-10 rounded-lg"})]}),(0,s.jsx)(i,{className:"h-8 w-16 mb-2"}),(0,s.jsx)(i,{className:"h-3 w-20"})]})}function c(e){let{type:t="spinner",...r}=e;switch(t){case"page":return(0,s.jsx)(n,{...r});case"skeleton":return(0,s.jsx)(i,{...r});case"card":return(0,s.jsx)(o,{...r});default:return(0,s.jsx)(l,{...r})}}},3439:(e,t,r)=>{r.d(t,{default:()=>h});var s=r(5155),a=r(2115),l=r(2619),n=r.n(l),i=r(63),o=r(6319),c=r(4156),d=r(2513),m=r(4202);let x=[{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/combos",label:"Combos",icon:"layers"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],u=[{href:"/dashboard/profile",label:"Settings",icon:"settings"}];function h(e){let{onClose:t}=e,r=(0,i.usePathname)(),[l,h]=(0,a.useState)(!1),[b,f]=(0,a.useState)(!1),[p,g]=(0,a.useState)(!1),j=e=>"/dashboard/endpoint"===e?"/dashboard"===r||r.startsWith("/dashboard/endpoint"):r.startsWith(e),v=async()=>{f(!0);try{await fetch("/api/shutdown",{method:"POST"})}catch(e){}f(!1),h(!1),g(!0)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("aside",{className:"flex w-72 flex-col border-r border-border bg-sidebar transition-colors duration-300",children:[(0,s.jsx)("div",{className:"p-8",children:(0,s.jsxs)(n(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex items-center justify-center size-9 rounded bg-gradient-to-br from-[#f97815] to-[#c2590a]",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-white text-[20px]",children:"hub"})}),(0,s.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:c.vQ.name})]})}),(0,s.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-1 overflow-y-auto custom-scrollbar",children:[x.map(e=>(0,s.jsxs)(n(),{href:e.href,onClick:t,className:(0,o.cn)("flex items-center gap-3 px-4 py-3 rounded-lg transition-all group",j(e.href)?"bg-surface text-primary shadow-sm border border-border":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,s.jsx)("span",{className:(0,o.cn)("material-symbols-outlined text-[20px]",j(e.href)?"fill-1":"group-hover:text-primary transition-colors"),children:e.icon}),(0,s.jsx)("span",{className:"text-sm font-medium",children:e.label})]},e.href)),(0,s.jsxs)("div",{className:"pt-6 mt-2",children:[(0,s.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-3",children:"System"}),u.map(e=>(0,s.jsxs)(n(),{href:e.href,onClick:t,className:(0,o.cn)("flex items-center gap-3 px-4 py-3 rounded-lg transition-all group",j(e.href)?"bg-surface text-primary shadow-sm border border-border":"text-text-muted hover:bg-surface/50 hover:text-text-main"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px] group-hover:text-primary transition-colors",children:e.icon}),(0,s.jsx)("span",{className:"text-sm font-medium",children:e.label})]},e.href))]})]}),(0,s.jsxs)("div",{className:"p-4 border-t border-border",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-xl bg-surface border border-border mb-3",children:[(0,s.jsx)("div",{className:"flex items-center justify-center size-8 rounded-lg bg-blue-500/10 text-blue-500 shrink-0 mt-0.5",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"info"})}),(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsx)("span",{className:"text-xs font-medium text-text-main leading-relaxed",children:"Service is running in terminal. You can close this web page. Shutdown will stop the service."})})]}),(0,s.jsx)(d.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>h(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})]})]}),(0,s.jsx)(m.ConfirmModal,{isOpen:l,onClose:()=>h(!1),onConfirm:v,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:b}),p&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,s.jsxs)("div",{className:"text-center p-8",children:[(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,s.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,s.jsx)(d.default,{variant:"secondary",onClick:()=>window.location.reload(),children:"Reload Page"})]})})]})}},3461:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(4244);function l(e){let{children:t}=e;return(0,s.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,s.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,s.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,s.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,s.jsx)(a.UW,{variant:"card"})}),(0,s.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:t})]})}},3876:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(5155),a=r(6319);let l={default:"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300",primary:"bg-primary/10 text-primary",success:"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border border-green-100 dark:border-green-800/30",warning:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-500 border border-yellow-100 dark:border-yellow-800/30",error:"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 border border-red-100 dark:border-red-800/30",info:"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 border border-blue-100 dark:border-blue-800/30"},n={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function i(e){let{children:t,variant:r="default",size:i="md",dot:o=!1,icon:c,className:d}=e;return(0,s.jsxs)("span",{className:(0,a.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",l[r],n[i],d),children:[o&&(0,s.jsx)("span",{className:(0,a.cn)("size-1.5 rounded-full","success"===r&&"bg-green-500","warning"===r&&"bg-yellow-500","error"===r&&"bg-red-500","info"===r&&"bg-blue-500","primary"===r&&"bg-primary","default"===r&&"bg-gray-500")}),c&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:c}),t]})}},4202:(e,t,r)=>{r.d(t,{ConfirmModal:()=>o,default:()=>i});var s=r(5155),a=r(2115),l=r(6319),n=r(2513);function i(e){let{isOpen:t,onClose:r,title:n,children:i,footer:o,size:c="md",closeOnOverlay:d=!0,showCloseButton:m=!0,className:x}=e;return((0,a.useEffect)(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),(0,a.useEffect)(()=>{let e=e=>{"Escape"===e.key&&t&&r()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,r]),t)?(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:d?r:void 0}),(0,s.jsxs)("div",{className:(0,l.cn)("relative w-full bg-surface","border border-border","rounded-2xl shadow-elevated","animate-in fade-in zoom-in-95 duration-200",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[c],x),children:[(n||m)&&(0,s.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[n&&(0,s.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:n}),m&&(0,s.jsx)("button",{onClick:r,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,s.jsx)("div",{className:"p-6 max-h-[calc(80vh-140px)] overflow-y-auto",children:i}),o&&(0,s.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border",children:o})]})]}):null}function o(e){let{isOpen:t,onClose:r,onConfirm:a,title:l="Confirm",message:o,confirmText:c="Confirm",cancelText:d="Cancel",variant:m="danger",loading:x=!1}=e;return(0,s.jsx)(i,{isOpen:t,onClose:r,title:l,size:"sm",footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.default,{variant:"ghost",onClick:r,disabled:x,children:d}),(0,s.jsx)(n.default,{variant:m,onClick:a,loading:x,children:c})]}),children:(0,s.jsx)("p",{className:"text-text-muted",children:o})})}},4244:(e,t,r)=>{r.d(t,{Ex:()=>c.default,$n:()=>s.default,Zp:()=>n.default,Qv:()=>o.CardSkeleton,pd:()=>a.default,aF:()=>i.default,rq:()=>u.default,LF:()=>x.default,l6:()=>l.default,UW:()=>m.default,lM:()=>d.default});var s=r(2513),a=r(2411),l=r(7897),n=r(1255),i=r(4202),o=r(3367);r(1980);var c=r(3876),d=r(9957),m=r(3222);r(9955),r(3439),r(1620),r(4486);var x=r(1553),u=r(2923);r(709),r(3461)},4486:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(5155),a=r(2619),l=r.n(a),n=r(4156);let i={product:[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],resources:[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],company:[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}]};function o(){return(0,s.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,s.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,s.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,s.jsx)("div",{className:"size-6 text-primary",children:(0,s.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,s.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,s.jsx)("span",{className:"text-xl font-bold text-text-main",children:n.vQ.name})]}),(0,s.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,s.jsxs)("div",{className:"flex gap-4",children:[(0,s.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,s.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,s.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,s.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,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,s.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.product.map(e=>(0,s.jsx)("li",{children:(0,s.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,s.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.resources.map(e=>(0,s.jsx)("li",{children:(0,s.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,s.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.company.map(e=>(0,s.jsx)("li",{children:(0,s.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]})]}),(0,s.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",n.vQ.name," Inc. All rights reserved."]}),(0,s.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,s.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,s.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},5157:(e,t,r)=>{r.d(t,{D:()=>l});var s=r(2115),a=r(1070);function l(){let{theme:e,setTheme:t,toggleTheme:r,initTheme:l}=(0,a.A)();return(0,s.useEffect)(()=>{l();let t=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{"system"===e&&l()};return t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[e,l]),{theme:e,setTheme:t,toggleTheme:r,isDark:"dark"===e||"system"===e&&window.matchMedia("(prefers-color-scheme: dark)").matches}}},6319:(e,t,r)=>{r.d(t,{cn:()=>s});function s(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},7897:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(6319);function l(e){let{label:t,options:r=[],value:l,onChange:n,placeholder:i="Select an option",error:o,hint:c,disabled:d=!1,required:m=!1,className:x,selectClassName:u,...h}=e;return(0,s.jsxs)("div",{className:(0,a.cn)("flex flex-col gap-1.5",x),children:[t&&(0,s.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[t,m&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)("select",{value:l,onChange:n,disabled:d,className:(0,a.cn)("w-full py-2.5 px-4 pr-10 text-sm text-text-main","bg-surface border rounded-lg appearance-none","focus:ring-2 focus:ring-primary/20 focus:border-primary focus:outline-none","transition-all shadow-sm disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",o?"border-red-500 focus:border-red-500 focus:ring-red-500/20":"border-border",u),...h,children:[(0,s.jsx)("option",{value:"",disabled:!0,children:i}),r.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,s.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),o&&(0,s.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),c&&!o&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:c})]})}},9957:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(6319);function l(e){let{checked:t=!1,onChange:r,label:l,description:n,disabled:i=!1,size:o="md",className:c}=e,d={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,s.jsxs)("div",{className:(0,a.cn)("flex items-center gap-3",i&&"opacity-50 cursor-not-allowed",c),children:[(0,s.jsx)("button",{type:"button",role:"switch","aria-checked":t,disabled:i,onClick:()=>{!i&&r&&r(!t)},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-primary/20 focus:ring-offset-2","dark:focus:ring-offset-surface-dark",t?"bg-primary":"bg-border",d[o].track,i&&"cursor-not-allowed"),children:(0,s.jsx)("span",{className:(0,a.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",t?d[o].translate:"translate-x-0.5",d[o].thumb,"mt-0.5")})}),(l||n)&&(0,s.jsxs)("div",{className:"flex flex-col",children:[l&&(0,s.jsx)("span",{className:"text-sm font-medium text-text-main",children:l}),n&&(0,s.jsx)("span",{className:"text-xs text-text-muted",children:n})]})]})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5812],{5812:(t,e,o)=>{o.r(e);var n=o(4427),s=o(6775),r=o(6981);(0,n.kz)(s.h.CLAUDE,s.h.OPENAI,function(t,e,o){let n={model:t,messages:[],stream:o};if(e.max_tokens&&(n.max_tokens=(0,r.M)(e)),void 0!==e.temperature&&(n.temperature=e.temperature),e.system){let t=Array.isArray(e.system)?e.system.map(t=>t.text||"").join("\n"):e.system;t&&n.messages.push({role:"system",content:t})}if(e.messages&&Array.isArray(e.messages))for(let t=0;t<e.messages.length;t++){let o=function(t){let e="user"===t.role||"tool"===t.role?"user":"assistant";if("string"==typeof t.content)return{role:e,content:t.content};if(Array.isArray(t.content)){let n=[],s=[],r=[];for(let e of t.content)switch(e.type){case"text":n.push({type:"text",text:e.text});break;case"image":var o;(null==(o=e.source)?void 0:o.type)==="base64"&&n.push({type:"image_url",image_url:{url:"data:".concat(e.source.media_type,";base64,").concat(e.source.data)}});break;case"tool_use":s.push({id:e.id,type:"function",function:{name:e.name,arguments:JSON.stringify(e.input||{})}});break;case"tool_result":let t="";"string"==typeof e.content?t=e.content:Array.isArray(e.content)?t=e.content.filter(t=>"text"===t.type).map(t=>t.text).join("\n")||JSON.stringify(e.content):e.content&&(t=JSON.stringify(e.content)),r.push({role:"tool",tool_call_id:e.tool_use_id,content:t})}if(r.length>0)return n.length>0?[...r,{role:"user",content:1===n.length&&"text"===n[0].type?n[0].text:n}]:r;if(s.length>0){let t={role:"assistant"};return n.length>0&&(t.content=1===n.length&&"text"===n[0].type?n[0].text:n),t.tool_calls=s,t}if(n.length>0)return{role:e,content:1===n.length&&"text"===n[0].type?n[0].text:n};if(0===t.content.length)return{role:e,content:""}}return null}(e.messages[t]);o&&(Array.isArray(o)?n.messages.push(...o):n.messages.push(o))}return function(t){for(let e=0;e<t.length;e++){let o=t[e];if("assistant"===o.role&&o.tool_calls&&o.tool_calls.length>0){let n=o.tool_calls.map(t=>t.id),s=new Set,r=e+1;for(let o=e+1;o<t.length;o++){let e=t[o];if("tool"===e.role&&e.tool_call_id)s.add(e.tool_call_id),r=o+1;else break}let l=n.filter(t=>!s.has(t));if(l.length>0){let o=l.map(t=>({role:"tool",tool_call_id:t,content:"[No response received]"}));t.splice(r,0,...o),e=r+o.length-1}}}}(n.messages),e.tools&&Array.isArray(e.tools)&&(n.tools=e.tools.map(t=>({type:"function",function:{name:t.name,description:t.description,parameters:t.input_schema||{type:"object",properties:{}}}}))),e.tool_choice&&(n.tool_choice=function(t){if(!t)return"auto";if("string"==typeof t)return t;switch(t.type){case"auto":default:return"auto";case"any":return"required";case"tool":return{type:"function",function:{name:t.name}}}}(e.tool_choice)),n},null)},6981:(t,e,o)=>{o.d(e,{M:()=>s});var n=o(9562);function s(t){let e=t.max_tokens||n.Uc;return t.tools&&Array.isArray(t.tools)&&t.tools.length>0&&e<n.eo&&(console.log("[AUTO-ADJUST] max_tokens: ".concat(e," → ").concat(n.eo," (tool calling detected)")),e=n.eo),e}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6899],{6899:()=>{}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8456],{8456:(e,t,n)=>{n.r(t);var s=n(4427),o=n(6775);function r(e,t,n){e.reasoningId||(e.reasoningId="rs_".concat(e.responseId,"_").concat(n),e.reasoningIndex=n,t("response.output_item.added",{type:"response.output_item.added",output_index:n,item:{id:e.reasoningId,type:"reasoning",summary:[]}}),t("response.reasoning_summary_part.added",{type:"response.reasoning_summary_part.added",item_id:e.reasoningId,output_index:n,summary_index:0,part:{type:"summary_text",text:""}}),e.reasoningPartAdded=!0)}function d(e,t,n){n&&(e.reasoningBuf+=n,t("response.reasoning_summary_text.delta",{type:"response.reasoning_summary_text.delta",item_id:e.reasoningId,output_index:e.reasoningIndex,summary_index:0,delta:n}))}function i(e,t){e.reasoningId&&!e.reasoningDone&&(e.reasoningDone=!0,t("response.reasoning_summary_text.done",{type:"response.reasoning_summary_text.done",item_id:e.reasoningId,output_index:e.reasoningIndex,summary_index:0,text:e.reasoningBuf}),t("response.reasoning_summary_part.done",{type:"response.reasoning_summary_part.done",item_id:e.reasoningId,output_index:e.reasoningIndex,summary_index:0,part:{type:"summary_text",text:e.reasoningBuf}}),t("response.output_item.done",{type:"response.output_item.done",output_index:e.reasoningIndex,item:{id:e.reasoningId,type:"reasoning",summary:[{type:"summary_text",text:e.reasoningBuf}]}}))}function u(e,t,n){if(e.msgItemAdded[n]&&!e.msgItemDone[n]){e.msgItemDone[n]=!0;let s=e.msgTextBuf[n]||"",o="msg_".concat(e.responseId,"_").concat(n);t("response.output_text.done",{type:"response.output_text.done",item_id:o,output_index:parseInt(n),content_index:0,text:s,logprobs:[]}),t("response.content_part.done",{type:"response.content_part.done",item_id:o,output_index:parseInt(n),content_index:0,part:{type:"output_text",annotations:[],logprobs:[],text:s}}),t("response.output_item.done",{type:"response.output_item.done",output_index:parseInt(n),item:{id:o,type:"message",content:[{type:"output_text",annotations:[],logprobs:[],text:s}],role:"assistant"}})}}function a(e,t,n){let s=e.funcCallIds[n];if(s&&!e.funcItemDone[n]){let o=e.funcArgsBuf[n]||"{}";t("response.function_call_arguments.done",{type:"response.function_call_arguments.done",item_id:"fc_".concat(s),output_index:parseInt(n),arguments:o}),t("response.output_item.done",{type:"response.output_item.done",output_index:parseInt(n),item:{id:"fc_".concat(s),type:"function_call",arguments:o,call_id:s,name:e.funcNames[n]||""}}),e.funcItemDone[n]=!0,e.funcArgsDone[n]=!0}}function p(e,t){e.completedSent||(e.completedSent=!0,t("response.completed",{type:"response.completed",response:{id:e.responseId,object:"response",created_at:e.created,status:"completed",background:!1,error:null}}))}(0,s.kz)(o.h.OPENAI,o.h.OPENAI_RESPONSES,null,function(e,t){var n;if(!e){var s=t;if(s.completedSent)return[];let e=[],n=(t,n)=>{n.sequence_number=++s.seq,e.push({event:t,data:n})};for(let e in s.msgItemAdded)u(s,n,e);for(let e in i(s,n),s.funcCallIds)a(s,n,e);return p(s,n),e}if(!(null==(n=e.choices)?void 0:n.length))return[];let o=[],c=(e,n)=>{n.sequence_number=++t.seq,o.push({event:e,data:n})},_=e.choices[0],m=_.index||0,l=_.delta||{};if(t.started||(t.started=!0,t.responseId=e.id?"resp_".concat(e.id):t.responseId,c("response.created",{type:"response.created",response:{id:t.responseId,object:"response",created_at:t.created,status:"in_progress",background:!1,error:null,output:[]}}),c("response.in_progress",{type:"response.in_progress",response:{id:t.responseId,object:"response",created_at:t.created,status:"in_progress"}})),l.reasoning_content&&(r(t,c,m),d(t,c,l.reasoning_content)),l.content){let e=l.content;if(e.includes("<think>")&&(t.inThinking=!0,e=e.replace("<think>",""),r(t,c,m)),e.includes("</think>")){let n=e.split("</think>"),s=n[0],o=n.slice(1).join("</think>");s&&d(t,c,s),i(t,c),t.inThinking=!1,e=o}if(t.inThinking&&e)return d(t,c,e),o;e&&function(e,t,n,s){if(!e.msgItemAdded[n]){e.msgItemAdded[n]=!0;let s="msg_".concat(e.responseId,"_").concat(n);t("response.output_item.added",{type:"response.output_item.added",output_index:n,item:{id:s,type:"message",content:[],role:"assistant"}})}e.msgContentAdded[n]||(e.msgContentAdded[n]=!0,t("response.content_part.added",{type:"response.content_part.added",item_id:"msg_".concat(e.responseId,"_").concat(n),output_index:n,content_index:0,part:{type:"output_text",annotations:[],logprobs:[],text:""}})),t("response.output_text.delta",{type:"response.output_text.delta",item_id:"msg_".concat(e.responseId,"_").concat(n),output_index:n,content_index:0,delta:s,logprobs:[]}),e.msgTextBuf[n]||(e.msgTextBuf[n]=""),e.msgTextBuf[n]+=s}(t,c,m,e)}if(l.tool_calls)for(let e of(u(t,c,m),l.tool_calls))!function(e,t,n){var s,o,r;let d=null!=(r=n.index)?r:0,i=n.id,u=null==(s=n.function)?void 0:s.name;if(u&&(e.funcNames[d]=u),!e.funcCallIds[d]&&i&&(e.funcCallIds[d]=i,t("response.output_item.added",{type:"response.output_item.added",output_index:d,item:{id:"fc_".concat(i),type:"function_call",arguments:"",call_id:i,name:e.funcNames[d]||""}})),e.funcArgsBuf[d]||(e.funcArgsBuf[d]=""),null==(o=n.function)?void 0:o.arguments){let s=e.funcCallIds[d]||i;s&&t("response.function_call_arguments.delta",{type:"response.function_call_arguments.delta",item_id:"fc_".concat(s),output_index:d,delta:n.function.arguments}),e.funcArgsBuf[d]+=n.function.arguments}}(t,c,e);if(_.finish_reason){for(let e in t.msgItemAdded)u(t,c,e);for(let e in i(t,c),t.funcCallIds)a(t,c,e);p(t,c)}return o})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9955],{505:(e,i,n)=>{n.d(i,{Xg:()=>t,vq:()=>a,KC:()=>o}),n(9562);let a={cc:[{id:"claude-opus-4-5-20251101",name:"Claude 4.5 Opus"},{id:"claude-sonnet-4-5-20250929",name:"Claude 4.5 Sonnet"},{id:"claude-haiku-4-5-20251001",name:"Claude 4.5 Haiku"}],cx:[{id:"gpt-5.2-codex",name:"GPT 5.2 Codex"},{id:"gpt-5.2",name:"GPT 5.2"},{id:"gpt-5.1-codex-max",name:"GPT 5.1 Codex Max"},{id:"gpt-5.1-codex",name:"GPT 5.1 Codex"},{id:"gpt-5.1-codex-mini",name:"GPT 5.1 Codex Mini"},{id:"gpt-5.1",name:"GPT 5.1"},{id:"gpt-5-codex",name:"GPT 5 Codex"},{id:"gpt-5-codex-mini",name:"GPT 5 Codex Mini"}],gc:[{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview"},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite"}],qw:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"qwen3-coder-flash",name:"Qwen3 Coder Flash"},{id:"vision-model",name:"Qwen3 Vision Model"}],if:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"kimi-k2",name:"Kimi K2"},{id:"kimi-k2-thinking",name:"Kimi K2 Thinking"},{id:"deepseek-r1",name:"DeepSeek R1"},{id:"deepseek-v3.2-chat",name:"DeepSeek V3.2 Chat"},{id:"deepseek-v3.2-reasoner",name:"DeepSeek V3.2 Reasoner"},{id:"minimax-m2",name:"MiniMax M2"},{id:"glm-4.6",name:"GLM 4.6"},{id:"glm-4.7",name:"GLM 4.7"}],ag:[{id:"gemini-3-pro-low",name:"Gemini 3 Pro Low"},{id:"gemini-3-pro-high",name:"Gemini 3 Pro High"},{id:"gemini-3-flash",name:"Gemini 3 Flash"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 "},{id:"claude-sonnet-4-5-thinking",name:"Claude Sonnet 4.5 Thinking"},{id:"claude-opus-4-5-thinking",name:"Claude Opus 4.5"}],gh:[{id:"gpt-5",name:"GPT-5"},{id:"gpt-5-mini",name:"GPT-5 Mini"},{id:"gpt-5.1-codex",name:"GPT-5.1 Codex"},{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max"},{id:"gpt-4.1",name:"GPT-4.1"},{id:"claude-4.5-sonnet",name:"Claude 4.5 Sonnet"},{id:"claude-4.5-opus",name:"Claude 4.5 Opus"},{id:"claude-4.5-haiku",name:"Claude 4.5 Haiku"},{id:"gemini-3-pro",name:"Gemini 3 Pro"},{id:"gemini-3-flash",name:"Gemini 3 Flash"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"grok-code-fast-1",name:"Grok Code Fast 1"}],openai:[{id:"gpt-4o",name:"GPT-4o"},{id:"gpt-4o-mini",name:"GPT-4o Mini"},{id:"gpt-4-turbo",name:"GPT-4 Turbo"},{id:"o1",name:"O1"},{id:"o1-mini",name:"O1 Mini"}],anthropic:[{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4"},{id:"claude-opus-4-20250514",name:"Claude Opus 4"},{id:"claude-3-5-sonnet-20241022",name:"Claude 3.5 Sonnet"}],gemini:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite"}],openrouter:[{id:"auto",name:"Auto (Best Available)"}],glm:[{id:"glm-4.7",name:"GLM 4.7"},{id:"glm-4.6",name:"GLM 4.6"},{id:"glm-4.6v",name:"GLM 4.6V (Vision)"}],kimi:[{id:"kimi-latest",name:"Kimi Latest"}],minimax:[{id:"MiniMax-M2.1",name:"MiniMax M2.1"}]},t={claude:"cc",codex:"cx","gemini-cli":"gc",qwen:"qw",iflow:"if",antigravity:"ag",github:"gh",openai:"openai",anthropic:"anthropic",gemini:"gemini",openrouter:"openrouter",glm:"glm",kimi:"kimi",minimax:"minimax"};function o(e){return a[t[e]||e]||[]}n(6775),n(4427),n(6562),n(3971);var r,l,s=n(5704);void 0!==s&&(null==(r=s.versions)||r.node),void 0!==s&&(null==(l=s.env)||l.ENABLE_REQUEST_LOGS),Object.entries(n(9608).Q2).filter(e=>{let[,i]=e;return i.passthroughModels}).map(e=>{let[i]=e;return i}),Object.entries(a).flatMap(e=>{let[i,n]=e;return n.map(e=>({provider:i,model:e.id,name:e.name}))})},1070:(e,i,n)=>{n.d(i,{A:()=>l});var a=n(5959),t=n(9863),o=n(4156);function r(e){let i=document.documentElement,n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";"dark"===("system"===e?n:e)?i.classList.add("dark"):i.classList.remove("dark")}let l=(0,a.v)((0,t.Zr)((e,i)=>({theme:o.B2.defaultTheme,setTheme:i=>{e({theme:i}),r(i)},toggleTheme:()=>{let n="dark"===i().theme?"light":"dark";e({theme:n}),r(n)},initTheme:()=>{r(i().theme)}}),{name:o.B2.storageKey}))},3971:(e,i,n)=>{n.d(i,{refreshCopilotToken:()=>o,refreshGitHubToken:()=>t});var a=n(9562);async function t(e,i){var n,t;let o=await fetch(a.NA.github.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:a.xq.github.clientId,client_secret:a.xq.github.clientSecret})});if(!o.ok){let e=await o.text();return null==i||null==(t=i.error)||t.call(i,"TOKEN_REFRESH","Failed to refresh GitHub token",{status:o.status,error:e}),null}let r=await o.json();return null==i||null==(n=i.info)||n.call(i,"TOKEN_REFRESH","Successfully refreshed GitHub token",{hasNewAccessToken:!!r.access_token,hasNewRefreshToken:!!r.refresh_token,expiresIn:r.expires_in}),{accessToken:r.access_token,refreshToken:r.refresh_token||e,expiresIn:r.expires_in}}async function o(e,i){var n,a,t;try{let t=await fetch("https://api.github.com/copilot_internal/v2/token",{headers:{Authorization:"Bearer ".concat(e),"User-Agent":"GitHub-Copilot/1.0",Accept:"*/*"}});if(!t.ok){let e=await t.text();return null==i||null==(a=i.error)||a.call(i,"TOKEN_REFRESH","Failed to refresh Copilot token",{status:t.status,error:e}),null}let o=await t.json();return null==i||null==(n=i.info)||n.call(i,"TOKEN_REFRESH","Successfully refreshed Copilot token",{hasToken:!!o.token,expiresAt:o.expires_at}),{token:o.token,expiresAt:o.expires_at}}catch(e){return null==i||null==(t=i.error)||t.call(i,"TOKEN_REFRESH","Error refreshing Copilot token",{error:e.message}),null}}},4156:(e,i,n)=>{n.d(i,{B2:()=>o,MA:()=>a.MA,Q2:()=>a.Q2,fg:()=>a.fg,vQ:()=>t,zN:()=>a.zN});var a=n(9608);n(505);let t={name:"Endpoint Proxy",description:"AI Infrastructure Management",version:"1.0.0"},o={storageKey:"theme",defaultTheme:"system"}},4427:(e,i,n)=>{n.d(i,{kz:()=>o}),n(6775),n(6562);let a=new Map,t=new Map;function o(e,i,n,o){let r="".concat(e,":").concat(i);n&&a.set(r,n),o&&t.set(r,o)}},6562:(e,i,n)=>{n(9562)},6775:(e,i,n)=>{n.d(i,{h:()=>a});let a={OPENAI:"openai",OPENAI_RESPONSES:"openai-responses",OPENAI_RESPONSE:"openai-response",CLAUDE:"claude",GEMINI:"gemini",GEMINI_CLI:"gemini-cli",CODEX:"codex",ANTIGRAVITY:"antigravity"}},9562:(e,i,n)=>{n.d(i,{Co:()=>t,NA:()=>o,Uc:()=>r,eo:()=>l,xq:()=>a});let a={claude:{baseUrl:"https://api.anthropic.com/v1/messages",format:"claude",headers:{"Anthropic-Version":"2023-06-01","Anthropic-Beta":"claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14,context-management-2025-06-27","Anthropic-Dangerous-Direct-Browser-Access":"true","User-Agent":"claude-cli/1.0.83 (external, cli)","X-App":"cli","X-Stainless-Helper-Method":"stream","X-Stainless-Retry-Count":"0","X-Stainless-Runtime-Version":"v24.3.0","X-Stainless-Package-Version":"0.55.1","X-Stainless-Runtime":"node","X-Stainless-Lang":"js","X-Stainless-Arch":"arm64","X-Stainless-Os":"MacOS","X-Stainless-Timeout":"60"},clientId:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",tokenUrl:"https://console.anthropic.com/v1/oauth/token"},gemini:{baseUrl:"https://generativelanguage.googleapis.com/v1beta/models",format:"gemini",clientId:"681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",clientSecret:"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"},"gemini-cli":{baseUrl:"https://cloudcode-pa.googleapis.com/v1internal",format:"gemini-cli",clientId:"681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",clientSecret:"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"},codex:{baseUrl:"https://chatgpt.com/backend-api/codex/responses",format:"codex",headers:{Version:"0.21.0","Openai-Beta":"responses=experimental","User-Agent":"codex_cli_rs/0.50.0 (Mac OS 26.0.1; arm64)"},clientId:"app_EMoamEEZ73f0CkXaXp7hrann",clientSecret:"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",tokenUrl:"https://auth.openai.com/oauth/token"},qwen:{baseUrl:"https://portal.qwen.ai/v1/chat/completions",format:"openai",headers:{"User-Agent":"google-api-nodejs-client/9.15.1","X-Goog-Api-Client":"gl-node/22.17.0"},clientId:"f0304373b74a44d2b584a3fb70ca9e56",tokenUrl:"https://chat.qwen.ai/api/v1/oauth2/token",authUrl:"https://chat.qwen.ai/api/v1/oauth2/device/code"},iflow:{baseUrl:"https://apis.iflow.cn/v1/chat/completions",format:"openai",headers:{"User-Agent":"iFlow-Cli"},clientId:"10009311001",clientSecret:"4Z3YjXycVsQvyGF1etiNlIBB4RsqSDtW",tokenUrl:"https://iflow.cn/oauth/token",authUrl:"https://iflow.cn/oauth"},antigravity:{baseUrls:["https://daily-cloudcode-pa.sandbox.googleapis.com","https://cloudcode-pa.googleapis.com"],format:"antigravity",headers:{"User-Agent":"antigravity/1.11.5 windows/amd64"},clientId:"1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com",clientSecret:"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"},openrouter:{baseUrl:"https://openrouter.ai/api/v1/chat/completions",format:"openai",headers:{"HTTP-Referer":"https://endpoint-proxy.local","X-Title":"Endpoint Proxy"}},openai:{baseUrl:"https://api.openai.com/v1/chat/completions",format:"openai"},glm:{baseUrl:"https://api.z.ai/api/anthropic/v1/messages",format:"claude",headers:{"Anthropic-Version":"2023-06-01","Anthropic-Beta":"claude-code-20250219,interleaved-thinking-2025-05-14"}},kimi:{baseUrl:"https://api.kimi.com/coding/v1/messages",format:"claude",headers:{"Anthropic-Version":"2023-06-01","Anthropic-Beta":"claude-code-20250219,interleaved-thinking-2025-05-14"}},minimax:{baseUrl:"https://api.minimax.io/anthropic/v1/messages",format:"claude",headers:{"Anthropic-Version":"2023-06-01","Anthropic-Beta":"claude-code-20250219,interleaved-thinking-2025-05-14"}},github:{baseUrl:"https://api.githubcopilot.com/chat/completions",format:"openai",headers:{"copilot-integration-id":"vscode-chat","editor-version":"vscode/1.107.1","editor-plugin-version":"copilot-chat/0.26.7","user-agent":"GitHubCopilotChat/0.26.7","openai-intent":"conversation-panel","x-github-api-version":"2025-04-01","x-vscode-user-agent-library-version":"electron-fetch","X-Initiator":"user",Accept:"application/json","Content-Type":"application/json"}}},t="You are Claude Code, Anthropic's official CLI for Claude.",o={google:{token:"https://oauth2.googleapis.com/token",auth:"https://accounts.google.com/o/oauth2/auth"},openai:{token:"https://auth.openai.com/oauth/token",auth:"https://auth.openai.com/oauth/authorize"},anthropic:{token:"https://console.anthropic.com/v1/oauth/token",auth:"https://console.anthropic.com/v1/oauth/authorize"},qwen:{token:"https://chat.qwen.ai/api/v1/oauth2/token",auth:"https://chat.qwen.ai/api/v1/oauth2/device/code"},iflow:{token:"https://iflow.cn/oauth/token",auth:"https://iflow.cn/oauth"},github:{token:"https://github.com/login/oauth/access_token",auth:"https://github.com/login/oauth/authorize",deviceCode:"https://github.com/login/device/code"}},r=64e3,l=32e3},9608:(e,i,n)=>{n.d(i,{MA:()=>r,Q2:()=>o,fg:()=>t,wG:()=>l,zN:()=>a});let a={claude:{id:"claude",alias:"cc",name:"Claude Code",icon:"smart_toy",color:"#D97757"},antigravity:{id:"antigravity",alias:"ag",name:"Antigravity",icon:"rocket_launch",color:"#F59E0B"},codex:{id:"codex",alias:"cx",name:"OpenAI Codex",icon:"code",color:"#3B82F6"},iflow:{id:"iflow",alias:"if",name:"iFlow AI",icon:"water_drop",color:"#6366F1"},qwen:{id:"qwen",alias:"qw",name:"Qwen Code",icon:"psychology",color:"#10B981"},"gemini-cli":{id:"gemini-cli",alias:"gc",name:"Gemini CLI",icon:"terminal",color:"#4285F4"},github:{id:"github",alias:"gh",name:"GitHub Copilot",icon:"code",color:"#333333"}},t={openrouter:{id:"openrouter",alias:"openrouter",name:"OpenRouter",icon:"router",color:"#6366F1",textIcon:"OR",passthroughModels:!0},glm:{id:"glm",alias:"glm",name:"GLM Coding",icon:"code",color:"#2563EB",textIcon:"GL"},kimi:{id:"kimi",alias:"kimi",name:"Kimi Coding",icon:"psychology",color:"#1E3A8A",textIcon:"KM"},minimax:{id:"minimax",alias:"minimax",name:"Minimax Coding",icon:"memory",color:"#7C3AED",textIcon:"MM"},openai:{id:"openai",alias:"openai",name:"OpenAI",icon:"auto_awesome",color:"#10A37F",textIcon:"OA"},anthropic:{id:"anthropic",alias:"anthropic",name:"Anthropic",icon:"smart_toy",color:"#D97757",textIcon:"AN"},gemini:{id:"gemini",alias:"gemini",name:"Gemini",icon:"diamond",color:"#4285F4",textIcon:"GE"}},o={...a,...t},r={oauth:{id:"oauth",name:"OAuth",icon:"lock"},apikey:{id:"apikey",name:"API Key",icon:"key"}};function l(e){let i=o[e];return(null==i?void 0:i.alias)||e}Object.values(o).reduce((e,i)=>(e[i.alias]=i.id,e),{}),Object.values(o).reduce((e,i)=>(e[i.id]=i.alias,e),{})},9955:(e,i,n)=>{n.d(i,{ThemeProvider:()=>r});var a=n(5155),t=n(2115),o=n(1070);function r(e){let{children:i}=e,{initTheme:n}=(0,o.A)();return(0,t.useEffect)(()=>{n()},[n]),(0,a.jsx)(a.Fragment,{children:i})}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2326],{2016:(e,t,s)=>{Promise.resolve().then(s.bind(s,6445))},6445:(e,t,s)=>{"use strict";s.d(t,{default:()=>p});var l=s(5155),a=s(2115),r=s(4244);let o={claude:{id:"claude",name:"Claude Code",icon:"terminal",color:"#D97757",description:"Anthropic Claude Code CLI",configType:"env",envVars:{baseUrl:"ANTHROPIC_BASE_URL",model:"ANTHROPIC_MODEL",opusModel:"ANTHROPIC_DEFAULT_OPUS_MODEL",sonnetModel:"ANTHROPIC_DEFAULT_SONNET_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-4-5-20251101"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-4-5-20250929"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},codex:{id:"codex",name:"OpenAI Codex CLI",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresCloud:!0,notes:[{type:"warning",text:"Requires Cursor Pro account to use this feature."},{type:"cloudCheck",text:"Cursor routes requests through its own server, so local endpoint is not supported. Please enable Cloud Endpoint in Settings."}],guideSteps:[{step:1,title:"Open Settings",desc:"Go to Settings → Models"},{step:2,title:"Enable OpenAI API",desc:'Enable "OpenAI API key" option'},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Add Custom Model",desc:'Click "View All Model" → "Add Custom Model"'},{step:6,title:"Select Model",type:"modelSelector"}]},cline:{id:"cline",name:"CLINE",image:"/providers/cline.png",color:"#00D1B2",description:"CLINE AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to CLINE Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → Ollama"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},roo:{id:"roo",name:"Roo",image:"/providers/roo.png",color:"#FF6B6B",description:"Roo AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Roo Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → Ollama"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Config",desc:"Open Continue configuration file"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Model",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Add the following configuration to your models array:"}],codeBlock:{language:"json",code:'{\n "apiBase": "{{baseUrl}}",\n "title": "{{model}}",\n "model": "{{model}}",\n "provider": "openai",\n "apiKey": "{{apiKey}}"\n}'}}};var n=s(505),i=s(5239);let c="https://9router.com";function d(e){let{tool:t,isExpanded:s,onToggle:o,activeProviders:n,modelMappings:d,onModelMappingChange:x,baseUrl:m,hasActiveProviders:u,apiKeys:p,cloudEnabled:h}=e,[g,y]=(0,a.useState)(null),[f,b]=(0,a.useState)(!1),[j,v]=(0,a.useState)(!1),[N,k]=(0,a.useState)(!1),[C,w]=(0,a.useState)(null),[S,_]=(0,a.useState)(!1),[A,E]=(0,a.useState)(!1),[O,I]=(0,a.useState)(null),[P,T]=(0,a.useState)(""),[L,K]=(0,a.useState)(!1),[M,R]=(0,a.useState)({}),U=(()=>{var e,t;if(!(null==g?void 0:g.installed))return null;let s=null==(t=g.settings)||null==(e=t.env)?void 0:e.ANTHROPIC_BASE_URL;if(!s)return"not_configured";let l=s.includes("localhost")||s.includes("127.0.0.1"),a=h&&c&&s.startsWith(c);return l||a?"configured":"other"})();(0,a.useEffect)(()=>{(null==p?void 0:p.length)>0&&!P&&T(p[0].key)},[p]),(0,a.useEffect)(()=>{s&&!g&&(D(),H())},[s]);let H=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&R(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(null==g?void 0:g.installed){var e;let s=(null==(e=g.settings)?void 0:e.env)||{};t.defaultModels.forEach(e=>{if(e.envKey){let t=s[e.envKey]||e.defaultValue||"";t&&x(e.alias,t)}});let l=s.ANTHROPIC_AUTH_TOKEN;l&&(null==p?void 0:p.some(e=>e.key===l))&&T(l)}},[g,p]);let D=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();y(t)}catch(e){y({installed:!1,error:e.message})}finally{b(!1)}},F=async()=>{v(!0),w(null);try{let e={ANTHROPIC_BASE_URL:m},s=(null==P?void 0:P.trim())||((null==p?void 0:p.length)>0?p[0].key:null)||(h?null:"sk_9router");s&&(e.ANTHROPIC_AUTH_TOKEN=s),t.defaultModels.forEach(t=>{let s=d[t.alias];s&&t.envKey&&(e[t.envKey]=s)});let l=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:e})}),a=await l.json();l.ok?(w({type:"success",text:"Settings applied successfully!"}),y(t=>({...t,hasBackup:!0,settings:{...null==t?void 0:t.settings,env:e}}))):w({type:"error",text:a.error||"Failed to apply settings"})}catch(e){w({type:"error",text:e.message})}finally{v(!1)}},z=async()=>{k(!0),w(null);try{let e=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await e.json();e.ok?(w({type:"success",text:"Settings reset successfully!"}),t.defaultModels.forEach(e=>x(e.alias,e.defaultValue||"")),T("")):w({type:"error",text:s.error||"Failed to reset settings"})}catch(e){w({type:"error",text:e.message})}finally{k(!1)}},B=()=>{let e={ANTHROPIC_BASE_URL:m,ANTHROPIC_AUTH_TOKEN:P&&P.trim()?P:h?"<API_KEY_FROM_DASHBOARD>":"sk_9router"};return t.defaultModels.forEach(t=>{let s=d[t.alias];s&&t.envKey&&(e[t.envKey]=s)}),JSON.stringify({env:e},null,2)},$=async e=>{try{await navigator.clipboard.writeText(e),K(!0),setTimeout(()=>K(!1),2e3)}catch(e){console.log("Failed to copy:",e)}};return(0,l.jsxs)(r.Zp,{className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:o,children:[(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("div",{className:"size-12 rounded-xl flex items-center justify-center",style:{backgroundColor:"".concat(t.color,"15")},children:(0,l.jsx)(i.default,{src:"/providers/claude.png",alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-semibold text-lg",children:t.name}),"configured"===U&&(0,l.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===U&&(0,l.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===U&&(0,l.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other endpoint"})]}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:t.description})]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted transition-transform ".concat(s?"rotate-180":""),children:"expand_more"})]}),s&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[f&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude CLI..."})]}),!f&&g&&!g.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Claude CLI to use this feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>_(!S),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:S?"expand_less":"help"}),S?"Hide":"How to Install"]})]}),S&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!f&&(null==g?void 0:g.installed)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-green-500 text-[16px]",children:"check_circle"}),(0,l.jsx)("span",{className:"text-xs text-text-muted shrink-0",children:"URL:"}),(0,l.jsx)("code",{className:"text-xs font-mono text-text-main truncate",children:m})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted shrink-0",children:"Key:"}),p.length>0?(0,l.jsx)("select",{value:P,onChange:e=>T(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:p.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"text-xs text-text-muted",children:h?"No API keys - Create one in Keys page":"sk_9router"})]}),(0,l.jsx)("div",{className:"flex flex-col gap-2",children:t.defaultModels.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:d[e.alias]||"",onChange:t=>x(e.alias,t.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>{I(e.alias),E(!0)},disabled:!u,className:"px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ".concat(u?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"),children:"Select Model"}),d[e.alias]&&(0,l.jsx)("button",{onClick:()=>x(e.alias,""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]},e.alias))}),C&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs ".concat("success"===C.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===C.type?"check_circle":"error"}),(0,l.jsx)("span",{children:C.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:F,disabled:!u,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:z,disabled:!(null==g?void 0:g.has9Router),loading:N,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:D,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"})})]}),(0,l.jsxs)("div",{className:"pt-4 border-t border-border flex flex-col gap-3",children:[(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Or copy config manually:"}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)("span",{className:"text-xs font-medium text-text-main",children:"~/.claude/settings.json"}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>$(B()),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:L?"check":"content_copy"}),L?"Copied!":"Copy"]})]}),(0,l.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-40 overflow-y-auto",children:B()})]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:A,onClose:()=>E(!1),onSelect:e=>{O&&x(O,e.value)},selectedModel:O?d[O]:null,activeProviders:n,modelAliases:M,title:"Select model for ".concat(O)})]})}function x(e){let{tool:t,isExpanded:s,onToggle:o,baseUrl:n,apiKeys:c,activeProviders:d,cloudEnabled:x}=e,[m,u]=(0,a.useState)(null),[p,h]=(0,a.useState)(!1),[g,y]=(0,a.useState)(!1),[f,b]=(0,a.useState)(!1),[j,v]=(0,a.useState)(null),[N,k]=(0,a.useState)(!1),[C,w]=(0,a.useState)(""),[S,_]=(0,a.useState)(""),[A,E]=(0,a.useState)(!1),[O,I]=(0,a.useState)(!1),[P,T]=(0,a.useState)({});(0,a.useEffect)(()=>{(null==c?void 0:c.length)>0&&!C&&w(c[0].key)},[c]),(0,a.useEffect)(()=>{s&&!m&&(M(),L())},[s]);let L=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&T(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(null==m?void 0:m.config){let e=m.config.match(/^model\s*=\s*"([^"]+)"/m);e&&_(e[1])}},[m]);let K=(null==m?void 0:m.installed)?m.config?m.config.includes(n)||m.config.includes("localhost")||m.config.includes("127.0.0.1")?"configured":"other":"not_configured":null,M=async()=>{h(!0);try{let e=await fetch("/api/cli-tools/codex-settings"),t=await e.json();u(t)}catch(e){u({installed:!1,error:e.message})}finally{h(!1)}},R=async()=>{y(!0),v(null);try{let e=C&&C.trim()||x?C:"sk_9router",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n,apiKey:e,model:S})}),s=await t.json();t.ok?(v({type:"success",text:"Settings applied successfully!"}),M()):v({type:"error",text:s.error||"Failed to apply settings"})}catch(e){v({type:"error",text:e.message})}finally{y(!1)}},U=async()=>{b(!0),v(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(v({type:"success",text:"Settings reset successfully!"}),_(""),M()):v({type:"error",text:t.error||"Failed to reset settings"})}catch(e){v({type:"error",text:e.message})}finally{b(!1)}},H='# 9Router Configuration for Codex CLI\nmodel = "'.concat(S,'"\nmodel_provider = "9router"\n\n[model_providers.9router]\nname = "9Router"\nbase_url = "').concat(n,'/v1"\nwire_api = "responses"\n'),D=JSON.stringify({OPENAI_API_KEY:C&&C.trim()?C:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router"},null,2),F=async e=>{try{await navigator.clipboard.writeText(e),E(!0),setTimeout(()=>E(!1),2e3)}catch(e){console.log("Failed to copy:",e)}};return(0,l.jsxs)(r.Zp,{className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:o,children:[(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("div",{className:"size-12 rounded-xl flex items-center justify-center",style:{backgroundColor:"".concat(t.color,"15")},children:(0,l.jsx)(i.default,{src:"/providers/codex.png",alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-semibold text-lg",children:t.name}),"configured"===K&&(0,l.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===K&&(0,l.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===K&&(0,l.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other endpoint"})]}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:t.description})]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted transition-transform ".concat(s?"rotate-180":""),children:"expand_more"})]}),s&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[p&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Codex CLI..."})]}),!p&&m&&!m.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Codex CLI to use auto-apply feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>k(!N),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:N?"expand_less":"help"}),N?"Hide":"How to Install"]})]}),N&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,l.jsx)("div",{className:"pt-2 border-t border-border",children:(0,l.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," with ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!p&&(null==m?void 0:m.installed)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-green-500 text-[16px]",children:"check_circle"}),(0,l.jsx)("span",{className:"text-xs text-text-muted shrink-0",children:"URL:"}),(0,l.jsxs)("code",{className:"text-xs font-mono text-text-main truncate",children:[n,"/v1"]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted shrink-0",children:"Key:"}),c.length>0?(0,l.jsx)("select",{value:C,onChange:e=>w(e.target.value),className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:c.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"text-xs text-text-muted",children:x?"No API keys - Create one in Keys page":"sk_9router"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-16 shrink-0 text-sm font-semibold text-text-main text-right",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:S,onChange:e=>_(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>I(!0),disabled:!(null==d?void 0:d.length),className:"px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ".concat((null==d?void 0:d.length)?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"),children:"Select Model"}),S&&(0,l.jsx)("button",{onClick:()=>_(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs ".concat("success"===j.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===j.type?"check_circle":"error"}),(0,l.jsx)("span",{children:j.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:R,disabled:!C||!S,loading:g,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:U,disabled:!m.has9Router,loading:f,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:M,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"})})]})]}),(0,l.jsxs)("div",{className:"pt-4 border-t border-border flex flex-col gap-3",children:[(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Or copy config manually:"}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)("span",{className:"text-xs font-medium text-text-main",children:"~/.codex/config.toml"}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>F(H),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:A?"check":"content_copy"}),A?"Copied!":"Copy"]})]}),(0,l.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-32 overflow-y-auto",children:H})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)("span",{className:"text-xs font-medium text-text-main",children:"~/.codex/auth.json"}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>F(D),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:A?"check":"content_copy"}),A?"Copied!":"Copy"]})]}),(0,l.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-32 overflow-y-auto",children:D})]})]})]}),(0,l.jsx)(r.rq,{isOpen:O,onClose:()=>I(!1),onSelect:e=>{_(e.value),I(!1)},selectedModel:S,activeProviders:d,modelAliases:P,title:"Select Model for Codex"})]})}function m(e){let{toolId:t,tool:s,isExpanded:o,onToggle:n,baseUrl:c,apiKeys:d,activeProviders:x=[],cloudEnabled:m=!1}=e,[u,p]=(0,a.useState)(null),[h,g]=(0,a.useState)(!1),[y,f]=(0,a.useState)(""),[b,j]=(0,a.useState)(()=>(null==d?void 0:d.length)>0?d[0].key:""),v=e=>{let t=b&&b.trim()?b:m?"your-api-key":"sk_9router";return e.replace(/\{\{baseUrl\}\}/g,c||"http://localhost:3000").replace(/\{\{apiKey\}\}/g,t).replace(/\{\{model\}\}/g,y||"provider/model-id")},N=async(e,t)=>{await navigator.clipboard.writeText(v(e)),p(t),setTimeout(()=>p(null),2e3)},k=x.length>0,C=()=>!s.requiresCloud||!!m;return(0,l.jsxs)(r.Zp,{className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:n,children:[(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("div",{className:"size-12 rounded-xl flex items-center justify-center",style:{backgroundColor:"".concat(s.color,"15")},children:s.image?(0,l.jsx)(i.default,{src:s.image,alt:s.name,width:32,height:32,className:"size-8 object-contain rounded-lg",onError:e=>{e.target.style.display="none"}}):s.icon?(0,l.jsx)("span",{className:"material-symbols-outlined text-2xl",style:{color:s.color},children:s.icon}):(0,l.jsx)(i.default,{src:"/providers/".concat(t,".png"),alt:s.name,width:32,height:32,className:"size-8 object-contain rounded-lg",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"font-semibold text-lg",children:s.name}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:s.description})]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted transition-transform ".concat(o?"rotate-180":""),children:"expand_more"})]}),o&&(0,l.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:s.guideSteps?(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[s.notes&&0!==s.notes.length?(0,l.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:s.notes.map((e,t)=>{if("cloudCheck"===e.type&&m)return null;let s="warning"===e.type,a="cloudCheck"===e.type&&!m,r="bg-blue-500/10 border-blue-500/30",o="text-blue-600 dark:text-blue-400",n="text-blue-500",i="info";return s?(r="bg-yellow-500/10 border-yellow-500/30",o="text-yellow-600 dark:text-yellow-400",n="text-yellow-500",i="warning"):a&&(r="bg-red-500/10 border-red-500/30",o="text-red-600 dark:text-red-400",n="text-red-500",i="error"),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg border ".concat(r),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-lg ".concat(n),children:i}),(0,l.jsx)("p",{className:"text-sm ".concat(o),children:e.text})]},t)})}):null,C()&&s.guideSteps.map(e=>(0,l.jsxs)("div",{className:"flex items-start gap-4",children:[(0,l.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:s.color},children:e.step}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"font-medium text-text",children:e.title}),e.desc&&(0,l.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:e.desc}),"apiKeySelector"===e.type&&(0,l.jsx)("div",{className:"mt-2 flex items-center gap-2",children:d&&d.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("select",{value:b,onChange:e=>j(e.target.value),className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}),(0,l.jsx)("button",{onClick:()=>N(b,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===u?"check":"content_copy"})})]}):(0,l.jsx)("span",{className:"text-sm text-text-muted",children:m?"No API keys - Create one in Keys page":"sk_9router"})}),"modelSelector"===e.type&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("input",{type:"text",value:y,onChange:e=>f(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>g(!0),disabled:!k,className:"shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ".concat(k?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"),children:"Select Model"}),y&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{onClick:()=>N(y,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===u?"check":"content_copy"})}),(0,l.jsx)("button",{onClick:()=>f(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),e.value&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:v(e.value)}),e.copyable&&(0,l.jsx)("button",{onClick:()=>N(e.value,"".concat(e.step,"-").concat(e.title)),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:u==="".concat(e.step,"-").concat(e.title)?"check":"content_copy"})})]})]})]},e.step)),C()&&s.codeBlock&&(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:s.codeBlock.language}),(0,l.jsxs)("button",{onClick:()=>N(s.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===u?"check":"content_copy"}),"codeblock"===u?"Copied!":"Copy"]})]}),(0,l.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,l.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:v(s.codeBlock.code)})})]})]}):(0,l.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,l.jsx)(r.rq,{isOpen:h,onClose:()=>g(!1),onSelect:e=>{f(e.value)},selectedModel:y,activeProviders:x,title:"Select Model"})]})}let u="https://9router.com";function p(e){let{machineId:t}=e,[s,i]=(0,a.useState)([]),[c,p]=(0,a.useState)(!0),[h,g]=(0,a.useState)(null),[y,f]=(0,a.useState)({}),[b,j]=(0,a.useState)(!1),[v,N]=(0,a.useState)([]);(0,a.useEffect)(()=>{w(),k(),C()},[]);let k=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let t=await e.json();j(t.cloudEnabled||!1)}}catch(e){console.log("Error loading cloud settings:",e)}},C=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let t=await e.json();N(t.keys||[])}}catch(e){console.log("Error fetching API keys:",e)}},w=async()=>{try{let e=await fetch("/api/providers"),t=await e.json();e.ok&&i(t.connections||[])}catch(e){console.log("Error fetching connections:",e)}finally{p(!1)}},S=()=>s.filter(e=>!1!==e.isActive);if(c)return(0,l.jsx)("div",{className:"flex flex-col gap-6",children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(r.Qv,{}),(0,l.jsx)(r.Qv,{}),(0,l.jsx)(r.Qv,{})]})});let _=(()=>{let e=S(),t=[],s=new Set;return e.forEach(e=>{let l=n.Xg[e.provider]||e.provider;(0,n.KC)(e.provider).forEach(a=>{let r="".concat(l,"/").concat(a.id);s.has(r)||(s.add(r),t.push({value:r,label:"".concat(l,"/").concat(a.id),provider:e.provider,alias:l,connectionName:e.name,modelId:a.id}))})}),0===t.length&&Object.entries(n.vq).forEach(e=>{let[s,l]=e;l.forEach(e=>{let l="".concat(s,"/").concat(e.id);t.push({value:l,label:"".concat(s,"/").concat(e.id),provider:s,alias:s,connectionName:s,modelId:e.id})})}),t})().length>0;return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[!_&&(0,l.jsx)(r.Zp,{className:"border-yellow-500/50 bg-yellow-500/5",children:(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"No active providers"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please add and connect providers first to configure CLI tools."})]})]})}),(0,l.jsx)("div",{className:"flex flex-col gap-4",children:Object.entries(o).map(e=>{let[t,s]=e,a={tool:s,isExpanded:h===t,onToggle:()=>g(h===t?null:t),baseUrl:b&&u?u:window.location.origin,apiKeys:v};switch(t){case"claude":return(0,l.jsx)(d,{...a,activeProviders:S(),modelMappings:y[t]||{},onModelMappingChange:(e,s)=>{f(l=>({...l,[t]:{...l[t],[e]:s}}))},hasActiveProviders:_,cloudEnabled:b},t);case"codex":return(0,l.jsx)(x,{...a,activeProviders:S(),cloudEnabled:b},t);default:return(0,l.jsx)(m,{toolId:t,...a,activeProviders:S(),cloudEnabled:b},t)}})})]})}}},e=>{e.O(0,[1760,5239,9955,4244,8441,1255,7358],()=>e(e.s=2016)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{2397:(e,t,s)=>{Promise.resolve().then(s.bind(s,5259))},5259:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var a=s(5155),l=s(2115),r=s(63),i=s(2619),n=s.n(i);s(5239);var o=s(4244),c=s(9608),d=s(505);s(4156);var m=s(2694);function x(){let e=(0,r.useParams)().id,[t,s]=(0,l.useState)([]),[i,x]=(0,l.useState)(!0),[h,y]=(0,l.useState)(!1),[b,g]=(0,l.useState)(!1),[N,C]=(0,l.useState)(!1),[w,k]=(0,l.useState)(null),[S,E]=(0,l.useState)({}),{copied:A,copy:O}=(0,m.C)(),P=c.zN[e]||c.fg[e],T=!!c.zN[e],D=(0,d.KC)(e),I=(0,c.wG)(e);(0,l.useEffect)(()=>{U(),K()},[e]);let K=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&E(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},_=async(e,t)=>{let s="".concat(I,"/").concat(e);try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})});if(e.ok)await K();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},M=async e=>{try{(await fetch("/api/models/alias?alias=".concat(encodeURIComponent(e)),{method:"DELETE"})).ok&&await K()}catch(e){console.log("Error deleting alias:",e)}},U=async()=>{try{let t=await fetch("/api/providers"),a=await t.json();if(t.ok){let t=(a.connections||[]).filter(t=>t.provider===e);s(t)}}catch(e){console.log("Error fetching connections:",e)}finally{x(!1)}},L=async e=>{if(confirm("Delete this connection?"))try{(await fetch("/api/providers/".concat(e),{method:"DELETE"})).ok&&s(t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},$=async t=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})})).ok&&(await U(),g(!1))}catch(e){console.log("Error saving connection:",e)}},z=async e=>{try{(await fetch("/api/providers/".concat(w.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await U(),C(!1))}catch(e){console.log("Error updating connection:",e)}},F=async(e,t)=>{if(e&&t)try{await Promise.all([fetch("/api/providers/".concat(e.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t.priority})}),fetch("/api/providers/".concat(t.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e.priority})})]),await U()}catch(e){console.log("Error swapping priority:",e)}};return P?i?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(o.Qv,{}),(0,a.jsx)(o.Qv,{})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(n(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("div",{className:"rounded-lg flex items-center justify-center",style:{backgroundColor:"".concat(P.color,"15")},children:(0,a.jsx)("img",{src:"/providers/".concat(P.id,".png"),alt:P.name,className:"size-12 object-contain rounded-lg",onError:e=>{e.target.style.display="none"}})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:P.name}),(0,a.jsxs)("p",{className:"text-text-muted",children:[t.length," connection",1!==t.length?"s":""]})]})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>T?y(!0):g(!0),children:"Add"})]}),0===t.length?(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-4xl text-text-muted mb-2",children:T?"lock":"key"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"})]}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:t.sort((e,t)=>(e.priority||0)-(t.priority||0)).map((e,s)=>(0,a.jsx)(f,{connection:e,isOAuth:T,isFirst:0===s,isLast:s===t.length-1,onMoveUp:()=>F(e,t[s-1]),onMoveDown:()=>F(e,t[s+1]),onEdit:()=>{k(e),C(!0)},onDelete:()=>L(e.id)},e.id))})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4",children:P.passthroughModels?"Model Aliases":"Available Models"}),P.passthroughModels?(0,a.jsx)(u,{providerAlias:I,modelAliases:S,copied:A,onCopy:O,onSetAlias:_,onDeleteAlias:M}):0===D.length?(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No models configured"}):(0,a.jsx)("div",{className:"flex flex-wrap gap-3",children:D.map(t=>{var s;let l="".concat(I,"/").concat(t.id),r="".concat(e,"/").concat(t.id),i=null==(s=Object.entries(S).find(e=>{let[,t]=e;return t===l||t===r}))?void 0:s[0];return(0,a.jsx)(p,{model:t,fullModel:l,alias:i,copied:A,onCopy:O,onSetAlias:e=>_(t.id,e),onDeleteAlias:()=>M(i)},t.id)})})]}),(0,a.jsx)(o.LF,{isOpen:h,provider:e,providerInfo:P,onSuccess:()=>{U(),y(!1)},onClose:()=>y(!1)}),(0,a.jsx)(v,{isOpen:b,provider:e,onSave:$,onClose:()=>g(!1)}),(0,a.jsx)(j,{isOpen:N,connection:w,onSave:z,onClose:()=>C(!1)})]}):(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,a.jsx)(n(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}function p(e){let{model:t,fullModel:s,alias:l,copied:r,onCopy:i}=e;return(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:s}),(0,a.jsx)("button",{onClick:()=>i(s,"model-".concat(t.id)),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:r==="model-".concat(t.id)?"check":"content_copy"})})]})}function u(e){let{providerAlias:t,modelAliases:s,copied:r,onCopy:i,onSetAlias:n,onDeleteAlias:c}=e,[d,m]=(0,l.useState)(""),[x,p]=(0,l.useState)(!1),u=Object.entries(s).filter(e=>{let[,s]=e;return s.startsWith("".concat(t,"/"))}).map(e=>{let[s,a]=e;return{modelId:a.replace("".concat(t,"/"),""),fullModel:a,alias:s}}),y=async()=>{if(!d.trim()||x)return;let e=d.trim(),t=(e=>{let t=e.split("/");return t[t.length-1]})(e);if(s[t])return void alert('Alias "'.concat(t,'" already exists. Please use a different model or edit existing alias.'));p(!0);try{await n(e,t),m("")}catch(e){console.log("Error adding model:",e)}finally{p(!1)}};return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"OpenRouter supports any model. Add models and create aliases for quick access."}),(0,a.jsxs)("div",{className:"flex items-end gap-2",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Model ID (from OpenRouter)"}),(0,a.jsx)("input",{type:"text",value:d,onChange:e=>m(e.target.value),onKeyDown:e=>"Enter"===e.key&&y(),placeholder:"anthropic/claude-3-opus",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,a.jsx)(o.$n,{size:"sm",icon:"add",onClick:y,disabled:!d.trim()||x,children:x?"Adding...":"Add"})]}),u.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-3",children:u.map(e=>{let{modelId:t,fullModel:s,alias:l}=e;return(0,a.jsx)(h,{modelId:t,fullModel:s,copied:r,onCopy:i,onDeleteAlias:()=>c(l)},s)})})]})}function h(e){let{modelId:t,fullModel:s,copied:l,onCopy:r,onDeleteAlias:i}=e;return(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border hover:bg-sidebar/50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:"smart_toy"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:t}),(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:s}),(0,a.jsx)("button",{onClick:()=>r(s,"model-".concat(t)),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",title:"Copy model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:l==="model-".concat(t)?"check":"content_copy"})})]})]}),(0,a.jsx)("button",{onClick:i,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function y(e){let{until:t}=e,[s,r]=(0,l.useState)("");return((0,l.useEffect)(()=>{let e=()=>{let e=new Date(t).getTime()-Date.now();if(e<=0)return void r("");let s=Math.floor(e/1e3);if(s<60)r("".concat(s,"s"));else if(s<3600)r("".concat(Math.floor(s/60),"m ").concat(s%60,"s"));else{let e=Math.floor(s/3600),t=Math.floor(s%3600/60);r("".concat(e,"h ").concat(t,"m"))}};e();let s=setInterval(e,1e3);return()=>clearInterval(s)},[t]),s)?(0,a.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",s]}):null}function f(e){let{connection:t,isOAuth:s,isFirst:r,isLast:i,onMoveUp:n,onMoveDown:c,onEdit:d,onDelete:m}=e,x=s?t.name||t.email||t.displayName||"OAuth Account":t.name,[p,u]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=()=>{u(t.rateLimitedUntil&&new Date(t.rateLimitedUntil).getTime()>Date.now())};e();let s=t.rateLimitedUntil?setInterval(e,1e3):null;return()=>{s&&clearInterval(s)}},[t.rateLimitedUntil]);let h="unavailable"!==t.testStatus||p?t.testStatus:"active";return(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border hover:bg-sidebar/50 hover:cursor-pointer",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("button",{onClick:n,disabled:r,className:"p-0.5 rounded ".concat(r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,a.jsx)("button",{onClick:c,disabled:i,className:"p-0.5 rounded ".concat(i?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"),children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:s?"lock":"key"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:x}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,a.jsx)(o.Ex,{variant:"active"===h||"success"===h?"success":"error"===h||"expired"===h||"unavailable"===h?"error":"default",size:"sm",dot:!0,children:h||"Unknown"}),p&&(0,a.jsx)(y,{until:t.rateLimitedUntil}),t.lastError&&(0,a.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:t.lastError,children:t.lastError}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["#",t.priority]}),t.globalPriority&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",t.globalPriority]})]})]})]}),(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsx)("button",{onClick:d,className:"p-2 hover:bg-sidebar rounded",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"edit"})}),(0,a.jsx)("button",{onClick:m,className:"p-2 hover:bg-red-50 rounded text-red-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"delete"})})]})]})}function v(e){let{isOpen:t,provider:s,onSave:r,onClose:i}=e,[n,c]=(0,l.useState)({name:"",apiKey:"",priority:1}),[d,m]=(0,l.useState)(!1),[x,p]=(0,l.useState)(null),u=async()=>{m(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:s,apiKey:n.apiKey})}),t=await e.json();p(t.valid?"success":"failed")}catch(e){p("failed")}finally{m(!1)}};return s?(0,a.jsx)(o.aF,{isOpen:t,title:"Add ".concat(s," API Key"),onClose:i,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(o.pd,{label:"Name",value:n.name,onChange:e=>c({...n,name:e.target.value}),placeholder:"Production Key"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(o.pd,{label:"API Key",type:"password",value:n.apiKey,onChange:e=>c({...n,apiKey:e.target.value}),className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(o.$n,{onClick:u,disabled:!n.apiKey||d,variant:"secondary",children:d?"Checking...":"Check"})})]}),x&&(0,a.jsx)(o.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Invalid"}),(0,a.jsx)(o.pd,{label:"Priority",type:"number",value:n.priority,onChange:e=>c({...n,priority:parseInt(e.target.value)||1})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(o.$n,{onClick:()=>{r({name:n.name,apiKey:n.apiKey,priority:n.priority,testStatus:"success"===x?"active":"unknown"})},fullWidth:!0,disabled:!n.name||!n.apiKey,children:"Save"}),(0,a.jsx)(o.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function j(e){let{isOpen:t,connection:s,onSave:r,onClose:i}=e,[n,c]=(0,l.useState)({name:"",priority:1}),[d,m]=(0,l.useState)(!1),[x,p]=(0,l.useState)(null);(0,l.useEffect)(()=>{s&&(c({name:s.name||"",priority:s.priority||1}),p(null))},[s]);let u=async()=>{if(null==s?void 0:s.provider){m(!0),p(null);try{let e=await fetch("/api/providers/".concat(s.id,"/test"),{method:"POST"}),t=await e.json();p(t.valid?"success":"failed"),t.valid?r({testStatus:"active",lastError:null,lastErrorAt:null}):r({testStatus:"error",lastError:t.error,lastErrorAt:new Date().toISOString()})}catch(e){p("failed")}finally{m(!1)}}};if(!s)return null;let h="oauth"===s.authType;return(0,a.jsx)(o.aF,{isOpen:t,title:"Edit Connection",onClose:i,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(o.pd,{label:"Name",value:n.name,onChange:e=>c({...n,name:e.target.value}),placeholder:h?"Account name":"Production Key"}),h&&s.email&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,a.jsx)("p",{className:"font-medium",children:s.email})]}),(0,a.jsx)(o.pd,{label:"Priority",type:"number",value:n.priority,onChange:e=>c({...n,priority:parseInt(e.target.value)||1})}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(o.$n,{onClick:u,variant:"secondary",disabled:d,children:d?"Testing...":"Test Connection"}),x&&(0,a.jsx)(o.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Failed"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(o.$n,{onClick:()=>{r({name:n.name,priority:n.priority})},fullWidth:!0,children:"Save"}),(0,a.jsx)(o.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}}},e=>{e.O(0,[1760,5239,9955,4244,8441,1255,7358],()=>e(e.s=2397)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,8974,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,8974,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,8974,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,8974,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,8974,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,8974,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,8974,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,8974,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[335,552,747,748,907,931,992,1070,1288,1512,1566,1625,1666,1860,1949,2296,2720,3025,3102,3472,3549,4286,5079,5177,5211,5922,6529,7442,8246,8453,8648,8974,9088,9141,9461],{4441:()=>{}},_=>{_.O(0,[8441,1255,7358],()=>_(_.s=4441)),_N_E=_.O()}]);