@yina-npm/openrouterx 0.4.19 → 0.4.21

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 (581) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +6 -3
  3. package/app/.next/build-manifest.json +2 -2
  4. package/app/.next/routes-manifest.json +18 -0
  5. package/app/.next/server/app/(dashboard)/dashboard/admin/keys/page.js +2 -2
  6. package/app/.next/server/app/(dashboard)/dashboard/admin/keys/page.js.nft.json +1 -1
  7. package/app/.next/server/app/(dashboard)/dashboard/admin/keys/page_client-reference-manifest.js +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/admin/users/page.js +2 -2
  9. package/app/.next/server/app/(dashboard)/dashboard/admin/users/page.js.nft.json +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/admin/users/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js +2 -2
  12. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +2 -2
  15. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  16. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +2 -2
  18. package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  19. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js +2 -2
  21. package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  22. package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  23. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +2 -2
  24. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  25. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  26. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +17 -17
  27. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  28. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  29. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +2 -2
  30. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  31. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  32. package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +3 -3
  33. package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  34. package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  35. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js +2 -2
  36. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  37. package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  38. package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js +2 -2
  39. package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  40. package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  41. package/app/.next/server/app/(dashboard)/dashboard/page.js +2 -2
  42. package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  43. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  44. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +2 -2
  45. package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  46. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  47. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  48. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  49. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  50. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +2 -2
  51. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  52. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  53. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +2 -2
  54. package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  55. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  56. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +3 -3
  57. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  58. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  59. package/app/.next/server/app/(dashboard)/dashboard/quota/page.js +2 -2
  60. package/app/.next/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  61. package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  62. package/app/.next/server/app/(dashboard)/dashboard/skills/page.js +2 -2
  63. package/app/.next/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  64. package/app/.next/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  65. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +2 -2
  66. package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  67. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  68. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +2 -2
  69. package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  70. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  71. package/app/.next/server/app/(dashboard)/dashboard/user/page.js +3 -3
  72. package/app/.next/server/app/(dashboard)/dashboard/user/page.js.nft.json +1 -1
  73. package/app/.next/server/app/(dashboard)/dashboard/user/page_client-reference-manifest.js +1 -1
  74. package/app/.next/server/app/_global-error/page.js +3 -3
  75. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  76. package/app/.next/server/app/_global-error.html +1 -1
  77. package/app/.next/server/app/_global-error.rsc +1 -1
  78. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  79. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  80. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  81. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  82. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  83. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  84. package/app/.next/server/app/_not-found/page.js +2 -2
  85. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  86. package/app/.next/server/app/_not-found.html +1 -1
  87. package/app/.next/server/app/_not-found.rsc +4 -4
  88. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
  89. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  90. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
  91. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  92. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  93. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  94. package/app/.next/server/app/api/auth/login/route.js +1 -1
  95. package/app/.next/server/app/api/auth/logout/route.js +1 -1
  96. package/app/.next/server/app/api/auth/me/route.js +1 -1
  97. package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  98. package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
  99. package/app/.next/server/app/api/cli-tools/claude-settings/route.js +1 -1
  100. package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
  101. package/app/.next/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  102. package/app/.next/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -0
  103. package/app/.next/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -0
  104. package/app/.next/server/app/api/cli-tools/cowork-mcp-registry/route_client-reference-manifest.js +1 -0
  105. package/app/.next/server/app/api/cli-tools/cowork-settings/route.js +2 -2
  106. package/app/.next/server/app/api/cli-tools/droid-settings/route.js +2 -2
  107. package/app/.next/server/app/api/cli-tools/hermes-settings/route.js +1 -1
  108. package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
  109. package/app/.next/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  110. package/app/.next/server/app/api/cloud/auth/route.js +1 -1
  111. package/app/.next/server/app/api/cloud/credentials/update/route.js +1 -1
  112. package/app/.next/server/app/api/cloud/model/resolve/route.js +1 -1
  113. package/app/.next/server/app/api/cloud/models/alias/route.js +1 -1
  114. package/app/.next/server/app/api/combos/[id]/route.js +1 -1
  115. package/app/.next/server/app/api/combos/route.js +1 -1
  116. package/app/.next/server/app/api/health/route.js +1 -1
  117. package/app/.next/server/app/api/init/route.js +1 -1
  118. package/app/.next/server/app/api/keys/[id]/route.js +1 -1
  119. package/app/.next/server/app/api/keys/route.js +1 -1
  120. package/app/.next/server/app/api/locale/route.js +1 -1
  121. package/app/.next/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
  122. package/app/.next/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  123. package/app/.next/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
  124. package/app/.next/server/app/api/media-providers/tts/voices/route.js +1 -1
  125. package/app/.next/server/app/api/models/alias/route.js +1 -1
  126. package/app/.next/server/app/api/models/availability/route.js +1 -1
  127. package/app/.next/server/app/api/models/custom/route.js +1 -1
  128. package/app/.next/server/app/api/models/disabled/route.js +1 -1
  129. package/app/.next/server/app/api/models/route.js +1 -1
  130. package/app/.next/server/app/api/models/test/route.js +1 -1
  131. package/app/.next/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  132. package/app/.next/server/app/api/oauth/cursor/auto-import/route.js +2 -2
  133. package/app/.next/server/app/api/oauth/cursor/import/route.js +1 -1
  134. package/app/.next/server/app/api/oauth/gitlab/pat/route.js +1 -1
  135. package/app/.next/server/app/api/oauth/iflow/cookie/route.js +1 -1
  136. package/app/.next/server/app/api/oauth/kiro/auto-import/route.js +1 -1
  137. package/app/.next/server/app/api/oauth/kiro/import/route.js +1 -1
  138. package/app/.next/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  139. package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  140. package/app/.next/server/app/api/pricing/route.js +1 -1
  141. package/app/.next/server/app/api/provider-nodes/[id]/route.js +1 -1
  142. package/app/.next/server/app/api/provider-nodes/route.js +1 -1
  143. package/app/.next/server/app/api/provider-nodes/route.js.nft.json +1 -1
  144. package/app/.next/server/app/api/provider-nodes/validate/route.js +1 -1
  145. package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
  146. package/app/.next/server/app/api/providers/[id]/route.js +1 -1
  147. package/app/.next/server/app/api/providers/[id]/route.js.nft.json +1 -1
  148. package/app/.next/server/app/api/providers/[id]/test/route.js +1 -1
  149. package/app/.next/server/app/api/providers/[id]/test-models/route.js +1 -1
  150. package/app/.next/server/app/api/providers/client/route.js +1 -1
  151. package/app/.next/server/app/api/providers/kilo/free-models/route.js +1 -1
  152. package/app/.next/server/app/api/providers/route.js +1 -1
  153. package/app/.next/server/app/api/providers/suggested-models/route.js +1 -1
  154. package/app/.next/server/app/api/providers/test-batch/route.js +1 -1
  155. package/app/.next/server/app/api/providers/validate/route.js +1 -1
  156. package/app/.next/server/app/api/proxy-pools/[id]/route.js +1 -1
  157. package/app/.next/server/app/api/proxy-pools/[id]/test/route.js +1 -1
  158. package/app/.next/server/app/api/proxy-pools/route.js +1 -1
  159. package/app/.next/server/app/api/proxy-pools/vercel-deploy/route.js +2 -2
  160. package/app/.next/server/app/api/settings/database/route.js +1 -1
  161. package/app/.next/server/app/api/settings/proxy-test/route.js +1 -1
  162. package/app/.next/server/app/api/settings/require-login/route.js +1 -1
  163. package/app/.next/server/app/api/settings/route.js +1 -1
  164. package/app/.next/server/app/api/shutdown/route.js +1 -1
  165. package/app/.next/server/app/api/tags/route.js +1 -1
  166. package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
  167. package/app/.next/server/app/api/translator/console-logs/stream/route.js +2 -2
  168. package/app/.next/server/app/api/translator/load/route.js +1 -1
  169. package/app/.next/server/app/api/translator/save/route.js +1 -1
  170. package/app/.next/server/app/api/translator/send/route.js +1 -1
  171. package/app/.next/server/app/api/translator/translate/route.js +1 -1
  172. package/app/.next/server/app/api/tunnel/disable/route.js +1 -1
  173. package/app/.next/server/app/api/tunnel/enable/route.js +1 -1
  174. package/app/.next/server/app/api/tunnel/status/route.js +1 -1
  175. package/app/.next/server/app/api/tunnel/tailscale-check/route.js +1 -1
  176. package/app/.next/server/app/api/tunnel/tailscale-disable/route.js +1 -1
  177. package/app/.next/server/app/api/tunnel/tailscale-enable/route.js +1 -1
  178. package/app/.next/server/app/api/tunnel/tailscale-install/route.js +3 -3
  179. package/app/.next/server/app/api/tunnel/tailscale-login/route.js +1 -1
  180. package/app/.next/server/app/api/tunnel/tailscale-start-daemon/route.js +2 -2
  181. package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
  182. package/app/.next/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  183. package/app/.next/server/app/api/usage/api-keys/route.js +1 -1
  184. package/app/.next/server/app/api/usage/chart/route.js +1 -1
  185. package/app/.next/server/app/api/usage/history/route.js +1 -1
  186. package/app/.next/server/app/api/usage/logs/route.js +1 -1
  187. package/app/.next/server/app/api/usage/providers/route.js +1 -1
  188. package/app/.next/server/app/api/usage/request-details/route.js +1 -1
  189. package/app/.next/server/app/api/usage/request-logs/route.js +1 -1
  190. package/app/.next/server/app/api/usage/stats/route.js +1 -1
  191. package/app/.next/server/app/api/usage/stream/route.js +2 -2
  192. package/app/.next/server/app/api/users/[id]/route.js +1 -1
  193. package/app/.next/server/app/api/users/route.js +1 -1
  194. package/app/.next/server/app/api/v1/api/chat/route.js +1 -1
  195. package/app/.next/server/app/api/v1/audio/speech/route.js +1 -1
  196. package/app/.next/server/app/api/v1/audio/transcriptions/route.js +1 -1
  197. package/app/.next/server/app/api/v1/audio/voices/route.js +1 -0
  198. package/app/.next/server/app/api/v1/audio/voices/route.js.nft.json +1 -0
  199. package/app/.next/server/app/api/v1/audio/voices/route_client-reference-manifest.js +1 -0
  200. package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
  201. package/app/.next/server/app/api/v1/embeddings/route.js +1 -1
  202. package/app/.next/server/app/api/v1/images/generations/route.js +2 -2
  203. package/app/.next/server/app/api/v1/messages/count_tokens/route.js +1 -1
  204. package/app/.next/server/app/api/v1/messages/route.js +1 -1
  205. package/app/.next/server/app/api/v1/models/[kind]/route.js +1 -1
  206. package/app/.next/server/app/api/v1/models/info/route.js +1 -0
  207. package/app/.next/server/app/api/v1/models/info/route.js.nft.json +1 -0
  208. package/app/.next/server/app/api/v1/models/info/route_client-reference-manifest.js +1 -0
  209. package/app/.next/server/app/api/v1/models/route.js +1 -1
  210. package/app/.next/server/app/api/v1/responses/compact/route.js +1 -1
  211. package/app/.next/server/app/api/v1/responses/route.js +1 -1
  212. package/app/.next/server/app/api/v1/route.js +1 -1
  213. package/app/.next/server/app/api/v1/search/route.js +1 -1
  214. package/app/.next/server/app/api/v1/web/fetch/route.js +1 -1
  215. package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
  216. package/app/.next/server/app/api/v1beta/models/route.js +1 -1
  217. package/app/.next/server/app/api/version/route.js +1 -1
  218. package/app/.next/server/app/api/version/update/route.js +1 -1
  219. package/app/.next/server/app/callback/page.js +2 -2
  220. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  221. package/app/.next/server/app/callback.html +1 -1
  222. package/app/.next/server/app/callback.rsc +4 -4
  223. package/app/.next/server/app/callback.segments/_full.segment.rsc +4 -4
  224. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  225. package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
  226. package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
  227. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  228. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  229. package/app/.next/server/app/dashboard/settings/pricing/page.js +2 -2
  230. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  231. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  232. package/app/.next/server/app/dashboard/settings/pricing.rsc +4 -4
  233. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  234. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  235. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  236. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  237. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  238. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  239. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  240. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  241. package/app/.next/server/app/favicon.ico/route.js +1 -1
  242. package/app/.next/server/app/index.html +1 -1
  243. package/app/.next/server/app/index.rsc +4 -4
  244. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  245. package/app/.next/server/app/index.segments/_full.segment.rsc +4 -4
  246. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  247. package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
  248. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  249. package/app/.next/server/app/landing/page.js +2 -2
  250. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  251. package/app/.next/server/app/landing.html +1 -1
  252. package/app/.next/server/app/landing.rsc +4 -4
  253. package/app/.next/server/app/landing.segments/_full.segment.rsc +4 -4
  254. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  255. package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
  256. package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
  257. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  258. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  259. package/app/.next/server/app/login/page.js +2 -2
  260. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  261. package/app/.next/server/app/login.html +1 -1
  262. package/app/.next/server/app/login.rsc +5 -5
  263. package/app/.next/server/app/login.segments/_full.segment.rsc +5 -5
  264. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  265. package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
  266. package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  267. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  268. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  269. package/app/.next/server/app/manifest.webmanifest/route.js +2 -2
  270. package/app/.next/server/app/page.js +2 -2
  271. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  272. package/app/.next/server/app-paths-manifest.json +6 -3
  273. package/app/.next/server/chunks/2343.js +1 -1
  274. package/app/.next/server/chunks/3855.js +1 -1
  275. package/app/.next/server/chunks/3913.js +1 -1
  276. package/app/.next/server/chunks/412.js +6 -6
  277. package/app/.next/server/chunks/4122.js +1 -1
  278. package/app/.next/server/chunks/4989.js +1 -1
  279. package/app/.next/server/chunks/5627.js +2 -2
  280. package/app/.next/server/chunks/5681.js +1 -1
  281. package/app/.next/server/chunks/6182.js +3 -3
  282. package/app/.next/server/chunks/6774.js +1 -0
  283. package/app/.next/server/chunks/7595.js +1 -1
  284. package/app/.next/server/chunks/7937.js +4 -4
  285. package/app/.next/server/chunks/9489.js +1 -1
  286. package/app/.next/server/chunks/9547.js +23 -0
  287. package/app/.next/server/chunks/9718.js +1 -1
  288. package/app/.next/server/middleware-build-manifest.js +1 -1
  289. package/app/.next/server/middleware.js +1 -1
  290. package/app/.next/server/pages/404.html +1 -1
  291. package/app/.next/server/pages/500.html +1 -1
  292. package/app/.next/server/server-reference-manifest.js +1 -1
  293. package/app/.next/server/server-reference-manifest.json +1 -1
  294. package/app/.next/static/2TCKT7FIN7PE7ZJ20oAeb/_buildManifest.js +1 -0
  295. package/app/.next/static/chunks/1321-b84130cd27e8b78c.js +1 -0
  296. package/app/.next/static/chunks/1a258343-5938f676ed376386.js +1 -0
  297. package/app/.next/static/chunks/2336-5b3617dc05c223ff.js +23 -0
  298. package/app/.next/static/chunks/5497-a2d728c63029180e.js +7 -0
  299. package/app/.next/static/chunks/app/(dashboard)/dashboard/admin/users/page-15091159f6d63fb7.js +1 -0
  300. package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-ba226c8b3c01dd8d.js → page-bd677c182bc2aae9.js} +1 -1
  301. package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/{page-cee4e0a7455b73ca.js → page-32b908ea6b23f583.js} +1 -1
  302. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-eb5193b550d3e8de.js +59 -0
  303. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-7cf63e1a3a8adecd.js +1 -0
  304. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-28a10e3cb86b9581.js → page-82cfc464b5e01f4f.js} +2 -2
  305. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-eefae72167c9579c.js → page-1862080d556d8e9e.js} +1 -1
  306. package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/{page-99260106103e6a4e.js → page-4473f52ad379b661.js} +1 -1
  307. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-0dc79ccb25aab919.js +1 -0
  308. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-a0419a964a084f76.js +1 -0
  309. package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-e03634044afafb6e.js +1 -0
  310. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-d1c369e2c3fb727b.js +1 -0
  311. package/app/.next/static/chunks/app/(dashboard)/dashboard/user/{page-e9ab0043e9b15204.js → page-cb9bce72dd4d0df2.js} +2 -2
  312. package/app/.next/static/chunks/app/(dashboard)/layout-7ea5a7abc543b04d.js +1 -0
  313. package/app/.next/static/chunks/app/_global-error/page-d1c369e2c3fb727b.js +1 -0
  314. package/app/.next/static/chunks/app/api/auth/login/route-d1c369e2c3fb727b.js +1 -0
  315. package/app/.next/static/chunks/app/api/auth/logout/route-d1c369e2c3fb727b.js +1 -0
  316. package/app/.next/static/chunks/app/api/auth/me/route-d1c369e2c3fb727b.js +1 -0
  317. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-d1c369e2c3fb727b.js +1 -0
  318. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-d1c369e2c3fb727b.js +1 -0
  319. package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-d1c369e2c3fb727b.js +1 -0
  320. package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-d1c369e2c3fb727b.js +1 -0
  321. package/app/.next/static/chunks/app/api/cli-tools/copilot-settings/route-d1c369e2c3fb727b.js +1 -0
  322. package/app/.next/static/chunks/app/api/cli-tools/cowork-mcp-registry/route-d1c369e2c3fb727b.js +1 -0
  323. package/app/.next/static/chunks/app/api/cli-tools/cowork-settings/route-d1c369e2c3fb727b.js +1 -0
  324. package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-d1c369e2c3fb727b.js +1 -0
  325. package/app/.next/static/chunks/app/api/cli-tools/hermes-settings/route-d1c369e2c3fb727b.js +1 -0
  326. package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-d1c369e2c3fb727b.js +1 -0
  327. package/app/.next/static/chunks/app/api/cli-tools/opencode-settings/route-d1c369e2c3fb727b.js +1 -0
  328. package/app/.next/static/chunks/app/api/cloud/auth/route-d1c369e2c3fb727b.js +1 -0
  329. package/app/.next/static/chunks/app/api/cloud/credentials/update/route-d1c369e2c3fb727b.js +1 -0
  330. package/app/.next/static/chunks/app/api/cloud/model/resolve/route-d1c369e2c3fb727b.js +1 -0
  331. package/app/.next/static/chunks/app/api/cloud/models/alias/route-d1c369e2c3fb727b.js +1 -0
  332. package/app/.next/static/chunks/app/api/combos/[id]/route-d1c369e2c3fb727b.js +1 -0
  333. package/app/.next/static/chunks/app/api/combos/route-d1c369e2c3fb727b.js +1 -0
  334. package/app/.next/static/chunks/app/api/health/route-d1c369e2c3fb727b.js +1 -0
  335. package/app/.next/static/chunks/app/api/init/route-d1c369e2c3fb727b.js +1 -0
  336. package/app/.next/static/chunks/app/api/keys/[id]/route-d1c369e2c3fb727b.js +1 -0
  337. package/app/.next/static/chunks/app/api/keys/route-d1c369e2c3fb727b.js +1 -0
  338. package/app/.next/static/chunks/app/api/locale/route-d1c369e2c3fb727b.js +1 -0
  339. package/app/.next/static/chunks/app/api/media-providers/tts/deepgram/voices/route-d1c369e2c3fb727b.js +1 -0
  340. package/app/.next/static/chunks/app/api/media-providers/tts/elevenlabs/voices/route-d1c369e2c3fb727b.js +1 -0
  341. package/app/.next/static/chunks/app/api/media-providers/tts/inworld/voices/route-d1c369e2c3fb727b.js +1 -0
  342. package/app/.next/static/chunks/app/api/media-providers/tts/voices/route-d1c369e2c3fb727b.js +1 -0
  343. package/app/.next/static/chunks/app/api/models/alias/route-d1c369e2c3fb727b.js +1 -0
  344. package/app/.next/static/chunks/app/api/models/availability/route-d1c369e2c3fb727b.js +1 -0
  345. package/app/.next/static/chunks/app/api/models/custom/route-d1c369e2c3fb727b.js +1 -0
  346. package/app/.next/static/chunks/app/api/models/disabled/route-d1c369e2c3fb727b.js +1 -0
  347. package/app/.next/static/chunks/app/api/models/route-d1c369e2c3fb727b.js +1 -0
  348. package/app/.next/static/chunks/app/api/models/test/route-d1c369e2c3fb727b.js +1 -0
  349. package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-d1c369e2c3fb727b.js +1 -0
  350. package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-d1c369e2c3fb727b.js +1 -0
  351. package/app/.next/static/chunks/app/api/oauth/cursor/import/route-d1c369e2c3fb727b.js +1 -0
  352. package/app/.next/static/chunks/app/api/oauth/gitlab/pat/route-d1c369e2c3fb727b.js +1 -0
  353. package/app/.next/static/chunks/app/api/oauth/iflow/cookie/route-d1c369e2c3fb727b.js +1 -0
  354. package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-d1c369e2c3fb727b.js +1 -0
  355. package/app/.next/static/chunks/app/api/oauth/kiro/import/route-d1c369e2c3fb727b.js +1 -0
  356. package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-d1c369e2c3fb727b.js +1 -0
  357. package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-d1c369e2c3fb727b.js +1 -0
  358. package/app/.next/static/chunks/app/api/pricing/route-d1c369e2c3fb727b.js +1 -0
  359. package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-d1c369e2c3fb727b.js +1 -0
  360. package/app/.next/static/chunks/app/api/provider-nodes/route-d1c369e2c3fb727b.js +1 -0
  361. package/app/.next/static/chunks/app/api/provider-nodes/validate/route-d1c369e2c3fb727b.js +1 -0
  362. package/app/.next/static/chunks/app/api/providers/[id]/models/route-d1c369e2c3fb727b.js +1 -0
  363. package/app/.next/static/chunks/app/api/providers/[id]/route-d1c369e2c3fb727b.js +1 -0
  364. package/app/.next/static/chunks/app/api/providers/[id]/test/route-d1c369e2c3fb727b.js +1 -0
  365. package/app/.next/static/chunks/app/api/providers/[id]/test-models/route-d1c369e2c3fb727b.js +1 -0
  366. package/app/.next/static/chunks/app/api/providers/client/route-d1c369e2c3fb727b.js +1 -0
  367. package/app/.next/static/chunks/app/api/providers/kilo/free-models/route-d1c369e2c3fb727b.js +1 -0
  368. package/app/.next/static/chunks/app/api/providers/route-d1c369e2c3fb727b.js +1 -0
  369. package/app/.next/static/chunks/app/api/providers/suggested-models/route-d1c369e2c3fb727b.js +1 -0
  370. package/app/.next/static/chunks/app/api/providers/test-batch/route-d1c369e2c3fb727b.js +1 -0
  371. package/app/.next/static/chunks/app/api/providers/validate/route-d1c369e2c3fb727b.js +1 -0
  372. package/app/.next/static/chunks/app/api/proxy-pools/[id]/route-d1c369e2c3fb727b.js +1 -0
  373. package/app/.next/static/chunks/app/api/proxy-pools/[id]/test/route-d1c369e2c3fb727b.js +1 -0
  374. package/app/.next/static/chunks/app/api/proxy-pools/route-d1c369e2c3fb727b.js +1 -0
  375. package/app/.next/static/chunks/app/api/proxy-pools/vercel-deploy/route-d1c369e2c3fb727b.js +1 -0
  376. package/app/.next/static/chunks/app/api/settings/database/route-d1c369e2c3fb727b.js +1 -0
  377. package/app/.next/static/chunks/app/api/settings/proxy-test/route-d1c369e2c3fb727b.js +1 -0
  378. package/app/.next/static/chunks/app/api/settings/require-login/route-d1c369e2c3fb727b.js +1 -0
  379. package/app/.next/static/chunks/app/api/settings/route-d1c369e2c3fb727b.js +1 -0
  380. package/app/.next/static/chunks/app/api/shutdown/route-d1c369e2c3fb727b.js +1 -0
  381. package/app/.next/static/chunks/app/api/tags/route-d1c369e2c3fb727b.js +1 -0
  382. package/app/.next/static/chunks/app/api/translator/console-logs/route-d1c369e2c3fb727b.js +1 -0
  383. package/app/.next/static/chunks/app/api/translator/console-logs/stream/route-d1c369e2c3fb727b.js +1 -0
  384. package/app/.next/static/chunks/app/api/translator/load/route-d1c369e2c3fb727b.js +1 -0
  385. package/app/.next/static/chunks/app/api/translator/save/route-d1c369e2c3fb727b.js +1 -0
  386. package/app/.next/static/chunks/app/api/translator/send/route-d1c369e2c3fb727b.js +1 -0
  387. package/app/.next/static/chunks/app/api/translator/translate/route-d1c369e2c3fb727b.js +1 -0
  388. package/app/.next/static/chunks/app/api/tunnel/disable/route-d1c369e2c3fb727b.js +1 -0
  389. package/app/.next/static/chunks/app/api/tunnel/enable/route-d1c369e2c3fb727b.js +1 -0
  390. package/app/.next/static/chunks/app/api/tunnel/status/route-d1c369e2c3fb727b.js +1 -0
  391. package/app/.next/static/chunks/app/api/tunnel/tailscale-check/route-d1c369e2c3fb727b.js +1 -0
  392. package/app/.next/static/chunks/app/api/tunnel/tailscale-disable/route-d1c369e2c3fb727b.js +1 -0
  393. package/app/.next/static/chunks/app/api/tunnel/tailscale-enable/route-d1c369e2c3fb727b.js +1 -0
  394. package/app/.next/static/chunks/app/api/tunnel/tailscale-install/route-d1c369e2c3fb727b.js +1 -0
  395. package/app/.next/static/chunks/app/api/tunnel/tailscale-login/route-d1c369e2c3fb727b.js +1 -0
  396. package/app/.next/static/chunks/app/api/tunnel/tailscale-start-daemon/route-d1c369e2c3fb727b.js +1 -0
  397. package/app/.next/static/chunks/app/api/usage/[connectionId]/route-d1c369e2c3fb727b.js +1 -0
  398. package/app/.next/static/chunks/app/api/usage/api-keys/route-d1c369e2c3fb727b.js +1 -0
  399. package/app/.next/static/chunks/app/api/usage/chart/route-d1c369e2c3fb727b.js +1 -0
  400. package/app/.next/static/chunks/app/api/usage/history/route-d1c369e2c3fb727b.js +1 -0
  401. package/app/.next/static/chunks/app/api/usage/logs/route-d1c369e2c3fb727b.js +1 -0
  402. package/app/.next/static/chunks/app/api/usage/providers/route-d1c369e2c3fb727b.js +1 -0
  403. package/app/.next/static/chunks/app/api/usage/request-details/route-d1c369e2c3fb727b.js +1 -0
  404. package/app/.next/static/chunks/app/api/usage/request-logs/route-d1c369e2c3fb727b.js +1 -0
  405. package/app/.next/static/chunks/app/api/usage/stats/route-d1c369e2c3fb727b.js +1 -0
  406. package/app/.next/static/chunks/app/api/usage/stream/route-d1c369e2c3fb727b.js +1 -0
  407. package/app/.next/static/chunks/app/api/users/[id]/route-d1c369e2c3fb727b.js +1 -0
  408. package/app/.next/static/chunks/app/api/users/route-d1c369e2c3fb727b.js +1 -0
  409. package/app/.next/static/chunks/app/api/v1/api/chat/route-d1c369e2c3fb727b.js +1 -0
  410. package/app/.next/static/chunks/app/api/v1/audio/speech/route-d1c369e2c3fb727b.js +1 -0
  411. package/app/.next/static/chunks/app/api/v1/audio/transcriptions/route-d1c369e2c3fb727b.js +1 -0
  412. package/app/.next/static/chunks/app/api/v1/audio/voices/route-d1c369e2c3fb727b.js +1 -0
  413. package/app/.next/static/chunks/app/api/v1/chat/completions/route-d1c369e2c3fb727b.js +1 -0
  414. package/app/.next/static/chunks/app/api/v1/embeddings/route-d1c369e2c3fb727b.js +1 -0
  415. package/app/.next/static/chunks/app/api/v1/images/generations/route-d1c369e2c3fb727b.js +1 -0
  416. package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-d1c369e2c3fb727b.js +1 -0
  417. package/app/.next/static/chunks/app/api/v1/messages/route-d1c369e2c3fb727b.js +1 -0
  418. package/app/.next/static/chunks/app/api/v1/models/[kind]/route-d1c369e2c3fb727b.js +1 -0
  419. package/app/.next/static/chunks/app/api/v1/models/info/route-d1c369e2c3fb727b.js +1 -0
  420. package/app/.next/static/chunks/app/api/v1/models/route-d1c369e2c3fb727b.js +1 -0
  421. package/app/.next/static/chunks/app/api/v1/responses/compact/route-d1c369e2c3fb727b.js +1 -0
  422. package/app/.next/static/chunks/app/api/v1/responses/route-d1c369e2c3fb727b.js +1 -0
  423. package/app/.next/static/chunks/app/api/v1/route-d1c369e2c3fb727b.js +1 -0
  424. package/app/.next/static/chunks/app/api/v1/search/route-d1c369e2c3fb727b.js +1 -0
  425. package/app/.next/static/chunks/app/api/v1/web/fetch/route-d1c369e2c3fb727b.js +1 -0
  426. package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-d1c369e2c3fb727b.js +1 -0
  427. package/app/.next/static/chunks/app/api/v1beta/models/route-d1c369e2c3fb727b.js +1 -0
  428. package/app/.next/static/chunks/app/api/version/route-d1c369e2c3fb727b.js +1 -0
  429. package/app/.next/static/chunks/app/api/version/update/route-d1c369e2c3fb727b.js +1 -0
  430. package/app/.next/static/chunks/app/manifest.webmanifest/route-d1c369e2c3fb727b.js +1 -0
  431. package/app/.next/static/chunks/app/page-d1c369e2c3fb727b.js +1 -0
  432. package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-d1c369e2c3fb727b.js +1 -0
  433. package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-d1c369e2c3fb727b.js +1 -0
  434. package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-d1c369e2c3fb727b.js +1 -0
  435. package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-d1c369e2c3fb727b.js +1 -0
  436. package/app/.next/static/css/48caf49054c81db9.css +1 -0
  437. package/app/package.json +1 -1
  438. package/app/src/lib/updater/updater.js +6 -2
  439. package/app/src/mitm/dns/dnsConfig.js +1 -1
  440. package/app/src/mitm/handlers/kiro.js +385 -6
  441. package/app/src/mitm/manager.js +12 -3
  442. package/app/src/mitm/paths.js +7 -3
  443. package/cli.js +4 -3
  444. package/package.json +1 -1
  445. package/app/.next/server/chunks/1256.js +0 -1
  446. package/app/.next/server/chunks/2238.js +0 -23
  447. package/app/.next/static/NtU3O4mCJYjlmlBWGF7gX/_buildManifest.js +0 -1
  448. package/app/.next/static/chunks/1321-7e9aeddc67afb663.js +0 -1
  449. package/app/.next/static/chunks/1a258343-4878413fb430abba.js +0 -1
  450. package/app/.next/static/chunks/4295-fbaece639df900b6.js +0 -23
  451. package/app/.next/static/chunks/5497-54ae9c6ec04c2fb1.js +0 -7
  452. package/app/.next/static/chunks/app/(dashboard)/dashboard/admin/users/page-c8e5a4b31bc18425.js +0 -1
  453. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-e8660483a85aed9d.js +0 -59
  454. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-9ff3dee6ea964428.js +0 -1
  455. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-08a8f17b396ac1f4.js +0 -1
  456. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-7dac10f6360f52df.js +0 -1
  457. package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/page-52fbe722ba5c5393.js +0 -1
  458. package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-badb7034e478a358.js +0 -1
  459. package/app/.next/static/chunks/app/(dashboard)/layout-d368218e0e87c124.js +0 -1
  460. package/app/.next/static/chunks/app/_global-error/page-badb7034e478a358.js +0 -1
  461. package/app/.next/static/chunks/app/api/auth/login/route-badb7034e478a358.js +0 -1
  462. package/app/.next/static/chunks/app/api/auth/logout/route-badb7034e478a358.js +0 -1
  463. package/app/.next/static/chunks/app/api/auth/me/route-badb7034e478a358.js +0 -1
  464. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-badb7034e478a358.js +0 -1
  465. package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-badb7034e478a358.js +0 -1
  466. package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-badb7034e478a358.js +0 -1
  467. package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-badb7034e478a358.js +0 -1
  468. package/app/.next/static/chunks/app/api/cli-tools/copilot-settings/route-badb7034e478a358.js +0 -1
  469. package/app/.next/static/chunks/app/api/cli-tools/cowork-settings/route-badb7034e478a358.js +0 -1
  470. package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-badb7034e478a358.js +0 -1
  471. package/app/.next/static/chunks/app/api/cli-tools/hermes-settings/route-badb7034e478a358.js +0 -1
  472. package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-badb7034e478a358.js +0 -1
  473. package/app/.next/static/chunks/app/api/cli-tools/opencode-settings/route-badb7034e478a358.js +0 -1
  474. package/app/.next/static/chunks/app/api/cloud/auth/route-badb7034e478a358.js +0 -1
  475. package/app/.next/static/chunks/app/api/cloud/credentials/update/route-badb7034e478a358.js +0 -1
  476. package/app/.next/static/chunks/app/api/cloud/model/resolve/route-badb7034e478a358.js +0 -1
  477. package/app/.next/static/chunks/app/api/cloud/models/alias/route-badb7034e478a358.js +0 -1
  478. package/app/.next/static/chunks/app/api/combos/[id]/route-badb7034e478a358.js +0 -1
  479. package/app/.next/static/chunks/app/api/combos/route-badb7034e478a358.js +0 -1
  480. package/app/.next/static/chunks/app/api/health/route-badb7034e478a358.js +0 -1
  481. package/app/.next/static/chunks/app/api/init/route-badb7034e478a358.js +0 -1
  482. package/app/.next/static/chunks/app/api/keys/[id]/route-badb7034e478a358.js +0 -1
  483. package/app/.next/static/chunks/app/api/keys/route-badb7034e478a358.js +0 -1
  484. package/app/.next/static/chunks/app/api/locale/route-badb7034e478a358.js +0 -1
  485. package/app/.next/static/chunks/app/api/media-providers/tts/deepgram/voices/route-badb7034e478a358.js +0 -1
  486. package/app/.next/static/chunks/app/api/media-providers/tts/elevenlabs/voices/route-badb7034e478a358.js +0 -1
  487. package/app/.next/static/chunks/app/api/media-providers/tts/inworld/voices/route-badb7034e478a358.js +0 -1
  488. package/app/.next/static/chunks/app/api/media-providers/tts/voices/route-badb7034e478a358.js +0 -1
  489. package/app/.next/static/chunks/app/api/models/alias/route-badb7034e478a358.js +0 -1
  490. package/app/.next/static/chunks/app/api/models/availability/route-badb7034e478a358.js +0 -1
  491. package/app/.next/static/chunks/app/api/models/custom/route-badb7034e478a358.js +0 -1
  492. package/app/.next/static/chunks/app/api/models/disabled/route-badb7034e478a358.js +0 -1
  493. package/app/.next/static/chunks/app/api/models/route-badb7034e478a358.js +0 -1
  494. package/app/.next/static/chunks/app/api/models/test/route-badb7034e478a358.js +0 -1
  495. package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-badb7034e478a358.js +0 -1
  496. package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-badb7034e478a358.js +0 -1
  497. package/app/.next/static/chunks/app/api/oauth/cursor/import/route-badb7034e478a358.js +0 -1
  498. package/app/.next/static/chunks/app/api/oauth/gitlab/pat/route-badb7034e478a358.js +0 -1
  499. package/app/.next/static/chunks/app/api/oauth/iflow/cookie/route-badb7034e478a358.js +0 -1
  500. package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-badb7034e478a358.js +0 -1
  501. package/app/.next/static/chunks/app/api/oauth/kiro/import/route-badb7034e478a358.js +0 -1
  502. package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-badb7034e478a358.js +0 -1
  503. package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-badb7034e478a358.js +0 -1
  504. package/app/.next/static/chunks/app/api/pricing/route-badb7034e478a358.js +0 -1
  505. package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-badb7034e478a358.js +0 -1
  506. package/app/.next/static/chunks/app/api/provider-nodes/route-badb7034e478a358.js +0 -1
  507. package/app/.next/static/chunks/app/api/provider-nodes/validate/route-badb7034e478a358.js +0 -1
  508. package/app/.next/static/chunks/app/api/providers/[id]/models/route-badb7034e478a358.js +0 -1
  509. package/app/.next/static/chunks/app/api/providers/[id]/route-badb7034e478a358.js +0 -1
  510. package/app/.next/static/chunks/app/api/providers/[id]/test/route-badb7034e478a358.js +0 -1
  511. package/app/.next/static/chunks/app/api/providers/[id]/test-models/route-badb7034e478a358.js +0 -1
  512. package/app/.next/static/chunks/app/api/providers/client/route-badb7034e478a358.js +0 -1
  513. package/app/.next/static/chunks/app/api/providers/kilo/free-models/route-badb7034e478a358.js +0 -1
  514. package/app/.next/static/chunks/app/api/providers/route-badb7034e478a358.js +0 -1
  515. package/app/.next/static/chunks/app/api/providers/suggested-models/route-badb7034e478a358.js +0 -1
  516. package/app/.next/static/chunks/app/api/providers/test-batch/route-badb7034e478a358.js +0 -1
  517. package/app/.next/static/chunks/app/api/providers/validate/route-badb7034e478a358.js +0 -1
  518. package/app/.next/static/chunks/app/api/proxy-pools/[id]/route-badb7034e478a358.js +0 -1
  519. package/app/.next/static/chunks/app/api/proxy-pools/[id]/test/route-badb7034e478a358.js +0 -1
  520. package/app/.next/static/chunks/app/api/proxy-pools/route-badb7034e478a358.js +0 -1
  521. package/app/.next/static/chunks/app/api/proxy-pools/vercel-deploy/route-badb7034e478a358.js +0 -1
  522. package/app/.next/static/chunks/app/api/settings/database/route-badb7034e478a358.js +0 -1
  523. package/app/.next/static/chunks/app/api/settings/proxy-test/route-badb7034e478a358.js +0 -1
  524. package/app/.next/static/chunks/app/api/settings/require-login/route-badb7034e478a358.js +0 -1
  525. package/app/.next/static/chunks/app/api/settings/route-badb7034e478a358.js +0 -1
  526. package/app/.next/static/chunks/app/api/shutdown/route-badb7034e478a358.js +0 -1
  527. package/app/.next/static/chunks/app/api/tags/route-badb7034e478a358.js +0 -1
  528. package/app/.next/static/chunks/app/api/translator/console-logs/route-badb7034e478a358.js +0 -1
  529. package/app/.next/static/chunks/app/api/translator/console-logs/stream/route-badb7034e478a358.js +0 -1
  530. package/app/.next/static/chunks/app/api/translator/load/route-badb7034e478a358.js +0 -1
  531. package/app/.next/static/chunks/app/api/translator/save/route-badb7034e478a358.js +0 -1
  532. package/app/.next/static/chunks/app/api/translator/send/route-badb7034e478a358.js +0 -1
  533. package/app/.next/static/chunks/app/api/translator/translate/route-badb7034e478a358.js +0 -1
  534. package/app/.next/static/chunks/app/api/tunnel/disable/route-badb7034e478a358.js +0 -1
  535. package/app/.next/static/chunks/app/api/tunnel/enable/route-badb7034e478a358.js +0 -1
  536. package/app/.next/static/chunks/app/api/tunnel/status/route-badb7034e478a358.js +0 -1
  537. package/app/.next/static/chunks/app/api/tunnel/tailscale-check/route-badb7034e478a358.js +0 -1
  538. package/app/.next/static/chunks/app/api/tunnel/tailscale-disable/route-badb7034e478a358.js +0 -1
  539. package/app/.next/static/chunks/app/api/tunnel/tailscale-enable/route-badb7034e478a358.js +0 -1
  540. package/app/.next/static/chunks/app/api/tunnel/tailscale-install/route-badb7034e478a358.js +0 -1
  541. package/app/.next/static/chunks/app/api/tunnel/tailscale-login/route-badb7034e478a358.js +0 -1
  542. package/app/.next/static/chunks/app/api/tunnel/tailscale-start-daemon/route-badb7034e478a358.js +0 -1
  543. package/app/.next/static/chunks/app/api/usage/[connectionId]/route-badb7034e478a358.js +0 -1
  544. package/app/.next/static/chunks/app/api/usage/api-keys/route-badb7034e478a358.js +0 -1
  545. package/app/.next/static/chunks/app/api/usage/chart/route-badb7034e478a358.js +0 -1
  546. package/app/.next/static/chunks/app/api/usage/history/route-badb7034e478a358.js +0 -1
  547. package/app/.next/static/chunks/app/api/usage/logs/route-badb7034e478a358.js +0 -1
  548. package/app/.next/static/chunks/app/api/usage/providers/route-badb7034e478a358.js +0 -1
  549. package/app/.next/static/chunks/app/api/usage/request-details/route-badb7034e478a358.js +0 -1
  550. package/app/.next/static/chunks/app/api/usage/request-logs/route-badb7034e478a358.js +0 -1
  551. package/app/.next/static/chunks/app/api/usage/stats/route-badb7034e478a358.js +0 -1
  552. package/app/.next/static/chunks/app/api/usage/stream/route-badb7034e478a358.js +0 -1
  553. package/app/.next/static/chunks/app/api/users/[id]/route-badb7034e478a358.js +0 -1
  554. package/app/.next/static/chunks/app/api/users/route-badb7034e478a358.js +0 -1
  555. package/app/.next/static/chunks/app/api/v1/api/chat/route-badb7034e478a358.js +0 -1
  556. package/app/.next/static/chunks/app/api/v1/audio/speech/route-badb7034e478a358.js +0 -1
  557. package/app/.next/static/chunks/app/api/v1/audio/transcriptions/route-badb7034e478a358.js +0 -1
  558. package/app/.next/static/chunks/app/api/v1/chat/completions/route-badb7034e478a358.js +0 -1
  559. package/app/.next/static/chunks/app/api/v1/embeddings/route-badb7034e478a358.js +0 -1
  560. package/app/.next/static/chunks/app/api/v1/images/generations/route-badb7034e478a358.js +0 -1
  561. package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-badb7034e478a358.js +0 -1
  562. package/app/.next/static/chunks/app/api/v1/messages/route-badb7034e478a358.js +0 -1
  563. package/app/.next/static/chunks/app/api/v1/models/[kind]/route-badb7034e478a358.js +0 -1
  564. package/app/.next/static/chunks/app/api/v1/models/route-badb7034e478a358.js +0 -1
  565. package/app/.next/static/chunks/app/api/v1/responses/compact/route-badb7034e478a358.js +0 -1
  566. package/app/.next/static/chunks/app/api/v1/responses/route-badb7034e478a358.js +0 -1
  567. package/app/.next/static/chunks/app/api/v1/route-badb7034e478a358.js +0 -1
  568. package/app/.next/static/chunks/app/api/v1/search/route-badb7034e478a358.js +0 -1
  569. package/app/.next/static/chunks/app/api/v1/web/fetch/route-badb7034e478a358.js +0 -1
  570. package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-badb7034e478a358.js +0 -1
  571. package/app/.next/static/chunks/app/api/v1beta/models/route-badb7034e478a358.js +0 -1
  572. package/app/.next/static/chunks/app/api/version/route-badb7034e478a358.js +0 -1
  573. package/app/.next/static/chunks/app/api/version/update/route-badb7034e478a358.js +0 -1
  574. package/app/.next/static/chunks/app/manifest.webmanifest/route-badb7034e478a358.js +0 -1
  575. package/app/.next/static/chunks/app/page-badb7034e478a358.js +0 -1
  576. package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-badb7034e478a358.js +0 -1
  577. package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-badb7034e478a358.js +0 -1
  578. package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-badb7034e478a358.js +0 -1
  579. package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-badb7034e478a358.js +0 -1
  580. package/app/.next/static/css/326fa3d6432d4810.css +0 -1
  581. /package/app/.next/static/{NtU3O4mCJYjlmlBWGF7gX → 2TCKT7FIN7PE7ZJ20oAeb}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{47295:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>i});var a=s(95155),l=s(12115),o=s(35497),r=s(11059);s(52679);let n=/^[a-zA-Z0-9_.\-]+$/;function i(){let[e,t]=(0,l.useState)([]),[s,n]=(0,l.useState)(!0),[i,d]=(0,l.useState)(!1),[x,h]=(0,l.useState)(null),[p,u]=(0,l.useState)([]),[b,f]=(0,l.useState)({}),{copied:g,copy:j}=(0,r.C)();(0,l.useEffect)(()=>{fetch("/api/auth/me").then(e=>e.json()).then(e=>{"sub_user"===e.role&&(window.location.href="/dashboard/usage")}).catch(()=>{}),y()},[]);let y=async()=>{try{let[e,s,a]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/settings")]),l=await e.json(),o=await s.json(),r=a.ok?await a.json():{};e.ok&&t((l.combos||[]).filter(e=>!e.kind)),s.ok&&u(o.connections||[]),f(r.comboStrategies||{})}catch(e){console.log("Error fetching data:",e)}finally{n(!1)}},w=async e=>{try{let t=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)await y(),d(!1);else{let e=await t.json();alert(e.error||"Failed to create combo")}}catch(e){console.log("Error creating combo:",e)}},v=async(e,t)=>{try{let s=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.ok)await y(),h(null);else{let e=await s.json();alert(e.error||"Failed to update combo")}}catch(e){console.log("Error updating combo:",e)}},N=async s=>{if(confirm("Delete this combo?"))try{(await fetch(`/api/combos/${s}`,{method:"DELETE"})).ok&&t(e.filter(e=>e.id!==s))}catch(e){console.log("Error deleting combo:",e)}},k=async(e,t)=>{try{let s={...b};t?s[e]={fallbackStrategy:"round-robin"}:delete s[e],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:s})}),f(s)}catch(e){console.log("Error updating combo strategy:",e)}};return s?(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(o.Qv,{}),(0,a.jsx)(o.Qv,{})]}):(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold",children:"Combos"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Create model combos with fallback support"})]}),(0,a.jsx)(o.$n,{icon:"add",onClick:()=>d(!0),className:"w-full sm:w-auto",children:"Create Combo"})]}),0===e.length?(0,a.jsx)(o.Zp,{children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"layers"})}),(0,a.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No combos yet"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create model combos with fallback support"}),(0,a.jsx)(o.$n,{icon:"add",onClick:()=>d(!0),className:"w-full sm:w-auto",children:"Create Combo"})]})}):(0,a.jsx)("div",{className:"flex flex-col gap-4",children:e.map(e=>(0,a.jsx)(c,{combo:e,copied:g,onCopy:j,onEdit:()=>h(e),onDelete:()=>N(e.id),roundRobinEnabled:b[e.name]?.fallbackStrategy==="round-robin",onToggleRoundRobin:t=>k(e.name,t)},e.id))}),(0,a.jsx)(m,{isOpen:i,onClose:()=>d(!1),onSave:w,activeProviders:p},"create"),(0,a.jsx)(m,{isOpen:!!x,combo:x,onClose:()=>h(null),onSave:e=>v(x.id,e),activeProviders:p},x?.id||"new")]})}function c({combo:e,copied:t,onCopy:s,onEdit:l,onDelete:r,roundRobinEnabled:n,onToggleRoundRobin:i}){return(0,a.jsx)(o.Zp,{padding:"sm",className:"group",children:(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("code",{className:"block truncate font-mono text-sm font-medium",children:e.name}),(0,a.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1",children:[0===e.models.length?(0,a.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models"}):e.models.slice(0,3).map((e,t)=>(0,a.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1.5 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[220px]",children:e},t)),e.models.length>3&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["+",e.models.length-3," more"]})]})]})]}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3 sm:shrink-0",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-1.5 rounded-lg bg-black/[0.02] px-2 py-1.5 dark:bg-white/[0.02] sm:justify-start sm:bg-transparent sm:px-0 sm:py-0 sm:dark:bg-transparent",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(o.lM,{size:"sm",checked:n,onChange:i})]}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-1 sm:flex",children:[(0,a.jsxs)("button",{onClick:t=>{t.stopPropagation(),s(e.name,`combo-${e.id}`)},className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Copy combo name",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:t===`combo-${e.id}`?"check":"content_copy"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Copy"})]}),(0,a.jsxs)("button",{onClick:l,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Edit",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,a.jsxs)("button",{onClick:r,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 transition-colors hover:bg-red-500/10",title:"Delete",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]})]})]})})}function d({index:e,model:t,isFirst:s,isLast:o,onEdit:r,onMoveUp:n,onMoveDown:i,onRemove:c}){let[m,x]=(0,l.useState)(!1),[h,p]=(0,l.useState)(t),u=()=>{let e=h.trim();e&&e!==t?r(e):p(t),x(!1)};return(0,a.jsxs)("div",{className:"group flex min-w-0 items-center gap-1.5 rounded-md bg-black/[0.02] px-2 py-1 transition-colors hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04]",children:[(0,a.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:e+1}),m?(0,a.jsx)("input",{autoFocus:!0,value:h,onChange:e=>p(e.target.value),onBlur:u,onKeyDown:e=>{"Enter"===e.key&&u(),"Escape"===e.key&&(p(t),x(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,a.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>x(!0),title:"Click to edit",children:t}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,a.jsx)("button",{onClick:n,disabled:s,className:`p-0.5 rounded ${s?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,a.jsx)("button",{onClick:i,disabled:o,className:`p-0.5 rounded ${o?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,a.jsx)("button",{onClick:c,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function m({isOpen:e,combo:t,onClose:s,onSave:r,activeProviders:i,kindFilter:c=null}){let[x,h]=(0,l.useState)(t?.name||""),[p,u]=(0,l.useState)(t?.models||[]),[b,f]=(0,l.useState)(!1),[g,j]=(0,l.useState)(!1),[y,w]=(0,l.useState)(""),[v,N]=(0,l.useState)({}),k=async()=>{try{let e=await fetch("/api/models/alias");if(!e.ok)return;let t=await e.json();N(t.aliases||{})}catch(e){console.error("Error fetching modal data:",e)}};(0,l.useEffect)(()=>{e&&k()},[e]);let C=e=>e.trim()?n.test(e)?(w(""),!0):(w("Only letters, numbers, -, _ and . allowed"),!1):(w("Name is required"),!1),S=async()=>{C(x)&&(j(!0),await r({name:x.trim(),models:p}),j(!1))},E=!!t;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.aF,{isOpen:e,onClose:s,title:E?"Edit Combo":"Create Combo",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.pd,{label:"Combo Name",value:x,onChange:e=>{let t=e.target.value;h(t),t?C(t):w("")},placeholder:"my-combo",error:y}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and . allowed"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===p.length?(0,a.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,a.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:p.map((e,t)=>(0,a.jsx)(d,{index:t,model:e,isFirst:0===t,isLast:t===p.length-1,onEdit:e=>{let s=[...p];s[t]=e,u(s)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...p];[t[e-1],t[e]]=[t[e],t[e-1]],u(t)})(t),onMoveDown:()=>(e=>{if(e===p.length-1)return;let t=[...p];[t[e],t[e+1]]=[t[e+1],t[e]],u(t)})(t),onRemove:()=>{u(p.filter((e,s)=>s!==t))}},t))}),(0,a.jsxs)("button",{onClick:()=>f(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,a.jsx)(o.$n,{onClick:s,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(o.$n,{onClick:S,fullWidth:!0,size:"sm",disabled:!x.trim()||!!y||g,children:g?"Saving...":E?"Save":"Create"})]})]})}),(0,a.jsx)(o.rq,{isOpen:b,onClose:()=>f(!1),onSelect:e=>{p.includes(e.value)||u([...p,e.value])},activeProviders:i,modelAliases:v,title:"Add Model to Combo",kindFilter:c})]})}},78036:(e,t,s)=>{Promise.resolve().then(s.bind(s,47295))}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=78036)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{47295:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>i});var a=s(95155),l=s(12115),o=s(35497),r=s(11059);s(52679);let n=/^[a-zA-Z0-9_.\-]+$/;function i(){let[e,t]=(0,l.useState)([]),[s,n]=(0,l.useState)(!0),[i,d]=(0,l.useState)(!1),[x,h]=(0,l.useState)(null),[p,u]=(0,l.useState)([]),[b,f]=(0,l.useState)({}),{copied:g,copy:j}=(0,r.C)();(0,l.useEffect)(()=>{fetch("/api/auth/me").then(e=>e.json()).then(e=>{"sub_user"===e.role&&(window.location.href="/dashboard/usage")}).catch(()=>{}),y()},[]);let y=async()=>{try{let[e,s,a]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/settings")]),l=await e.json(),o=await s.json(),r=a.ok?await a.json():{};e.ok&&t((l.combos||[]).filter(e=>!e.kind)),s.ok&&u(o.connections||[]),f(r.comboStrategies||{})}catch(e){console.log("Error fetching data:",e)}finally{n(!1)}},w=async e=>{try{let t=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)await y(),d(!1);else{let e=await t.json();alert(e.error||"Failed to create combo")}}catch(e){console.log("Error creating combo:",e)}},v=async(e,t)=>{try{let s=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.ok)await y(),h(null);else{let e=await s.json();alert(e.error||"Failed to update combo")}}catch(e){console.log("Error updating combo:",e)}},N=async s=>{if(confirm("Delete this combo?"))try{(await fetch(`/api/combos/${s}`,{method:"DELETE"})).ok&&t(e.filter(e=>e.id!==s))}catch(e){console.log("Error deleting combo:",e)}},k=async(e,t)=>{try{let s={...b};t?s[e]={fallbackStrategy:"round-robin"}:delete s[e],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:s})}),f(s)}catch(e){console.log("Error updating combo strategy:",e)}};return s?(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(o.Qv,{}),(0,a.jsx)(o.Qv,{})]}):(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold",children:"Combos"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Create model combos with fallback support"})]}),(0,a.jsx)(o.$n,{icon:"add",onClick:()=>d(!0),className:"w-full sm:w-auto",children:"Create Combo"})]}),0===e.length?(0,a.jsx)(o.Zp,{children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"layers"})}),(0,a.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No combos yet"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create model combos with fallback support"}),(0,a.jsx)(o.$n,{icon:"add",onClick:()=>d(!0),className:"w-full sm:w-auto",children:"Create Combo"})]})}):(0,a.jsx)("div",{className:"flex flex-col gap-4",children:e.map(e=>(0,a.jsx)(c,{combo:e,copied:g,onCopy:j,onEdit:()=>h(e),onDelete:()=>N(e.id),roundRobinEnabled:b[e.name]?.fallbackStrategy==="round-robin",onToggleRoundRobin:t=>k(e.name,t)},e.id))}),(0,a.jsx)(m,{isOpen:i,onClose:()=>d(!1),onSave:w,activeProviders:p},"create"),(0,a.jsx)(m,{isOpen:!!x,combo:x,onClose:()=>h(null),onSave:e=>v(x.id,e),activeProviders:p},x?.id||"new")]})}function c({combo:e,copied:t,onCopy:s,onEdit:l,onDelete:r,roundRobinEnabled:n,onToggleRoundRobin:i}){return(0,a.jsx)(o.Zp,{padding:"sm",className:"group",children:(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("code",{className:"block truncate font-mono text-sm font-medium",children:e.name}),(0,a.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1",children:[0===e.models.length?(0,a.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models"}):e.models.slice(0,3).map((e,t)=>(0,a.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1.5 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[220px]",children:e},t)),e.models.length>3&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["+",e.models.length-3," more"]})]})]})]}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3 sm:shrink-0",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-1.5 rounded-lg bg-black/[0.02] px-2 py-1.5 dark:bg-white/[0.02] sm:justify-start sm:bg-transparent sm:px-0 sm:py-0 sm:dark:bg-transparent",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(o.lM,{size:"sm",checked:n,onChange:i})]}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-1 sm:flex",children:[(0,a.jsxs)("button",{onClick:t=>{t.stopPropagation(),s(e.name,`combo-${e.id}`)},className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Copy combo name",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:t===`combo-${e.id}`?"check":"content_copy"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Copy"})]}),(0,a.jsxs)("button",{onClick:l,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Edit",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,a.jsxs)("button",{onClick:r,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 transition-colors hover:bg-red-500/10",title:"Delete",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]})]})]})})}function d({index:e,model:t,isFirst:s,isLast:o,onEdit:r,onMoveUp:n,onMoveDown:i,onRemove:c}){let[m,x]=(0,l.useState)(!1),[h,p]=(0,l.useState)(t),u=()=>{let e=h.trim();e&&e!==t?r(e):p(t),x(!1)};return(0,a.jsxs)("div",{className:"group flex min-w-0 items-center gap-1.5 rounded-md bg-black/[0.02] px-2 py-1 transition-colors hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04]",children:[(0,a.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:e+1}),m?(0,a.jsx)("input",{autoFocus:!0,value:h,onChange:e=>p(e.target.value),onBlur:u,onKeyDown:e=>{"Enter"===e.key&&u(),"Escape"===e.key&&(p(t),x(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,a.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>x(!0),title:"Click to edit",children:t}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,a.jsx)("button",{onClick:n,disabled:s,className:`p-0.5 rounded ${s?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,a.jsx)("button",{onClick:i,disabled:o,className:`p-0.5 rounded ${o?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,a.jsx)("button",{onClick:c,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function m({isOpen:e,combo:t,onClose:s,onSave:r,activeProviders:i,kindFilter:c=null}){let[x,h]=(0,l.useState)(t?.name||""),[p,u]=(0,l.useState)(t?.models||[]),[b,f]=(0,l.useState)(!1),[g,j]=(0,l.useState)(!1),[y,w]=(0,l.useState)(""),[v,N]=(0,l.useState)({}),k=async()=>{try{let e=await fetch("/api/models/alias");if(!e.ok)return;let t=await e.json();N(t.aliases||{})}catch(e){console.error("Error fetching modal data:",e)}};(0,l.useEffect)(()=>{e&&k()},[e]);let C=e=>e.trim()?n.test(e)?(w(""),!0):(w("Only letters, numbers, -, _ and . allowed"),!1):(w("Name is required"),!1),S=async()=>{C(x)&&(j(!0),await r({name:x.trim(),models:p}),j(!1))},E=!!t;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.aF,{isOpen:e,onClose:s,title:E?"Edit Combo":"Create Combo",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.pd,{label:"Combo Name",value:x,onChange:e=>{let t=e.target.value;h(t),t?C(t):w("")},placeholder:"my-combo",error:y}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and . allowed"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===p.length?(0,a.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,a.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:p.map((e,t)=>(0,a.jsx)(d,{index:t,model:e,isFirst:0===t,isLast:t===p.length-1,onEdit:e=>{let s=[...p];s[t]=e,u(s)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...p];[t[e-1],t[e]]=[t[e],t[e-1]],u(t)})(t),onMoveDown:()=>(e=>{if(e===p.length-1)return;let t=[...p];[t[e],t[e+1]]=[t[e+1],t[e]],u(t)})(t),onRemove:()=>{u(p.filter((e,s)=>s!==t))}},t))}),(0,a.jsxs)("button",{onClick:()=>f(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,a.jsx)(o.$n,{onClick:s,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(o.$n,{onClick:S,fullWidth:!0,size:"sm",disabled:!x.trim()||!!y||g,children:g?"Saving...":E?"Save":"Create"})]})]})}),(0,a.jsx)(o.rq,{isOpen:b,onClose:()=>f(!1),onSelect:e=>{p.includes(e.value)||u([...p,e.value])},onDeselect:e=>{u(p.filter(t=>t!==e.value))},activeProviders:i,modelAliases:v,title:"Add Model to Combo",kindFilter:c,addedModelValues:p,closeOnSelect:!1})]})}},78036:(e,t,s)=>{Promise.resolve().then(s.bind(s,47295))}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=78036)),_N_E=e.O()}]);
@@ -0,0 +1,59 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{42661:(e,t,s)=>{Promise.resolve().then(s.bind(s,94588))},94588:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>O});var a=s(95155),r=s(73321),o=s(98500),l=s.n(o),n=s(12115),i=s(35497),d=s(57250),c=s(32598),m=s(52679),p=s(28777),u=s(11059),x=s(14051),h=s.n(x);function b({until:e}){let[t,s]=(0,n.useState)("");return((0,n.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void s("");let a=Math.floor(t/1e3);a<60?s(`${a}s`):a<3600?s(`${Math.floor(a/60)}m ${a%60}s`):s(`${Math.floor(a/3600)}h ${Math.floor(a%3600/60)}m`)};t();let a=setInterval(t,1e3);return()=>clearInterval(a)},[e]),t)?(0,a.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function f({connection:e,proxyPools:t,isOAuth:s,isFirst:r,isLast:o,onMoveUp:l,onMoveDown:d,onToggleActive:c,onUpdateProxy:m,onEdit:p,onDelete:u}){let[x,h]=(0,n.useState)(!1),[g,y]=(0,n.useState)(!1),[v,j]=(0,n.useState)(!1),w=(0,n.useRef)(null),N=new Map((t||[]).map(e=>[e.id,e])),k=e.providerSpecificData?.proxyPoolId||null,S=k?N.get(k):null,C=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,$=!!k||C,P=S?`Pool: ${S.name}`:k?`Pool: ${k} (inactive/missing)`:C?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",A="",E=S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;if(E)try{let e=new URL(E);A=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{A=E}let _=S?.noProxy||e.providerSpecificData?.connectionNoProxy||"",T=S?.isActive===!0?"success":k||C?"error":"default",I=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(Boolean).sort()[0]||null;(0,n.useEffect)(()=>{let t=()=>{j(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let s=I?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[I]),(0,n.useEffect)(()=>{if(!x)return;let e=e=>{w.current&&!w.current.contains(e.target)&&h(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[x]);let R="unavailable"!==e.testStatus||v?e.testStatus:"active",O=s?e.name||e.email||e.displayName||"OAuth Account":e.name,M=async e=>{y(!0);try{await m("__none__"===e?null:e)}finally{y(!1),h(!1)}};return(0,a.jsxs)("div",{className:`group flex flex-col gap-3 p-2 rounded-lg sm:flex-row sm:items-center sm:justify-between hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,a.jsxs)("div",{className:"flex w-full min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("button",{onClick:l,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,a.jsx)("button",{onClick:d,disabled:o,className:`p-0.5 rounded ${o?"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:O}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[(0,a.jsx)(i.Ex,{variant:!1===e.isActive?"default":"active"===R||"success"===R?"success":"error"===R||"expired"===R||"unavailable"===R?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":R||"Unknown"}),$&&(0,a.jsx)(i.Ex,{variant:T,size:"sm",children:"Proxy"}),v&&!1!==e.isActive&&(0,a.jsx)(b,{until:I}),e.lastError&&!1!==e.isActive&&(0,a.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:e.lastError,children:e.lastError}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]})]}),$&&(0,a.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[11px] text-text-muted truncate max-w-[420px]",title:P,children:P}),A&&(0,a.jsx)("code",{className:"text-[10px] font-mono bg-black/5 dark:bg-white/5 px-1 py-0.5 rounded text-text-muted",children:A}),_&&(0,a.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:_,children:["no_proxy: ",_]})]})]})]}),(0,a.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(t||[]).length>0&&(0,a.jsxs)("div",{className:"relative",ref:w,children:[(0,a.jsxs)("button",{onClick:()=>h(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${$?"text-primary":"text-text-muted hover:text-primary"}`,disabled:g,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:g?"progress_activity":"lan"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),x&&(0,a.jsxs)("div",{className:"absolute right-0 top-full mt-1 z-50 bg-bg border border-border rounded-lg shadow-lg py-1 min-w-[160px]",children:[(0,a.jsx)("button",{onClick:()=>M("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!k?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,a.jsx)("button",{onClick:()=>M(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${k===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,a.jsxs)("button",{onClick:p,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,a.jsxs)("button",{onClick:u,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-red-500/10 text-red-500",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,a.jsx)(i.lM,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable":"Enable"})]})]})}function g({isOpen:e,provider:t,providerName:s,proxyPools:r,onSave:o,onClose:l}){let d="__none__",[c,m]=(0,n.useState)({name:"",apiKey:"",priority:1,proxyPoolId:d}),[p,u]=(0,n.useState)(!1),[x,h]=(0,n.useState)(null),[b,f]=(0,n.useState)(!1),y=s?`${s} Key`:"Production Key";(0,n.useEffect)(()=>{e&&(m({name:s?`${s} Key`:"",apiKey:"",priority:1,proxyPoolId:d}),h(null),u(!1),f(!1))},[e,s]);let v=async()=>{u(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})}),s=await e.json();h(s.valid?"success":"failed")}catch{h("failed")}finally{u(!1)}},j=async()=>{if(t&&c.apiKey){f(!0);try{let e=!1;try{u(!0),h(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})});e=!!(await s.json()).valid,h(e?"success":"failed")}catch{h("failed")}finally{u(!1)}await o({name:c.name.trim()||y,apiKey:c.apiKey,priority:c.priority,proxyPoolId:c.proxyPoolId===d?null:c.proxyPoolId,testStatus:e?"active":"unknown"})}finally{f(!1)}}};return t?(0,a.jsx)(i.aF,{isOpen:e,title:`Add ${s||t} API Key`,onClose:l,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Name"}),(0,a.jsx)("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.name,onChange:e=>m({...c,name:e.target.value}),placeholder:y})]}),(0,a.jsxs)("div",{className:"flex 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:"API Key"}),(0,a.jsx)("input",{type:"password",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.apiKey,onChange:e=>m({...c,apiKey:e.target.value})})]}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(i.$n,{onClick:v,disabled:!c.apiKey||p||b,variant:"secondary",children:p?"Checking...":"Check"})})]}),x&&(0,a.jsx)(i.Ex,{variant:"success"===x?"success":"error",children:"success"===x?"Valid":"Invalid"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Priority"}),(0,a.jsx)("input",{type:"number",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.priority,onChange:e=>m({...c,priority:Number.parseInt(e.target.value)||1})})]}),(0,a.jsx)(i.l6,{label:"Proxy Pool",value:c.proxyPoolId,onChange:e=>m({...c,proxyPoolId:e.target.value}),options:[{value:d,label:"None"},...(r||[]).map(e=>({value:e.id,label:e.name}))]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:j,fullWidth:!0,disabled:!c.apiKey||b,children:b?"Saving...":"Save"}),(0,a.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function y({providerId:e,providerName:t,isOAuth:s}){let[r,o]=(0,n.useState)([]),[l,d]=(0,n.useState)([]),[c,m]=(0,n.useState)(!0),[p,u]=(0,n.useState)(!1),[x,h]=(0,n.useState)(!1),[b,v]=(0,n.useState)(null),[j,w]=(0,n.useState)(null),[N,k]=(0,n.useState)("1"),S=(0,n.useCallback)(async()=>{try{let[t,s,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),r=await t.json(),l=await s.json(),n=a.ok?await a.json():{};t.ok&&o((r.connections||[]).filter(t=>t.provider===e)),s.ok&&d(l.proxyPools||[]);let i=(n.providerStrategies||{})[e]||{};w(i.fallbackStrategy||null),k(null!=i.stickyRoundRobinLimit?String(i.stickyRoundRobinLimit):"1")}catch(e){console.log("ConnectionsCard fetch error:",e)}finally{m(!1)}},[e]);(0,n.useEffect)(()=>{S()},[S]);let C=async(t,s)=>{try{let a=await fetch("/api/settings",{cache:"no-store"}),r=(a.ok?await a.json():{}).providerStrategies||{},o={};t&&(o.fallbackStrategy=t),"round-robin"===t&&""!==s&&(o.stickyRoundRobinLimit=Number(s)||3);let l={...r};0===Object.keys(o).length?delete l[e]:l[e]=o,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})})}catch(e){console.log("saveStrategy error:",e)}},$=async(e,t)=>{let s=[...r];[s[e],s[t]]=[s[t],s[e]],o(s);try{await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch{await S()}},P=async e=>{if(confirm("Delete this connection?"))try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&o(t=>t.filter(t=>t.id!==e))}catch(e){console.log("delete error:",e)}},A=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&o(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("toggle error:",e)}},E=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&o(s=>s.map(s=>s.id===e?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("proxy error:",e)}},_=async t=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})})).ok&&(await S(),u(!1))}catch(e){console.log("save apikey error:",e)}},T=async e=>{try{(await fetch(`/api/providers/${b.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await S(),h(!1))}catch(e){console.log("update connection error:",e)}};return c?(0,a.jsx)(i.Zp,{children:(0,a.jsx)("div",{className:"h-20 animate-pulse bg-black/5 rounded-lg"})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(i.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(i.lM,{checked:"round-robin"===j,onChange:e=>{let t=e?"round-robin":null;w(t),e&&!N&&k("1"),C(t,e?N||"1":N)}}),"round-robin"===j&&(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:N,onChange:e=>{k(e.target.value),C("round-robin",e.target.value)},className:"w-16 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]}),0===r.length?(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),(0,a.jsx)(i.$n,{size:"sm",icon:"add",onClick:()=>u(!0),children:"Add Connection"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:r.map((e,t)=>(0,a.jsx)(f,{connection:e,proxyPools:l,isOAuth:s,isFirst:0===t,isLast:t===r.length-1,onMoveUp:()=>$(t,t-1),onMoveDown:()=>$(t,t+1),onToggleActive:t=>A(e.id,t),onUpdateProxy:t=>E(e.id,t),onEdit:()=>{v(e),h(!0)},onDelete:()=>P(e.id)},e.id))}),(0,a.jsx)("div",{className:"mt-4 flex justify-stretch sm:justify-start",children:(0,a.jsx)(i.$n,{size:"sm",icon:"add",onClick:()=>u(!0),children:"Add"})})]})]}),(0,a.jsx)(g,{isOpen:p,provider:e,providerName:t,proxyPools:l,onSave:_,onClose:()=>u(!1)}),(0,a.jsx)(i.wI,{isOpen:x,connection:b,proxyPools:l,onSave:T,onClose:()=>h(!1)})]})}function v({model:e,fullModel:t,displayModel:s,copied:r,onCopy:o,testStatus:l,isCustom:n,isFree:i,onDeleteAlias:d,onTest:c,isTesting:m}){let p="ok"===l?"#22c55e":"error"===l?"#ef4444":void 0;return(0,a.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===l?"border-green-500/40":"error"===l?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base",style:p?{color:p}:void 0,children:"ok"===l?"check_circle":"error"===l?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex flex-col gap-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||t}),e.name&&(0,a.jsx)("span",{className:"text-[9px] text-text-muted/70 italic pl-1",children:e.name})]}),c&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:c,disabled:m,className:`p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-opacity ${m?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:m?{animation:"spin 1s linear infinite"}:void 0,children:m?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:m?"Testing...":"Test"})]}),(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:()=>o(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:r===`model-${e.id}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:r===`model-${e.id}`?"Copied!":"Copy"})]}),i&&(0,a.jsx)("span",{className:"text-[10px] font-bold text-green-500 bg-green-500/10 px-1.5 py-0.5 rounded",children:"FREE"}),n&&(0,a.jsx)("button",{onClick:d,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity ml-auto",title:"Remove custom model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})})]})})}function j({isOpen:e,onSave:t,onClose:s}){let[r,o]=(0,n.useState)(""),l=()=>{r.trim()&&(t(r.trim()),o(""))};return(0,a.jsx)(i.aF,{isOpen:e,title:"Add Custom Model",onClose:s,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,a.jsx)("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:r,onChange:e=>o(e.target.value),onKeyDown:e=>"Enter"===e.key&&l(),placeholder:"e.g. tts-1-hd",autoFocus:!0})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{type:"button",onClick:l,fullWidth:!0,disabled:!r.trim(),children:"Add"}),(0,a.jsx)(i.$n,{type:"button",onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function w({providerId:e,kindFilter:t,providerAliasOverride:s}){let{copied:r,copy:o}=(0,u.C)(),[l,d]=(0,n.useState)({}),[c,x]=(0,n.useState)([]),[h,b]=(0,n.useState)({}),[f,g]=(0,n.useState)(null),[y,N]=(0,n.useState)(""),[k,S]=(0,n.useState)(!1),[C,$]=(0,n.useState)([]),P=s||(0,m.wG)(e),A="codex"===e,E=t||"llm",_=(0,n.useCallback)(async()=>{try{let[t,s,a]=await Promise.all([fetch("/api/models/alias"),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/custom",{cache:"no-store"})]),r=await t.json(),o=await s.json(),l=await a.json();t.ok&&d(r.aliases||{}),s.ok&&$((o.connections||[]).filter(t=>t.provider===e)),a.ok&&x(l.models||[])}catch(e){console.log("ModelsCard fetch error:",e)}},[e]);(0,n.useEffect)(()=>{_()},[_]);let T=async(e,t)=>{let s=`${P}/${e}`;try{(await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})})).ok&&await _()}catch(e){console.log("set alias error:",e)}},I=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await _()}catch(e){console.log("delete alias error:",e)}},R=async e=>{try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:P,id:e,type:E})})).ok&&(await _(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("add custom model error:",e)}},O=async e=>{try{let t=new URLSearchParams({providerAlias:P,id:e,type:E});(await fetch(`/api/models/custom?${t}`,{method:"DELETE"})).ok&&(await _(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("delete custom model error:",e)}},M=async e=>{if(!f){g(e);try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${P}/${e}`,kind:t})}),a=await s.json();b(t=>({...t,[e]:a.ok?"ok":"error"})),N(a.ok?"":a.error||"Model not reachable")}catch{b(t=>({...t,[e]:"error"})),N("Network error")}finally{g(null)}}},K=(0,p.KC)(e),U=t?K.filter(e=>e.kinds?e.kinds.includes(t):(e.type||"llm")===t):K,L=c.filter(e=>e.providerAlias===P&&(e.type||"llm")===E&&!U.some(t=>t.id===e.id));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(i.Zp,{children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,a.jsxs)("h2",{className:"text-lg font-semibold",children:["Models",t?` — ${t.toUpperCase()}`:""]})}),y&&(0,a.jsx)("p",{className:"text-xs text-red-500 mb-3 wrap-break-word",children:y}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[U.map(e=>{let t=`${P}/${e.id}`,s=Object.entries(l).find(([,e])=>e===t)?.[0];return(0,a.jsx)(v,{model:e,fullModel:`${P}/${e.id}`,displayModel:A?e.id:`${P}/${e.id}`,alias:s,copied:r,onCopy:o,onSetAlias:t=>T(e.id,t),onDeleteAlias:()=>I(s),testStatus:h[e.id],onTest:C.length>0?()=>M(e.id):void 0,isTesting:f===e.id,isFree:e.isFree},e.id)}),L.map(e=>(0,a.jsx)(v,{model:{id:e.id,name:e.name},fullModel:`${P}/${e.id}`,displayModel:A?e.id:`${P}/${e.id}`,copied:r,onCopy:o,onSetAlias:()=>{},onDeleteAlias:()=>O(e.id),testStatus:h[e.id],onTest:C.length>0?()=>M(e.id):void 0,isTesting:f===e.id,isCustom:!0},`${e.id}-${e.type}`)),(0,a.jsxs)("button",{onClick:()=>S(!0),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg border border-dashed border-black/15 dark:border-white/15 text-xs text-text-muted hover:text-primary hover:border-primary/40 transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]})]})]}),(0,a.jsx)(j,{isOpen:k,onSave:async e=>{await R(e),S(!1)},onClose:()=>S(!1)})]})}b.propTypes={until:h().string.isRequired},f.propTypes={connection:h().shape({id:h().string,name:h().string,email:h().string,displayName:h().string,testStatus:h().string,isActive:h().bool,lastError:h().string,priority:h().number}).isRequired,proxyPools:h().array,isOAuth:h().bool.isRequired,isFirst:h().bool.isRequired,isLast:h().bool.isRequired,onMoveUp:h().func.isRequired,onMoveDown:h().func.isRequired,onToggleActive:h().func.isRequired,onUpdateProxy:h().func,onEdit:h().func.isRequired,onDelete:h().func.isRequired},g.propTypes={isOpen:h().bool.isRequired,provider:h().string,providerName:h().string,proxyPools:h().array,onSave:h().func.isRequired,onClose:h().func.isRequired},y.propTypes={providerId:h().string.isRequired,providerName:h().string,isOAuth:h().bool},v.propTypes={model:h().shape({id:h().string.isRequired}).isRequired,fullModel:h().string.isRequired,displayModel:h().string,copied:h().string,onCopy:h().func.isRequired,testStatus:h().oneOf(["ok","error"]),isCustom:h().bool,isFree:h().bool,onDeleteAlias:h().func,onTest:h().func,isTesting:h().bool},j.propTypes={isOpen:h().bool.isRequired,onSave:h().func.isRequired,onClose:h().func.isRequired},w.propTypes={providerId:h().string.isRequired,kindFilter:h().string,providerAliasOverride:h().string};let N={"google-tts":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"hardcoded"},openai:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"openai-tts-models",voiceKey:"openai-tts-voices",voicesPerModel:!0},openrouter:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"openrouter-tts-models",voiceKey:"openrouter-tts-voices",voicesPerModel:!0},elevenlabs:{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",modelKey:"elevenlabs-tts-models",apiEndpoint:"/api/media-providers/tts/elevenlabs/voices"},"edge-tts":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language"},"local-device":{hasLanguageDropdown:!1,hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language"},nvidia:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},hyperbolic:{hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"config"},deepgram:{hasModelSelector:!1,hasBrowseButton:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/deepgram/voices"},huggingface:{hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"config"},cartesia:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},playht:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},coqui:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},tortoise:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},inworld:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",modelKey:"inworld-tts-models",apiEndpoint:"/api/media-providers/tts/inworld/voices"},qwen:{hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!0,voiceSource:"config"},gemini:{hasLanguageDropdown:!1,hasLanguageHint:!0,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"gemini-tts-models",voiceKey:"gemini-tts-voices",voicesPerModel:!0}};var k=s(717),S=s(91781);function C({label:e,children:t,align:s="center"}){return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-3",children:[(0,a.jsx)("span",{className:"w-full text-xs font-medium text-text-muted sm:w-20 sm:shrink-0",children:e}),(0,a.jsx)("div",{className:"w-full min-w-0 flex-1",children:t})]})}function $(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}let P=`// Audio will appear here after running.
2
+ // Example JSON response (response_format=json):
3
+ {
4
+ "format": "mp3",
5
+ "audio": "//NExAANaAIIAUAAANNNNNNNN..." // base64 encoded MP3
6
+ }`,A=`{
7
+ "object": "list",
8
+ "data": [{
9
+ "object": "embedding",
10
+ "index": 0,
11
+ "embedding": [0.002301, -0.019212, 0.004815, -0.031249, ...]
12
+ }],
13
+ "model": "...",
14
+ "usage": { "prompt_tokens": 9, "total_tokens": 9 }
15
+ }`,E={webSearch:{inputLabel:"Query",inputPlaceholder:"What is the latest news about AI?",defaultInput:"What is the latest news about AI?",bodyKey:"query",defaultResponse:`{
16
+ "results": [
17
+ { "title": "...", "url": "...", "snippet": "..." }
18
+ ]
19
+ }`,extraFields:[{key:"search_type",label:"Type",type:"select",default:"web",options:["web","news"]},{key:"max_results",label:"Max results",type:"number",default:5,min:1,max:100},{key:"country",label:"Country",type:"text",default:""},{key:"language",label:"Language",type:"text",default:""}]},webFetch:{inputLabel:"URL",inputPlaceholder:"https://example.com",defaultInput:"https://example.com",bodyKey:"url",defaultResponse:`{
20
+ "content": "...",
21
+ "title": "...",
22
+ "url": "..."
23
+ }`,extraFields:[{key:"format",label:"Format",type:"select",default:"markdown",options:["markdown","text","html"]},{key:"max_characters",label:"Max chars",type:"number",default:0,min:0}]},image:{inputLabel:"Prompt",inputPlaceholder:"A cute cat wearing a hat",defaultInput:"A cute cat wearing a hat",bodyKey:"prompt",defaultResponse:`{
24
+ "data": [
25
+ { "url": "...", "b64_json": "..." }
26
+ ]
27
+ }`,extraFields:[{key:"n",label:"n",type:"number",default:1,min:1,max:4},{key:"size",label:"Size",type:"select",default:"",options:["",...c.z]},{key:"quality",label:"Quality",type:"select",default:"auto",options:["auto","low","medium","high","standard","hd"]},{key:"background",label:"Background",type:"select",default:"auto",options:["auto","transparent","opaque"]},{key:"style",label:"Style",type:"select",default:"",options:["","vivid","natural"]},{key:"response_format",label:"Format",type:"select",default:"",options:["","url","b64_json"]},{key:"image_detail",label:"Image Detail",type:"select",default:"high",options:["auto","low","high","original"]},{key:"output_format",label:"Codec",type:"select",default:"png",options:["png","jpeg","webp"]}]},imageToText:{inputLabel:"Image URL",inputPlaceholder:"https://example.com/image.png",defaultInput:"https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg",bodyKey:"url",extraBody:{prompt:"Describe this image in detail"},defaultResponse:`{
28
+ "text": "A cat sitting on a windowsill...",
29
+ "model": "..."
30
+ }`},video:{inputLabel:"Prompt",inputPlaceholder:"A serene lake at sunset",defaultInput:"A serene lake at sunset",bodyKey:"prompt",defaultResponse:`{
31
+ "data": [
32
+ { "url": "..." }
33
+ ]
34
+ }`},music:{inputLabel:"Prompt",inputPlaceholder:"A calm piano melody",defaultInput:"A calm piano melody",bodyKey:"prompt",defaultResponse:`{
35
+ "data": [
36
+ { "url": "...", "format": "mp3" }
37
+ ]
38
+ }`}};function _({providerId:e,customAlias:t}){let s=(0,m.gC)(e),r=s?t||e:(0,m.wG)(e),o=s?[]:(0,p.KC)(e).filter(e=>"embedding"===e.type),[l,d]=(0,n.useState)(o[0]?.id??""),[c,x]=(0,n.useState)("The quick brown fox jumps over the lazy dog"),[h,b]=(0,n.useState)(""),[f,g]=(0,n.useState)(""),[y,v]=(0,n.useState)(!1),[j,w]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[S,$]=(0,n.useState)(null),[P,E]=(0,n.useState)(!1),[T,I]=(0,n.useState)(""),{copied:R,copy:O}=(0,u.C)(),{copied:M,copy:K}=(0,u.C)();(0,n.useEffect)(()=>{w(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{g((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&k(e.publicUrl)}).catch(()=>{})},[]);let U=y?N:j,L=l?`${r}/${l}`:"",D=()=>{let e={model:L,input:c.trim()},t=Number(h);return h&&Number.isFinite(t)&&t>0&&(e.dimensions=t),e},B=`curl -X POST ${U}/v1/embeddings \\
39
+ -H "Content-Type: application/json" \\
40
+ -H "Authorization: Bearer ${f||"YOUR_KEY"}" \\
41
+ -d '${JSON.stringify(D())}'`,F=async()=>{if(!c.trim()||!L)return;E(!0),I(""),$(null);let e=Date.now();try{let t={"Content-Type":"application/json"};f&&(t.Authorization=`Bearer ${f}`);let s=await fetch("/api/v1/embeddings",{method:"POST",headers:t,body:JSON.stringify(D())}),a=Date.now()-e,r=await s.json();if(!s.ok)return void I(r?.error?.message||r?.error||`HTTP ${s.status}`);$({data:r,latencyMs:a})}catch(e){I(e.message||"Network error")}finally{E(!1)}},z=S?JSON.stringify(S.data,null,2):"";return(0,a.jsxs)(i.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,a.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,a.jsx)(C,{label:"Model",children:s?(0,a.jsx)("input",{value:l,onChange:e=>d(e.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"}):(0,a.jsx)("select",{value:l,onChange:e=>d(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:o.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,a.jsx)(C,{label:"Endpoint",children:(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsx)("input",{value:U,onChange:e=>y?k(e.target.value):w(e.target.value),className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono",placeholder:"http://localhost:3000"}),N&&(0,a.jsxs)("button",{onClick:()=>v(e=>!e),title:y?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${y?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,a.jsx)(C,{label:"API Key",children:(0,a.jsx)("input",{type:"password",value:f,onChange:e=>g(e.target.value),placeholder:"sk-...",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),(0,a.jsx)(C,{label:"Input",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:c,onChange:e=>x(e.target.value),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),c&&(0,a.jsx)("button",{type:"button",onClick:()=>x(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})}),(0,a.jsx)(C,{label:"Dimensions",children:(0,a.jsx)("input",{type:"number",min:"1",value:h,onChange:e=>b(e.target.value),placeholder:"optional, e.g. 512, 1024 (leave empty for default)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),(0,a.jsxs)("div",{className:"mt-1",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsxs)("button",{onClick:()=>O(B),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:R?"check":"content_copy"}),R?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:F,disabled:P||!c.trim()||!L,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:P?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),P?"Running...":"Run"]})]})]}),(0,a.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:B})]}),T&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:T}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,a.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",S&&(0,a.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",S.latencyMs,"ms"]})]}),S&&(0,a.jsxs)("button",{onClick:()=>K(z),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:M?"check":"content_copy"}),M?"Copied":"Copy"]})]}),(0,a.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:(e=>{if(!e)return A;let t=JSON.parse(JSON.stringify(e));return(t.data||[]).forEach(e=>{Array.isArray(e.embedding)&&e.embedding.length>4&&(e.embedding=[...e.embedding.slice(0,4).map(e=>parseFloat(e.toFixed(6))),`... (${e.embedding.length} dims)`])}),JSON.stringify(t,null,2)})(S?.data)})]})]})]})}function T({providerId:e}){let t,s=(0,m.wG)(e),r=N[e]||N["edge-tts"],[o,l]=(0,n.useState)(""),[d,c]=(0,n.useState)(""),[x,h]=(0,n.useState)(""),[b,f]=(0,n.useState)([]),[g,y]=(0,n.useState)(""),[v,j]=(0,n.useState)(()=>{let t=m.Q2[e]?.ttsConfig?.models;if(t?.length)return t[0].id;if(r.hasModelSelector&&r.modelKey){let e=(0,p.KC)(r.modelKey);return e?.[0]?.id||""}return""}),[w,$]=(0,n.useState)("Hello, this is a text to speech test."),[A,E]=(0,n.useState)(""),[_,I]=(0,n.useState)(!1),[R,O]=(0,n.useState)(""),[M,K]=(0,n.useState)(""),[U,L]=(0,n.useState)("mp3"),[D,B]=(0,n.useState)(""),[F,z]=(0,n.useState)(null),[q,J]=(0,n.useState)(!1),[H,V]=(0,n.useState)(""),[W,Y]=(0,n.useState)(null),{copied:G,copy:Q}=(0,u.C)(),[Z,X]=(0,n.useState)(!1),[ee,et]=(0,n.useState)([]),[es,ea]=(0,n.useState)(!1),[er,eo]=(0,n.useState)(""),[el,en]=(0,n.useState)(""),[ei,ed]=(0,n.useState)({}),[ec,em]=(0,n.useState)("");(0,n.useEffect)(()=>{if(O(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{E((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&K(e.publicUrl)}).catch(()=>{}),"hardcoded"===r.voiceSource){let t=r.hasModelSelector&&r.modelKey&&(0,p.KC)(r.modelKey)?.[0]?.id||"",s=r.voicesPerModel&&t?(0,k.jY)(e,t)||[]:(0,p.KC)(r.voiceKey||e).filter(e=>"tts"===e.type);if(s.length)if(r.hasBrowseButton){let e=s.find(e=>"en"===e.id)||s[0];y(e.id),l(e.id),c(e.name),f([{id:e.id,name:e.name}])}else f(s),l(s[0].id),c(s[0].name||s[0].id)}},[e]),(0,n.useEffect)(()=>{if(!r.voicesPerModel||!v)return;let t=(0,k.jY)(e,v)||[];f(t),t.length&&(l(t[0].id),c(t[0].name||t[0].id))},[v]);let ep=async()=>{if(X(!0),eo(""),en(""),!ee.length){ea(!0);try{if("hardcoded"===r.voiceSource){let t=r.voiceKey||e,s=(0,p.KC)(t).filter(e=>"tts"===e.type),a={};for(let e of s)a[e.id]||(a[e.id]={code:e.id,name:e.name,voices:[{id:e.id,name:e.name}]});ed(a),et(Object.values(a).sort((e,t)=>e.name.localeCompare(t.name)))}else{let t=r.apiEndpoint?r.apiEndpoint:`/api/media-providers/tts/voices?provider=${"local-device"===e?"local-device":"edge-tts"}`,s=await fetch(t),a=await s.json();if(a.error)return void en(a.error);et(a.languages||[]),ed(a.byLang||{})}}catch(e){en(e.message)}finally{ea(!1)}}},eu=er?ee.filter(e=>e.name.toLowerCase().includes(er.toLowerCase())||e.code.toLowerCase().includes(er.toLowerCase())):ee,ex=_?M:R,eh=r.hasVoiceIdInput&&x||o,eb=r.hasModelSelector&&v&&eh?`${s}/${v}/${eh}`:r.hasModelSelector&&v?`${s}/${v}`:eh?`${s}/${eh}`:"",ef=(t={model:eb,input:w},r.hasLanguageHint&&ec&&(t.language=ec),t),eg=`curl -X POST ${ex}/v1/audio/speech${"json"===U?"?response_format=json":""} \\
42
+ -H "Content-Type: application/json" \\
43
+ -H "Authorization: Bearer ${A||"YOUR_KEY"}" \\
44
+ -d '${JSON.stringify(ef)}' \\
45
+ ${"json"===U?"":"--output speech.mp3"}`,ey=async()=>{if(!w.trim()||!eb)return;J(!0),V(""),B(""),z(null);let e=Date.now();try{let t={"Content-Type":"application/json"};A&&(t.Authorization=`Bearer ${A}`);let s=`/api/v1/audio/speech${"json"===U?"?response_format=json":""}`,a=await fetch(s,{method:"POST",headers:t,body:JSON.stringify({...ef,input:w.trim()})});if(Y(Date.now()-e),!a.ok){let e=await a.json().catch(()=>({}));V(e?.error?.message||e?.error||`HTTP ${a.status}`);return}if("json"===U){let e=await a.json();z(e);let t=await fetch(`data:audio/mp3;base64,${e.audio}`).then(e=>e.blob());B(URL.createObjectURL(t))}else{let e=await a.blob();B(URL.createObjectURL(e))}}catch(e){V(e.message||"Network error")}finally{J(!1)}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(i.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,a.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,a.jsx)(C,{label:"Endpoint",children:(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[ex,"/v1/audio/speech"]}),M&&(0,a.jsxs)("button",{onClick:()=>I(e=>!e),title:_?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${_?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,a.jsx)(C,{label:"API Key",children:(0,a.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:A?`${A.slice(0,8)}${"•".repeat(Math.min(20,A.length-8))}`:(0,a.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),r.hasModelSelector&&(r.modelKey||m.Q2[e]?.ttsConfig?.models?.length)&&(0,a.jsx)(C,{label:"Model",children:(0,a.jsx)("select",{value:v,onChange:e=>j(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:((m.Q2[e]?.ttsConfig?.models?.length?m.Q2[e].ttsConfig.models:(0,p.KC)(r.modelKey))||[]).map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),r.hasLanguageHint&&(0,a.jsx)(C,{label:"Language",children:(0,a.jsxs)("select",{value:ec,onChange:e=>em(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"",children:"Auto-detect"}),S.I.map(e=>(0,a.jsx)("option",{value:e.name,children:e.name},e.id))]})}),r.hasBrowseButton&&(0,a.jsx)(C,{label:"Language",children:(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsx)("button",{onClick:ep,className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-background font-mono truncate text-left hover:border-primary/40 transition-colors",children:g?(0,a.jsx)("span",{className:"text-text-main",children:ee.find(e=>e.code===g)?.name||g}):(0,a.jsx)("span",{className:"text-text-muted",children:"No language selected"})}),(0,a.jsxs)("button",{onClick:ep,className:"flex w-full items-center justify-center gap-1 text-xs px-2.5 py-1.5 rounded-lg border border-border text-text-muted hover:text-primary hover:border-primary/40 transition-colors sm:w-auto sm:shrink-0",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"language"}),"Select language"]})]})}),b.length>0&&(0,a.jsx)(C,{label:"Voice",children:(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.map(e=>(0,a.jsxs)("button",{onClick:()=>{l(e.id),c(e.name),r.hasVoiceIdInput&&h(e.id)},className:`px-2.5 py-1 rounded-full text-xs border transition-colors ${o===e.id?"bg-primary/15 border-primary/40 text-primary font-medium":"border-border text-text-muted hover:text-primary hover:border-primary/40"}`,children:[e.name,e.gender?` \xb7 ${e.gender[0].toUpperCase()}`:"",!0===e.free_users_allowed&&(0,a.jsx)("span",{className:"ml-1.5 px-1 py-0.5 text-[9px] font-semibold rounded bg-green-500/15 text-green-600 border border-green-500/20",children:"Free"}),!1===e.free_users_allowed&&(0,a.jsx)("span",{className:"ml-1.5 px-1 py-0.5 text-[9px] font-semibold rounded bg-amber-500/15 text-amber-600 border border-amber-500/20",children:"Paid"})]},e.id))})}),r.hasVoiceIdInput&&(0,a.jsx)(C,{label:"Voice ID",children:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:x,onChange:e=>{h(e.target.value),l(e.target.value)},placeholder:"e.g. CwhRBWXzGAHq8TQ4Fs17",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"}),x&&(0,a.jsx)("button",{type:"button",onClick:()=>{h(""),l("")},className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})})}),r.hasLanguageDropdown&&(0,a.jsx)(C,{label:"Language",children:(0,a.jsx)("select",{value:o,onChange:t=>{let s=(0,p.KC)(e).filter(e=>"tts"===e.type).find(e=>e.id===t.target.value);l(t.target.value),c(s?.name||t.target.value)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:(0,p.KC)(e).filter(e=>"tts"===e.type).map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,a.jsx)(C,{label:"Input",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:w,onChange:e=>$(e.target.value),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),w&&(0,a.jsx)("button",{type:"button",onClick:()=>$(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})}),(0,a.jsx)(C,{label:"Output Format",children:(0,a.jsxs)("select",{value:U,onChange:e=>L(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"mp3",children:"MP3 (Binary)"}),(0,a.jsx)("option",{value:"json",children:"JSON (Base64)"})]})}),(0,a.jsxs)("div",{className:"mt-1",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsxs)("button",{onClick:()=>Q(eg),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:G?"check":"content_copy"}),G?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:ey,disabled:q||!w.trim()||!eb,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:q?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),q?"Generating...":"Run"]})]})]}),(0,a.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:eg})]}),H&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:H}),D?(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,a.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",W&&(0,a.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",W,"ms"]})]}),(0,a.jsxs)("a",{href:D,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})]}),(0,a.jsx)("audio",{controls:!0,src:D,className:"w-full"}),F&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:(0,a.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"JSON Response"})}),(0,a.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:JSON.stringify({format:F.format,audio:F.audio?`${F.audio.substring(0,100)}...`:""},null,2)})]})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Response"}),(0,a.jsx)("pre",{className:"mt-1.5 bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-50",children:P})]})]})]}),Z&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-end justify-center sm:items-center",style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(2px)"},onClick:()=>X(!1),children:(0,a.jsxs)("div",{className:"border border-border rounded-xl shadow-2xl w-full max-w-md mx-4 flex flex-col max-h-[80vh]",style:{backgroundColor:"var(--color-bg)",isolation:"isolate"},onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0 rounded-t-xl",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"Select Language"}),(0,a.jsx)("button",{onClick:()=>X(!1),className:"text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,a.jsx)("div",{className:"px-4 py-2.5 border-b border-border shrink-0",children:(0,a.jsx)("input",{autoFocus:!0,value:er,onChange:e=>eo(e.target.value),placeholder:"Search language...",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),(0,a.jsxs)("div",{className:"overflow-y-auto flex-1 p-2",children:[el&&(0,a.jsx)("p",{className:"text-xs text-red-500 px-2 py-1",children:el}),es?(0,a.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"Loading..."}):(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[eu.map(e=>(0,a.jsxs)("button",{onClick:()=>{let t;return X(!1),y(e.code),void(f(t=ei[e.code]?.voices||[]),t.length&&(l(t[0].id),c(t[0].name),r.hasVoiceIdInput&&h(t[0].id)))},className:`flex items-center justify-between w-full px-3 py-2 rounded-lg text-left hover:bg-sidebar transition-colors ${g===e.code?"bg-primary/10 text-primary":""}`,children:[(0,a.jsx)("span",{className:"text-sm",children:e.name}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[e.voices.length," voices"]}),g===e.code&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check"})]})]},e.code)),0===eu.length&&(0,a.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"No languages found."})]})]})]})})]})}function I({providerId:e,kind:t,providerAliasOverride:s="",customNode:r=null}){let o=s||(0,m.wG)(e),l=m.rj.find(e=>e.id===t),d=E[t],c=d||{},x=(0,p.KC)(e).filter(e=>e.type===t),[h,b]=(0,n.useState)([]),f=[...x,...h],g=new Set(["image","video","music","imageToText"]).has(t),y=!!(s&&"image"===t),v=g&&0===f.length&&!y,[j,w]=(0,n.useState)(f[0]?.id??""),N=f.find(e=>e.id===j),k=!!N?.capabilities?.includes("edit"),[S,P]=(0,n.useState)(c.defaultInput||""),[A,_]=(0,n.useState)([]),[T,R]=(0,n.useState)(""),O=(0,n.useRef)(null),[M,K]=(0,n.useState)(()=>(c.extraFields||[]).reduce((e,s)=>(e[s.key]="image"===t&&"size"===s.key&&r?.defaultSize?r.defaultSize:s.default??"",e),{})),[U,L]=(0,n.useState)(""),[D,B]=(0,n.useState)(!1),[F,z]=(0,n.useState)(""),[q,J]=(0,n.useState)(""),[H,V]=(0,n.useState)(null),[W,Y]=(0,n.useState)(null),[G,Q]=(0,n.useState)(null),[Z,X]=(0,n.useState)("json"),[ee,et]=(0,n.useState)(""),[es,ea]=(0,n.useState)(!1),[er,eo]=(0,n.useState)(""),[el,en]=(0,n.useState)([]),[ei,ed]=(0,n.useState)(""),{copied:ec,copy:em}=(0,u.C)(),{copied:ep,copy:eu}=(0,u.C)(),ex=()=>{let e=T.trim();e&&!(A.length>=4)&&(_(t=>[...t,{id:$(),name:e,type:"url",dataUrl:e,size:0}]),R(""))},eh=async e=>{let t=4-A.length,s=Array.from(e.target.files||[]).filter(e=>e.type.startsWith("image/")).filter(e=>e.size<=0x1400000).slice(0,Math.max(t,0));if(e.target.value="",0===s.length)return;let a=await Promise.all(s.map(async e=>({id:$(),name:e.name,type:e.type,size:e.size,dataUrl:await new Promise((t,s)=>{let a=new FileReader;a.onload=()=>t(String(a.result||"")),a.onerror=()=>s(Error(`Failed to read ${e.name}`)),a.readAsDataURL(e)})})));_(e=>[...e,...a])};if((0,n.useEffect)(()=>{z(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{L((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&J(e.publicUrl)}).catch(()=>{}),fetch("/api/providers/client").then(e=>e.json()).then(t=>{en((t.connections||[]).filter(t=>t.provider===e&&!1!==t.isActive))}).catch(()=>{});let s=()=>{fetch("/api/models/custom",{cache:"no-store"}).then(e=>e.json()).then(e=>{b((e.models||[]).filter(e=>e.providerAlias===o&&(e.type||"llm")===t).map(e=>({id:e.id,name:e.name||e.id,type:t,isCustom:!0})))}).catch(()=>{})};return s(),window.addEventListener("focus",s),window.addEventListener("customModelChanged",s),()=>{window.removeEventListener("focus",s),window.removeEventListener("customModelChanged",s)}},[o,e,t]),(0,n.useEffect)(()=>{!j&&f.length>0?w(f[0].id):j&&!f.some(e=>e.id===j)&&w(f[0]?.id||"")},[f,j]),(0,n.useEffect)(()=>{"image"===t&&r?.defaultSize&&K(e=>({...e,size:r.defaultSize}))},[t,r?.defaultSize]),!l||!d)return null;let eb=D?q:F,ef=l.endpoint.path,eg=g?j?`${o}/${j}`:v?"":o:o,ey=Object.entries(M).reduce((e,[t,s])=>(""===s||null==s||"number"==typeof s&&Number.isNaN(s)||(e[t]=s),e),{}),ev=T.trim(),ej=A.map(e=>e.dataUrl).filter(Boolean),ew=ev&&ej.length<4?[ev,...ej]:ej,eN={model:eg,[d.bodyKey]:S,...d.extraBody,...ey,...k&&ew.length>0?{reference_images:ew.slice(0,4)}:{}},ek="image"===t&&"binary"===Z,eS="image"===t&&"codex"===e&&!ek,eC=`${ef}${ek?"?response_format=binary":""}`,e$=`-H "Content-Type: application/json" \\
46
+ -H "Authorization: Bearer ${U||"YOUR_KEY"}"${ei?` \\
47
+ -H "x-connection-id: ${ei}"`:""}${eS?` \\
48
+ -H "Accept: text/event-stream"`:""}`,eP=`curl -X ${l.endpoint.method} ${eb}${eC} \\
49
+ ${e$.replace(/\\\n /g,"\\\n ")} \\
50
+ -d '${JSON.stringify(eN)}'${ek?" \\\n --output image.png":""}`,eA=async()=>{if(!S.trim()||!eg)return;if(ea(!0),eo(""),V(null),Y(null),Q(null),ee){try{URL.revokeObjectURL(ee)}catch{}et("")}let e=Date.now();try{let t={"Content-Type":"application/json"};U&&(t.Authorization=`Bearer ${U}`),ei&&(t["x-connection-id"]=ei),eS&&(t.Accept="text/event-stream");let s={...eN,model:eg},a=await fetch(`/api${eC}`,{method:l.endpoint.method,headers:t,body:JSON.stringify(s)});if(!a.ok){let e=await a.json().catch(()=>({}));eo(e?.error?.message||e?.error||`HTTP ${a.status}`);return}let r=a.headers.get("content-type")||"";if(r.startsWith("image/")){let t=await a.blob(),s=URL.createObjectURL(t);et(s),V({data:{binary:!0,mime:r,size:t.size},latencyMs:Date.now()-e});return}if(r.includes("text/event-stream")&&a.body){let t=a.body.getReader(),s=new TextDecoder,r="",o=null,l=null;for(;;){let e,{done:a,value:n}=await t.read();if(a)break;for(r+=s.decode(n,{stream:!0});-1!==(e=r.indexOf("\n\n"));){let t=r.slice(0,e);r=r.slice(e+2);let s=null,a="";for(let e of t.split("\n"))e.startsWith("event:")?s=e.slice(6).trim():e.startsWith("data:")&&(a+=e.slice(5).trim());if(s)try{let e=a?JSON.parse(a):{};"progress"===s?Y(e):"partial_image"===s?Q(e):"done"===s?o=e:"error"===s&&(l=e?.message||"Stream error")}catch{}}}let n=Date.now()-e;if(l)return void eo(l);o&&V({data:o,latencyMs:n})}else{let t=await a.json(),s=Date.now()-e;V({data:t,latencyMs:s})}}catch(e){eo(e.message||"Network error")}finally{ea(!1)}},eE=e=>{if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(eE);let t={};for(let[s,a]of Object.entries(e))t[s]="b64_json"===s&&"string"==typeof a&&a.length>100?`<${a.length} chars base64>`:eE(a);return t},e_=H?JSON.stringify(eE(H.data),null,2):"";return(0,a.jsxs)(i.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,a.jsxs)("div",{className:"flex flex-col gap-2.5",children:[f.length>0?(0,a.jsx)(C,{label:"Model",children:(0,a.jsx)("select",{value:j,onChange:e=>w(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:f.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):v?(0,a.jsx)(C,{label:"Model",children:(0,a.jsx)("input",{value:j,onChange:e=>w(e.target.value),placeholder:"Enter model id (provider-specific)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}):g?(0,a.jsx)(C,{label:"Model",children:(0,a.jsxs)("select",{value:j,onChange:e=>w(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[0===f.length&&(0,a.jsx)("option",{value:"",children:"Please add a model first"}),f.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))]})}):null,(0,a.jsx)(C,{label:"Endpoint",children:(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[eb,ef]}),q&&(0,a.jsxs)("button",{onClick:()=>B(e=>!e),title:D?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${D?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,a.jsx)(C,{label:"API Key",children:(0,a.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:U?`${U.slice(0,8)}${"•".repeat(Math.min(20,U.length-8))}`:(0,a.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),el.length>0&&(0,a.jsx)(C,{label:"Connection",children:(0,a.jsxs)("select",{value:ei,onChange:e=>ed(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"",children:"Auto (by priority)"}),el.map(e=>{let t=e.providerSpecificData?.chatgptPlanType,s=e.email||e.name||e.id.slice(0,8);return(0,a.jsxs)("option",{value:e.id,children:[s,t?` [${t}]`:""]},e.id)})]})}),(0,a.jsx)(C,{label:d.inputLabel,children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:S,onChange:e=>P(e.target.value),placeholder:d.inputPlaceholder,className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),S&&(0,a.jsx)("button",{type:"button",onClick:()=>P(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})}),k&&(0,a.jsx)(C,{label:"Ref Image",align:"start",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2 w-full",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,a.jsxs)("div",{className:"relative flex-1",children:[(0,a.jsx)("input",{value:T,onChange:e=>R(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),ex())},placeholder:"https://example.com/source.png",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}),T&&(0,a.jsx)("button",{type:"button",onClick:()=>R(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,a.jsx)("button",{type:"button",onClick:ex,disabled:!T.trim()||A.length>=4,className:"shrink-0 px-3 py-1.5 text-sm border border-border rounded-lg hover:border-primary hover:text-primary transition-colors disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-border disabled:hover:text-inherit",children:"Add URL"}),(0,a.jsxs)("button",{type:"button",onClick:()=>O.current?.click(),disabled:A.length>=4,className:"shrink-0 px-3 py-1.5 text-sm border border-border rounded-lg hover:border-primary hover:text-primary transition-colors flex items-center gap-1 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-border disabled:hover:text-inherit",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"upload"}),"Upload"]}),(0,a.jsx)("input",{ref:O,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:eh})]}),A.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:A.map(e=>(0,a.jsxs)("div",{className:"relative group",children:[(0,a.jsx)("img",{src:e.dataUrl,alt:e.name,title:e.name,className:"h-16 w-16 object-cover rounded-lg border border-border bg-sidebar",onError:e=>{e.currentTarget.style.display="none"}}),(0,a.jsx)("button",{type:"button",onClick:()=>{var t;return t=e.id,void _(e=>e.filter(e=>e.id!==t))},className:"absolute -top-1.5 -right-1.5 w-5 h-5 bg-red-500 text-white rounded-full flex items-center justify-center text-[10px] opacity-0 group-hover:opacity-100 transition-opacity",children:"\xd7"})]},e.id))})]})}),(d.extraFields||[]).filter(e=>"image"===t||0===f.length||Array.isArray(N?.params)&&N.params.includes(e.key)).map(e=>(0,a.jsx)(C,{label:e.label,children:"select"===e.type?(0,a.jsx)("select",{value:M[e.key]??"",onChange:t=>K(s=>({...s,[e.key]:t.target.value})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:(e.options||[]).map(e=>(0,a.jsx)("option",{value:e,children:""===e?"(default)":e},e))}):"text"===e.type?(0,a.jsx)("input",{type:"text",value:M[e.key]??"",placeholder:e.placeholder,onChange:t=>K(s=>({...s,[e.key]:t.target.value})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"}):(0,a.jsx)("input",{type:"number",value:M[e.key]??"",min:e.min,max:e.max,onChange:t=>K(s=>({...s,[e.key]:""===t.target.value?"":Number(t.target.value)})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})},e.key)),"image"===t&&(0,a.jsx)(C,{label:"Output Format",children:(0,a.jsxs)("select",{value:Z,onChange:e=>X(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"json",children:"JSON (Base64)"}),(0,a.jsx)("option",{value:"binary",children:"Binary File"})]})}),(0,a.jsxs)("div",{className:"mt-1",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsxs)("button",{onClick:()=>em(eP),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:ec?"check":"content_copy"}),ec?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:eA,disabled:es||!S.trim()||!eg,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:es?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),es?"Running...":"Run"]})]})]}),(0,a.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:eP})]}),(es||W)&&eS&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-2 rounded-lg bg-sidebar border border-border sm:flex-row sm:items-center sm:gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",style:es?{animation:"spin 1s linear infinite"}:void 0,children:es?"progress_activity":"check_circle"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[W?.stage||"starting",!es&&W?.bytesReceived?` \xb7 ${(W.bytesReceived/1024).toFixed(1)} KB`:""]})]}),G?.b64_json&&!H&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Partial preview"}),(0,a.jsx)("img",{src:`data:image/png;base64,${G.b64_json}`,alt:"Partial",className:"max-w-full rounded-lg border border-border mt-1.5 opacity-80"})]}),er&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:er}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,a.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",H&&(0,a.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",H.latencyMs,"ms"]})]}),H&&(0,a.jsxs)("button",{onClick:()=>eu(e_),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:ep?"check":"content_copy"}),ep?"Copied":"Copy"]})]}),(0,a.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:H?e_:d.defaultResponse}),"image"===t&&(ee||H?.data?.data?.[0])&&(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:ee||(H?.data?.data?.[0]?.b64_json?`data:image/png;base64,${H.data.data[0].b64_json}`:H?.data?.data?.[0]?.url||""),download:"image.png",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)("img",{src:ee||(H?.data?.data?.[0]?.b64_json?`data:image/png;base64,${H.data.data[0].b64_json}`:H?.data?.data?.[0]?.url),alt:"Generated",className:"max-w-full rounded-lg border border-border"})]})]})]})]})}function R({providerId:e}){let t=(0,m.wG)(e),s=(0,p.KC)(e).filter(e=>"stt"===e.type),[r,o]=(0,n.useState)([]),l=[...s,...r],[d,c]=(0,n.useState)(s[0]?.id??""),x=l.find(e=>e.id===d),h=Array.isArray(x?.params)?x.params:[],[b,f]=(0,n.useState)(null),[g,y]=(0,n.useState)(""),[v,j]=(0,n.useState)(""),[w,N]=(0,n.useState)("json"),[k,S]=(0,n.useState)(""),[$,P]=(0,n.useState)(""),[A,E]=(0,n.useState)(!1),[_,T]=(0,n.useState)(""),[I,O]=(0,n.useState)(""),[M,K]=(0,n.useState)(null),[U,L]=(0,n.useState)(null),[D,B]=(0,n.useState)(!1),[F,z]=(0,n.useState)(""),{copied:q,copy:J}=(0,u.C)(),{copied:H,copy:V}=(0,u.C)();(0,n.useEffect)(()=>{T(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{P((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&O(e.publicUrl)}).catch(()=>{});let e=()=>{fetch("/api/models/custom",{cache:"no-store"}).then(e=>e.json()).then(e=>{o((e.models||[]).filter(e=>"stt"===e.type&&e.providerAlias===t))}).catch(()=>{})};return e(),window.addEventListener("focus",e),window.addEventListener("customModelChanged",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("customModelChanged",e)}},[t]);let W=A?I:_,Y=d?`${t}/${d}`:"",G=`curl -X POST ${W}/v1/audio/transcriptions \\
51
+ -H "Authorization: Bearer ${$||"YOUR_KEY"}" \\
52
+ -F "file=@${b?.name||"audio.mp3"}" \\
53
+ -F "model=${Y}"${h.includes("language")&&g?` \\
54
+ -F "language=${g}"`:""}${h.includes("response_format")?` \\
55
+ -F "response_format=${w}"`:""}${h.includes("temperature")&&k?` \\
56
+ -F "temperature=${k}"`:""}${h.includes("prompt")&&v?` \\
57
+ -F "prompt=${v}"`:""}`,Q=async()=>{if(!b||!Y)return;B(!0),z(""),K(null);let e=Date.now();try{let t=new FormData;t.append("file",b),t.append("model",Y),h.includes("language")&&g&&t.append("language",g),h.includes("response_format")&&t.append("response_format",w),h.includes("temperature")&&k&&t.append("temperature",k),h.includes("prompt")&&v&&t.append("prompt",v);let s={};$&&(s.Authorization=`Bearer ${$}`);let a=await fetch("/api/v1/audio/transcriptions",{method:"POST",headers:s,body:t});L(Date.now()-e);let r=(a.headers.get("content-type")||"").includes("application/json")?await a.json():await a.text();if(!a.ok)return void z(r?.error?.message||r?.error||r||`HTTP ${a.status}`);K(r)}catch(e){z(e.message||"Network error")}finally{B(!1)}},Z="string"==typeof M?M:M?JSON.stringify(M,null,2):`{
58
+ "text": "Hello world..."
59
+ }`;return(0,a.jsxs)(i.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,a.jsxs)("div",{className:"flex flex-col gap-2.5",children:[l.length>0?(0,a.jsx)(C,{label:"Model",children:(0,a.jsx)("select",{value:d,onChange:e=>c(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:l.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):(0,a.jsx)(C,{label:"Model",children:(0,a.jsx)("input",{value:d,onChange:e=>c(e.target.value),placeholder:"Enter model id",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),(0,a.jsx)(C,{label:"Endpoint",children:(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[W,"/v1/audio/transcriptions"]}),I&&(0,a.jsxs)("button",{onClick:()=>E(e=>!e),title:A?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${A?"border-primary/40 bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"wifi_tethering"}),"Tunnel"]})]})}),(0,a.jsx)(C,{label:"API Key",children:(0,a.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:$?`${$.slice(0,8)}${"•".repeat(Math.min(20,$.length-8))}`:(0,a.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),(0,a.jsx)(C,{label:"Audio File",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("input",{type:"file",accept:"audio/*,video/mp4,.m4a,.mp3,.wav,.ogg,.flac,.webm,.opus",onChange:e=>f(e.target.files?.[0]||null),className:"w-full text-xs text-text-muted file:mr-2 file:py-1 file:px-2.5 file:rounded-lg file:border file:border-border file:bg-background file:text-text-main hover:file:bg-sidebar file:cursor-pointer"}),b&&(0,a.jsxs)("span",{className:"text-xs text-text-muted font-mono",children:[b.name," \xb7 ",(b.size/1024).toFixed(1)," KB"]})]})}),h.includes("language")&&(0,a.jsx)(C,{label:"Language",children:(0,a.jsx)("input",{value:g,onChange:e=>y(e.target.value),placeholder:"e.g. en, vi, ja (auto-detect if empty)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),h.includes("prompt")&&(0,a.jsx)(C,{label:"Prompt",children:(0,a.jsx)("input",{value:v,onChange:e=>j(e.target.value),placeholder:"optional context to improve accuracy",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),h.includes("temperature")&&(0,a.jsx)(C,{label:"Temperature",children:(0,a.jsx)("input",{type:"number",step:"0.1",min:"0",max:"1",value:k,onChange:e=>S(e.target.value),placeholder:"0 - 1 (default 0)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),h.includes("response_format")&&(0,a.jsx)(C,{label:"Response Format",children:(0,a.jsxs)("select",{value:w,onChange:e=>N(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"json",children:"json"}),(0,a.jsx)("option",{value:"text",children:"text"}),(0,a.jsx)("option",{value:"srt",children:"srt"}),(0,a.jsx)("option",{value:"verbose_json",children:"verbose_json"}),(0,a.jsx)("option",{value:"vtt",children:"vtt"})]})}),(0,a.jsxs)("div",{className:"mt-1",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsxs)("button",{onClick:()=>J(G),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:q?"check":"content_copy"}),q?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:Q,disabled:D||!b||!Y,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-white text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:D?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),D?"Transcribing...":"Run"]})]})]}),(0,a.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:G})]}),F&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:F}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,a.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",M&&U&&(0,a.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",U,"ms"]})]}),M&&(0,a.jsxs)("button",{onClick:()=>V(Z),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:H?"check":"content_copy"}),H?"Copied":"Copy"]})]}),(0,a.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:Z})]})]})]})}function O(){let{kind:e,id:t}=(0,r.useParams)(),s=(0,r.useRouter)(),o=m.rj.find(t=>t.id===e),c=(0,m.gC)(t)&&"embedding"===e,p=(0,m.Yg)(t)&&"image"===e,u=c||p,x=async()=>{if(confirm(`Delete this ${p?"Custom Image":"Custom Embedding"} node?`))try{(await fetch(`/api/provider-nodes/${t}`,{method:"DELETE"})).ok&&s.push(`/dashboard/media-providers/${e}`)}catch(e){console.log("Error deleting custom media node:",e)}},[h,b]=(0,n.useState)(null),[f,g]=(0,n.useState)(u),[v,j]=(0,n.useState)(!1),[N,k]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!u)return;let e=!1;return fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(s=>{e||(b((s.nodes||[]).find(e=>e.id===t)||null),g(!1))}).catch(()=>{e||g(!1)}),()=>{e=!0}},[t,u]),(0,n.useEffect)(()=>{let a=!1;return fetch("/api/auth/me",{cache:"no-store"}).then(e=>e.json()).then(r=>{if(!a){if("sub_user"===r.role&&!(r.allowedProviders||[]).includes(t))return void s.replace(`/dashboard/media-providers/${e}`);k(!0)}}).catch(()=>{a||k(!0)}),()=>{a=!0}},[t,e,s]),!o)return(0,r.notFound)();if(!N)return(0,a.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let S=m.Q2[t],C=u?h?{id:t,name:h.name||(p?"Custom Image":"Custom Embedding"),color:p?"#EC4899":"#6366F1",textIcon:p?"CI":"CE"}:null:S;if(!u&&!S||u&&!f&&!h)return(0,r.notFound)();if(u&&f)return(0,a.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let $=u?[e]:C.serviceKinds??["llm"];return u||$.includes(e)?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(l(),{href:`/dashboard/media-providers/${e}`,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"}),o.label]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[(0,a.jsx)("div",{className:"size-12 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${C.color}15`},children:(0,a.jsx)(d.A,{src:`/providers/${C.id}.png`,alt:C.name,size:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",fallbackText:C.textIcon||C.id.slice(0,2).toUpperCase(),fallbackColor:C.color})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[(0,a.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:C.name}),!u&&C.notice?.apiKeyUrl&&(0,a.jsxs)("a",{href:C.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),"Get API Key"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mt-1 flex-wrap",children:[u&&(0,a.jsxs)(i.Ex,{variant:"default",size:"sm",children:["Custom \xb7 ",h?.prefix]}),$.map(t=>(0,a.jsx)(i.Ex,{variant:t===e?"primary":"default",size:"sm",children:t.toUpperCase()},t))]})]}),u&&(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>j(!0),children:"Edit"}),(0,a.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:x,children:"Delete"})]})]})]}),!u&&C.kindNotice?.[e]&&(0,a.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-700 dark:text-amber-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px] mt-0.5",children:"warning"}),(0,a.jsx)("p",{className:"text-sm",children:C.kindNotice[e]})]}),!u&&C.notice?.text&&!C.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:C.notice.text}),C.notice.apiKeyUrl&&(0,a.jsx)("a",{href:C.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),!u&&C.noAuth?(0,a.jsx)(i.gw,{providerId:t}):(0,a.jsx)(y,{providerId:t,providerName:C.name,isOAuth:!1}),"tts"!==e&&"webSearch"!==e&&"webFetch"!==e&&(0,a.jsx)(w,{providerId:t,kindFilter:e,providerAliasOverride:u?h?.prefix:void 0}),!u&&(C.searchConfig||C.fetchConfig||C.ttsConfig||C.sttConfig||C.embeddingConfig||C.searchViaChat)&&(0,a.jsx)(i.Wx,{config:"webFetch"===e?C.fetchConfig:"tts"===e?C.ttsConfig:"stt"===e?C.sttConfig:"embedding"===e?C.embeddingConfig:C.searchConfig||{mode:"chat-completions",defaultModel:C.searchViaChat?.defaultModel,pricingUrl:C.searchViaChat?.pricingUrl,freeTier:C.searchViaChat?.freeTier},provider:C,title:`${o.label} Config`}),"embedding"===e&&(0,a.jsx)(_,{providerId:t,customAlias:h?.prefix}),"tts"===e&&(0,a.jsx)(T,{providerId:t}),"stt"===e&&!u&&(0,a.jsx)(R,{providerId:t}),(!u&&E[e]||p&&E[e])&&(0,a.jsx)(I,{providerId:t,kind:e,providerAliasOverride:h?.prefix,customNode:p?h:null}),c&&(0,a.jsx)(i.x0,{isOpen:v,node:h,onClose:()=>j(!1),onSaved:e=>{b(e),j(!1)}}),p&&(0,a.jsx)(i.VW,{isOpen:v,node:h,onClose:()=>j(!1),onSaved:e=>{b(e),j(!1)}})]}):(0,r.notFound)()}}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=42661)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6620],{16144:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>f});var a=t(95155),i=t(73321),r=t(98500),n=t.n(r),o=t(12115),l=t(35497),c=t(57250),d=t(52679);let m=new Set([]),x={image:"image-combo",tts:"tts-combo"};function h(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function u({provider:e,kind:s,connections:t,isCustom:i}){let r=d.Q2[e.id],o=!!r?.noAuth,m=t.filter(s=>s.provider===e.id),x=m.filter(e=>{let s=h(e);return"active"===s||"success"===s}).length,p=m.filter(e=>{let s=h(e);return"error"===s||"expired"===s||"unavailable"===s}).length,f=m.length,g=f>0&&m.every(e=>!1===e.isActive);return(0,a.jsx)(n(),{href:`/dashboard/media-providers/${s}/${e.id}`,className:"group",children:(0,a.jsx)(l.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${g?"opacity-50":""}`,children:(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.color?.length>7?e.color:(e.color??"#888")+"15"}`},children:(0,a.jsx)(c.A,{src:`/providers/${e.id}.png`,alt:e.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:e.textIcon||e.id.slice(0,2).toUpperCase(),fallbackColor:e.color})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"font-semibold text-sm",children:e.name}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[i&&(0,a.jsx)(l.Ex,{variant:"default",size:"sm",children:"Custom"}),o?(0,a.jsx)(l.Ex,{variant:"success",size:"sm",children:"Ready"}):g?(0,a.jsx)(l.Ex,{variant:"default",size:"sm",children:"Disabled"}):0===f?(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"No connections"}):(0,a.jsxs)(a.Fragment,{children:[x>0&&(0,a.jsxs)(l.Ex,{variant:"success",size:"sm",dot:!0,children:[x," Connected"]}),p>0&&(0,a.jsxs)(l.Ex,{variant:"error",size:"sm",dot:!0,children:[p," Error"]}),0===x&&0===p&&(0,a.jsxs)(l.Ex,{variant:"default",size:"sm",children:[f," Added"]})]})]})]})]})})})}function p({combos:e}){return 0===e.length?null:(0,a.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>(0,a.jsx)(n(),{href:`/dashboard/media-providers/combo/${e.id}`,children:(0,a.jsx)(l.Zp,{padding:"xs",className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors cursor-pointer",children:(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"}),(0,a.jsx)("code",{className:"text-sm font-mono font-medium flex-1 truncate",children:e.name}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1 sm:shrink-0",children:[e.models.slice(0,6).map((e,s)=>{let t="string"==typeof e?e.split("/")[0]:"",i=d.Q2[t];return(0,a.jsx)("div",{title:i?.name||e,className:"size-5 rounded flex items-center justify-center",style:{backgroundColor:`${i?.color??"#888"}15`},children:(0,a.jsx)(c.A,{src:`/providers/${t}.png`,alt:i?.name||t,size:18,className:"object-contain rounded max-w-[18px] max-h-[18px]",fallbackText:i?.textIcon||t.slice(0,2).toUpperCase(),fallbackColor:i?.color})},`${e}-${s}`)}),e.models.length>6&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted ml-1",children:["+",e.models.length-6]})]}),(0,a.jsx)("span",{className:"text-[11px] text-text-muted shrink-0",children:e.models.length}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[16px]",children:"chevron_right"})]})})},e.id))})}function f(){let{kind:e}=(0,i.useParams)(),s=(0,i.useRouter)(),[t,r]=(0,o.useState)([]),[n,c]=(0,o.useState)([]),[h,f]=(0,o.useState)([]),[g,j]=(0,o.useState)(!1),[b,v]=(0,o.useState)(!1),[N,C]=(0,o.useState)([]),[k,w]=(0,o.useState)(!1);(0,o.useEffect)(()=>{("webSearch"===e||"webFetch"===e)&&s.replace("/dashboard/media-providers/web")},[e,s]);let y=d.rj.find(s=>s.id===e),$="embedding"===e,E=m.has(e);if((0,o.useEffect)(()=>{y&&(fetch("/api/auth/me",{cache:"no-store"}).then(e=>e.json()).then(e=>{w("sub_user"===e.role),C("sub_user"===e.role&&e.allowedProviders||[])}).catch(()=>{}),fetch("/api/providers",{cache:"no-store"}).then(e=>e.json()).then(e=>r(e.connections||[])).catch(()=>{}),($||"image"===e)&&fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(e=>c((e.nodes||[]).filter(e=>e.type===($?"custom-embedding":"custom-image")))).catch(()=>{}),E&&fetch("/api/combos",{cache:"no-store"}).then(e=>e.json()).then(e=>f(e.combos||[])).catch(()=>{}))},[$,E,y]),!y)return(0,i.notFound)();let S=(0,d.o5)(e).filter(e=>!k||N.includes(e.id)),z=h.filter(s=>s.kind===e),_=n.filter(e=>!k||N.includes(e.id)).map(s=>({id:s.id,name:s.name||("image"===e?"Custom Image":"Custom Embedding"),color:"image"===e?"#EC4899":"#6366F1",textIcon:"image"===e?"CI":"CE"})),A=[...S,..._],O=async()=>{let t=x[e]||`${e}-combo`,a=t,i=1,r=new Set(h.map(e=>e.name));for(;r.has(a);)a=`${t}-${i++}`;let n=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a,models:[],kind:e})});if(n.ok){let e=await n.json();s.push(`/dashboard/media-providers/combo/${e.id}`)}else alert((await n.json()).error||"Failed to create combo")};return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[!k&&($||"image"===e||E)&&(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[E&&(0,a.jsx)(l.$n,{size:"sm",icon:"add",onClick:O,children:"Create Combo"}),$&&(0,a.jsx)(l.$n,{size:"sm",icon:"add",onClick:()=>j(!0),children:"Add Custom Embedding"}),"image"===e&&(0,a.jsx)(l.$n,{size:"sm",icon:"add",onClick:()=>v(!0),children:"Add Custom Image"})]}),E&&z.length>0&&(0,a.jsx)(p,{combos:z}),0===A.length?(0,a.jsxs)("div",{className:"text-center py-12 border border-dashed border-border rounded-xl text-text-muted text-sm",children:["No providers support ",(0,a.jsx)("strong",{children:y.label})," yet."]}):(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[S.map(s=>(0,a.jsx)(u,{provider:s,kind:e,connections:t},s.id)),_.map(s=>(0,a.jsx)(u,{provider:s,kind:e,connections:t,isCustom:!0},s.id))]}),$&&(0,a.jsx)(l.x0,{isOpen:g,onClose:()=>j(!1),onCreated:e=>{c(s=>[...s,e]),j(!1)}}),"image"===e&&(0,a.jsx)(l.VW,{isOpen:b,onClose:()=>v(!1),onCreated:e=>{c(s=>[...s,e]),v(!1)}})]})}},55973:(e,s,t)=>{Promise.resolve().then(t.bind(t,16144))}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=55973)),_N_E=e.O()}]);
@@ -1,4 +1,4 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8334],{22662:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>b});var a=s(95155),l=s(73321),r=s(12115),i=s(98500),n=s.n(i),o=s(35497),c=s(57250),d=s(52679);let m=/^[a-zA-Z0-9_.\-]+$/,x={webSearch:"Web Search",webFetch:"Web Fetch",image:"Text to Image",tts:"Text To Speech"},h={webSearch:"/v1/search",webFetch:"/v1/web/fetch",image:"/v1/images/generations",tts:"/v1/audio/speech"},u={webSearch:e=>({model:e,query:"What is the latest news about AI?",search_type:"web",max_results:5}),webFetch:e=>({model:e,url:"https://example.com",format:"markdown"}),image:e=>({model:e,prompt:"A cute cat playing piano",n:1,size:"1024x1024"}),tts:e=>({model:e,input:"Hello, this is a test.",voice:"alloy"})};function p(e){return"webSearch"===e||"webFetch"===e?"/dashboard/media-providers/web":`/dashboard/media-providers/${e}`}function b(){let{id:e}=(0,l.useParams)(),t=(0,l.useRouter)(),[s,i]=(0,r.useState)(null),[b,f]=(0,r.useState)(!0),[j,g]=(0,r.useState)(""),[w,y]=(0,r.useState)(""),[v,N]=(0,r.useState)([]),[k,S]=(0,r.useState)(!1),[U,$]=(0,r.useState)(!1),[C,O]=(0,r.useState)([]),[_,T]=(0,r.useState)(!1),[R,A]=(0,r.useState)(null),[L,P]=(0,r.useState)(""),[E,z]=(0,r.useState)(""),[F,D]=(0,r.useState)([]),[I,J]=(0,r.useState)({}),M=async()=>{try{let[t,s,a,l,r,n]=await Promise.all([fetch(`/api/combos/${e}`,{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"}),fetch("/api/usage/logs",{cache:"no-store"}),fetch("/api/keys",{cache:"no-store"}),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/alias",{cache:"no-store"})]);if(n.ok&&J((await n.json()).aliases||{}),l.ok){let e=await l.json();z((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}if(r.ok&&D((await r.json()).connections||[]),!t.ok){i(null),f(!1);return}let o=await t.json();i(o),g(o.name),N(o.models||[]);let c=s.ok?await s.json():{};S(c.comboStrategies?.[o.name]?.fallbackStrategy==="round-robin");let d=a.ok?await a.json():[];O(d.filter(e=>"string"==typeof e&&e.includes(o.name)).slice(0,50))}catch{}f(!1)};(0,r.useEffect)(()=>{M()},[e]);let W=e=>e.trim()?m.test(e)?(y(""),!0):(y("Only letters, numbers, -, _ and ."),!1):(y("Name is required"),!1),H=async t=>{let s=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return!!s.ok||(alert((await s.json()).error||"Failed to save"),!1)},Z=async()=>{!W(j)||j===s.name||await H({name:j})&&await M()},q=async e=>{let t=e?.value||e;if(!t||v.includes(t))return;let s=[...v,t];N(s),await H({models:s})},B=async e=>{let t=v.filter((t,s)=>s!==e);N(t),await H({models:t})},Y=async(e,t)=>{let s=[...v],a=e+t;a<0||a>=s.length||([s[e],s[a]]=[s[a],s[e]],N(s),await H({models:s}))},G=async e=>{S(e);let t=await fetch("/api/settings",{cache:"no-store"}),a={...(t.ok?await t.json():{}).comboStrategies||{}};e?a[s.name]={fallbackStrategy:"round-robin"}:delete a[s.name],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:a})})},K=async()=>{!confirm(`Delete combo "${s.name}"?`)||(await fetch(`/api/combos/${e}`,{method:"DELETE"})).ok&&t.push(p(s.kind))},Q=async()=>{if(T(!0),A(null),P(""),R?.audioUrl)try{URL.revokeObjectURL(R.audioUrl)}catch{}if(R?.imageUrl?.startsWith("blob:"))try{URL.revokeObjectURL(R.imageUrl)}catch{}let e=Date.now();try{let t=h[s.kind],a=u[s.kind](s.name),l={"Content-Type":"application/json"};E&&(l.Authorization=`Bearer ${E}`);let r=await fetch(`/api${t}`,{method:"POST",headers:l,body:JSON.stringify(a)}),i=Date.now()-e;if(!r.ok){let e=await r.json().catch(()=>({}));P(e?.error?.message||e?.error||`HTTP ${r.status}`),A({json:JSON.stringify(e,null,2),latencyMs:i});return}let n=r.headers.get("content-type")||"";if(n.startsWith("image/")){let e=await r.blob();A({imageUrl:URL.createObjectURL(e),latencyMs:i});return}if(n.startsWith("audio/")||"application/octet-stream"===n){let e=await r.blob();A({audioUrl:URL.createObjectURL(e),latencyMs:i});return}let o=await r.json(),c=o?.data?.[0],d=c?.b64_json?`data:image/png;base64,${c.b64_json}`:c?.url||"";A({json:JSON.stringify(function e(t){if(!t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(e);let s={};for(let[a,l]of Object.entries(t))s[a]="b64_json"===a&&"string"==typeof l&&l.length>100?`<${l.length} chars base64>`:e(l);return s}(o),null,2),imageUrl:d,latencyMs:i})}catch(e){P(e.message||"Network error")}T(!1)};if(b)return(0,a.jsx)("div",{className:"text-text-muted text-sm",children:"Loading..."});if(!s)return(0,l.notFound)();let X=x[s.kind]||d.rj.find(e=>e.id===s.kind)?.label||"Combo",V=h[s.kind],ee=s.kind&&u[s.kind]?u[s.kind](s.name):null,et=V?`curl -X POST http://localhost:20128${V} \\
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8334],{22662:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>b});var a=s(95155),l=s(73321),r=s(12115),i=s(98500),n=s.n(i),o=s(35497),c=s(57250),d=s(52679);let m=/^[a-zA-Z0-9_.\-]+$/,x={webSearch:"Web Search",webFetch:"Web Fetch",image:"Text to Image",tts:"Text To Speech"},h={webSearch:"/v1/search",webFetch:"/v1/web/fetch",image:"/v1/images/generations",tts:"/v1/audio/speech"},u={webSearch:e=>({model:e,query:"What is the latest news about AI?",search_type:"web",max_results:5}),webFetch:e=>({model:e,url:"https://example.com",format:"markdown"}),image:e=>({model:e,prompt:"A cute cat playing piano",n:1,size:"1024x1024"}),tts:e=>({model:e,input:"Hello, this is a test.",voice:"alloy"})};function p(e){return"webSearch"===e||"webFetch"===e?"/dashboard/media-providers/web":`/dashboard/media-providers/${e}`}function b(){let{id:e}=(0,l.useParams)(),t=(0,l.useRouter)(),[s,i]=(0,r.useState)(null),[b,f]=(0,r.useState)(!0),[j,g]=(0,r.useState)(""),[w,y]=(0,r.useState)(""),[v,N]=(0,r.useState)([]),[k,S]=(0,r.useState)(!1),[U,$]=(0,r.useState)(!1),[C,O]=(0,r.useState)([]),[_,T]=(0,r.useState)(!1),[R,A]=(0,r.useState)(null),[L,P]=(0,r.useState)(""),[E,z]=(0,r.useState)(""),[D,F]=(0,r.useState)([]),[M,I]=(0,r.useState)({}),J=async()=>{try{let[t,s,a,l,r,n]=await Promise.all([fetch(`/api/combos/${e}`,{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"}),fetch("/api/usage/logs",{cache:"no-store"}),fetch("/api/keys",{cache:"no-store"}),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/alias",{cache:"no-store"})]);if(n.ok&&I((await n.json()).aliases||{}),l.ok){let e=await l.json();z((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}if(r.ok&&F((await r.json()).connections||[]),!t.ok){i(null),f(!1);return}let o=await t.json();i(o),g(o.name),N(o.models||[]);let c=s.ok?await s.json():{};S(c.comboStrategies?.[o.name]?.fallbackStrategy==="round-robin");let d=a.ok?await a.json():[];O(d.filter(e=>"string"==typeof e&&e.includes(o.name)).slice(0,50))}catch{}f(!1)};(0,r.useEffect)(()=>{J()},[e]);let W=e=>e.trim()?m.test(e)?(y(""),!0):(y("Only letters, numbers, -, _ and ."),!1):(y("Name is required"),!1),H=async t=>{let s=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return!!s.ok||(alert((await s.json()).error||"Failed to save"),!1)},Z=async()=>{!W(j)||j===s.name||await H({name:j})&&await J()},q=async e=>{let t=e?.value||e;if(!t||v.includes(t))return;let s=[...v,t];N(s),await H({models:s})},B=async e=>{let t=e?.value||e;if(!t||!v.includes(t))return;let s=v.filter(e=>e!==t);N(s),await H({models:s})},Y=async e=>{let t=v.filter((t,s)=>s!==e);N(t),await H({models:t})},G=async(e,t)=>{let s=[...v],a=e+t;a<0||a>=s.length||([s[e],s[a]]=[s[a],s[e]],N(s),await H({models:s}))},K=async e=>{S(e);let t=await fetch("/api/settings",{cache:"no-store"}),a={...(t.ok?await t.json():{}).comboStrategies||{}};e?a[s.name]={fallbackStrategy:"round-robin"}:delete a[s.name],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:a})})},Q=async()=>{!confirm(`Delete combo "${s.name}"?`)||(await fetch(`/api/combos/${e}`,{method:"DELETE"})).ok&&t.push(p(s.kind))},V=async()=>{if(T(!0),A(null),P(""),R?.audioUrl)try{URL.revokeObjectURL(R.audioUrl)}catch{}if(R?.imageUrl?.startsWith("blob:"))try{URL.revokeObjectURL(R.imageUrl)}catch{}let e=Date.now();try{let t=h[s.kind],a=u[s.kind](s.name),l={"Content-Type":"application/json"};E&&(l.Authorization=`Bearer ${E}`);let r=await fetch(`/api${t}`,{method:"POST",headers:l,body:JSON.stringify(a)}),i=Date.now()-e;if(!r.ok){let e=await r.json().catch(()=>({}));P(e?.error?.message||e?.error||`HTTP ${r.status}`),A({json:JSON.stringify(e,null,2),latencyMs:i});return}let n=r.headers.get("content-type")||"";if(n.startsWith("image/")){let e=await r.blob();A({imageUrl:URL.createObjectURL(e),latencyMs:i});return}if(n.startsWith("audio/")||"application/octet-stream"===n){let e=await r.blob();A({audioUrl:URL.createObjectURL(e),latencyMs:i});return}let o=await r.json(),c=o?.data?.[0],d=c?.b64_json?`data:image/png;base64,${c.b64_json}`:c?.url||"";A({json:JSON.stringify(function e(t){if(!t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(e);let s={};for(let[a,l]of Object.entries(t))s[a]="b64_json"===a&&"string"==typeof l&&l.length>100?`<${l.length} chars base64>`:e(l);return s}(o),null,2),imageUrl:d,latencyMs:i})}catch(e){P(e.message||"Network error")}T(!1)};if(b)return(0,a.jsx)("div",{className:"text-text-muted text-sm",children:"Loading..."});if(!s)return(0,l.notFound)();let X=x[s.kind]||d.rj.find(e=>e.id===s.kind)?.label||"Combo",ee=h[s.kind],et=s.kind&&u[s.kind]?u[s.kind](s.name):null,es=ee?`curl -X POST http://localhost:20128${ee} \\
2
2
  -H "Content-Type: application/json" \\
3
3
  -H "Authorization: Bearer ${E||"YOUR_KEY"}" \\
4
- -d '${JSON.stringify(ee)}'`:"",es=p(s.kind);return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,a.jsx)(n(),{href:es,className:"text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined",children:"arrow_back"})}),(0,a.jsx)("div",{className:"size-10 rounded-lg bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"layers"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[X," Combo"]}),(0,a.jsx)("code",{className:"text-lg font-semibold font-mono",children:s.name})]})]}),(0,a.jsx)(o.$n,{variant:"outline",icon:"delete",onClick:K,className:"text-red-500 border-red-200 hover:bg-red-50",children:"Delete"})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Settings"}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.pd,{label:"Combo Name",value:j,onChange:e=>{g(e.target.value),W(e.target.value)},onBlur:Z,error:w}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and ."})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Round Robin"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Rotate providers across requests instead of strict fallback order."})]}),(0,a.jsx)(o.lM,{checked:k,onChange:G})]})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Providers"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Tried in order (top-down) or rotated when round-robin is on."})]}),(0,a.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>$(!0),children:"Add Provider"})]}),0===v.length?(0,a.jsx)("div",{className:"text-center py-6 border border-dashed border-border rounded-lg text-text-muted text-sm",children:"No providers yet."}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:v.map((e,t)=>{let{providerId:s,model:l}=function(e){if("string"!=typeof e)return{providerId:"",model:""};let t=e.indexOf("/");return t<0?{providerId:e,model:""}:{providerId:e.slice(0,t),model:e.slice(t+1)}}(e),r=d.Q2[s];return(0,a.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted w-5 text-center",children:t+1}),(0,a.jsx)(c.A,{src:`/providers/${s}.png`,alt:r?.name||s,size:24,className:"object-contain rounded shrink-0",fallbackText:r?.textIcon||s.slice(0,2).toUpperCase(),fallbackColor:r?.color}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-sm font-medium truncate",children:r?.name||s}),l&&(0,a.jsx)("code",{className:"text-[10px] text-text-muted font-mono truncate block",children:l})]}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)("button",{onClick:()=>Y(t,-1),disabled:0===t,className:`p-1 rounded ${0===t?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,title:"Move up",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_upward"})}),(0,a.jsx)("button",{onClick:()=>Y(t,1),disabled:t===v.length-1,className:`p-1 rounded ${t===v.length-1?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,title:"Move down",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_downward"})}),(0,a.jsx)("button",{onClick:()=>B(t),className:"p-1 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]})]},`${e}-${t}`)})})]}),s.kind&&V&&(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Test Example"}),(0,a.jsx)(o.$n,{size:"sm",icon:"play_arrow",onClick:Q,disabled:_||0===v.length,children:_?"Running...":"Run"})]}),(0,a.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-x-auto whitespace-pre-wrap break-all",children:et}),L&&(0,a.jsx)("p",{className:"mt-3 text-xs text-red-500 break-words",children:L}),R&&(0,a.jsxs)("div",{className:"mt-3 flex flex-col gap-3",children:[null!=R.latencyMs&&(0,a.jsxs)("span",{className:"text-[11px] text-text-muted",children:["⚡ ",R.latencyMs,"ms"]}),R.imageUrl&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:R.imageUrl,download:"image.png",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)("img",{src:R.imageUrl,alt:"Generated",className:"max-w-full rounded-lg border border-border"})]}),R.audioUrl&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:R.audioUrl,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)("audio",{controls:!0,src:R.audioUrl,className:"w-full"})]}),R.json&&(0,a.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[300px] whitespace-pre-wrap break-all",children:R.json})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Usage Logs"}),0===C.length?(0,a.jsx)("p",{className:"text-xs text-text-muted italic",children:"No usage yet."}):(0,a.jsx)("pre",{className:"text-[11px] font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[400px] whitespace-pre-wrap",children:C.join("\n")})]}),(0,a.jsx)(o.rq,{isOpen:U,onClose:()=>$(!1),onSelect:q,activeProviders:F,modelAliases:I,title:`Add ${X} Model`,kindFilter:s.kind})]})}},91829:(e,t,s)=>{Promise.resolve().then(s.bind(s,22662))}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=91829)),_N_E=e.O()}]);
4
+ -d '${JSON.stringify(et)}'`:"",ea=p(s.kind);return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,a.jsx)(n(),{href:ea,className:"text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined",children:"arrow_back"})}),(0,a.jsx)("div",{className:"size-10 rounded-lg bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"layers"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[X," Combo"]}),(0,a.jsx)("code",{className:"text-lg font-semibold font-mono",children:s.name})]})]}),(0,a.jsx)(o.$n,{variant:"outline",icon:"delete",onClick:Q,className:"text-red-500 border-red-200 hover:bg-red-50",children:"Delete"})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Settings"}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.pd,{label:"Combo Name",value:j,onChange:e=>{g(e.target.value),W(e.target.value)},onBlur:Z,error:w}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and ."})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Round Robin"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Rotate providers across requests instead of strict fallback order."})]}),(0,a.jsx)(o.lM,{checked:k,onChange:K})]})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Providers"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Tried in order (top-down) or rotated when round-robin is on."})]}),(0,a.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>$(!0),children:"Add Provider"})]}),0===v.length?(0,a.jsx)("div",{className:"text-center py-6 border border-dashed border-border rounded-lg text-text-muted text-sm",children:"No providers yet."}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:v.map((e,t)=>{let{providerId:s,model:l}=function(e){if("string"!=typeof e)return{providerId:"",model:""};let t=e.indexOf("/");return t<0?{providerId:e,model:""}:{providerId:e.slice(0,t),model:e.slice(t+1)}}(e),r=d.Q2[s];return(0,a.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted w-5 text-center",children:t+1}),(0,a.jsx)(c.A,{src:`/providers/${s}.png`,alt:r?.name||s,size:24,className:"object-contain rounded shrink-0",fallbackText:r?.textIcon||s.slice(0,2).toUpperCase(),fallbackColor:r?.color}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-sm font-medium truncate",children:r?.name||s}),l&&(0,a.jsx)("code",{className:"text-[10px] text-text-muted font-mono truncate block",children:l})]}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)("button",{onClick:()=>G(t,-1),disabled:0===t,className:`p-1 rounded ${0===t?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,title:"Move up",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_upward"})}),(0,a.jsx)("button",{onClick:()=>G(t,1),disabled:t===v.length-1,className:`p-1 rounded ${t===v.length-1?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,title:"Move down",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_downward"})}),(0,a.jsx)("button",{onClick:()=>Y(t),className:"p-1 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]})]},`${e}-${t}`)})})]}),s.kind&&ee&&(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Test Example"}),(0,a.jsx)(o.$n,{size:"sm",icon:"play_arrow",onClick:V,disabled:_||0===v.length,children:_?"Running...":"Run"})]}),(0,a.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-x-auto whitespace-pre-wrap break-all",children:es}),L&&(0,a.jsx)("p",{className:"mt-3 text-xs text-red-500 break-words",children:L}),R&&(0,a.jsxs)("div",{className:"mt-3 flex flex-col gap-3",children:[null!=R.latencyMs&&(0,a.jsxs)("span",{className:"text-[11px] text-text-muted",children:["⚡ ",R.latencyMs,"ms"]}),R.imageUrl&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:R.imageUrl,download:"image.png",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)("img",{src:R.imageUrl,alt:"Generated",className:"max-w-full rounded-lg border border-border"})]}),R.audioUrl&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:R.audioUrl,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)("audio",{controls:!0,src:R.audioUrl,className:"w-full"})]}),R.json&&(0,a.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[300px] whitespace-pre-wrap break-all",children:R.json})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Usage Logs"}),0===C.length?(0,a.jsx)("p",{className:"text-xs text-text-muted italic",children:"No usage yet."}):(0,a.jsx)("pre",{className:"text-[11px] font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[400px] whitespace-pre-wrap",children:C.join("\n")})]}),(0,a.jsx)(o.rq,{isOpen:U,onClose:()=>$(!1),onSelect:q,onDeselect:B,activeProviders:D,modelAliases:M,title:`Add ${X} Model`,kindFilter:s.kind,addedModelValues:v,closeOnSelect:!1})]})}},91829:(e,t,s)=>{Promise.resolve().then(s.bind(s,22662))}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=91829)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9260],{71088:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>b});var r=t(95155),a=t(98500),i=t.n(a),l=t(12115),o=t(73321),c=t(35497),n=t(57250),d=t(52679);function m(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function x({provider:e,kind:s,connections:t}){let a=d.Q2[e.id],l=!!a?.noAuth,o=t.filter(s=>s.provider===e.id),h=o.filter(e=>{let s=m(e);return"active"===s||"success"===s}).length,p=o.filter(e=>{let s=m(e);return"error"===s||"expired"===s||"unavailable"===s}).length,b=o.length,u=b>0&&o.every(e=>!1===e.isActive);return(0,r.jsx)(i(),{href:`/dashboard/media-providers/${s}/${e.id}`,className:"group",children:(0,r.jsx)(c.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${u?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.color?.length>7?e.color:(e.color??"#888")+"15"}`},children:(0,r.jsx)(n.A,{src:`/providers/${e.id}.png`,alt:e.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:e.textIcon||e.id.slice(0,2).toUpperCase(),fallbackColor:e.color})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-semibold text-sm",children:e.name}),(0,r.jsx)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:l?(0,r.jsx)(c.Ex,{variant:"success",size:"sm",children:"Ready"}):u?(0,r.jsx)(c.Ex,{variant:"default",size:"sm",children:"Disabled"}):0===b?(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"No connections"}):(0,r.jsxs)(r.Fragment,{children:[h>0&&(0,r.jsxs)(c.Ex,{variant:"success",size:"sm",dot:!0,children:[h," Connected"]}),p>0&&(0,r.jsxs)(c.Ex,{variant:"error",size:"sm",dot:!0,children:[p," Error"]}),0===h&&0===p&&(0,r.jsxs)(c.Ex,{variant:"default",size:"sm",children:[b," Added"]})]})})]})]})})})}function h({combos:e}){return 0===e.length?(0,r.jsx)("p",{className:"text-xs text-text-muted italic",children:"No combos yet."}):(0,r.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>(0,r.jsx)(i(),{href:`/dashboard/media-providers/combo/${e.id}`,children:(0,r.jsx)(c.Zp,{padding:"xs",className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors cursor-pointer",children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"}),(0,r.jsx)("code",{className:"text-sm font-mono font-medium flex-1 truncate",children:e.name}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1 sm:shrink-0",children:[e.models.slice(0,6).map((e,s)=>{let t="string"==typeof e?e.split("/")[0]:"",a=d.Q2[t];return(0,r.jsx)("div",{title:a?.name||e,className:"size-5 rounded flex items-center justify-center",style:{backgroundColor:`${a?.color??"#888"}15`},children:(0,r.jsx)(n.A,{src:`/providers/${t}.png`,alt:a?.name||t,size:18,className:"object-contain rounded max-w-[18px] max-h-[18px]",fallbackText:a?.textIcon||t.slice(0,2).toUpperCase(),fallbackColor:a?.color})},`${e}-${s}`)}),e.models.length>6&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted ml-1",children:["+",e.models.length-6]})]}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted shrink-0",children:e.models.length}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[16px]",children:"chevron_right"})]})})},e.id))})}function p({title:e,icon:s,kind:t,providers:a,connections:i,combos:l,onCreateCombo:o}){return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary",children:s}),(0,r.jsx)("h2",{className:"text-base font-semibold",children:e}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["(",a.length," providers \xb7 ",l.length," combos)"]})]}),(0,r.jsx)(c.$n,{size:"sm",icon:"add",onClick:o,children:"Create Combo"})]}),l.length>0&&(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(h,{combos:l})}),0===a.length?(0,r.jsx)("div",{className:"text-center py-8 border border-dashed border-border rounded-xl text-text-muted text-sm",children:"No providers."}):(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:a.map(e=>(0,r.jsx)(x,{provider:e,kind:t,connections:i},e.id))})]})}function b(){let e=(0,o.useRouter)(),[s,t]=(0,l.useState)([]),[a,i]=(0,l.useState)([]),c=async()=>{try{let[e,s]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/combos",{cache:"no-store"})]);e.ok&&t((await e.json()).connections||[]),s.ok&&i((await s.json()).combos||[])}catch{}};(0,l.useEffect)(()=>{c()},[]);let n=(0,d.o5)("webSearch"),m=(0,d.o5)("webFetch"),x=a.filter(e=>"webSearch"===e.kind),h=a.filter(e=>"webFetch"===e.kind),b=async s=>{let t="webSearch"===s?"search-combo":"fetch-combo",r=t,i=1,l=new Set(a.map(e=>e.name));for(;l.has(r);)r=`${t}-${i++}`;let o=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r,models:[],kind:s})});if(o.ok){let s=await o.json();e.push(`/dashboard/media-providers/combo/${s.id}`)}else alert((await o.json()).error||"Failed to create combo")};return(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(p,{title:"Web Search",icon:"search",kind:"webSearch",providers:n,connections:s,combos:x,onCreateCombo:()=>b("webSearch")}),(0,r.jsx)("div",{className:"border-t border-border"}),(0,r.jsx)(p,{title:"Web Fetch",icon:"travel_explore",kind:"webFetch",providers:m,connections:s,combos:h,onCreateCombo:()=>b("webFetch")})]})}},74269:(e,s,t)=>{Promise.resolve().then(t.bind(t,71088))}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=74269)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9260],{71088:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>b});var r=t(95155),a=t(98500),i=t.n(a),l=t(12115),o=t(73321),c=t(35497),n=t(57250),d=t(52679);function m(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function x({provider:e,kind:s,connections:t}){let a=d.Q2[e.id],l=!!a?.noAuth,o=t.filter(s=>s.provider===e.id),h=o.filter(e=>{let s=m(e);return"active"===s||"success"===s}).length,p=o.filter(e=>{let s=m(e);return"error"===s||"expired"===s||"unavailable"===s}).length,b=o.length,u=b>0&&o.every(e=>!1===e.isActive);return(0,r.jsx)(i(),{href:`/dashboard/media-providers/${s}/${e.id}`,className:"group",children:(0,r.jsx)(c.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${u?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.color?.length>7?e.color:(e.color??"#888")+"15"}`},children:(0,r.jsx)(n.A,{src:`/providers/${e.id}.png`,alt:e.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:e.textIcon||e.id.slice(0,2).toUpperCase(),fallbackColor:e.color})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-semibold text-sm",children:e.name}),(0,r.jsx)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:l?(0,r.jsx)(c.Ex,{variant:"success",size:"sm",children:"Ready"}):u?(0,r.jsx)(c.Ex,{variant:"default",size:"sm",children:"Disabled"}):0===b?(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"No connections"}):(0,r.jsxs)(r.Fragment,{children:[h>0&&(0,r.jsxs)(c.Ex,{variant:"success",size:"sm",dot:!0,children:[h," Connected"]}),p>0&&(0,r.jsxs)(c.Ex,{variant:"error",size:"sm",dot:!0,children:[p," Error"]}),0===h&&0===p&&(0,r.jsxs)(c.Ex,{variant:"default",size:"sm",children:[b," Added"]})]})})]})]})})})}function h({combos:e}){return 0===e.length?(0,r.jsx)("p",{className:"text-xs text-text-muted italic",children:"No combos yet."}):(0,r.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>(0,r.jsx)(i(),{href:`/dashboard/media-providers/combo/${e.id}`,children:(0,r.jsx)(c.Zp,{padding:"xs",className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors cursor-pointer",children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"}),(0,r.jsx)("code",{className:"text-sm font-mono font-medium flex-1 truncate",children:e.name}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1 sm:shrink-0",children:[e.models.slice(0,6).map((e,s)=>{let t="string"==typeof e?e.split("/")[0]:"",a=d.Q2[t];return(0,r.jsx)("div",{title:a?.name||e,className:"size-5 rounded flex items-center justify-center",style:{backgroundColor:`${a?.color??"#888"}15`},children:(0,r.jsx)(n.A,{src:`/providers/${t}.png`,alt:a?.name||t,size:18,className:"object-contain rounded max-w-[18px] max-h-[18px]",fallbackText:a?.textIcon||t.slice(0,2).toUpperCase(),fallbackColor:a?.color})},`${e}-${s}`)}),e.models.length>6&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted ml-1",children:["+",e.models.length-6]})]}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted shrink-0",children:e.models.length}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[16px]",children:"chevron_right"})]})})},e.id))})}function p({title:e,icon:s,kind:t,providers:a,connections:i,combos:l,onCreateCombo:o}){return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary",children:s}),(0,r.jsx)("h2",{className:"text-base font-semibold",children:e}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["(",a.length," providers \xb7 ",l.length," combos)"]})]}),o&&(0,r.jsx)(c.$n,{size:"sm",icon:"add",onClick:o,children:"Create Combo"})]}),l.length>0&&(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(h,{combos:l})}),0===a.length?(0,r.jsx)("div",{className:"text-center py-8 border border-dashed border-border rounded-xl text-text-muted text-sm",children:"No providers."}):(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:a.map(e=>(0,r.jsx)(x,{provider:e,kind:t,connections:i},e.id))})]})}function b(){let e=(0,o.useRouter)(),[s,t]=(0,l.useState)([]),[a,i]=(0,l.useState)([]),[c,n]=(0,l.useState)([]),[m,x]=(0,l.useState)(!1),h=async()=>{try{let[e,s,r]=await Promise.all([fetch("/api/auth/me",{cache:"no-store"}),fetch("/api/providers",{cache:"no-store"}),fetch("/api/combos",{cache:"no-store"})]);if(e.ok){let s=await e.json();x("sub_user"===s.role),n("sub_user"===s.role&&s.allowedProviders||[])}s.ok&&t((await s.json()).connections||[]),r.ok&&i((await r.json()).combos||[])}catch{}};(0,l.useEffect)(()=>{h()},[]);let b=(0,d.o5)("webSearch").filter(e=>!m||c.includes(e.id)),u=(0,d.o5)("webFetch").filter(e=>!m||c.includes(e.id)),f=a.filter(e=>"webSearch"===e.kind),j=a.filter(e=>"webFetch"===e.kind),v=async s=>{let t="webSearch"===s?"search-combo":"fetch-combo",r=t,i=1,l=new Set(a.map(e=>e.name));for(;l.has(r);)r=`${t}-${i++}`;let o=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r,models:[],kind:s})});if(o.ok){let s=await o.json();e.push(`/dashboard/media-providers/combo/${s.id}`)}else alert((await o.json()).error||"Failed to create combo")};return(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)(p,{title:"Web Search",icon:"search",kind:"webSearch",providers:b,connections:s,combos:f,onCreateCombo:m?void 0:()=>v("webSearch")}),(0,r.jsx)("div",{className:"border-t border-border"}),(0,r.jsx)(p,{title:"Web Fetch",icon:"travel_explore",kind:"webFetch",providers:u,connections:s,combos:j,onCreateCombo:m?void 0:()=>v("webFetch")})]})}},74269:(e,s,t)=>{Promise.resolve().then(t.bind(t,71088))}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=74269)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6607],{23879:(e,s,a)=>{"use strict";a.d(s,{default:()=>l});var t=a(95155),n=a(12115),i=a(3534),d=a(28777),o=a(52679),c=a(99908);function l(){let[e,s]=(0,n.useState)([]),[a,l]=(0,n.useState)([]),[r,u]=(0,n.useState)({}),[h,f]=(0,n.useState)(!1),[p,w]=(0,n.useState)(null),[g,v]=(0,n.useState)({running:!1,certExists:!1,dnsStatus:{},hasCachedPassword:!1});(0,n.useEffect)(()=>{fetch("/api/auth/me").then(e=>e.json()).then(e=>{"sub_user"===e.role&&(window.location.href="/dashboard/usage")}).catch(()=>{}),S(),y(),k(),b()},[]);let S=async()=>{try{let e=await fetch("/api/providers");if(e.ok){let a=await e.json();s(a.connections||[])}}catch{}},y=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let s=await e.json();l(s.keys||[])}}catch{}},k=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let s=await e.json();u(s.aliases||{})}}catch{}},b=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let s=await e.json();f(s.cloudEnabled||!1)}}catch{}},j=()=>e.filter(e=>!1!==e.isActive),m=Object.entries(i.wn);return(0,t.jsxs)("div",{className:"flex w-full flex-col gap-6",children:[(0,t.jsx)(c.tA,{apiKeys:a,cloudEnabled:h,onStatusChange:v}),(0,t.jsx)("div",{className:"grid gap-3 sm:gap-4",children:m.map(([e,s])=>(0,t.jsx)(c.kn,{tool:s,isExpanded:p===e,onToggle:()=>w(p===e?null:e),serverRunning:g.running,dnsActive:g.dnsStatus?.[e]||!1,hasCachedPassword:g.hasCachedPassword||!1,needsSudoPassword:!1!==g.needsSudoPassword,isWin:!0===g.isWin,apiKeys:a,activeProviders:j(),hasActiveProviders:j().some(e=>(0,d.KC)(e.provider).length>0||(0,o.mq)(e.provider)||(0,o.gb)(e.provider)),modelAliases:r,cloudEnabled:h,onDnsChange:e=>v(s=>({...s,dnsStatus:e.dnsStatus??s.dnsStatus}))},e))})]})}},51167:(e,s,a)=>{Promise.resolve().then(a.bind(a,23879))}},e=>{e.O(0,[2574,3862,1051,5772,1321,5497,4295,8441,3794,7358],()=>e(e.s=51167)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6607],{23879:(e,s,a)=>{"use strict";a.d(s,{default:()=>l});var t=a(95155),n=a(12115),i=a(3534),d=a(28777),o=a(52679),c=a(14259);function l(){let[e,s]=(0,n.useState)([]),[a,l]=(0,n.useState)([]),[r,u]=(0,n.useState)({}),[h,f]=(0,n.useState)(!1),[p,w]=(0,n.useState)(null),[g,v]=(0,n.useState)({running:!1,certExists:!1,dnsStatus:{},hasCachedPassword:!1});(0,n.useEffect)(()=>{fetch("/api/auth/me").then(e=>e.json()).then(e=>{"sub_user"===e.role&&(window.location.href="/dashboard/usage")}).catch(()=>{}),S(),y(),k(),b()},[]);let S=async()=>{try{let e=await fetch("/api/providers");if(e.ok){let a=await e.json();s(a.connections||[])}}catch{}},y=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let s=await e.json();l(s.keys||[])}}catch{}},k=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let s=await e.json();u(s.aliases||{})}}catch{}},b=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let s=await e.json();f(s.cloudEnabled||!1)}}catch{}},j=()=>e.filter(e=>!1!==e.isActive),m=Object.entries(i.wn);return(0,t.jsxs)("div",{className:"flex w-full flex-col gap-6",children:[(0,t.jsx)(c.tA,{apiKeys:a,cloudEnabled:h,onStatusChange:v}),(0,t.jsx)("div",{className:"grid gap-3 sm:gap-4",children:m.map(([e,s])=>(0,t.jsx)(c.kn,{tool:s,isExpanded:p===e,onToggle:()=>w(p===e?null:e),serverRunning:g.running,dnsActive:g.dnsStatus?.[e]||!1,hasCachedPassword:g.hasCachedPassword||!1,needsSudoPassword:!1!==g.needsSudoPassword,isWin:!0===g.isWin,apiKeys:a,activeProviders:j(),hasActiveProviders:j().some(e=>(0,d.KC)(e.provider).length>0||(0,o.mq)(e.provider)||(0,o.gb)(e.provider)),modelAliases:r,cloudEnabled:h,onDnsChange:e=>v(s=>({...s,dnsStatus:e.dnsStatus??s.dnsStatus}))},e))})]})}},51167:(e,s,a)=>{Promise.resolve().then(a.bind(a,23879))}},e=>{e.O(0,[2574,3862,1051,5772,1321,5497,2336,8441,3794,7358],()=>e(e.s=51167)),_N_E=e.O()}]);