@techysy/10router 1.6.0 → 1.6.2

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 (652) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +11 -11
  3. package/app/.next-cli-build/build-manifest.json +2 -2
  4. package/app/.next-cli-build/prerender-manifest.json +21 -21
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/experimental/page.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/experimental/page.js.nft.json +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/experimental/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +4 -4
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  78. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  79. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  80. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  81. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  82. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  83. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  84. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  85. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  86. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  87. package/app/.next-cli-build/server/app/_not-found.html +2 -2
  88. package/app/.next-cli-build/server/app/_not-found.rsc +6 -6
  89. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +6 -6
  90. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +6 -6
  91. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  92. package/app/.next-cli-build/server/app/api/auth/login/route.js +1 -1
  93. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js +1 -1
  96. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js +1 -1
  98. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js +1 -1
  100. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js +1 -1
  102. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js +1 -1
  104. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js +2 -2
  106. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js +1 -1
  108. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js +1 -1
  110. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/auth/status/route.js +1 -1
  112. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/auth/verify-password/route.js +1 -1
  114. package/app/.next-cli-build/server/app/api/auth/verify-password/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
  116. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  118. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
  120. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/claude-profiles/route.js +2 -2
  122. package/app/.next-cli-build/server/app/api/cli-tools/claude-profiles/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  130. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
  132. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  134. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  136. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
  138. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +1 -1
  140. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  142. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +1 -1
  144. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  147. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  149. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  151. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  153. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
  155. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/combos/route.js +1 -1
  157. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/external-quota/[source]/route.js +1 -1
  159. package/app/.next-cli-build/server/app/api/external-quota/[source]/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/gateway-probe/route.js +1 -1
  161. package/app/.next-cli-build/server/app/api/gateway-probe/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js +1 -1
  164. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/headroom/restart/route.js +1 -1
  166. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/headroom/start/route.js +1 -1
  168. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/headroom/status/route.js +1 -1
  170. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/keys/[id]/route.js +1 -1
  175. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/keys/rotate/route.js +1 -1
  177. package/app/.next-cli-build/server/app/api/keys/rotate/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/keys/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
  184. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  186. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
  188. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js +1 -1
  190. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  192. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/models/alias/route.js +1 -1
  194. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/models/availability/route.js +1 -1
  196. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/models/caps/route.js +1 -1
  198. package/app/.next-cli-build/server/app/api/models/caps/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/models/custom/bulk/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  201. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/models/disabled/route.js +1 -1
  203. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  205. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  207. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/network/egress-region/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  210. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/route.js +1 -1
  212. package/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/checkin/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/claim-compensation/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/export/route.js +1 -1
  216. package/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/export/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  218. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  220. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  223. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js +1 -1
  225. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js +1 -1
  227. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  229. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  230. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  232. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js +1 -1
  234. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  236. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  238. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/oauth/qoder/checkin/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/oauth/qoder-cn/checkin/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/oauth/transfer/export/route.js +1 -1
  242. package/app/.next-cli-build/server/app/api/oauth/transfer/export/route.js.nft.json +1 -1
  243. package/app/.next-cli-build/server/app/api/oauth/transfer/import/route.js +1 -1
  244. package/app/.next-cli-build/server/app/api/oauth/transfer/import/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js +1 -1
  246. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js +1 -1
  248. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/desktop-kill/route.js.nft.json +1 -1
  250. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/desktop-status/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js +1 -1
  253. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/pricing/route.js +1 -1
  255. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js +1 -1
  257. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  259. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js +1 -1
  261. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  263. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  265. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  267. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  269. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  270. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  271. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  274. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  276. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  277. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  278. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  279. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  280. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js +1 -1
  281. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js +1 -1
  283. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  284. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js +2 -2
  285. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  286. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js +2 -2
  287. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  288. package/app/.next-cli-build/server/app/api/proxy-pools/route.js +1 -1
  289. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  290. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js +2 -2
  291. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  292. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  293. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  294. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  295. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  296. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js +2 -2
  297. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  298. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  299. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js +2 -2
  300. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  301. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  302. package/app/.next-cli-build/server/app/api/security/status/route.js +1 -1
  303. package/app/.next-cli-build/server/app/api/security/status/route.js.nft.json +1 -1
  304. package/app/.next-cli-build/server/app/api/settings/database/import-usage/route.js +1 -1
  305. package/app/.next-cli-build/server/app/api/settings/database/import-usage/route.js.nft.json +1 -1
  306. package/app/.next-cli-build/server/app/api/settings/database/route.js +1 -1
  307. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  308. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  309. package/app/.next-cli-build/server/app/api/settings/require-login/route.js +1 -1
  310. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  311. package/app/.next-cli-build/server/app/api/settings/route.js +2 -2
  312. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  313. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  314. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  315. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  316. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  317. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
  318. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  319. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  320. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  321. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  322. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  323. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  324. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  325. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js +1 -1
  326. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  327. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js +1 -1
  328. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  329. package/app/.next-cli-build/server/app/api/tunnel/status/route.js +1 -1
  330. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  331. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js +1 -1
  332. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  333. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js +1 -1
  334. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  335. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js +1 -1
  336. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  337. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
  338. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  339. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  340. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
  341. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  342. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  343. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  344. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  345. package/app/.next-cli-build/server/app/api/usage/chart/route.js +1 -1
  346. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  347. package/app/.next-cli-build/server/app/api/usage/dashboard/route.js +1 -1
  348. package/app/.next-cli-build/server/app/api/usage/dashboard/route.js.nft.json +1 -1
  349. package/app/.next-cli-build/server/app/api/usage/history/route.js +1 -1
  350. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  351. package/app/.next-cli-build/server/app/api/usage/logs/route.js +1 -1
  352. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  353. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  354. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  355. package/app/.next-cli-build/server/app/api/usage/quotas/route.js +1 -1
  356. package/app/.next-cli-build/server/app/api/usage/quotas/route.js.nft.json +1 -1
  357. package/app/.next-cli-build/server/app/api/usage/request-details/route.js +1 -1
  358. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  359. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js +1 -1
  360. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  361. package/app/.next-cli-build/server/app/api/usage/stats/route.js +1 -1
  362. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  363. package/app/.next-cli-build/server/app/api/usage/stream/route.js +2 -2
  364. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  365. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  366. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  367. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  368. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  369. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  370. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  371. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  372. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  373. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  374. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  375. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  376. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  377. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +2 -2
  378. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  379. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  380. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  381. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  382. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
  383. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  384. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  385. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  386. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  387. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  388. package/app/.next-cli-build/server/app/api/v1/rerank/route.js +1 -1
  389. package/app/.next-cli-build/server/app/api/v1/rerank/route.js.nft.json +1 -1
  390. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  391. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  392. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  393. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  394. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  395. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  396. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  397. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  398. package/app/.next-cli-build/server/app/api/v1/systemone/route.js +1 -1
  399. package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
  400. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  401. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  402. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  403. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  404. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  405. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  406. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  407. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  408. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  409. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  410. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  411. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  412. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  413. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  414. package/app/.next-cli-build/server/app/api/version/route.js +2 -2
  415. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  416. package/app/.next-cli-build/server/app/api/version/shell-update/route.js.nft.json +1 -1
  417. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  418. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  419. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  420. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  421. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  422. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  423. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  424. package/app/.next-cli-build/server/app/callback.html +2 -2
  425. package/app/.next-cli-build/server/app/callback.rsc +6 -6
  426. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +6 -6
  427. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  428. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +6 -6
  429. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +2 -2
  430. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +8 -8
  431. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +8 -8
  432. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +8 -8
  433. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  434. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +2 -2
  435. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +8 -8
  436. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +8 -8
  437. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +8 -8
  438. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  439. package/app/.next-cli-build/server/app/dashboard/combos.html +2 -2
  440. package/app/.next-cli-build/server/app/dashboard/combos.rsc +8 -8
  441. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +8 -8
  442. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +8 -8
  443. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  444. package/app/.next-cli-build/server/app/dashboard/endpoint.html +2 -2
  445. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +8 -8
  446. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +8 -8
  447. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +8 -8
  448. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  449. package/app/.next-cli-build/server/app/dashboard/experimental.html +2 -2
  450. package/app/.next-cli-build/server/app/dashboard/experimental.rsc +8 -8
  451. package/app/.next-cli-build/server/app/dashboard/experimental.segments/!KGRhc2hib2FyZCk/dashboard/experimental/__PAGE__.segment.rsc +8 -8
  452. package/app/.next-cli-build/server/app/dashboard/experimental.segments/_full.segment.rsc +8 -8
  453. package/app/.next-cli-build/server/app/dashboard/experimental.segments/_tree.segment.rsc +2 -2
  454. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +2 -2
  455. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +8 -8
  456. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +8 -8
  457. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +8 -8
  458. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  459. package/app/.next-cli-build/server/app/dashboard/mitm.html +2 -2
  460. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +8 -8
  461. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +8 -8
  462. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +8 -8
  463. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  464. package/app/.next-cli-build/server/app/dashboard/profile.html +2 -2
  465. package/app/.next-cli-build/server/app/dashboard/profile.rsc +8 -8
  466. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +8 -8
  467. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +8 -8
  468. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  469. package/app/.next-cli-build/server/app/dashboard/providers/new.html +2 -2
  470. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +8 -8
  471. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +8 -8
  472. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +8 -8
  473. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  474. package/app/.next-cli-build/server/app/dashboard/providers.html +2 -2
  475. package/app/.next-cli-build/server/app/dashboard/providers.rsc +8 -8
  476. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +8 -8
  477. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +8 -8
  478. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  479. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +2 -2
  480. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +8 -8
  481. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +8 -8
  482. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +8 -8
  483. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  484. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +2 -2
  485. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +8 -8
  486. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +8 -8
  487. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +8 -8
  488. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
  489. package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  490. package/app/.next-cli-build/server/app/dashboard/quota.rsc +9 -9
  491. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +9 -9
  492. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +9 -9
  493. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  494. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  495. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  496. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  497. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +2 -2
  498. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +6 -6
  499. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +6 -6
  500. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  501. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +6 -6
  502. package/app/.next-cli-build/server/app/dashboard/skills.html +2 -2
  503. package/app/.next-cli-build/server/app/dashboard/skills.rsc +8 -8
  504. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +8 -8
  505. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +8 -8
  506. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  507. package/app/.next-cli-build/server/app/dashboard/token-saver.html +2 -2
  508. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +8 -8
  509. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +8 -8
  510. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +8 -8
  511. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
  512. package/app/.next-cli-build/server/app/dashboard/translator.html +2 -2
  513. package/app/.next-cli-build/server/app/dashboard/translator.rsc +8 -8
  514. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +8 -8
  515. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +8 -8
  516. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  517. package/app/.next-cli-build/server/app/dashboard/usage.html +2 -2
  518. package/app/.next-cli-build/server/app/dashboard/usage.rsc +8 -8
  519. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +8 -8
  520. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +8 -8
  521. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  522. package/app/.next-cli-build/server/app/dashboard.html +2 -2
  523. package/app/.next-cli-build/server/app/dashboard.rsc +8 -8
  524. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +8 -8
  525. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +8 -8
  526. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  527. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  528. package/app/.next-cli-build/server/app/index.html +1 -1
  529. package/app/.next-cli-build/server/app/index.rsc +6 -6
  530. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +6 -6
  531. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +6 -6
  532. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  533. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  534. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  535. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  536. package/app/.next-cli-build/server/app/landing.html +2 -2
  537. package/app/.next-cli-build/server/app/landing.rsc +7 -7
  538. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +7 -7
  539. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  540. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +7 -7
  541. package/app/.next-cli-build/server/app/login/page.js +1 -1
  542. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  543. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  544. package/app/.next-cli-build/server/app/login.html +2 -2
  545. package/app/.next-cli-build/server/app/login.rsc +7 -7
  546. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +7 -7
  547. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  548. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +7 -7
  549. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  550. package/app/.next-cli-build/server/app/page.js +1 -1
  551. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  552. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  553. package/app/.next-cli-build/server/app-paths-manifest.json +11 -11
  554. package/app/.next-cli-build/server/chunks/1329.js +1 -1
  555. package/app/.next-cli-build/server/chunks/1351.js +1 -0
  556. package/app/.next-cli-build/server/chunks/1622.js +1 -0
  557. package/app/.next-cli-build/server/chunks/1806.js +1 -1
  558. package/app/.next-cli-build/server/chunks/1819.js +1 -1
  559. package/app/.next-cli-build/server/chunks/1884.js +1 -1
  560. package/app/.next-cli-build/server/chunks/2132.js +1 -1
  561. package/app/.next-cli-build/server/chunks/2380.js +21 -0
  562. package/app/.next-cli-build/server/chunks/2557.js +1 -1
  563. package/app/.next-cli-build/server/chunks/318.js +7 -8
  564. package/app/.next-cli-build/server/chunks/{5625.js → 3389.js} +1 -1
  565. package/app/.next-cli-build/server/chunks/3500.js +2 -2
  566. package/app/.next-cli-build/server/chunks/3662.js +1 -1
  567. package/app/.next-cli-build/server/chunks/3792.js +1 -1
  568. package/app/.next-cli-build/server/chunks/3943.js +1 -1
  569. package/app/.next-cli-build/server/chunks/3962.js +1 -1
  570. package/app/.next-cli-build/server/chunks/4123.js +1 -1
  571. package/app/.next-cli-build/server/chunks/4575.js +1 -1
  572. package/app/.next-cli-build/server/chunks/4692.js +1 -1
  573. package/app/.next-cli-build/server/chunks/4775.js +1 -1
  574. package/app/.next-cli-build/server/chunks/4906.js +1 -1
  575. package/app/.next-cli-build/server/chunks/4927.js +3 -3
  576. package/app/.next-cli-build/server/chunks/5210.js +27 -28
  577. package/app/.next-cli-build/server/chunks/539.js +1 -1
  578. package/app/.next-cli-build/server/chunks/5527.js +1 -1
  579. package/app/.next-cli-build/server/chunks/5598.js +1 -1
  580. package/app/.next-cli-build/server/chunks/5615.js +1 -1
  581. package/app/.next-cli-build/server/chunks/5663.js +1 -1
  582. package/app/.next-cli-build/server/chunks/5757.js +1 -1
  583. package/app/.next-cli-build/server/chunks/5781.js +2 -2
  584. package/app/.next-cli-build/server/chunks/5837.js +1 -0
  585. package/app/.next-cli-build/server/chunks/6070.js +1 -1
  586. package/app/.next-cli-build/server/chunks/615.js +1 -1
  587. package/app/.next-cli-build/server/chunks/6212.js +1 -0
  588. package/app/.next-cli-build/server/chunks/6306.js +1 -1
  589. package/app/.next-cli-build/server/chunks/6326.js +1 -1
  590. package/app/.next-cli-build/server/chunks/6763.js +1 -1
  591. package/app/.next-cli-build/server/chunks/6790.js +1 -1
  592. package/app/.next-cli-build/server/chunks/6956.js +1 -1
  593. package/app/.next-cli-build/server/chunks/6960.js +1 -1
  594. package/app/.next-cli-build/server/chunks/7067.js +1 -1
  595. package/app/.next-cli-build/server/chunks/7122.js +1 -1
  596. package/app/.next-cli-build/server/chunks/7209.js +1 -0
  597. package/app/.next-cli-build/server/chunks/7247.js +1 -1
  598. package/app/.next-cli-build/server/chunks/7274.js +1 -1
  599. package/app/.next-cli-build/server/chunks/7729.js +1 -1
  600. package/app/.next-cli-build/server/chunks/8145.js +1 -1
  601. package/app/.next-cli-build/server/chunks/8172.js +2 -2
  602. package/app/.next-cli-build/server/chunks/8318.js +1 -1
  603. package/app/.next-cli-build/server/chunks/8439.js +1 -1
  604. package/app/.next-cli-build/server/chunks/8595.js +1 -1
  605. package/app/.next-cli-build/server/chunks/8775.js +1 -1
  606. package/app/.next-cli-build/server/chunks/8895.js +6 -6
  607. package/app/.next-cli-build/server/chunks/8920.js +1 -1
  608. package/app/.next-cli-build/server/chunks/8936.js +1 -0
  609. package/app/.next-cli-build/server/chunks/9154.js +1 -1
  610. package/app/.next-cli-build/server/chunks/9489.js +3 -3
  611. package/app/.next-cli-build/server/chunks/9536.js +1 -0
  612. package/app/.next-cli-build/server/chunks/9609.js +1 -1
  613. package/app/.next-cli-build/server/chunks/9628.js +1 -1
  614. package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
  615. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  616. package/app/.next-cli-build/server/middleware.js +5 -5
  617. package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
  618. package/app/.next-cli-build/server/pages/404.html +2 -2
  619. package/app/.next-cli-build/server/pages/500.html +1 -1
  620. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  621. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  622. package/app/.next-cli-build/static/chunks/1321-3d22643da5d0f152.js +1 -0
  623. package/app/.next-cli-build/static/chunks/5497-ce4781ece1a27ac0.js +7 -0
  624. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-a2f5c1fa12df475b.js +1 -0
  625. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-6db03f8140121a40.js → page-6393f6dfae0de3e6.js} +13 -13
  626. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-9c29e4e5c17e55ea.js +14 -0
  627. package/app/.next-cli-build/static/chunks/app/landing/page-626d89125b768dcf.js +1 -0
  628. package/app/.next-cli-build/static/css/5922b1ff9e56869d.css +1 -0
  629. package/app/package.json +1 -1
  630. package/app/public/i18n/changelog/en.md +548 -513
  631. package/app/public/i18n/changelog/zh-CN.md +546 -511
  632. package/app/public/i18n/changelog/zh-TW.md +548 -513
  633. package/app/public/i18n/literals/zh-CN.json +2129 -2107
  634. package/app/public/i18n/literals/zh-TW.json +1 -0
  635. package/app/public/providers/oxion.png +0 -0
  636. package/app/public/providers/uc-web.png +0 -0
  637. package/app/public/providers/veoaifree-web.png +0 -0
  638. package/package.json +1 -1
  639. package/app/.next-cli-build/server/chunks/2154.js +0 -1
  640. package/app/.next-cli-build/server/chunks/3267.js +0 -1
  641. package/app/.next-cli-build/server/chunks/4386.js +0 -1
  642. package/app/.next-cli-build/server/chunks/6756.js +0 -1
  643. package/app/.next-cli-build/server/chunks/75.js +0 -1
  644. package/app/.next-cli-build/server/chunks/8499.js +0 -21
  645. package/app/.next-cli-build/static/chunks/1321-77ba328dd4d69fdb.js +0 -1
  646. package/app/.next-cli-build/static/chunks/5497-ec8a6308121a2b70.js +0 -7
  647. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-8f6aadfc8bf2eb7b.js +0 -1
  648. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-a6b07fa9d0712cee.js +0 -14
  649. package/app/.next-cli-build/static/chunks/app/landing/page-c6c3a32dd06bc907.js +0 -1
  650. package/app/.next-cli-build/static/css/17275fac82e1641e.css +0 -1
  651. /package/app/.next-cli-build/static/{1q0xTGDYtD52dGw4uiY4- → KyW2U59Ruq5vPQZjvyylc}/_buildManifest.js +0 -0
  652. /package/app/.next-cli-build/static/{1q0xTGDYtD52dGw4uiY4- → KyW2U59Ruq5vPQZjvyylc}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{22759:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>k});var l=s(95155),a=s(12115),r=s(44923),n=s(87256),o=s(39768),i=s(5020),d=s(35497),c=s(76995);let m=Number.MAX_SAFE_INTEGER;function x(e,t){let s=[...e||[]];for(let e of t||[])s.includes(e)||s.push(e);return s}function u(e){return fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboCardOrder:e})})}var p=s(11059),h=s(929);s(88105);var b=s(990),f=s(31474),g=s(73006);let j=/^[a-zA-Z0-9_.\-]+$/,y=[{key:"vision",label:"Vision",icon:"visibility",desc:"Images"},{key:"audioInput",label:"Audio",icon:"graphic_eq",desc:"Audio input"}],v="oc/mimo-v2.6-flash-free",N={enabled:!0,roundRobin:!1,models:[]},w={vision:{...N},pdf:{...N},audioInput:{...N},videoInput:{...N}};function k(){let e,t,[s,r]=(0,a.useState)([]),[n,o]=(0,a.useState)(!0),[i,b]=(0,a.useState)(!1),[f,j]=(0,a.useState)(null),[v,k]=(0,a.useState)([]),[C,S]=(0,a.useState)({}),[M,A]=(0,a.useState)([]),[$,D]=(0,a.useState)(null),[P,R]=(0,a.useState)(null),[F,_]=(0,a.useState)(w),{getCaps:z}=(0,h.yU)(),[I,q]=(0,a.useState)(null),{copied:V,copy:J}=(0,p.C)();(0,a.useEffect)(()=>{B()},[]);let B=async()=>{try{let[t,s,l]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/settings")]),a=await t.json(),n=await s.json(),o=l.ok?await l.json():{};t.ok&&r((a.combos||[]).filter(e=>!e.kind||"llm"===e.kind)),s.ok&&k(n.connections||[]),S(o.comboStrategies||{}),Array.isArray(o.comboCardOrder)&&A(o.comboCardOrder);let i=o.capacityAdapter||{},d={};for(let t of y){var e;d[t.key]=(e=i[t.key],Array.isArray(e)?{enabled:!0,roundRobin:!1,models:e.map(e=>e?.model||e).filter(Boolean)}:e&&"object"==typeof e?{enabled:!1!==e.enabled,roundRobin:!!e.roundRobin,models:Array.isArray(e.models)?e.models.filter(Boolean):[]}:{...N})}_(d)}catch(e){console.log("Error fetching data:",e)}finally{o(!1)}},G=(0,a.useCallback)(e=>{D(null),R(null),$&&e&&$!==e&&A(t=>{let l=function(e,t,s,l){if(!s||!l||s===l)return e;let a=x(e,t),r=a.indexOf(s),n=a.indexOf(l);return -1===r||-1===n?e:(a.splice(r,1),a.splice(n,0,s),a)}(t,s.map(e=>e.id),$,e);return l!==t&&u(l).catch(e=>console.log("Failed to save combo card order:",e)),l})},[$,s]),L=(0,a.useCallback)(e=>{e&&A(t=>{let l=function(e,t,s){if(!s)return e;let l=x(e,t),a=l.indexOf(s);return 0===a?e:(-1===a||l.splice(a,1),l.unshift(s),l)}(t,s.map(e=>e.id),e);return l!==t&&u(l).catch(e=>console.log("Failed to save combo card order:",e)),l})},[s]),Q=async e=>{_(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({capacityAdapter:e})})}catch(e){console.log("Error updating capacity adapter:",e)}},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 B(),b(!1);else{let e=await t.json();alert(e.error||"Failed to create combo")}}catch(e){console.log("Error creating combo:",e)}},Z=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 B(),j(null);else{let e=await s.json();alert(e.error||"Failed to update combo")}}catch(e){console.log("Error updating combo:",e)}},H=async e=>{q({title:"Delete Combo",message:"Delete this combo?",onConfirm:async()=>{q(null);try{(await fetch(`/api/combos/${e}`,{method:"DELETE"})).ok&&r(s.filter(t=>t.id!==e))}catch(e){console.log("Error deleting combo:",e)}}})},U=async(e,t)=>{try{let s={...C},l={...s[e]||{},...t};l.fallbackStrategy&&"fallback"!==l.fallbackStrategy||l.retryOnEmpty?s[e]=l:delete s[e],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:s})}),S(s)}catch(e){console.log("Error updating combo strategy:",e)}};return n?(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(d.Qv,{}),(0,l.jsx)(d.Qv,{})]}):(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("p",{className:"text-sm text-text-muted mt-1",children:(0,g.Tl)("Group models under one name, then pick a strategy per combo:")}),(0,l.jsxs)("ul",{className:"text-sm text-text-muted mt-2 flex flex-col gap-1",children:[(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:(0,g.Tl)("Fallback")})," ",(0,g.Tl)("— tries models in order (next on failure)")]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:(0,g.Tl)("Round Robin")})," ",(0,g.Tl)("— rotates models across requests to spread load")]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:(0,g.Tl)("Fusion")})," ",(0,g.Tl)("— queries all models in parallel, then a judge synthesizes one answer. Best quality, but costs the most: every request bills all panel models + the judge (N+1 calls)")]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:(0,g.Tl)("Router")})," ",(0,g.Tl)("— decision model analyzes user prompt and selects the best-suited member model to answer (fast, capability-aware routing)")]})]})]}),(0,l.jsx)(d.$n,{icon:"add",onClick:()=>b(!0),className:"w-full sm:w-auto whitespace-nowrap",children:"Create Combo"})]}),0===s.length?(0,l.jsx)(d.Zp,{children:(0,l.jsxs)("div",{className:"text-center py-12",children:[(0,l.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"layers"})}),(0,l.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No combos yet"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create model combos with fallback support"}),(0,l.jsx)(d.$n,{icon:"add",onClick:()=>b(!0),className:"w-full sm:w-auto",children:"Create Combo"})]})}):(0,l.jsx)("div",{className:"flex flex-col gap-4",children:(t=Object.fromEntries((e=[...s].sort(function({cardOrder:e=[]}={}){let t=function(e=[]){let t=new Map;return(e||[]).forEach((e,s)=>{t.has(e)||t.set(e,s)}),e=>t.has(e)?t.get(e):m}(e);return(e,s)=>{let l="object"==typeof e&&null!==e?e.id:e,a="object"==typeof s&&null!==s?s.id:s,r=t(l),n=t(a);if(r!==n)return r-n;let o="object"==typeof e&&e?.createdAt?new Date(e.createdAt).getTime():0,i="object"==typeof s&&s?.createdAt?new Date(s.createdAt).getTime():0;if(o&&i&&o!==i)return o-i;let d="object"==typeof e&&e?.name?e.name:String(e??""),c="object"==typeof s&&s?.name?s.name:String(s??"");return d.localeCompare(c)}}({cardOrder:M}))).map(e=>[e.name,e.models])),e.map(e=>(0,l.jsx)(c.A,{cardId:e.id,isDragging:$===e.id,isOver:P===e.id,onDragStart:D,onDragOver:R,onDrop:G,onDragEnd:()=>{D(null),R(null)},children:(0,l.jsx)(T,{combo:e,getCaps:z,comboByName:t,activeProviders:v,copied:V,onCopy:J,onEdit:()=>j(e),onDelete:()=>H(e.id),onPinToTop:L,strategy:C[e.name]||{},onSetStrategy:t=>U(e.name,t)})},e.id)))}),(0,l.jsx)(O,{capacityAdapter:F,onChange:Q,activeProviders:v,getCaps:z}),i&&(0,l.jsx)(E,{isOpen:i,onClose:()=>b(!1),onSave:W,activeProviders:v},"create"),f&&(0,l.jsx)(E,{isOpen:!!f,combo:f,onClose:()=>j(null),onSave:e=>Z(f.id,e),activeProviders:v},f.id),(0,l.jsx)(d.uo,{isOpen:!!I,onClose:()=>q(null),onConfirm:I?.onConfirm,title:I?.title||"Confirm",message:I?.message,variant:"danger"})]})}let C=e=>{if(!e)return"?";if(e>=1e6){let t=e/1e6;return`${Number.isInteger(t)?t:t.toFixed(1)}M`}return`${Math.round(e/1e3)}k`},S=[{value:"fallback",label:(0,g.Tl)("Fallback — try in order")},{value:"round-robin",label:(0,g.Tl)("Round Robin — rotate")},{value:"fusion",label:(0,g.Tl)("Fusion — panel + judge")},{value:"router",label:(0,g.Tl)("Router — decision model picks member")}];function T({combo:e,getCaps:t,comboByName:s={},activeProviders:r=[],copied:n,onCopy:o,onEdit:i,onDelete:c,onPinToTop:m,strategy:x={},onSetStrategy:u}){let[p,h]=(0,a.useState)(!1),[j,y]=(0,a.useState)(!1),v=x.fallbackStrategy||"fallback",N=x.judgeModel||"",w=x.routerModel||"",k=(0,b.Q5)(e.models,s,t);return(0,l.jsxs)(d.Zp,{padding:"sm",className:"group",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,l.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("code",{className:"block truncate font-mono text-sm font-medium",children:e.name}),(0,l.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1",children:[0===e.models.length?(0,l.jsx)("span",{className:"text-xs text-text-muted italic",children:(0,g.Tl)("No models")}):e.models.slice(0,3).map((e,a)=>(0,l.jsxs)("code",{className:"inline-flex items-center gap-1 rounded bg-black/5 px-1.5 py-0.5 font-mono text-xs text-text-muted dark:bg-white/5",children:[(0,l.jsx)("span",{children:e}),(0,l.jsx)(d.nh,{caps:s[e]?(0,b.Q5)(s[e],s,t):t?.(e)})]},a)),e.models.length>3&&(0,l.jsxs)("span",{className:"text-[10px] text-text-muted",children:["+",e.models.length-3," ",(0,g.Tl)("more")]})]}),k&&(0,l.jsxs)("div",{className:"mt-1 flex items-center gap-2 text-[10px] text-text-muted",children:[(0,l.jsxs)("span",{children:["ctx ",C(k.contextWindow)]}),(0,l.jsx)("span",{className:"opacity-40",children:"\xb7"}),(0,l.jsxs)("span",{children:["max ",C(k.maxOutput)]})]}),"fusion"===v&&(0,l.jsxs)("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Judge"}),(0,l.jsxs)("button",{onClick:()=>h(!0),className:"inline-flex max-w-full items-center gap-1 rounded border border-dashed border-primary/40 px-1.5 py-0.5 font-mono text-[11px] text-primary hover:border-primary hover:bg-primary/5 transition-colors",title:"Pick the model that fuses panel answers",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"gavel"}),(0,l.jsx)("span",{className:"truncate",children:N||`Auto — ${e.models[0]||"first model"}`})]}),N&&(0,l.jsx)("button",{onClick:()=>u({judgeModel:""}),className:"p-0.5 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10 transition-colors",title:"Reset judge to Auto",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"close"})})]}),"router"===v&&(0,l.jsxs)("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Router"}),(0,l.jsxs)("button",{onClick:()=>y(!0),className:(0,f.cn)("inline-flex max-w-full items-center gap-1 rounded border border-dashed px-1.5 py-0.5 font-mono text-[11px] transition-colors",w?"border-primary/40 text-primary hover:border-primary hover:bg-primary/5":"border-amber-500/50 text-amber-600 dark:text-amber-400 hover:border-amber-500"),title:w?"Pick the decision model that selects the answering member":"No decision model set — the combo falls back to the normal order",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"alt_route"}),(0,l.jsx)("span",{className:"truncate",children:w||(0,g.Tl)("Select decision model")})]}),w&&(0,l.jsx)("button",{onClick:()=>u({routerModel:""}),className:"p-0.5 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10 transition-colors",title:"Clear decision model (falls back to normal order)",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"close"})})]})]})]}),(0,l.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,l.jsxs)("div",{className:"w-full sm:w-[200px]",children:[(0,l.jsx)(d.l6,{options:S,value:v,onChange:e=>u({fallbackStrategy:e.target.value}),selectClassName:"py-1.5 text-xs"}),"fusion"!==v&&(0,l.jsxs)("label",{className:"mt-1 flex cursor-pointer items-center gap-1.5 text-[11px] text-text-muted",title:(0,g.Tl)("When the model returns an empty answer (content filter or zero output), fall through to the next model. The abandoned attempt still consumes its input tokens."),children:[(0,l.jsx)(d.lM,{size:"sm",checked:!!x.retryOnEmpty,onChange:e=>u({retryOnEmpty:e})}),(0,l.jsx)("span",{children:(0,g.Tl)("Retry on empty")})]})]}),(0,l.jsxs)("div",{className:"grid grid-cols-4 gap-1 sm:flex",children:[(0,l.jsxs)("button",{onClick:t=>{t.stopPropagation(),m?.(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:(0,g.Tl)("Pin to top"),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"vertical_align_top"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:(0,g.Tl)("Pin to top")})]}),(0,l.jsxs)("button",{onClick:t=>{t.stopPropagation(),o(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,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:n===`combo-${e.id}`?"check":"content_copy"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Copy"})]}),(0,l.jsxs)("button",{onClick:i,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,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,l.jsxs)("button",{onClick:c,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,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]})]})]}),p&&(0,l.jsx)(d.rq,{isOpen:p,onClose:()=>h(!1),onSelect:e=>{u({judgeModel:e?.value||""}),h(!1)},activeProviders:r,title:"Select Judge Model",addedModelValues:N?[N]:[],closeOnSelect:!0}),j&&(0,l.jsx)(d.rq,{isOpen:j,onClose:()=>y(!1),onSelect:e=>{u({routerModel:e?.value||""}),y(!1)},activeProviders:r,kindFilter:"systemone",title:(0,g.Tl)("Select Decision Model"),addedModelValues:w?[w]:[],closeOnSelect:!0})]})}function O({capacityAdapter:e,onChange:t,activeProviders:s,getCaps:a}){return(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsx)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("p",{className:"text-sm font-medium",children:(0,g.Tl)("Vision Adapter")}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:(0,g.Tl)("Your model can't read image/audio? Auto-switches to a model in the pool below.")}),(0,l.jsxs)("ul",{className:"mt-1.5 text-[11px] text-text-muted flex flex-col gap-0.5",children:[(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Vision"})," — ",(0,g.Tl)("Images")," (png, jpg, webp, …)"]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Audio"})," — ",(0,g.Tl)("Audio input")]})]})]})}),(0,l.jsx)("div",{className:"flex flex-col gap-4",children:y.map(r=>(0,l.jsx)(M,{cap:r,entry:e[r.key]||N,onChange:s=>t({...e,[r.key]:s}),activeProviders:s,getCaps:a},r.key))})]})}function M({cap:e,entry:t,onChange:s,activeProviders:r,getCaps:n}){let[o,i]=(0,a.useState)(!1),{enabled:c,roundRobin:m,models:x}=t,u=e=>s({...t,...e}),p=(e,t)=>{let s=e+t;if(s<0||s>=x.length)return;let l=[...x];[l[e],l[s]]=[l[s],l[e]],u({models:l})};return(0,l.jsxs)(d.Zp,{padding:"sm",className:`group ${!c?"opacity-50":""}`,children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2.5 sm:items-center",children:[(0,l.jsx)(d.lM,{checked:c,onChange:e=>u({enabled:e}),"aria-label":`${(0,g.Tl)("Enable")} ${e.label} ${(0,g.Tl)("adapter")}`}),(0,l.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:e.icon})}),(0,l.jsx)("div",{className:"min-w-0 flex-1",children:(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("code",{className:"font-mono text-sm font-medium",children:e.label}),(0,l.jsxs)("span",{className:"text-[10px] text-text-muted",children:["— ",(0,g.Tl)(e.desc)]})]})})]}),(0,l.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,l.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted cursor-pointer select-none",children:[(0,l.jsx)(d.lM,{checked:m,onChange:e=>u({roundRobin:e}),disabled:!c,"aria-label":`${(0,g.Tl)("Round-robin")} ${e.label} ${(0,g.Tl)("adapter")}`}),(0,l.jsx)("span",{children:(0,g.Tl)("Round")})]}),(0,l.jsx)(d.$n,{icon:"add",variant:"ghost",size:"sm",onClick:()=>i(!0),disabled:!c,title:`${(0,g.Tl)("Add Model")} — ${e.label}`,children:(0,g.Tl)("Add Model")})]})]}),0===x.length?(0,l.jsxs)("div",{className:"mt-3 py-2 text-center text-xs text-text-muted italic",children:[(0,g.Tl)("No models in pool")," (",(0,g.Tl)("will fallback to")," ",(0,l.jsx)("code",{className:"font-mono",children:v}),")"]}):(0,l.jsx)("div",{className:"mt-3 overflow-hidden rounded-lg border border-border/50",children:(0,l.jsxs)("table",{className:"w-full text-left text-xs",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{className:"border-b border-border/40 bg-black/[0.02] text-text-muted dark:bg-white/[0.02]",children:[(0,l.jsx)("th",{className:"w-12 px-3 py-1.5 text-center font-medium",children:"#"}),(0,l.jsx)("th",{className:"px-3 py-1.5 font-medium",children:(0,g.Tl)("Model")}),(0,l.jsx)("th",{className:"w-24 px-3 py-1.5 text-center font-medium",children:(0,g.Tl)("Order")}),(0,l.jsx)("th",{className:"w-12 px-3 py-1.5 text-right"})]})}),(0,l.jsx)("tbody",{className:"divide-y divide-border/30 font-mono",children:x.map((e,t)=>(0,l.jsxs)("tr",{className:"transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02]",children:[(0,l.jsxs)("td",{className:"px-3 py-2 text-center font-sans text-[11px] text-text-muted",children:["#",t+1]}),(0,l.jsx)("td",{className:"px-3 py-2 text-text-main",children:(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"truncate",children:e}),(0,l.jsx)(d.nh,{caps:n?.(e)}),e===v&&(0,l.jsx)("span",{className:"rounded bg-emerald-500/10 px-1.5 py-0.5 font-sans text-[10px] font-medium text-emerald-600 dark:text-emerald-400",children:"free default"})]})}),(0,l.jsx)("td",{className:"px-3 py-2",children:(0,l.jsxs)("div",{className:"flex items-center justify-center gap-1",children:[(0,l.jsx)("button",{type:"button",onClick:()=>p(t,-1),disabled:!c||0===t,className:`rounded p-1 transition-colors ${!c||0===t?"cursor-not-allowed text-text-muted/20":"text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5"}`,title:(0,g.Tl)("Move up"),children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] leading-none",children:"arrow_upward"})}),(0,l.jsx)("button",{type:"button",onClick:()=>p(t,1),disabled:!c||t===x.length-1,className:`rounded p-1 transition-colors ${!c||t===x.length-1?"cursor-not-allowed text-text-muted/20":"text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5"}`,title:(0,g.Tl)("Move down"),children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] leading-none",children:"arrow_downward"})})]})}),(0,l.jsx)("td",{className:"px-3 py-2 text-right",children:(0,l.jsx)("button",{type:"button",onClick:()=>{let e;u({models:0===(e=x.filter((e,s)=>s!==t)).length?[v]:e})},disabled:!c,className:`rounded p-1 transition-colors ${!c?"cursor-not-allowed text-text-muted/20":"text-text-muted hover:bg-red-500/10 hover:text-red-500"}`,title:(0,g.Tl)("Remove model"),children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] leading-none",children:"close"})})})]},`${e}-${t}`))})]})}),o&&(0,l.jsx)(d.rq,{isOpen:o,onClose:()=>i(!1),onSelect:e=>{x.includes(e.value)||u({models:[...x,e.value]})},onDeselect:e=>{let t=x.filter(t=>t!==e.value);u({models:0===t.length?[v]:t})},activeProviders:r,title:`Add ${e.label} Model`,addedModelValues:x,capFilter:e.key,closeOnSelect:!1})]})}function A({id:e,index:t,model:s,isFirst:r,isLast:i,onEdit:d,onMoveUp:c,onMoveDown:m,onRemove:x}){let{attributes:u,listeners:p,setNodeRef:h,transform:b,isDragging:f}=(0,n.gl)({id:e}),g={transform:o.Ks.Transform.toString(b),opacity:f?.4:1,zIndex:f?999:void 0},[j,y]=(0,a.useState)(!1),[v,N]=(0,a.useState)(s),w=()=>{let e=v.trim();e&&e!==s?d(e):N(s),y(!1)};return(0,l.jsxs)("div",{ref:h,style:g,className:`group flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1 bg-black/[0.02] hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04] transition-colors ${f?"shadow-md ring-1 ring-primary/30":""}`,children:[(0,l.jsx)("button",{...u,...p,type:"button",className:"cursor-grab touch-none p-0.5 rounded text-text-muted hover:text-primary active:cursor-grabbing shrink-0",title:"Drag to reorder",children:(0,l.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,l.jsx)("circle",{cx:"9",cy:"4",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"4",r:"2"}),(0,l.jsx)("circle",{cx:"9",cy:"12",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"12",r:"2"}),(0,l.jsx)("circle",{cx:"9",cy:"20",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"20",r:"2"})]})}),(0,l.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:t+1}),j?(0,l.jsx)("input",{autoFocus:!0,value:v,onChange:e=>N(e.target.value),onBlur:w,onKeyDown:e=>{"Enter"===e.key&&w(),"Escape"===e.key&&(N(s),y(!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,l.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:()=>y(!0),title:"Click to edit",children:s}),(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,l.jsx)("button",{onClick:c,disabled:r,className:`p-0.5 rounded ${r?"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,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,l.jsx)("button",{onClick:m,disabled:i,className:`p-0.5 rounded ${i?"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,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,l.jsx)("button",{onClick:x,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function E({isOpen:e,combo:t,onClose:s,onSave:o,activeProviders:c,kindFilter:m=null}){let[x,u]=(0,a.useState)(t?.name||""),[p,h]=(0,a.useState)(t?.models||[]),[b,f]=(0,a.useState)(!1),[g,y]=(0,a.useState)(!1),[v,N]=(0,a.useState)(""),[w,k]=(0,a.useState)({}),C=(0,r.FR)((0,r.MS)(r.AN,{activationConstraint:{distance:5}}),(0,r.MS)(r.uN,{coordinateGetter:n.JR})),S=p.map((e,t)=>({uid:`item-${t}`,model:e})),T=async()=>{try{let e=await fetch("/api/models/alias");if(!e.ok)return;let t=await e.json();k(t.aliases||{})}catch(e){console.error("Error fetching modal data:",e)}};(0,a.useEffect)(()=>{e&&T()},[e]);let O=e=>e.trim()?j.test(e)?(N(""),!0):(N("Only letters, numbers, -, _ and . allowed"),!1):(N("Name is required"),!1),M=async()=>{O(x)&&(y(!0),await o({name:x.trim(),models:p}),y(!1))},$=!!t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(d.aF,{isOpen:e,onClose:s,title:$?"Edit Combo":"Create Combo",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(d.pd,{label:"Combo Name",value:x,onChange:e=>{let t=e.target.value;u(t),t?O(t):N("")},placeholder:"my-combo",error:v}),(0,l.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and . allowed"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===p.length?(0,l.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,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,l.jsx)(r.Mp,{sensors:C,collisionDetection:r.fp,onDragEnd:e=>{let{active:t,over:s}=e;if(s&&t.id!==s.id){let e=S.findIndex(e=>e.uid===t.id),l=S.findIndex(e=>e.uid===s.id);-1!==e&&-1!==l&&h(t=>(0,n.be)(t,e,l))}},modifiers:[i.FN,i.gj],children:(0,l.jsx)(n.gB,{items:S.map(e=>e.uid),strategy:n._G,children:(0,l.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:S.map(({uid:e,model:t},s)=>(0,l.jsx)(A,{id:e,index:s,model:t,isFirst:0===s,isLast:s===S.length-1,onEdit:e=>{let t=[...p];t[s]=e,h(t)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...p];[t[e-1],t[e]]=[t[e],t[e-1]],h(t)})(s),onMoveDown:()=>(e=>{if(e===p.length-1)return;let t=[...p];[t[e],t[e+1]]=[t[e+1],t[e]],h(t)})(s),onRemove:()=>{h(p.filter((e,t)=>t!==s))}},e))})})}),(0,l.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,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,l.jsx)(d.$n,{onClick:s,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,l.jsx)(d.$n,{onClick:M,fullWidth:!0,size:"sm",disabled:!x.trim()||!!v||g,children:g?"Saving...":$?"Save":"Create"})]})]})}),b&&(0,l.jsx)(d.rq,{isOpen:b,onClose:()=>f(!1),onSelect:e=>{p.includes(e.value)||h([...p,e.value])},onDeselect:e=>{h(p.filter(t=>t!==e.value))},activeProviders:c,modelAliases:w,title:"Add Model to Combo",kindFilter:m,addedModelValues:p,closeOnSelect:!1})]})}},56836:(e,t,s)=>{Promise.resolve().then(s.bind(s,22759))},76995:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var l=s(95155),a=s(14051),r=s.n(a);function n({cardId:e,isDragging:t,isOver:s,onDragStart:a,onDragOver:r,onDrop:o,onDragEnd:i,children:d}){return(0,l.jsx)("div",{draggable:!0,onDragStart:t=>{a?.(e),t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",e)}catch{}},onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect="move",r?.(e)},onDrop:t=>{t.preventDefault(),o?.(e)},onDragEnd:i,className:`min-w-0 transition-all rounded-xl cursor-grab active:cursor-grabbing ${t?"opacity-30 scale-[0.98]":s?"ring-2 ring-primary/60 scale-[1.01]":""}`,children:d})}n.propTypes={cardId:r().string.isRequired,isDragging:r().bool,isOver:r().bool,onDragStart:r().func,onDragOver:r().func,onDrop:r().func,onDragEnd:r().func,children:r().node}},84680:(e,t,s)=>{"use strict";s.d(t,{PM:()=>l.PM,Sj:()=>l.Sj,Vy:()=>l.Vy,fF:()=>l.fF,sl:()=>l.sl,vL:()=>l.vL,y$:()=>l.y$,zM:()=>l.zM});var l=s(44923)}},e=>{e.O(0,[3170,305,5353,1321,5497,8441,3794,7358],()=>e(e.s=56836)),_N_E=e.O()}]);
@@ -1,4 +1,4 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{35139:(e,t,s)=>{Promise.resolve().then(s.bind(s,41095))},41095:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>U});var a=s(95155),r=s(73321),l=s(98500),o=s.n(l),n=s(12115),i=s(73006),d=s(35497),c=s(67852),u=s(88105),m=s(70217),p=s(36109),x=s(90337),h=s(31474),f=s(14051),b=s.n(f);function g({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 y({connection:e,proxyPools:t,isOAuth:s,isFirst:r,isLast:l,onMoveUp:o,onMoveDown:c,onToggleActive:u,onUpdateProxy:h,onEdit:f,onDelete:b}){let[v,j]=(0,n.useState)(!1),[w,N]=(0,n.useState)(!1),k=(0,n.useRef)(null),S=new Map((t||[]).map(e=>[e.id,e])),C=e.providerSpecificData?.proxyPoolId||null,$=C?S.get(C):null,T=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,P=!!C||T,_=$?`Pool: ${$.name}`:C?`Pool: ${C} (inactive/missing)`:T?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",E="",I=$?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;if(I)try{let e=new URL(I);E=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{E=I}let R=$?.noProxy||e.providerSpecificData?.connectionNoProxy||"",A=$?.isActive===!0?"success":C||T?"error":"default",[M,O]=(0,n.useState)(()=>(0,p._)(e));(0,n.useEffect)(()=>{let t=()=>{O(t=>{let s=(0,p._)(e);return(0,p.W)(t,s)?t:s})};t();let s=Object.keys(e).some(t=>t.startsWith("modelLock_")&&e[t])?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[e]);let{state:D,earliestUntil:K}=M,L="partial"===D||"unavailable"===D,U="needs-reauth"===D?(0,i.Tl)("Needs re-auth"):"partial"===D?(0,i.Tl)("Partial"):D;(0,n.useEffect)(()=>{if(!v)return;let e=e=>{k.current&&!k.current.contains(e.target)&&j(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[v]);let B=s?e.name||e.email||e.displayName||"OAuth Account":e.name,F=async e=>{N(!0);try{await h("__none__"===e?null:e)}finally{N(!1),j(!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:o,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,a.jsx)("button",{onClick:c,disabled:l,className:`p-0.5 rounded ${l?"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:B}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[(0,a.jsx)(d.Ex,{variant:(0,m.g)(e.isActive,D),size:"sm",dot:!0,children:!1===e.isActive?"disabled":U||"Unknown"}),P&&(0,a.jsx)(d.Ex,{variant:A,size:"sm",children:"Proxy"}),e.earliestPackageExpiry&&(0,a.jsxs)(d.Ex,{variant:"outline",size:"sm",title:`${(0,i.Tl)("Earliest package")}: ${e.earliestPackageName||(0,i.Tl)("Quota package")} (${new Date(e.earliestPackageExpiry).toLocaleString()})`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px] mr-1",children:"schedule"}),function(e){if(!e)return"";let t=new Date(e).getTime()-Date.now();if(t<=0)return(0,i.Tl)("expired");let s=Math.floor(t/36e5);if(s<24)return`${s}h`;let a=Math.floor(s/24);return a<30?s%24?`${a}d ${s%24}h`:`${a}d`:new Date(e).toLocaleDateString()}(e.earliestPackageExpiry)]}),L&&!1!==e.isActive&&(0,a.jsx)(g,{until:K}),e.lastError&&!1!==e.isActive&&(0,a.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:(0,x.DY)(e.lastError),children:(0,x.DY)(e.lastError)}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]})]}),P&&(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:_,children:_}),E&&(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:E}),R&&(0,a.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:R,children:["no_proxy: ",R]})]})]})]}),(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:k,children:[(0,a.jsxs)("button",{onClick:()=>j(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${P?"text-primary":"text-text-muted hover:text-primary"}`,disabled:w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:w?"progress_activity":"lan"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),v&&(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:()=>F("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!C?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,a.jsx)("button",{onClick:()=>F(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${C===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,a.jsxs)("button",{onClick:f,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:b,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)(d.lM,{size:"sm",checked:e.isActive??!0,onChange:u,title:e.isActive??!0?"Disable":"Enable"})]})]})}function v({isOpen:e,provider:t,providerName:s,proxyPools:r,onSave:l,onClose:o}){let i="__none__",[c,u]=(0,n.useState)({name:"",apiKey:"",priority:1,proxyPoolId:i}),[m,p]=(0,n.useState)(!1),[x,h]=(0,n.useState)(null),[f,b]=(0,n.useState)(!1),g=async()=>{p(!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{p(!1)}},y=async()=>{if(t&&c.apiKey){b(!0);try{let e=!1;try{p(!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{p(!1)}await l({name:c.name,apiKey:c.apiKey,priority:c.priority,proxyPoolId:c.proxyPoolId===i?null:c.proxyPoolId,testStatus:e?"active":"unknown"})}finally{b(!1)}}};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Add ${s||t} API Key`,onClose:o,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-surface focus:outline-none focus:border-primary",value:c.name,onChange:e=>u({...c,name:e.target.value}),placeholder:"Production Key"})]}),(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-surface focus:outline-none focus:border-primary",value:c.apiKey,onChange:e=>u({...c,apiKey:e.target.value})})]}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:g,disabled:!c.apiKey||m||f,variant:"secondary",children:m?"Checking...":"Check"})})]}),x&&(0,a.jsx)(d.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-surface focus:outline-none focus:border-primary",value:c.priority,onChange:e=>u({...c,priority:Number.parseInt(e.target.value)||1})})]}),(0,a.jsx)(d.l6,{label:"Proxy Pool",value:c.proxyPoolId,onChange:e=>u({...c,proxyPoolId:e.target.value}),options:[{value:i,label:"None"},...(r||[]).map(e=>({value:e.id,label:e.name}))]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:y,fullWidth:!0,disabled:!c.name||!c.apiKey||f,children:f?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:o,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function j({providerId:e,isOAuth:t}){let[s,r]=(0,n.useState)([]),[l,o]=(0,n.useState)([]),[c,u]=(0,n.useState)(!0),[m,p]=(0,n.useState)(!1),[x,f]=(0,n.useState)(!1),[b,g]=(0,n.useState)(null),[w,N]=(0,n.useState)(null),[k,S]=(0,n.useState)("1"),[C,$]=(0,n.useState)(!1),[T,P]=(0,n.useState)(null),_=(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"})]),l=await t.json(),n=await s.json(),i=a.ok?await a.json():{};t.ok&&r((l.connections||[]).filter(t=>t.provider===e)),s.ok&&o(n.proxyPools||[]);let d=(i.providerStrategies||{})[e]||{};N(d.fallbackStrategy||null),S(null!=d.stickyRoundRobinLimit?String(d.stickyRoundRobinLimit):"1"),$(!0===d.earliestExpiryFirst)}catch(e){console.log("ConnectionsCard fetch error:",e)}finally{u(!1)}},[e]);(0,n.useEffect)(()=>{let e=setTimeout(_,0);return()=>clearTimeout(e)},[_]);let E=async(t,s,a=C)=>{try{let r=await fetch("/api/settings",{cache:"no-store"}),l=(r.ok?await r.json():{}).providerStrategies||{},o={...l[e]||{}};t?o.fallbackStrategy=t:delete o.fallbackStrategy,"round-robin"===t&&""!==s?o.stickyRoundRobinLimit=Number(s)||3:delete o.stickyRoundRobinLimit,a?o.earliestExpiryFirst=!0:delete o.earliestExpiryFirst;let n={...l};0===Object.keys(o).length?delete n[e]:n[e]=o,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:n})})}catch(e){console.log("saveStrategy error:",e)}},I=async(e,t)=>{let a=[...s];[a[e],a[t]]=[a[t],a[e]],r(a);try{await Promise.all([fetch(`/api/providers/${a[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${a[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch{await _()}},R=async e=>{P({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{P(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&r(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&&r(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("toggle error:",e)}},M=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&r(s=>s.map(s=>s.id===e?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("proxy error:",e)}},O=async t=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})})).ok&&(await _(),p(!1))}catch(e){console.log("save apikey error:",e)}},D=async e=>{try{(await fetch(`/api/providers/${b.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await _(),f(!1))}catch(e){console.log("update connection error:",e)}};return c?(0,a.jsx)(d.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)(d.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:(0,i.Tl)("Connections")}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",title:(0,i.Tl)("Prioritize accounts whose quota (packages, subscription windows, balances) expires soonest"),children:(0,i.Tl)("Earliest Expiry First")}),(0,a.jsx)(d.lM,{checked:C,onChange:e=>{$(e),E(w,k,e)}})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:(0,h.cn)("text-xs font-medium",C?"text-text-muted/50 cursor-not-allowed":"text-text-muted"),title:C?(0,i.Tl)("Disabled while Earliest Expiry First is active (earliest-expiry takes precedence over round-robin)"):void 0,children:(0,i.Tl)("Round Robin")}),(0,a.jsx)(d.lM,{checked:"round-robin"===w,disabled:C,onChange:e=>{let t=e?"round-robin":null;N(t),e&&!k&&S("1"),E(t,e?k||"1":k,C)}}),"round-robin"===w&&(0,a.jsxs)("div",{className:(0,h.cn)("flex flex-wrap items-center gap-1.5",C&&"opacity-50 pointer-events-none"),children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:(0,i.Tl)("Sticky:")}),(0,a.jsx)("input",{type:"number",min:1,value:k,disabled:C,onChange:e=>{S(e.target.value),E("round-robin",e.target.value,C)},className:"w-16 px-2 py-1 text-xs border border-border rounded-md bg-surface focus:outline-none focus:border-primary"})]})]})]})]}),0===s.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)(d.$n,{size:"sm",icon:"add",onClick:()=>p(!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:s.map((e,r)=>(0,a.jsx)(y,{connection:e,proxyPools:l,isOAuth:t,isFirst:0===r,isLast:r===s.length-1,onMoveUp:()=>I(r,r-1),onMoveDown:()=>I(r,r+1),onToggleActive:t=>A(e.id,t),onUpdateProxy:t=>M(e.id,t),onEdit:()=>{g(e),f(!0)},onDelete:()=>R(e.id)},e.id))}),(0,a.jsx)("div",{className:"mt-4 flex justify-stretch sm:justify-start",children:(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>p(!0),children:"Add"})})]})]}),(0,a.jsx)(v,{isOpen:m,provider:e,proxyPools:l,onSave:O,onClose:()=>p(!1)}),(0,a.jsx)(d.wI,{isOpen:x,connection:b,proxyPools:l,onSave:D,onClose:()=>f(!1)}),(0,a.jsx)(d.uo,{isOpen:!!T,onClose:()=>P(null),onConfirm:T?.onConfirm,title:T?.title||"Confirm",message:T?.message,variant:"danger"})]})}g.propTypes={until:b().string.isRequired},y.propTypes={connection:b().shape({id:b().string,name:b().string,email:b().string,displayName:b().string,testStatus:b().string,isActive:b().bool,lastError:b().string,priority:b().number}).isRequired,proxyPools:b().array,isOAuth:b().bool.isRequired,isFirst:b().bool.isRequired,isLast:b().bool.isRequired,onMoveUp:b().func.isRequired,onMoveDown:b().func.isRequired,onToggleActive:b().func.isRequired,onUpdateProxy:b().func,onEdit:b().func.isRequired,onDelete:b().func.isRequired},v.propTypes={isOpen:b().bool.isRequired,provider:b().string,providerName:b().string,proxyPools:b().array,onSave:b().func.isRequired,onClose:b().func.isRequired},j.propTypes={providerId:b().string.isRequired,isOAuth:b().bool};var w=s(28777),N=s(11059);function k({model:e,fullModel:t,copied:s,onCopy:r,testStatus:l,isCustom:o,isFree:n,onDeleteAlias:d,onTest:c,isTesting:u}){let m="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 min-w-0",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",style:m?{color:m}:void 0,children:"ok"===l?"check_circle":"error"===l?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:[(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded truncate max-w-full",title:t,children:t}),e.name&&(0,a.jsx)("span",{className:"text-[9px] text-text-muted/70 italic pl-1 truncate max-w-full",children:e.name})]}),c&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:c,disabled:u,className:`p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-opacity ${u?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:u?{animation:"spin 1s linear infinite"}:void 0,children:u?"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:u?"Testing...":"Test"})]}),(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:()=>r(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:s===`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:s===`model-${e.id}`?"Copied!":"Copy"})]}),n&&(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"}),e.requiresSession&&(0,a.jsx)("span",{className:"text-[10px] font-bold text-amber-600 dark:text-amber-400 bg-amber-500/10 px-1.5 py-0.5 rounded cursor-help",title:(0,i.Tl)("Requires MiMo Desktop sign-in — API key alone cannot reach this model"),children:(0,i.Tl)("Desktop sign-in")}),o&&(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 S({isOpen:e,onSave:t,onClose:s}){let[r,l]=(0,n.useState)(""),o=()=>{r.trim()&&(t(r.trim()),l(""))};return(0,a.jsx)(d.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-surface focus:outline-none focus:border-primary",value:r,onChange:e=>l(e.target.value),onKeyDown:e=>"Enter"===e.key&&o(),placeholder:"e.g. tts-1-hd",autoFocus:!0})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:o,fullWidth:!0,disabled:!r.trim(),children:"Add"}),(0,a.jsx)(d.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function C({providerId:e,kindFilter:t,providerAliasOverride:s}){let{copied:r,copy:l}=(0,N.C)(),[o,i]=(0,n.useState)({}),[c,m]=(0,n.useState)([]),[p,x]=(0,n.useState)({}),[h,f]=(0,n.useState)(null),[b,g]=(0,n.useState)(""),[y,v]=(0,n.useState)(!1),j=s||(0,u.wG)(e),$=t||"llm",T=(0,n.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/models/alias"),fetch("/api/models/custom",{cache:"no-store"})]),s=await e.json(),a=await t.json();e.ok&&i(s.aliases||{}),t.ok&&m(a.models||[])}catch(e){console.log("ModelsCard fetch error:",e)}},[]);(0,n.useEffect)(()=>{T()},[T]);let P=async(e,t)=>{let s=`${j}/${e}`;try{(await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})})).ok&&await T()}catch(e){console.log("set alias error:",e)}},_=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await T()}catch(e){console.log("delete alias error:",e)}},E=async e=>{try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:j,id:e,type:$})})).ok&&(await T(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("add custom model error:",e)}},I=async e=>{try{let t=new URLSearchParams({providerAlias:j,id:e,type:$});(await fetch(`/api/models/custom?${t}`,{method:"DELETE"})).ok&&(await T(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("delete custom model error:",e)}},R=async e=>{if(!h){f(e);try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${j}/${e}`,kind:t})}),a=await s.json();x(t=>({...t,[e]:a.ok?"ok":"error"})),g(a.ok?"":a.error||"Model not reachable")}catch{x(t=>({...t,[e]:"error"})),g("Network error")}finally{f(null)}}},A=(0,w.KC)(e),M=t?A.filter(e=>e.kinds?e.kinds.includes(t):(0,w.CP)(e,"llm")===t):A,O=c.filter(e=>e.providerAlias===j&&(0,w.CP)(e,"llm")===$&&!M.some(t=>t.id===e.id));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d.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()}`:""]})}),b&&(0,a.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:b}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[M.map(e=>{let t=`${j}/${e.id}`,s=Object.entries(o).find(([,e])=>e===t)?.[0];return(0,a.jsx)(k,{model:e,fullModel:`${j}/${e.id}`,alias:s,copied:r,onCopy:l,onSetAlias:t=>P(e.id,t),onDeleteAlias:()=>_(s),testStatus:p[e.id],onTest:()=>R(e.id),isTesting:h===e.id,isFree:e.isFree},e.id)}),O.map(e=>(0,a.jsx)(k,{model:{id:e.id,name:e.name},fullModel:`${j}/${e.id}`,copied:r,onCopy:l,onSetAlias:()=>{},onDeleteAlias:()=>I(e.id),testStatus:p[e.id],onTest:()=>R(e.id),isTesting:h===e.id,isCustom:!0},`${e.id}-${e.type}`)),(0,a.jsxs)("button",{onClick:()=>v(!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)(S,{isOpen:y,onSave:async e=>{await E(e),v(!1)},onClose:()=>v(!1)})]})}function $({label:e,children:t}){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})]})}k.propTypes={model:b().shape({id:b().string.isRequired}).isRequired,fullModel:b().string.isRequired,copied:b().string,onCopy:b().func.isRequired,testStatus:b().oneOf(["ok","error"]),isCustom:b().bool,isFree:b().bool,onDeleteAlias:b().func,onTest:b().func,isTesting:b().bool},S.propTypes={isOpen:b().bool.isRequired,onSave:b().func.isRequired,onClose:b().func.isRequired},C.propTypes={providerId:b().string.isRequired,kindFilter:b().string,providerAliasOverride:b().string};let T={webSearch:{inputLabel:"Query",inputPlaceholder:"What is the latest news about AI?",defaultInput:"What is the latest news about AI?",bodyKey:"query",defaultResponse:`{
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{13031:(e,t,s)=>{"use strict";s.d(t,{B:()=>a,M:()=>i});let a={PACK_ASSET:"pack_asset",ROLLING_SUBSCRIPTION:"subscription",PURE_BALANCE:"balance",GATEWAY_FREE:"gateway_free",GENERIC:"generic"},r=new Set(["codebuddy-cn","codebuddy-intl","qoder","qoder-cn"]),l=new Set(["antigravity","github","codex","commandcode","glm","glm-cn"]),o=new Set(["deepseek","stepfun","stepfun-cn","openai","anthropic","minimax","minimax-cn","minimax-code","minimax-code-global","siliconflow-cn","groq","openrouter","together","fireworks","nebius","hyperbolic","chutes","cohere","mistral","river","modelscope","oxion","baidu","kimi","azure","step_plan"]),n=new Set(["zcode-free","minimax-free","trae-free"]);function i(e){if(!e||"string"!=typeof e)return a.GENERIC;let t=e.toLowerCase().trim();return r.has(t)?a.PACK_ASSET:l.has(t)?a.ROLLING_SUBSCRIPTION:o.has(t)?a.PURE_BALANCE:n.has(t)?a.GATEWAY_FREE:a.GENERIC}},35139:(e,t,s)=>{Promise.resolve().then(s.bind(s,41095))},41095:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>K});var a=s(95155),r=s(73321),l=s(98500),o=s.n(l),n=s(12115),i=s(73006),d=s(35497),c=s(67852),u=s(88105),m=s(70217),p=s(36109),x=s(90337),h=s(31474),f=s(14051),b=s.n(f),g=s(13031);function y({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 v({connection:e,proxyPools:t,isOAuth:s,isFirst:r,isLast:l,onMoveUp:o,onMoveDown:c,onToggleActive:u,onUpdateProxy:h,onEdit:f,onDelete:b}){let[g,j]=(0,n.useState)(!1),[w,N]=(0,n.useState)(!1),k=(0,n.useRef)(null),S=new Map((t||[]).map(e=>[e.id,e])),C=e.providerSpecificData?.proxyPoolId||null,$=C?S.get(C):null,T=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,E=!!C||T,P=$?`Pool: ${$.name}`:C?`Pool: ${C} (inactive/missing)`:T?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",_="",R=$?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;if(R)try{let e=new URL(R);_=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{_=R}let A=$?.noProxy||e.providerSpecificData?.connectionNoProxy||"",I=$?.isActive===!0?"success":C||T?"error":"default",[M,O]=(0,n.useState)(()=>(0,p._)(e));(0,n.useEffect)(()=>{let t=()=>{O(t=>{let s=(0,p._)(e);return(0,p.W)(t,s)?t:s})};t();let s=Object.keys(e).some(t=>t.startsWith("modelLock_")&&e[t])?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[e]);let{state:L,earliestUntil:B}=M,D="partial"===L||"unavailable"===L,U="needs-reauth"===L?(0,i.Tl)("Needs re-auth"):"partial"===L?(0,i.Tl)("Partial"):L;(0,n.useEffect)(()=>{if(!g)return;let e=e=>{k.current&&!k.current.contains(e.target)&&j(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]);let K=s?e.name||e.email||e.displayName||"OAuth Account":e.name,F=async e=>{N(!0);try{await h("__none__"===e?null:e)}finally{N(!1),j(!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:o,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,a.jsx)("button",{onClick:c,disabled:l,className:`p-0.5 rounded ${l?"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:K}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[(0,a.jsx)(d.Ex,{variant:(0,m.g)(e.isActive,L),size:"sm",dot:!0,children:!1===e.isActive?"disabled":U||"Unknown"}),E&&(0,a.jsx)(d.Ex,{variant:I,size:"sm",children:"Proxy"}),e.earliestPackageExpiry&&(0,a.jsxs)(d.Ex,{variant:"outline",size:"sm",title:`${(0,i.Tl)("Earliest package")}: ${e.earliestPackageName||(0,i.Tl)("Quota package")} (${new Date(e.earliestPackageExpiry).toLocaleString()})`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px] mr-1",children:"schedule"}),function(e){if(!e)return"";let t=new Date(e).getTime()-Date.now();if(t<=0)return(0,i.Tl)("expired");let s=Math.floor(t/36e5);if(s<24)return`${s}h`;let a=Math.floor(s/24);return a<30?s%24?`${a}d ${s%24}h`:`${a}d`:new Date(e).toLocaleDateString()}(e.earliestPackageExpiry)]}),D&&!1!==e.isActive&&(0,a.jsx)(y,{until:B}),e.lastError&&!1!==e.isActive&&(0,a.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:(0,x.DY)(e.lastError),children:(0,x.DY)(e.lastError)}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]})]}),E&&(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}),_&&(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:A,children:["no_proxy: ",A]})]})]})]}),(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:k,children:[(0,a.jsxs)("button",{onClick:()=>j(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${E?"text-primary":"text-text-muted hover:text-primary"}`,disabled:w,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:w?"progress_activity":"lan"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),g&&(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:()=>F("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!C?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,a.jsx)("button",{onClick:()=>F(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${C===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,a.jsxs)("button",{onClick:f,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:b,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)(d.lM,{size:"sm",checked:e.isActive??!0,onChange:u,title:e.isActive??!0?"Disable":"Enable"})]})]})}function j({isOpen:e,provider:t,providerName:s,proxyPools:r,onSave:l,onClose:o}){let i="__none__",[c,u]=(0,n.useState)({name:"",apiKey:"",priority:1,proxyPoolId:i}),[m,p]=(0,n.useState)(!1),[x,h]=(0,n.useState)(null),[f,b]=(0,n.useState)(!1),g=async()=>{p(!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{p(!1)}},y=async()=>{if(t&&c.apiKey){b(!0);try{let e=!1;try{p(!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{p(!1)}await l({name:c.name,apiKey:c.apiKey,priority:c.priority,proxyPoolId:c.proxyPoolId===i?null:c.proxyPoolId,testStatus:e?"active":"unknown"})}finally{b(!1)}}};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Add ${s||t} API Key`,onClose:o,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-surface focus:outline-none focus:border-primary",value:c.name,onChange:e=>u({...c,name:e.target.value}),placeholder:"Production Key"})]}),(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-surface focus:outline-none focus:border-primary",value:c.apiKey,onChange:e=>u({...c,apiKey:e.target.value})})]}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:g,disabled:!c.apiKey||m||f,variant:"secondary",children:m?"Checking...":"Check"})})]}),x&&(0,a.jsx)(d.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-surface focus:outline-none focus:border-primary",value:c.priority,onChange:e=>u({...c,priority:Number.parseInt(e.target.value)||1})})]}),(0,a.jsx)(d.l6,{label:"Proxy Pool",value:c.proxyPoolId,onChange:e=>u({...c,proxyPoolId:e.target.value}),options:[{value:i,label:"None"},...(r||[]).map(e=>({value:e.id,label:e.name}))]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:y,fullWidth:!0,disabled:!c.name||!c.apiKey||f,children:f?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:o,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function w({providerId:e,isOAuth:t}){let s,[r,l]=(0,n.useState)([]),[o,c]=(0,n.useState)([]),[u,m]=(0,n.useState)(!0),[p,x]=(0,n.useState)(!1),[f,b]=(0,n.useState)(!1),[y,N]=(0,n.useState)(null),[k,S]=(0,n.useState)(null),[C,$]=(0,n.useState)("1"),[T,E]=(0,n.useState)(!1),[P,_]=(0,n.useState)("priority"),[R,A]=(0,n.useState)(null),I=(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(),o=await s.json(),n=a.ok?await a.json():{};t.ok&&l((r.connections||[]).filter(t=>t.provider===e)),s.ok&&c(o.proxyPools||[]);let i=(n.providerStrategies||{})[e]||{};S(i.fallbackStrategy||null),$(null!=i.stickyRoundRobinLimit?String(i.stickyRoundRobinLimit):"1"),E(!0===i.earliestExpiryFirst),_(i.balanceStrategy||"priority")}catch(e){console.log("ConnectionsCard fetch error:",e)}finally{m(!1)}},[e]);(0,n.useEffect)(()=>{let e=setTimeout(I,0);return()=>clearTimeout(e)},[I]);let M=async(t,s,a=T,r=P)=>{try{let l=await fetch("/api/settings",{cache:"no-store"}),o=(l.ok?await l.json():{}).providerStrategies||{},n={...o[e]||{}};t?n.fallbackStrategy=t:delete n.fallbackStrategy,"round-robin"===t&&""!==s?n.stickyRoundRobinLimit=Number(s)||3:delete n.stickyRoundRobinLimit,a?n.earliestExpiryFirst=!0:delete n.earliestExpiryFirst,r&&"priority"!==r?n.balanceStrategy=r:delete n.balanceStrategy;let i={...o};0===Object.keys(n).length?delete i[e]:i[e]=n,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:i})})}catch(e){console.log("saveStrategy error:",e)}},O=async(e,t)=>{let s=[...r];[s[e],s[t]]=[s[t],s[e]],l(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 I()}},L=async e=>{A({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{A(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&l(t=>t.filter(t=>t.id!==e))}catch(e){console.log("delete error:",e)}}})},B=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&l(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("toggle error:",e)}},D=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&l(s=>s.map(s=>s.id===e?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("proxy error:",e)}},U=async t=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})})).ok&&(await I(),x(!1))}catch(e){console.log("save apikey error:",e)}},K=async e=>{try{(await fetch(`/api/providers/${y.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await I(),b(!1))}catch(e){console.log("update connection error:",e)}};return u?(0,a.jsx)(d.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)(d.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:(0,i.Tl)("Connections")}),(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-4",children:(s=(0,g.M)(e))===g.B.PACK_ASSET?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",title:(0,i.Tl)("Prioritize burning resource packs that are nearest to permanent expiration"),children:(0,i.Tl)("Earliest Pack Expiry")}),(0,a.jsx)(d.lM,{checked:T,onChange:e=>{E(e),M(k,C,e,P)}})]}):s===g.B.ROLLING_SUBSCRIPTION?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",title:(0,i.Tl)("Relay between accounts and hand off to next carrier when window reaches 5% red zone"),children:(0,i.Tl)("Subscription Relay")}),(0,a.jsx)(d.lM,{checked:T,onChange:e=>{E(e),M(k,C,e,P)}})]}):s===g.B.PURE_BALANCE?(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:(0,i.Tl)("Scheduling Preference")}),(0,a.jsx)(d.l6,{value:P,onChange:e=>{let t=e.target.value;_(t),"round-robin"===t?(S("round-robin"),C||$("1"),M("round-robin",C||"1",!1,t)):(S(null),M(null,C,!1,t))},options:[{value:"priority",label:(0,i.Tl)("Manual Priority (#1 → #2)")},{value:"lowest-first",label:(0,i.Tl)("Lowest Balance First")},{value:"highest-first",label:(0,i.Tl)("Highest Balance First")},{value:"round-robin",label:(0,i.Tl)("Round Robin (Balanced)")}],selectClassName:"!py-1 !text-xs w-48"})]}),"round-robin"===P&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:(0,i.Tl)("Sticky:")}),(0,a.jsx)("input",{type:"number",min:1,value:C,onChange:e=>{$(e.target.value),M("round-robin",e.target.value,!1,P)},className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-surface focus:outline-none focus:border-primary"})]})]}):s===g.B.GATEWAY_FREE?(0,a.jsx)("span",{className:"text-xs text-text-muted bg-surface px-2.5 py-1 rounded-md border border-border",children:(0,i.Tl)("Gateway Managed Auto Routing")}):(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",title:(0,i.Tl)("Prioritize accounts whose quota (packages, subscription windows, balances) expires soonest"),children:(0,i.Tl)("Earliest Expiry First")}),(0,a.jsx)(d.lM,{checked:T,onChange:e=>{E(e),M(k,C,e,P)}})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:(0,h.cn)("text-xs font-medium",T?"text-text-muted/50 cursor-not-allowed":"text-text-muted"),title:T?(0,i.Tl)("Disabled while Earliest Expiry First is active (earliest-expiry takes precedence over round-robin)"):void 0,children:(0,i.Tl)("Round Robin")}),(0,a.jsx)(d.lM,{checked:"round-robin"===k,disabled:T,onChange:e=>{let t=e?"round-robin":null;S(t),e&&!C&&$("1"),M(t,e?C||"1":C,T,P)}}),"round-robin"===k&&(0,a.jsxs)("div",{className:(0,h.cn)("flex flex-wrap items-center gap-1.5",T&&"opacity-50 pointer-events-none"),children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:(0,i.Tl)("Sticky:")}),(0,a.jsx)("input",{type:"number",min:1,value:C,disabled:T,onChange:e=>{$(e.target.value),M("round-robin",e.target.value,T,P)},className:"w-16 px-2 py-1 text-xs border border-border rounded-md bg-surface 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)(d.$n,{size:"sm",icon:"add",onClick:()=>x(!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,s)=>(0,a.jsx)(v,{connection:e,proxyPools:o,isOAuth:t,isFirst:0===s,isLast:s===r.length-1,onMoveUp:()=>O(s,s-1),onMoveDown:()=>O(s,s+1),onToggleActive:t=>B(e.id,t),onUpdateProxy:t=>D(e.id,t),onEdit:()=>{N(e),b(!0)},onDelete:()=>L(e.id)},e.id))}),(0,a.jsx)("div",{className:"mt-4 flex justify-stretch sm:justify-start",children:(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>x(!0),children:"Add"})})]})]}),(0,a.jsx)(j,{isOpen:p,provider:e,proxyPools:o,onSave:U,onClose:()=>x(!1)}),(0,a.jsx)(d.wI,{isOpen:f,connection:y,proxyPools:o,onSave:K,onClose:()=>b(!1)}),(0,a.jsx)(d.uo,{isOpen:!!R,onClose:()=>A(null),onConfirm:R?.onConfirm,title:R?.title||"Confirm",message:R?.message,variant:"danger"})]})}y.propTypes={until:b().string.isRequired},v.propTypes={connection:b().shape({id:b().string,name:b().string,email:b().string,displayName:b().string,testStatus:b().string,isActive:b().bool,lastError:b().string,priority:b().number}).isRequired,proxyPools:b().array,isOAuth:b().bool.isRequired,isFirst:b().bool.isRequired,isLast:b().bool.isRequired,onMoveUp:b().func.isRequired,onMoveDown:b().func.isRequired,onToggleActive:b().func.isRequired,onUpdateProxy:b().func,onEdit:b().func.isRequired,onDelete:b().func.isRequired},j.propTypes={isOpen:b().bool.isRequired,provider:b().string,providerName:b().string,proxyPools:b().array,onSave:b().func.isRequired,onClose:b().func.isRequired},w.propTypes={providerId:b().string.isRequired,isOAuth:b().bool};var N=s(28777),k=s(11059);function S({model:e,fullModel:t,copied:s,onCopy:r,testStatus:l,isCustom:o,isFree:n,onDeleteAlias:d,onTest:c,isTesting:u}){let m="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 min-w-0",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",style:m?{color:m}:void 0,children:"ok"===l?"check_circle":"error"===l?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:[(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded truncate max-w-full",title:t,children:t}),e.name&&(0,a.jsx)("span",{className:"text-[9px] text-text-muted/70 italic pl-1 truncate max-w-full",children:e.name})]}),c&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:c,disabled:u,className:`p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-opacity ${u?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:u?{animation:"spin 1s linear infinite"}:void 0,children:u?"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:u?"Testing...":"Test"})]}),(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:()=>r(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:s===`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:s===`model-${e.id}`?"Copied!":"Copy"})]}),n&&(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"}),e.requiresSession&&(0,a.jsx)("span",{className:"text-[10px] font-bold text-amber-600 dark:text-amber-400 bg-amber-500/10 px-1.5 py-0.5 rounded cursor-help",title:(0,i.Tl)("Requires MiMo Desktop sign-in — API key alone cannot reach this model"),children:(0,i.Tl)("Desktop sign-in")}),o&&(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 C({isOpen:e,onSave:t,onClose:s}){let[r,l]=(0,n.useState)(""),o=()=>{r.trim()&&(t(r.trim()),l(""))};return(0,a.jsx)(d.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-surface focus:outline-none focus:border-primary",value:r,onChange:e=>l(e.target.value),onKeyDown:e=>"Enter"===e.key&&o(),placeholder:"e.g. tts-1-hd",autoFocus:!0})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:o,fullWidth:!0,disabled:!r.trim(),children:"Add"}),(0,a.jsx)(d.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function $({providerId:e,kindFilter:t,providerAliasOverride:s}){let{copied:r,copy:l}=(0,k.C)(),[o,i]=(0,n.useState)({}),[c,m]=(0,n.useState)([]),[p,x]=(0,n.useState)({}),[h,f]=(0,n.useState)(null),[b,g]=(0,n.useState)(""),[y,v]=(0,n.useState)(!1),j=s||(0,u.wG)(e),w=t||"llm",T=(0,n.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/models/alias"),fetch("/api/models/custom",{cache:"no-store"})]),s=await e.json(),a=await t.json();e.ok&&i(s.aliases||{}),t.ok&&m(a.models||[])}catch(e){console.log("ModelsCard fetch error:",e)}},[]);(0,n.useEffect)(()=>{T()},[T]);let E=async(e,t)=>{let s=`${j}/${e}`;try{(await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})})).ok&&await T()}catch(e){console.log("set alias error:",e)}},P=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await T()}catch(e){console.log("delete alias error:",e)}},_=async e=>{try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:j,id:e,type:w})})).ok&&(await T(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("add custom model error:",e)}},R=async e=>{try{let t=new URLSearchParams({providerAlias:j,id:e,type:w});(await fetch(`/api/models/custom?${t}`,{method:"DELETE"})).ok&&(await T(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("delete custom model error:",e)}},A=async e=>{if(!h){f(e);try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${j}/${e}`,kind:t})}),a=await s.json();x(t=>({...t,[e]:a.ok?"ok":"error"})),g(a.ok?"":a.error||"Model not reachable")}catch{x(t=>({...t,[e]:"error"})),g("Network error")}finally{f(null)}}},I=(0,N.KC)(e),M=t?I.filter(e=>e.kinds?e.kinds.includes(t):(0,N.CP)(e,"llm")===t):I,O=c.filter(e=>e.providerAlias===j&&(0,N.CP)(e,"llm")===w&&!M.some(t=>t.id===e.id));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d.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()}`:""]})}),b&&(0,a.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:b}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[M.map(e=>{let t=`${j}/${e.id}`,s=Object.entries(o).find(([,e])=>e===t)?.[0];return(0,a.jsx)(S,{model:e,fullModel:`${j}/${e.id}`,alias:s,copied:r,onCopy:l,onSetAlias:t=>E(e.id,t),onDeleteAlias:()=>P(s),testStatus:p[e.id],onTest:()=>A(e.id),isTesting:h===e.id,isFree:e.isFree},e.id)}),O.map(e=>(0,a.jsx)(S,{model:{id:e.id,name:e.name},fullModel:`${j}/${e.id}`,copied:r,onCopy:l,onSetAlias:()=>{},onDeleteAlias:()=>R(e.id),testStatus:p[e.id],onTest:()=>A(e.id),isTesting:h===e.id,isCustom:!0},`${e.id}-${e.type}`)),(0,a.jsxs)("button",{onClick:()=>v(!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)(C,{isOpen:y,onSave:async e=>{await _(e),v(!1)},onClose:()=>v(!1)})]})}function T({label:e,children:t}){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})]})}S.propTypes={model:b().shape({id:b().string.isRequired}).isRequired,fullModel:b().string.isRequired,copied:b().string,onCopy:b().func.isRequired,testStatus:b().oneOf(["ok","error"]),isCustom:b().bool,isFree:b().bool,onDeleteAlias:b().func,onTest:b().func,isTesting:b().bool},C.propTypes={isOpen:b().bool.isRequired,onSave:b().func.isRequired,onClose:b().func.isRequired},$.propTypes={providerId:b().string.isRequired,kindFilter:b().string,providerAliasOverride:b().string};let E={webSearch:{inputLabel:"Query",inputPlaceholder:"What is the latest news about AI?",defaultInput:"What is the latest news about AI?",bodyKey:"query",defaultResponse:`{
2
2
  "results": [
3
3
  { "title": "...", "url": "...", "snippet": "..." }
4
4
  ]
@@ -41,30 +41,30 @@
41
41
  }],
42
42
  "model": "...",
43
43
  "usage": { "prompt_tokens": 9, "total_tokens": 9 }
44
- }`;function _({providerId:e,customAlias:t}){let s=(0,u.gC)(e),r=s?t||e:(0,u.wG)(e),l=s?[]:(0,w.KC)(e).filter(e=>"embedding"===(0,w.CP)(e)),[o,i]=(0,n.useState)(l[0]?.id??""),[c,m]=(0,n.useState)("The quick brown fox jumps over the lazy dog"),[p,x]=(0,n.useState)(""),[h,f]=(0,n.useState)(""),[b,g]=(0,n.useState)(!1),[y,v]=(0,n.useState)(""),[j,k]=(0,n.useState)(""),[S,C]=(0,n.useState)(null),[T,E]=(0,n.useState)(!1),[I,R]=(0,n.useState)(""),{copied:A,copy:M}=(0,N.C)(),{copied:O,copy:D}=(0,N.C)();(0,n.useEffect)(()=>{v(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{f((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 K=b?j:y,L=o?`${r}/${o}`:"",U=()=>{let e={model:L,input:c.trim()},t=Number(p);return p&&Number.isFinite(t)&&t>0&&(e.dimensions=t),e},B=`curl -X POST ${K}/v1/embeddings \\
44
+ }`;function _({providerId:e,customAlias:t}){let s=(0,u.gC)(e),r=s?t||e:(0,u.wG)(e),l=s?[]:(0,N.KC)(e).filter(e=>"embedding"===(0,N.CP)(e)),[o,i]=(0,n.useState)(l[0]?.id??""),[c,m]=(0,n.useState)("The quick brown fox jumps over the lazy dog"),[p,x]=(0,n.useState)(""),[h,f]=(0,n.useState)(""),[b,g]=(0,n.useState)(!1),[y,v]=(0,n.useState)(""),[j,w]=(0,n.useState)(""),[S,C]=(0,n.useState)(null),[$,E]=(0,n.useState)(!1),[R,A]=(0,n.useState)(""),{copied:I,copy:M}=(0,k.C)(),{copied:O,copy:L}=(0,k.C)();(0,n.useEffect)(()=>{v(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{f((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&w(e.publicUrl)}).catch(()=>{})},[]);let B=b?j:y,D=o?`${r}/${o}`:"",U=()=>{let e={model:D,input:c.trim()},t=Number(p);return p&&Number.isFinite(t)&&t>0&&(e.dimensions=t),e},K=`curl -X POST ${B}/v1/embeddings \\
45
45
  -H "Content-Type: application/json" \\
46
46
  -H "Authorization: Bearer ${h||"YOUR_KEY"}" \\
47
- -d '${JSON.stringify(U())}'`,F=async()=>{if(!c.trim()||!L)return;E(!0),R(""),C(null);let e=Date.now();try{let t={"Content-Type":"application/json"};h&&(t.Authorization=`Bearer ${h}`);let s=await fetch("/api/v1/embeddings",{method:"POST",headers:t,body:JSON.stringify(U())}),a=Date.now()-e,r=await s.json();if(!s.ok)return void R(r?.error?.message||r?.error||`HTTP ${s.status}`);C({data:r,latencyMs:a})}catch(e){R(e.message||"Network error")}finally{E(!1)}},q=S?JSON.stringify(S.data,null,2):"";return(0,a.jsxs)(d.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)($,{label:"Model",children:s?(0,a.jsx)("input",{value:o,onChange:e=>i(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-surface focus:outline-none focus:border-primary font-mono"}):(0,a.jsx)("select",{value:o,onChange:e=>i(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface 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)($,{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:K,onChange:e=>b?k(e.target.value):v(e.target.value),className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary font-mono",placeholder:"http://localhost:3000"}),j&&(0,a.jsxs)("button",{onClick:()=>g(e=>!e),title:b?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${b?"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)($,{label:"API Key",children:(0,a.jsx)("input",{type:"password",value:h,onChange:e=>f(e.target.value),placeholder:"sk-...",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary font-mono"})}),(0,a.jsx)($,{label:"Input",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:c,onChange:e=>m(e.target.value),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}),c&&(0,a.jsx)("button",{type:"button",onClick:()=>m(""),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)($,{label:"Dimensions",children:(0,a.jsx)("input",{type:"number",min:"1",value:p,onChange:e=>x(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-surface 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:()=>M(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:A?"check":"content_copy"}),A?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:F,disabled:T||!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:T?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),T?"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})]}),I&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:I}),(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:()=>D(q),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:O?"check":"content_copy"}),O?"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 P;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)})]})]})]})}let E={"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"},minimax:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices",defaultVoiceId:"English_expressive_narrator"},"minimax-cn":{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices?provider=minimax-cn",defaultVoiceId:"English_expressive_narrator"},gemini:{hasLanguageDropdown:!1,hasLanguageHint:!0,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"gemini-tts-models",voiceKey:"gemini-tts-voices",voicesPerModel:!0},"xiaomi-mimo":{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!1,hasStyleInput:!0,hasLanguageHint:!0,languageOptions:["Chinese","English"],voiceSource:"hardcoded",modelKey:"xiaomi-mimo-tts-models",voicesPerModel:!0}};var I=s(717),R=s(91781);let A=`// Audio will appear here after running.
47
+ -d '${JSON.stringify(U())}'`,F=async()=>{if(!c.trim()||!D)return;E(!0),A(""),C(null);let e=Date.now();try{let t={"Content-Type":"application/json"};h&&(t.Authorization=`Bearer ${h}`);let s=await fetch("/api/v1/embeddings",{method:"POST",headers:t,body:JSON.stringify(U())}),a=Date.now()-e,r=await s.json();if(!s.ok)return void A(r?.error?.message||r?.error||`HTTP ${s.status}`);C({data:r,latencyMs:a})}catch(e){A(e.message||"Network error")}finally{E(!1)}},q=S?JSON.stringify(S.data,null,2):"";return(0,a.jsxs)(d.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)(T,{label:"Model",children:s?(0,a.jsx)("input",{value:o,onChange:e=>i(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-surface focus:outline-none focus:border-primary font-mono"}):(0,a.jsx)("select",{value:o,onChange:e=>i(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface 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)(T,{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:B,onChange:e=>b?w(e.target.value):v(e.target.value),className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary font-mono",placeholder:"http://localhost:3000"}),j&&(0,a.jsxs)("button",{onClick:()=>g(e=>!e),title:b?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${b?"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)(T,{label:"API Key",children:(0,a.jsx)("input",{type:"password",value:h,onChange:e=>f(e.target.value),placeholder:"sk-...",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary font-mono"})}),(0,a.jsx)(T,{label:"Input",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:c,onChange:e=>m(e.target.value),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}),c&&(0,a.jsx)("button",{type:"button",onClick:()=>m(""),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)(T,{label:"Dimensions",children:(0,a.jsx)("input",{type:"number",min:"1",value:p,onChange:e=>x(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-surface 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:()=>M(K),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:I?"check":"content_copy"}),I?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:F,disabled:$||!c.trim()||!D,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:$?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),$?"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:K})]}),R&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:R}),(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:()=>L(q),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:O?"check":"content_copy"}),O?"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 P;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)})]})]})]})}let R={"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"},minimax:{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices",defaultVoiceId:"English_expressive_narrator"},"minimax-cn":{hasModelSelector:!0,hasBrowseButton:!0,hasVoiceIdInput:!0,voiceSource:"api-language",apiEndpoint:"/api/media-providers/tts/minimax/voices?provider=minimax-cn",defaultVoiceId:"English_expressive_narrator"},gemini:{hasLanguageDropdown:!1,hasLanguageHint:!0,hasModelSelector:!0,hasBrowseButton:!1,voiceSource:"hardcoded",modelKey:"gemini-tts-models",voiceKey:"gemini-tts-voices",voicesPerModel:!0},"xiaomi-mimo":{hasLanguageDropdown:!1,hasModelSelector:!0,hasBrowseButton:!1,hasVoiceIdInput:!1,hasStyleInput:!0,hasLanguageHint:!0,languageOptions:["Chinese","English"],voiceSource:"hardcoded",modelKey:"xiaomi-mimo-tts-models",voicesPerModel:!0}};var A=s(717),I=s(91781);let M=`// Audio will appear here after running.
48
48
  // Example JSON response (response_format=json):
49
49
  {
50
50
  "format": "mp3",
51
51
  "audio": "//NExAANaAIIAUAAANNNNNNNN..." // base64 encoded MP3
52
- }`;function M({providerId:e}){let t,s,r=(0,u.wG)(e),l=E[e]||E["edge-tts"],[o,c]=(0,n.useState)(l.defaultVoiceId||""),[m,p]=(0,n.useState)(""),[x,h]=(0,n.useState)(l.defaultVoiceId||""),[f,b]=(0,n.useState)([]),[g,y]=(0,n.useState)(""),[v,j]=(0,n.useState)(()=>{let t=u.Q2[e]?.ttsConfig?.models;if(t?.length)return t[0].id;if(l.hasModelSelector&&l.modelKey){let e=(0,w.KC)(l.modelKey);return e?.[0]?.id||""}return""}),[k,S]=(0,n.useState)("Hello, this is a text to speech test."),[C,T]=(0,n.useState)(""),[P,_]=(0,n.useState)(""),[O,D]=(0,n.useState)(!1),[K,L]=(0,n.useState)(""),[U,B]=(0,n.useState)(""),[F,q]=(0,n.useState)("mp3"),[z,J]=(0,n.useState)(""),[V,H]=(0,n.useState)(null),[W,Y]=(0,n.useState)(!1),[G,Q]=(0,n.useState)(""),[Z,X]=(0,n.useState)(null),{copied:ee,copy:et}=(0,N.C)(),[es,ea]=(0,n.useState)(!1),[er,el]=(0,n.useState)([]),[eo,en]=(0,n.useState)(!1),[ei,ed]=(0,n.useState)(""),[ec,eu]=(0,n.useState)(""),[em,ep]=(0,n.useState)({}),[ex,eh]=(0,n.useState)(""),[ef,eb]=(0,n.useState)(0);(0,n.useEffect)(()=>{if(L(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{_((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/providers",{cache:"no-store"}).then(e=>e.json()).then(t=>{eb((t.connections||[]).filter(t=>t.provider===e&&!1!==t.isActive).length)}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&B(e.publicUrl)}).catch(()=>{}),"hardcoded"===l.voiceSource){let t=l.hasModelSelector&&l.modelKey&&(0,w.KC)(l.modelKey)?.[0]?.id||"",s=l.voicesPerModel&&t?(0,I.jY)(e,t)||[]:(0,w.KC)(l.voiceKey||e).filter(e=>"tts"===(0,w.CP)(e));if(s.length)if(l.hasBrowseButton){let e=s.find(e=>"en"===e.id)||s[0];y(e.id),c(e.id),p(e.name),b([{id:e.id,name:e.name}])}else b(s),c(s[0].id),p(s[0].name||s[0].id)}},[e]),(0,n.useEffect)(()=>{if(!l.voicesPerModel||!v)return;let t=(0,I.jY)(e,v)||[];b(t),t.length?(c(t[0].id),p(t[0].name||t[0].id)):(c(""),p(""))},[v]);let eg=async()=>{if(ea(!0),ed(""),eu(""),!er.length){en(!0);try{if("hardcoded"===l.voiceSource){let t=l.voiceKey||e,s=(0,w.KC)(t).filter(e=>"tts"===(0,w.CP)(e)),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}]});ep(a),el(Object.values(a).sort((e,t)=>e.name.localeCompare(t.name)))}else{let t=l.apiEndpoint?l.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 eu(a.error);el(a.languages||[]),ep(a.byLang||{})}}catch(e){eu(e.message)}finally{en(!1)}}},ey=ei?er.filter(e=>e.name.toLowerCase().includes(ei.toLowerCase())||e.code.toLowerCase().includes(ei.toLowerCase())):er,ev=O?U:K,ej=l.hasVoiceIdInput&&x||o,ew=l.hasModelSelector&&v&&ej?`${r}/${v}/${ej}`:l.hasModelSelector&&v?`${r}/${v}`:ej?`${r}/${ej}`:"",eN=(t={model:ew,input:k},l.hasLanguageHint&&ex&&(t.language=ex),l.hasStyleInput&&C.trim()&&(t.style=C.trim()),t),ek=`curl -X POST ${ev}/v1/audio/speech${"json"===F?"?response_format=json":""} \\
52
+ }`;function O({providerId:e}){let t,s,r=(0,u.wG)(e),l=R[e]||R["edge-tts"],[o,c]=(0,n.useState)(l.defaultVoiceId||""),[m,p]=(0,n.useState)(""),[x,h]=(0,n.useState)(l.defaultVoiceId||""),[f,b]=(0,n.useState)([]),[g,y]=(0,n.useState)(""),[v,j]=(0,n.useState)(()=>{let t=u.Q2[e]?.ttsConfig?.models;if(t?.length)return t[0].id;if(l.hasModelSelector&&l.modelKey){let e=(0,N.KC)(l.modelKey);return e?.[0]?.id||""}return""}),[w,S]=(0,n.useState)("Hello, this is a text to speech test."),[C,$]=(0,n.useState)(""),[E,P]=(0,n.useState)(""),[_,L]=(0,n.useState)(!1),[B,D]=(0,n.useState)(""),[U,K]=(0,n.useState)(""),[F,q]=(0,n.useState)("mp3"),[z,J]=(0,n.useState)(""),[V,H]=(0,n.useState)(null),[G,W]=(0,n.useState)(!1),[Y,Q]=(0,n.useState)(""),[Z,X]=(0,n.useState)(null),{copied:ee,copy:et}=(0,k.C)(),[es,ea]=(0,n.useState)(!1),[er,el]=(0,n.useState)([]),[eo,en]=(0,n.useState)(!1),[ei,ed]=(0,n.useState)(""),[ec,eu]=(0,n.useState)(""),[em,ep]=(0,n.useState)({}),[ex,eh]=(0,n.useState)(""),[ef,eb]=(0,n.useState)(0);(0,n.useEffect)(()=>{if(D(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{P((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/providers",{cache:"no-store"}).then(e=>e.json()).then(t=>{eb((t.connections||[]).filter(t=>t.provider===e&&!1!==t.isActive).length)}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&K(e.publicUrl)}).catch(()=>{}),"hardcoded"===l.voiceSource){let t=l.hasModelSelector&&l.modelKey&&(0,N.KC)(l.modelKey)?.[0]?.id||"",s=l.voicesPerModel&&t?(0,A.jY)(e,t)||[]:(0,N.KC)(l.voiceKey||e).filter(e=>"tts"===(0,N.CP)(e));if(s.length)if(l.hasBrowseButton){let e=s.find(e=>"en"===e.id)||s[0];y(e.id),c(e.id),p(e.name),b([{id:e.id,name:e.name}])}else b(s),c(s[0].id),p(s[0].name||s[0].id)}},[e]),(0,n.useEffect)(()=>{if(!l.voicesPerModel||!v)return;let t=(0,A.jY)(e,v)||[];b(t),t.length?(c(t[0].id),p(t[0].name||t[0].id)):(c(""),p(""))},[v]);let eg=async()=>{if(ea(!0),ed(""),eu(""),!er.length){en(!0);try{if("hardcoded"===l.voiceSource){let t=l.voiceKey||e,s=(0,N.KC)(t).filter(e=>"tts"===(0,N.CP)(e)),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}]});ep(a),el(Object.values(a).sort((e,t)=>e.name.localeCompare(t.name)))}else{let t=l.apiEndpoint?l.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 eu(a.error);el(a.languages||[]),ep(a.byLang||{})}}catch(e){eu(e.message)}finally{en(!1)}}},ey=ei?er.filter(e=>e.name.toLowerCase().includes(ei.toLowerCase())||e.code.toLowerCase().includes(ei.toLowerCase())):er,ev=_?U:B,ej=l.hasVoiceIdInput&&x||o,ew=l.hasModelSelector&&v&&ej?`${r}/${v}/${ej}`:l.hasModelSelector&&v?`${r}/${v}`:ej?`${r}/${ej}`:"",eN=(t={model:ew,input:w},l.hasLanguageHint&&ex&&(t.language=ex),l.hasStyleInput&&C.trim()&&(t.style=C.trim()),t),ek=`curl -X POST ${ev}/v1/audio/speech${"json"===F?"?response_format=json":""} \\
53
53
  -H "Content-Type: application/json" \\
54
- -H "Authorization: Bearer ${P||"YOUR_KEY"}" \\
54
+ -H "Authorization: Bearer ${E||"YOUR_KEY"}" \\
55
55
  -d '${JSON.stringify(eN)}' \\
56
- ${"json"===F?"":"--output speech.mp3"}`,eS=async()=>{if(!k.trim()||!ew)return;Y(!0),Q(""),J(""),H(null);let e=Date.now();try{let t={"Content-Type":"application/json"};P&&(t.Authorization=`Bearer ${P}`);let s=`/api/v1/audio/speech${"json"===F?"?response_format=json":""}`,a=await fetch(s,{method:"POST",headers:t,body:JSON.stringify({...eN,input:k.trim()})});if(X(Date.now()-e),!a.ok){let e=await a.json().catch(()=>({}));Q(e?.error?.message||e?.error||`HTTP ${a.status}`);return}if("json"===F){let e=await a.json();H(e);let t=e.format||"mp3",s=await fetch(`data:audio/${t};base64,${e.audio}`).then(e=>e.blob());J(URL.createObjectURL(s))}else{let e=await a.blob();J(URL.createObjectURL(e))}}catch(e){Q(e.message||"Network error")}finally{Y(!1)}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d.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)($,{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:[ev,"/v1/audio/speech"]}),U&&(0,a.jsxs)("button",{onClick:()=>D(e=>!e),title:O?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${O?"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)($,{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:P?`${P.slice(0,8)}${"•".repeat(Math.min(20,P.length-8))}`:ef>0?(0,a.jsxs)("span",{className:"text-text-muted italic",children:["Using stored key(s) \xb7 ",ef," connection",ef>1?"s":""]}):(0,a.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),l.hasModelSelector&&(l.modelKey||(0,w.KC)(e).some(e=>"tts"===(0,w.CP)(e)))&&(0,a.jsx)($,{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-surface focus:outline-none focus:border-primary",children:((s=(0,w.KC)(e).filter(e=>"tts"===(0,w.CP)(e))).length?s:(0,w.KC)(l.modelKey)||[]).map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),l.hasLanguageHint&&(0,a.jsx)($,{label:"Language",children:(0,a.jsxs)("select",{value:ex,onChange:e=>eh(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"",children:"Auto-detect"}),(l.languageOptions||R.I).map(e=>"string"==typeof e?(0,a.jsx)("option",{value:e,children:e},e):(0,a.jsx)("option",{value:e.name,children:e.name},e.id))]})}),l.hasBrowseButton&&(0,a.jsx)($,{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:eg,className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-surface font-mono truncate text-left hover:border-primary/40 transition-colors",children:g?(0,a.jsx)("span",{className:"text-text-main",children:er.find(e=>e.code===g)?.name||g}):(0,a.jsx)("span",{className:"text-text-muted",children:"No language selected"})}),(0,a.jsxs)("button",{onClick:eg,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"]})]})}),f.length>0&&(0,a.jsx)($,{label:"Voice",children:(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:f.map(e=>(0,a.jsxs)("button",{onClick:()=>{c(e.id),p(e.name),l.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.language?` \xb7 ${e.language}`:"",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))})}),l.hasVoiceIdInput&&(0,a.jsx)($,{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),c(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-surface focus:outline-none focus:border-primary font-mono"}),x&&(0,a.jsx)("button",{type:"button",onClick:()=>{h(""),c("")},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"})})]})})}),l.hasLanguageDropdown&&(0,a.jsx)($,{label:"Language",children:(0,a.jsx)("select",{value:o,onChange:t=>{let s=(0,w.KC)(e).filter(e=>"tts"===(0,w.CP)(e)).find(e=>e.id===t.target.value);c(t.target.value),p(s?.name||t.target.value)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary",children:(0,w.KC)(e).filter(e=>"tts"===(0,w.CP)(e)).map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,a.jsx)($,{label:"Input",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:k,onChange:e=>S(e.target.value),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}),k&&(0,a.jsx)("button",{type:"button",onClick:()=>S(""),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"})})]})}),l.hasStyleInput&&(0,a.jsx)($,{label:(0,i.Tl)("Style"),children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("textarea",{value:C,onChange:e=>T(e.target.value),placeholder:(0,i.Tl)("e.g. a warm, gentle voice, speaking slowly with a British accent"),rows:2,className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary resize-none"}),C&&(0,a.jsx)("button",{type:"button",onClick:()=>T(""),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)($,{label:"Output Format",children:(0,a.jsxs)("select",{value:F,onChange:e=>q(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface 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:()=>et(ek),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:ee?"check":"content_copy"}),ee?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:eS,disabled:W||!k.trim()||!ew,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:W?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),W?"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:ek})]}),G&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:G}),z?(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 ",Z&&(0,a.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",Z,"ms"]})]}),(0,a.jsxs)("a",{href:z,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:z,className:"w-full"}),V&&(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:V.format,audio:V.audio?`${V.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:A})]})]})]}),es&&(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:()=>ea(!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:()=>ea(!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:ei,onChange:e=>ed(e.target.value),placeholder:"Search language...",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"})}),(0,a.jsxs)("div",{className:"overflow-y-auto flex-1 p-2",children:[ec&&(0,a.jsx)("p",{className:"text-xs text-red-500 px-2 py-1",children:ec}),eo?(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:[ey.map(e=>(0,a.jsxs)("button",{onClick:()=>{let t;return ea(!1),y(e.code),void(b(t=em[e.code]?.voices||[]),t.length&&(c(t[0].id),p(t[0].name),l.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===ey.length&&(0,a.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"No languages found."})]})]})]})})]})}let O="https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png";function D(e){let t="string"==typeof e?e.trim():"";return t?/^(data:image\/|https?:\/\/)/i.test(t)?t:`data:image/png;base64,${t}`:""}function K({providerId:e,kind:t}){let s=(0,u.wG)(e),r=(0,u.rs)(s)===e?s:e,l=u.rj.find(e=>e.id===t),o=T[t],i=o||{},c=(0,w.KC)(e).filter(e=>(0,w.CP)(e)===t),m=new Set(["image","video","music","imageToText","systemone"]).has(t),p=m&&0===c.length,[x,h]=(0,n.useState)(c[0]?.id??""),f=c.find(e=>e.id===x),b=!!f?.capabilities?.includes("edit"),g=!!f?.capabilities?.includes("mask"),[y,v]=(0,n.useState)(i.defaultInput||""),[j,k]=(0,n.useState)("Does this request require urgent attention?"),[S,C]=(0,n.useState)(""),[P,_]=(0,n.useState)(""),[E,I]=(0,n.useState)(()=>(i.extraFields||[]).reduce((e,t)=>(e[t.key]=t.default??"",e),{})),[R,A]=(0,n.useState)(""),[M,L]=(0,n.useState)(!1),[U,B]=(0,n.useState)(""),[F,q]=(0,n.useState)(""),[z,J]=(0,n.useState)(null),[V,H]=(0,n.useState)(null),[W,Y]=(0,n.useState)(null),[G,Q]=(0,n.useState)("json"),[Z,X]=(0,n.useState)(""),[ee,et]=(0,n.useState)(!1),[es,ea]=(0,n.useState)(""),[er,el]=(0,n.useState)([]),[eo,en]=(0,n.useState)(""),{copied:ei,copy:ed}=(0,N.C)(),{copied:ec,copy:eu}=(0,N.C)();if((0,n.useEffect)(()=>{B(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{A((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&q(e.publicUrl)}).catch(()=>{}),fetch("/api/providers/client").then(e=>e.json()).then(t=>{el((t.connections||[]).filter(t=>t.provider===e&&!1!==t.isActive))}).catch(()=>{})},[e]),!l||!o)return null;let em=M?F:U,ep=l.endpoint.path,ex=m?x?`${r}/${x}`:p?"":r:r,eh="cloudflare-ai"!==e?{}:"@cf/runwayml/stable-diffusion-v1-5-img2img"===x?{image:O}:"@cf/runwayml/stable-diffusion-v1-5-inpainting"===x?{image:O,mask_image:"https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png"}:{},ef=S.trim()||eh.image||"",eb=P.trim()||eh.mask_image||"",eg=D(ef),ey=D(eb),ev=Object.entries(E).reduce((e,[t,s])=>(""===s||null==s||"number"==typeof s&&Number.isNaN(s)||(e[t]=s),e),{}),ej="systemone"===t?{questions:{is_urgent:{type:"noul",instructions:j.trim()||"Does this request require urgent attention?"}}}:{},ew={model:ex,[o.bodyKey]:y,...o.extraBody,...ej,...ev,...b&&ef?{image:ef}:{},...g&&eb?{mask_image:eb}:{}},eN="image"===t&&"binary"===G,ek="image"===t&&"codex"===e&&!eN,eS=`${ep}${eN?"?response_format=binary":""}`,eC=`-H "Content-Type: application/json" \\
57
- -H "Authorization: Bearer ${R||"YOUR_KEY"}"${eo?` \\
56
+ ${"json"===F?"":"--output speech.mp3"}`,eS=async()=>{if(!w.trim()||!ew)return;W(!0),Q(""),J(""),H(null);let e=Date.now();try{let t={"Content-Type":"application/json"};E&&(t.Authorization=`Bearer ${E}`);let s=`/api/v1/audio/speech${"json"===F?"?response_format=json":""}`,a=await fetch(s,{method:"POST",headers:t,body:JSON.stringify({...eN,input:w.trim()})});if(X(Date.now()-e),!a.ok){let e=await a.json().catch(()=>({}));Q(e?.error?.message||e?.error||`HTTP ${a.status}`);return}if("json"===F){let e=await a.json();H(e);let t=e.format||"mp3",s=await fetch(`data:audio/${t};base64,${e.audio}`).then(e=>e.blob());J(URL.createObjectURL(s))}else{let e=await a.blob();J(URL.createObjectURL(e))}}catch(e){Q(e.message||"Network error")}finally{W(!1)}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d.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)(T,{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:[ev,"/v1/audio/speech"]}),U&&(0,a.jsxs)("button",{onClick:()=>L(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)(T,{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:E?`${E.slice(0,8)}${"•".repeat(Math.min(20,E.length-8))}`:ef>0?(0,a.jsxs)("span",{className:"text-text-muted italic",children:["Using stored key(s) \xb7 ",ef," connection",ef>1?"s":""]}):(0,a.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),l.hasModelSelector&&(l.modelKey||(0,N.KC)(e).some(e=>"tts"===(0,N.CP)(e)))&&(0,a.jsx)(T,{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-surface focus:outline-none focus:border-primary",children:((s=(0,N.KC)(e).filter(e=>"tts"===(0,N.CP)(e))).length?s:(0,N.KC)(l.modelKey)||[]).map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),l.hasLanguageHint&&(0,a.jsx)(T,{label:"Language",children:(0,a.jsxs)("select",{value:ex,onChange:e=>eh(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"",children:"Auto-detect"}),(l.languageOptions||I.I).map(e=>"string"==typeof e?(0,a.jsx)("option",{value:e,children:e},e):(0,a.jsx)("option",{value:e.name,children:e.name},e.id))]})}),l.hasBrowseButton&&(0,a.jsx)(T,{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:eg,className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm border border-border rounded-lg bg-surface font-mono truncate text-left hover:border-primary/40 transition-colors",children:g?(0,a.jsx)("span",{className:"text-text-main",children:er.find(e=>e.code===g)?.name||g}):(0,a.jsx)("span",{className:"text-text-muted",children:"No language selected"})}),(0,a.jsxs)("button",{onClick:eg,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"]})]})}),f.length>0&&(0,a.jsx)(T,{label:"Voice",children:(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:f.map(e=>(0,a.jsxs)("button",{onClick:()=>{c(e.id),p(e.name),l.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.language?` \xb7 ${e.language}`:"",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))})}),l.hasVoiceIdInput&&(0,a.jsx)(T,{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),c(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-surface focus:outline-none focus:border-primary font-mono"}),x&&(0,a.jsx)("button",{type:"button",onClick:()=>{h(""),c("")},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"})})]})})}),l.hasLanguageDropdown&&(0,a.jsx)(T,{label:"Language",children:(0,a.jsx)("select",{value:o,onChange:t=>{let s=(0,N.KC)(e).filter(e=>"tts"===(0,N.CP)(e)).find(e=>e.id===t.target.value);c(t.target.value),p(s?.name||t.target.value)},className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary",children:(0,N.KC)(e).filter(e=>"tts"===(0,N.CP)(e)).map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}),(0,a.jsx)(T,{label:"Input",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:w,onChange:e=>S(e.target.value),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}),w&&(0,a.jsx)("button",{type:"button",onClick:()=>S(""),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"})})]})}),l.hasStyleInput&&(0,a.jsx)(T,{label:(0,i.Tl)("Style"),children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("textarea",{value:C,onChange:e=>$(e.target.value),placeholder:(0,i.Tl)("e.g. a warm, gentle voice, speaking slowly with a British accent"),rows:2,className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary resize-none"}),C&&(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)(T,{label:"Output Format",children:(0,a.jsxs)("select",{value:F,onChange:e=>q(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface 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:()=>et(ek),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:ee?"check":"content_copy"}),ee?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:eS,disabled:G||!w.trim()||!ew,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:G?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),G?"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:ek})]}),Y&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:Y}),z?(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 ",Z&&(0,a.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",Z,"ms"]})]}),(0,a.jsxs)("a",{href:z,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:z,className:"w-full"}),V&&(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:V.format,audio:V.audio?`${V.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:M})]})]})]}),es&&(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:()=>ea(!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:()=>ea(!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:ei,onChange:e=>ed(e.target.value),placeholder:"Search language...",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"})}),(0,a.jsxs)("div",{className:"overflow-y-auto flex-1 p-2",children:[ec&&(0,a.jsx)("p",{className:"text-xs text-red-500 px-2 py-1",children:ec}),eo?(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:[ey.map(e=>(0,a.jsxs)("button",{onClick:()=>{let t;return ea(!1),y(e.code),void(b(t=em[e.code]?.voices||[]),t.length&&(c(t[0].id),p(t[0].name),l.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===ey.length&&(0,a.jsx)("p",{className:"text-xs text-text-muted px-2 py-3",children:"No languages found."})]})]})]})})]})}let L="https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png";function B(e){let t="string"==typeof e?e.trim():"";return t?/^(data:image\/|https?:\/\/)/i.test(t)?t:`data:image/png;base64,${t}`:""}function D({providerId:e,kind:t}){let s=(0,u.wG)(e),r=(0,u.rs)(s)===e?s:e,l=u.rj.find(e=>e.id===t),o=E[t],i=o||{},c=(0,N.KC)(e).filter(e=>(0,N.CP)(e)===t),m=new Set(["image","video","music","imageToText","systemone"]).has(t),p=m&&0===c.length,[x,h]=(0,n.useState)(c[0]?.id??""),f=c.find(e=>e.id===x),b=!!f?.capabilities?.includes("edit"),g=!!f?.capabilities?.includes("mask"),[y,v]=(0,n.useState)(i.defaultInput||""),[j,w]=(0,n.useState)("Does this request require urgent attention?"),[S,C]=(0,n.useState)(""),[$,P]=(0,n.useState)(""),[_,R]=(0,n.useState)(()=>(i.extraFields||[]).reduce((e,t)=>(e[t.key]=t.default??"",e),{})),[A,I]=(0,n.useState)(""),[M,O]=(0,n.useState)(!1),[U,K]=(0,n.useState)(""),[F,q]=(0,n.useState)(""),[z,J]=(0,n.useState)(null),[V,H]=(0,n.useState)(null),[G,W]=(0,n.useState)(null),[Y,Q]=(0,n.useState)("json"),[Z,X]=(0,n.useState)(""),[ee,et]=(0,n.useState)(!1),[es,ea]=(0,n.useState)(""),[er,el]=(0,n.useState)([]),[eo,en]=(0,n.useState)(""),{copied:ei,copy:ed}=(0,k.C)(),{copied:ec,copy:eu}=(0,k.C)();if((0,n.useEffect)(()=>{K(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{I((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&q(e.publicUrl)}).catch(()=>{}),fetch("/api/providers/client").then(e=>e.json()).then(t=>{el((t.connections||[]).filter(t=>t.provider===e&&!1!==t.isActive))}).catch(()=>{})},[e]),!l||!o)return null;let em=M?F:U,ep=l.endpoint.path,ex=m?x?`${r}/${x}`:p?"":r:r,eh="cloudflare-ai"!==e?{}:"@cf/runwayml/stable-diffusion-v1-5-img2img"===x?{image:L}:"@cf/runwayml/stable-diffusion-v1-5-inpainting"===x?{image:L,mask_image:"https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png"}:{},ef=S.trim()||eh.image||"",eb=$.trim()||eh.mask_image||"",eg=B(ef),ey=B(eb),ev=Object.entries(_).reduce((e,[t,s])=>(""===s||null==s||"number"==typeof s&&Number.isNaN(s)||(e[t]=s),e),{}),ej="systemone"===t?{questions:{is_urgent:{type:"noul",instructions:j.trim()||"Does this request require urgent attention?"}}}:{},ew={model:ex,[o.bodyKey]:y,...o.extraBody,...ej,...ev,...b&&ef?{image:ef}:{},...g&&eb?{mask_image:eb}:{}},eN="image"===t&&"binary"===Y,ek="image"===t&&"codex"===e&&!eN,eS=`${ep}${eN?"?response_format=binary":""}`,eC=`-H "Content-Type: application/json" \\
57
+ -H "Authorization: Bearer ${A||"YOUR_KEY"}"${eo?` \\
58
58
  -H "x-connection-id: ${eo}"`:""}${ek?` \\
59
59
  -H "Accept: text/event-stream"`:""}`,e$=`curl -X ${l.endpoint.method} ${em}${eS} \\
60
60
  ${eC.replace(/\\\n /g,"\\\n ")} \\
61
- -d '${JSON.stringify(ew)}'${eN?" \\\n --output image.png":""}`,eT=async()=>{if(!y.trim()||!ex)return;if(et(!0),ea(""),J(null),H(null),Y(null),Z){try{URL.revokeObjectURL(Z)}catch{}X("")}let e=Date.now();try{let t={"Content-Type":"application/json"};R&&(t.Authorization=`Bearer ${R}`),eo&&(t["x-connection-id"]=eo),ek&&(t.Accept="text/event-stream");let s={...ew,model:ex},a=await fetch(`/api${eS}`,{method:l.endpoint.method,headers:t,body:JSON.stringify(s)});if(!a.ok){let e=await a.json().catch(()=>({}));ea(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);X(s),J({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="",l=null,o=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?H(e):"partial_image"===s?Y(e):"done"===s?l=e:"error"===s&&(o=e?.message||"Stream error")}catch{}}}let n=Date.now()-e;if(o)return void ea(o);l&&J({data:l,latencyMs:n})}else{let t=await a.json(),s=Date.now()-e;J({data:t,latencyMs:s})}}catch(e){ea(e.message||"Network error")}finally{et(!1)}},eP=e=>{if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(eP);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>`:eP(a);return t},e_=z?JSON.stringify(eP(z.data),null,2):"";return(0,a.jsxs)(d.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:[c.length>0?(0,a.jsx)($,{label:"Model",children:(0,a.jsx)("select",{value:x,onChange:e=>h(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary",children:c.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):p?(0,a.jsx)($,{label:"Model",children:(0,a.jsx)("input",{value:x,onChange:e=>h(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-surface focus:outline-none focus:border-primary font-mono"})}):null,(0,a.jsx)($,{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:[em,ep]}),F&&(0,a.jsxs)("button",{onClick:()=>L(e=>!e),title:M?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${M?"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)($,{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:R?`${R.slice(0,8)}${"•".repeat(Math.min(20,R.length-8))}`:(0,a.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),er.length>0&&(0,a.jsx)($,{label:"Connection",children:(0,a.jsxs)("select",{value:eo,onChange:e=>en(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"",children:"Auto (by priority)"}),er.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)($,{label:o.inputLabel,children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:y,onChange:e=>v(e.target.value),placeholder:o.inputPlaceholder,className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}),y&&(0,a.jsx)("button",{type:"button",onClick:()=>v(""),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"})})]})}),"systemone"===t&&(0,a.jsx)($,{label:"Question",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:j,onChange:e=>k(e.target.value),placeholder:"Enter evaluation question or criteria",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}),j&&(0,a.jsx)("button",{type:"button",onClick:()=>k(""),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"})})]})}),b&&(0,a.jsx)($,{label:"Ref Image (URL)",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:S,onChange:e=>C(e.target.value),placeholder:eh.image||"https://example.com/source.png",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}),S&&(0,a.jsx)("button",{type:"button",onClick:()=>C(""),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"})})]}),eg&&(0,a.jsx)("img",{src:eg,alt:"Reference",className:"max-h-40 rounded-lg border border-border object-contain bg-sidebar",onError:e=>{e.currentTarget.style.display="none"},onLoad:e=>{e.currentTarget.style.display="block"},loading:"lazy",decoding:"async"})]})}),g&&(0,a.jsx)($,{label:"Mask (URL)",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:P,onChange:e=>_(e.target.value),placeholder:eh.mask_image||"https://example.com/mask.png",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}),P&&(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"})})]}),ey&&(0,a.jsx)("img",{src:ey,alt:"Mask",className:"max-h-40 rounded-lg border border-border object-contain bg-sidebar",onError:e=>{e.currentTarget.style.display="none"},onLoad:e=>{e.currentTarget.style.display="block"},loading:"lazy",decoding:"async"})]})}),(o.extraFields||[]).filter(e=>0===c.length||Array.isArray(f?.params)&&f.params.includes(e.key)).map(e=>(0,a.jsx)($,{label:e.label,children:"select"===e.type?(0,a.jsx)("select",{value:E[e.key]??"",onChange:t=>I(s=>({...s,[e.key]:t.target.value})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface 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:E[e.key]??"",placeholder:e.placeholder,onChange:t=>I(s=>({...s,[e.key]:t.target.value})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}):(0,a.jsx)("input",{type:"number",value:E[e.key]??"",min:e.min,max:e.max,onChange:t=>I(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-surface focus:outline-none focus:border-primary"})},e.key)),"image"===t&&(0,a.jsx)($,{label:"Output Format",children:(0,a.jsxs)("select",{value:G,onChange:e=>Q(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface 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:()=>ed(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:ei?"check":"content_copy"}),ei?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:eT,disabled:ee||!y.trim()||!ex,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:ee?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),ee?"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:e$})]}),(ee||V)&&ek&&(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:ee?{animation:"spin 1s linear infinite"}:void 0,children:ee?"progress_activity":"check_circle"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[V?.stage||"starting",!ee&&V?.bytesReceived?` \xb7 ${(V.bytesReceived/1024).toFixed(1)} KB`:""]})]}),W?.b64_json&&!z&&(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,${W.b64_json}`,alt:"Partial",className:"max-w-full rounded-lg border border-border mt-1.5 opacity-80",loading:"lazy",decoding:"async"})]}),es&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:es}),(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 ",z&&(0,a.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",z.latencyMs,"ms"]})]}),z&&(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:ec?"check":"content_copy"}),ec?"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?e_:o.defaultResponse}),"image"===t&&(Z||z?.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:Z||(z?.data?.data?.[0]?.b64_json?`data:image/png;base64,${z.data.data[0].b64_json}`:z?.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:Z||(z?.data?.data?.[0]?.b64_json?`data:image/png;base64,${z.data.data[0].b64_json}`:z?.data?.data?.[0]?.url),alt:"Generated",className:"max-w-full rounded-lg border border-border",loading:"lazy",decoding:"async"})]})]})]})]})}function L({providerId:e}){let t=(0,u.wG)(e),s=(0,w.KC)(e).filter(e=>"stt"===(0,w.CP)(e)),[r,l]=(0,n.useState)([]),o=[...s,...r],[i,c]=(0,n.useState)(s[0]?.id??""),m=o.find(e=>e.id===i),p=Array.isArray(m?.params)?m.params:[],[x,h]=(0,n.useState)(null),[f,b]=(0,n.useState)(""),[g,y]=(0,n.useState)(""),[v,j]=(0,n.useState)("json"),[k,S]=(0,n.useState)(""),[C,T]=(0,n.useState)(""),[P,_]=(0,n.useState)(!1),[E,I]=(0,n.useState)(""),[R,A]=(0,n.useState)(""),[M,O]=(0,n.useState)(null),[D,K]=(0,n.useState)(null),[U,B]=(0,n.useState)(!1),[F,q]=(0,n.useState)(""),{copied:z,copy:J}=(0,N.C)(),{copied:V,copy:H}=(0,N.C)();(0,n.useEffect)(()=>{I(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{T((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&A(e.publicUrl)}).catch(()=>{});let e=()=>{fetch("/api/models/custom",{cache:"no-store"}).then(e=>e.json()).then(e=>{l((e.models||[]).filter(e=>"stt"===(0,w.CP)(e)&&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=P?R:E,Y=i?`${t}/${i}`:"",G=`curl -X POST ${W}/v1/audio/transcriptions \\
61
+ -d '${JSON.stringify(ew)}'${eN?" \\\n --output image.png":""}`,eT=async()=>{if(!y.trim()||!ex)return;if(et(!0),ea(""),J(null),H(null),W(null),Z){try{URL.revokeObjectURL(Z)}catch{}X("")}let e=Date.now();try{let t={"Content-Type":"application/json"};A&&(t.Authorization=`Bearer ${A}`),eo&&(t["x-connection-id"]=eo),ek&&(t.Accept="text/event-stream");let s={...ew,model:ex},a=await fetch(`/api${eS}`,{method:l.endpoint.method,headers:t,body:JSON.stringify(s)});if(!a.ok){let e=await a.json().catch(()=>({}));ea(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);X(s),J({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="",l=null,o=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?H(e):"partial_image"===s?W(e):"done"===s?l=e:"error"===s&&(o=e?.message||"Stream error")}catch{}}}let n=Date.now()-e;if(o)return void ea(o);l&&J({data:l,latencyMs:n})}else{let t=await a.json(),s=Date.now()-e;J({data:t,latencyMs:s})}}catch(e){ea(e.message||"Network error")}finally{et(!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},eP=z?JSON.stringify(eE(z.data),null,2):"";return(0,a.jsxs)(d.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:[c.length>0?(0,a.jsx)(T,{label:"Model",children:(0,a.jsx)("select",{value:x,onChange:e=>h(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary",children:c.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):p?(0,a.jsx)(T,{label:"Model",children:(0,a.jsx)("input",{value:x,onChange:e=>h(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-surface focus:outline-none focus:border-primary font-mono"})}):null,(0,a.jsx)(T,{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:[em,ep]}),F&&(0,a.jsxs)("button",{onClick:()=>O(e=>!e),title:M?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${M?"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)(T,{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"})})}),er.length>0&&(0,a.jsx)(T,{label:"Connection",children:(0,a.jsxs)("select",{value:eo,onChange:e=>en(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"",children:"Auto (by priority)"}),er.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)(T,{label:o.inputLabel,children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:y,onChange:e=>v(e.target.value),placeholder:o.inputPlaceholder,className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}),y&&(0,a.jsx)("button",{type:"button",onClick:()=>v(""),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"})})]})}),"systemone"===t&&(0,a.jsx)(T,{label:"Question",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:j,onChange:e=>w(e.target.value),placeholder:"Enter evaluation question or criteria",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}),j&&(0,a.jsx)("button",{type:"button",onClick:()=>w(""),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"})})]})}),b&&(0,a.jsx)(T,{label:"Ref Image (URL)",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:S,onChange:e=>C(e.target.value),placeholder:eh.image||"https://example.com/source.png",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}),S&&(0,a.jsx)("button",{type:"button",onClick:()=>C(""),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"})})]}),eg&&(0,a.jsx)("img",{src:eg,alt:"Reference",className:"max-h-40 rounded-lg border border-border object-contain bg-sidebar",onError:e=>{e.currentTarget.style.display="none"},onLoad:e=>{e.currentTarget.style.display="block"},loading:"lazy",decoding:"async"})]})}),g&&(0,a.jsx)(T,{label:"Mask (URL)",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{value:$,onChange:e=>P(e.target.value),placeholder:eh.mask_image||"https://example.com/mask.png",className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}),$&&(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"})})]}),ey&&(0,a.jsx)("img",{src:ey,alt:"Mask",className:"max-h-40 rounded-lg border border-border object-contain bg-sidebar",onError:e=>{e.currentTarget.style.display="none"},onLoad:e=>{e.currentTarget.style.display="block"},loading:"lazy",decoding:"async"})]})}),(o.extraFields||[]).filter(e=>0===c.length||Array.isArray(f?.params)&&f.params.includes(e.key)).map(e=>(0,a.jsx)(T,{label:e.label,children:"select"===e.type?(0,a.jsx)("select",{value:_[e.key]??"",onChange:t=>R(s=>({...s,[e.key]:t.target.value})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface 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:_[e.key]??"",placeholder:e.placeholder,onChange:t=>R(s=>({...s,[e.key]:t.target.value})),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface focus:outline-none focus:border-primary"}):(0,a.jsx)("input",{type:"number",value:_[e.key]??"",min:e.min,max:e.max,onChange:t=>R(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-surface focus:outline-none focus:border-primary"})},e.key)),"image"===t&&(0,a.jsx)(T,{label:"Output Format",children:(0,a.jsxs)("select",{value:Y,onChange:e=>Q(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface 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:()=>ed(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:ei?"check":"content_copy"}),ei?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:eT,disabled:ee||!y.trim()||!ex,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:ee?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),ee?"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:e$})]}),(ee||V)&&ek&&(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:ee?{animation:"spin 1s linear infinite"}:void 0,children:ee?"progress_activity":"check_circle"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:[V?.stage||"starting",!ee&&V?.bytesReceived?` \xb7 ${(V.bytesReceived/1024).toFixed(1)} KB`:""]})]}),G?.b64_json&&!z&&(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",loading:"lazy",decoding:"async"})]}),es&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:es}),(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 ",z&&(0,a.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",z.latencyMs,"ms"]})]}),z&&(0,a.jsxs)("button",{onClick:()=>eu(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.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?eP:o.defaultResponse}),"image"===t&&(Z||z?.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:Z||(z?.data?.data?.[0]?.b64_json?`data:image/png;base64,${z.data.data[0].b64_json}`:z?.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:Z||(z?.data?.data?.[0]?.b64_json?`data:image/png;base64,${z.data.data[0].b64_json}`:z?.data?.data?.[0]?.url),alt:"Generated",className:"max-w-full rounded-lg border border-border",loading:"lazy",decoding:"async"})]})]})]})]})}function U({providerId:e}){let t=(0,u.wG)(e),s=(0,N.KC)(e).filter(e=>"stt"===(0,N.CP)(e)),[r,l]=(0,n.useState)([]),o=[...s,...r],[i,c]=(0,n.useState)(s[0]?.id??""),m=o.find(e=>e.id===i),p=Array.isArray(m?.params)?m.params:[],[x,h]=(0,n.useState)(null),[f,b]=(0,n.useState)(""),[g,y]=(0,n.useState)(""),[v,j]=(0,n.useState)("json"),[w,S]=(0,n.useState)(""),[C,$]=(0,n.useState)(""),[E,P]=(0,n.useState)(!1),[_,R]=(0,n.useState)(""),[A,I]=(0,n.useState)(""),[M,O]=(0,n.useState)(null),[L,B]=(0,n.useState)(null),[D,K]=(0,n.useState)(!1),[F,q]=(0,n.useState)(""),{copied:z,copy:J}=(0,k.C)(),{copied:V,copy:H}=(0,k.C)();(0,n.useEffect)(()=>{R(window.location.origin),fetch("/api/keys").then(e=>e.json()).then(e=>{$((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}).catch(()=>{}),fetch("/api/tunnel/status").then(e=>e.json()).then(e=>{e.publicUrl&&I(e.publicUrl)}).catch(()=>{});let e=()=>{fetch("/api/models/custom",{cache:"no-store"}).then(e=>e.json()).then(e=>{l((e.models||[]).filter(e=>"stt"===(0,N.CP)(e)&&e.providerAlias===t))}).catch(()=>{})};return e(),window.addEventListener("focus",e),window.addEventListener("customModelChanged",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("customModelChanged",e)}},[t]);let G=E?A:_,W=i?`${t}/${i}`:"",Y=`curl -X POST ${G}/v1/audio/transcriptions \\
62
62
  -H "Authorization: Bearer ${C||"YOUR_KEY"}" \\
63
63
  -F "file=@${x?.name||"audio.mp3"}" \\
64
- -F "model=${Y}"${p.includes("language")&&f?` \\
64
+ -F "model=${W}"${p.includes("language")&&f?` \\
65
65
  -F "language=${f}"`:""}${p.includes("response_format")?` \\
66
- -F "response_format=${v}"`:""}${p.includes("temperature")&&k?` \\
67
- -F "temperature=${k}"`:""}${p.includes("prompt")&&g?` \\
68
- -F "prompt=${g}"`:""}`,Q=async()=>{if(!x||!Y)return;B(!0),q(""),O(null);let e=Date.now();try{let t=new FormData;t.append("file",x),t.append("model",Y),p.includes("language")&&f&&t.append("language",f),p.includes("response_format")&&t.append("response_format",v),p.includes("temperature")&&k&&t.append("temperature",k),p.includes("prompt")&&g&&t.append("prompt",g);let s={};C&&(s.Authorization=`Bearer ${C}`);let a=await fetch("/api/v1/audio/transcriptions",{method:"POST",headers:s,body:t});K(Date.now()-e);let r=(a.headers.get("content-type")||"").includes("application/json")?await a.json():await a.text();if(!a.ok)return void q(r?.error?.message||r?.error||r||`HTTP ${a.status}`);O(r)}catch(e){q(e.message||"Network error")}finally{B(!1)}},Z="string"==typeof M?M:M?JSON.stringify(M,null,2):`{
66
+ -F "response_format=${v}"`:""}${p.includes("temperature")&&w?` \\
67
+ -F "temperature=${w}"`:""}${p.includes("prompt")&&g?` \\
68
+ -F "prompt=${g}"`:""}`,Q=async()=>{if(!x||!W)return;K(!0),q(""),O(null);let e=Date.now();try{let t=new FormData;t.append("file",x),t.append("model",W),p.includes("language")&&f&&t.append("language",f),p.includes("response_format")&&t.append("response_format",v),p.includes("temperature")&&w&&t.append("temperature",w),p.includes("prompt")&&g&&t.append("prompt",g);let s={};C&&(s.Authorization=`Bearer ${C}`);let a=await fetch("/api/v1/audio/transcriptions",{method:"POST",headers:s,body:t});B(Date.now()-e);let r=(a.headers.get("content-type")||"").includes("application/json")?await a.json():await a.text();if(!a.ok)return void q(r?.error?.message||r?.error||r||`HTTP ${a.status}`);O(r)}catch(e){q(e.message||"Network error")}finally{K(!1)}},Z="string"==typeof M?M:M?JSON.stringify(M,null,2):`{
69
69
  "text": "Hello world..."
70
- }`;return(0,a.jsxs)(d.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:[o.length>0?(0,a.jsx)($,{label:"Model",children:(0,a.jsx)("select",{value:i,onChange:e=>c(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface 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)($,{label:"Model",children:(0,a.jsx)("input",{value:i,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-surface focus:outline-none focus:border-primary font-mono"})}),(0,a.jsx)($,{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"]}),R&&(0,a.jsxs)("button",{onClick:()=>_(e=>!e),title:P?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${P?"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)($,{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:C?`${C.slice(0,8)}${"•".repeat(Math.min(20,C.length-8))}`:(0,a.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),(0,a.jsx)($,{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=>h(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-surface file:text-text-main hover:file:bg-sidebar file:cursor-pointer"}),x&&(0,a.jsxs)("span",{className:"text-xs text-text-muted font-mono",children:[x.name," \xb7 ",(x.size/1024).toFixed(1)," KB"]})]})}),p.includes("language")&&(0,a.jsx)($,{label:"Language",children:(0,a.jsx)("input",{value:f,onChange:e=>b(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-surface focus:outline-none focus:border-primary font-mono"})}),p.includes("prompt")&&(0,a.jsx)($,{label:"Prompt",children:(0,a.jsx)("input",{value:g,onChange:e=>y(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-surface focus:outline-none focus:border-primary"})}),p.includes("temperature")&&(0,a.jsx)($,{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-surface focus:outline-none focus:border-primary"})}),p.includes("response_format")&&(0,a.jsx)($,{label:"Response Format",children:(0,a.jsxs)("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-surface 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:z?"check":"content_copy"}),z?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:Q,disabled:U||!x||!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:U?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),U?"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&&D&&(0,a.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",D,"ms"]})]}),M&&(0,a.jsxs)("button",{onClick:()=>H(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:V?"check":"content_copy"}),V?"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 U(){let{kind:e,id:t}=(0,r.useParams)(),s=(0,r.useRouter)(),l=u.rj.find(t=>t.id===e),m=(0,u.gC)(t)&&"embedding"===e,p=async()=>{if(confirm("Delete this 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 embedding node:",e)}},[x,h]=(0,n.useState)(null),[f,b]=(0,n.useState)(m),[g,y]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!m)return;let e=!1;return fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(s=>{e||(h((s.nodes||[]).find(e=>e.id===t)||null),b(!1))}).catch(()=>{e||b(!1)}),()=>{e=!0}},[t,m]),!l)return(0,r.notFound)();let v=u.Q2[t],w=m?x?{id:t,name:x.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"}:null:v;if(!m&&!v||m&&!f&&!x)return(0,r.notFound)();if(m&&f)return(0,a.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let N=m?["embedding"]:w.serviceKinds??["llm"];return m||N.includes(e)?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(o(),{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"}),l.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:`${w.color}15`},children:(0,a.jsx)(c.A,{src:`/providers/${w.id}.png`,alt:w.name,size:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",fallbackText:w.textIcon||w.id.slice(0,2).toUpperCase(),fallbackColor:w.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:w.name}),!m&&w.notice?.apiKeyUrl&&(0,a.jsxs)("a",{href:w.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:[m&&(0,a.jsxs)(d.Ex,{variant:"default",size:"sm",children:["Custom \xb7 ",x?.prefix]}),N.map(t=>(0,a.jsx)(d.Ex,{variant:t===e?"primary":"default",size:"sm",children:t.toUpperCase()},t))]})]}),m&&(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)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>y(!0),children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:p,children:"Delete"})]})]})]}),!m&&w.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:w.kindNotice[e]})]}),!m&&w.notice?.text&&!w.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:(0,i.Tl)(w.notice.text)}),w.notice.apiKeyUrl&&(0,a.jsx)("a",{href:w.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:(0,i.Tl)("Get API Key →")})]}),!m&&w.noAuth?(0,a.jsx)(d.gw,{providerId:t}):(0,a.jsx)(j,{providerId:t,isOAuth:!1}),"tts"!==e&&"webSearch"!==e&&"webFetch"!==e&&(0,a.jsx)(C,{providerId:t,kindFilter:e,providerAliasOverride:m?x?.prefix:void 0}),!m&&(w.searchConfig||w.fetchConfig||w.ttsConfig||w.sttConfig||w.embeddingConfig||w.rerankConfig||w.systemoneConfig||w.searchViaChat)&&(0,a.jsx)(d.Wx,{config:"webFetch"===e?w.fetchConfig:"tts"===e?w.ttsConfig:"stt"===e?w.sttConfig:"embedding"===e?w.embeddingConfig:"rerank"===e?w.rerankConfig:"systemone"===e?w.systemoneConfig:w.searchConfig||{mode:"chat-completions",defaultModel:w.searchViaChat?.defaultModel,pricingUrl:w.searchViaChat?.pricingUrl,freeTier:w.searchViaChat?.freeTier},provider:w,title:`${l.label} Config`}),"embedding"===e&&(0,a.jsx)(_,{providerId:t,customAlias:x?.prefix}),"tts"===e&&(0,a.jsx)(M,{providerId:t}),"stt"===e&&!m&&(0,a.jsx)(L,{providerId:t}),!m&&T[e]&&(0,a.jsx)(K,{providerId:t,kind:e}),m&&(0,a.jsx)(d.x0,{isOpen:g,node:x,onClose:()=>y(!1),onSaved:e=>{h(e),y(!1)}})]}):(0,r.notFound)()}},43073:(e,t,s)=>{"use strict";s.d(t,{O:()=>r,l:()=>o});let a=/https:\/\/accounts\.google\.com\/signin\/continue[^\s"'<>)\]]+/;function r(e){if("string"!=typeof e)return null;let t=a.exec(e);return t?t[0]:null}let l=/https:\/\/[^\s"'<>)\]]*account\.stepfun\.com\/security[^\s"'<>)\]]*/;function o(e){if("string"!=typeof e)return null;let t=l.exec(e);return t?t[0]:null}},70217:(e,t,s)=>{"use strict";function a(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"partial"===t?"warning":"error"===t||"expired"===t||"unavailable"===t||"needs-reauth"===t?"error":"default"}s.d(t,{g:()=>a})},90337:(e,t,s)=>{"use strict";s.d(t,{DY:()=>i});var a=s(73006),r=s(22862),l=s(43073);let o=/subscription_quota_exhausted|本周用量已满|本周额度已用完/i;function n(e,t){return(0,a.Tl)(e).replace("{n}",String(t))}function i(e){if(!e||"string"!=typeof e)return e??"";let t=(0,a.Tl)(e);if(t&&t!==e)return t;if(o.test(e))return(0,a.Tl)("Subscription quota used up. Please wait for the quota reset.");if(r.AZ.test(e)){let t=(0,l.l)(e),s=(0,a.Tl)("This account must complete real-name verification before StepFun will serve it. Complete it at {url}, then retry.");return s.replace("{url}",t||(0,a.Tl)("the provider's console"))}if(/Individual quota reached|QUOTA_EXHAUSTED|RESOURCE_EXHAUSTED/i.test(e)){let t,s,r,l,o,i,d,c,{delay:u,timestamp:m,model:p}=(t=String(e||""),s=null,r=null,l=/"quotaResetDelay"\s*:\s*"([^"]+)"/.exec(t),o=/\bResets in\s+([0-9hms.]+)/i.exec(t),s=l&&l[1]||o&&o[1]||null,i=/"quotaResetTimeStamp"\s*:\s*"([^"]+)"/.exec(t),d=/"quotaResetTimeStamp"\s*:\s*(".*?"|\S+)/.exec(t),(r=i&&i[1]||d&&d[1]||null)&&(r=r.replace(/^"|"$/g,"")),{delay:s,timestamp:r,model:/"model"\s*:\s*"([^"]+)"/.exec(t)?.[1]||null}),x=function(e){if(!e)return"";let{h:t,m:s,s:a}=e;if(a>=60&&(s+=Math.floor(a/60),a%=60),s>=60&&(t+=Math.floor(s/60),s%=60),t>=24){let e=Math.floor(t/24),s=t%24;return s>0?`${n("{n}d",e)} ${n("{n}h",s)}`:n("{n}d",e)}let r=[];return t>0&&r.push(n("{n}h",t)),s>0&&r.push(n("{n}m",s)),(a>0||0===r.length)&&r.push(n("{n}s",a)),r.join(" ")}((c=/^(?:(\d+(?:\.\d+)?)h)?(?:(\d+(?:\.\d+)?)m)?(?:(\d+(?:\.\d+)?)s)?$/i.exec(String(u||"").trim()))&&(c[1]||c[2]||c[3])?{h:Math.floor(parseFloat(c[1]||0)),m:Math.floor(parseFloat(c[2]||0)),s:Math.round(parseFloat(c[3]||0))}:null),h=m?function(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e||"";try{return t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return t.toISOString()}}(m):"",f=(0,a.Tl)(p?"Individual quota reached for model {model}. Resets at {time} (in {duration}).":"Individual quota reached. Resets at {time} (in {duration}).");return(f=(f=f.replace("{model}",p||"")).replace("{time}",h||(0,a.Tl)("shortly"))).replace("{duration}",x||(0,a.Tl)("a short while"))}return t}}},e=>{e.O(0,[3170,305,1321,5497,6109,8441,3794,7358],()=>e(e.s=35139)),_N_E=e.O()}]);
70
+ }`;return(0,a.jsxs)(d.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:[o.length>0?(0,a.jsx)(T,{label:"Model",children:(0,a.jsx)("select",{value:i,onChange:e=>c(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-surface 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)(T,{label:"Model",children:(0,a.jsx)("input",{value:i,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-surface focus:outline-none focus:border-primary font-mono"})}),(0,a.jsx)(T,{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:[G,"/v1/audio/transcriptions"]}),A&&(0,a.jsxs)("button",{onClick:()=>P(e=>!e),title:E?"Using tunnel":"Using local",className:`flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg border shrink-0 transition-colors ${E?"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)(T,{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:C?`${C.slice(0,8)}${"•".repeat(Math.min(20,C.length-8))}`:(0,a.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),(0,a.jsx)(T,{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=>h(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-surface file:text-text-main hover:file:bg-sidebar file:cursor-pointer"}),x&&(0,a.jsxs)("span",{className:"text-xs text-text-muted font-mono",children:[x.name," \xb7 ",(x.size/1024).toFixed(1)," KB"]})]})}),p.includes("language")&&(0,a.jsx)(T,{label:"Language",children:(0,a.jsx)("input",{value:f,onChange:e=>b(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-surface focus:outline-none focus:border-primary font-mono"})}),p.includes("prompt")&&(0,a.jsx)(T,{label:"Prompt",children:(0,a.jsx)("input",{value:g,onChange:e=>y(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-surface focus:outline-none focus:border-primary"})}),p.includes("temperature")&&(0,a.jsx)(T,{label:"Temperature",children:(0,a.jsx)("input",{type:"number",step:"0.1",min:"0",max:"1",value:w,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-surface focus:outline-none focus:border-primary"})}),p.includes("response_format")&&(0,a.jsx)(T,{label:"Response Format",children:(0,a.jsxs)("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-surface 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(Y),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:z?"check":"content_copy"}),z?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:Q,disabled:D||!x||!W,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:Y})]}),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&&L&&(0,a.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",L,"ms"]})]}),M&&(0,a.jsxs)("button",{onClick:()=>H(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:V?"check":"content_copy"}),V?"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 K(){let{kind:e,id:t}=(0,r.useParams)(),s=(0,r.useRouter)(),l=u.rj.find(t=>t.id===e),m=(0,u.gC)(t)&&"embedding"===e,p=async()=>{if(confirm("Delete this 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 embedding node:",e)}},[x,h]=(0,n.useState)(null),[f,b]=(0,n.useState)(m),[g,y]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!m)return;let e=!1;return fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(s=>{e||(h((s.nodes||[]).find(e=>e.id===t)||null),b(!1))}).catch(()=>{e||b(!1)}),()=>{e=!0}},[t,m]),!l)return(0,r.notFound)();let v=u.Q2[t],j=m?x?{id:t,name:x.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"}:null:v;if(!m&&!v||m&&!f&&!x)return(0,r.notFound)();if(m&&f)return(0,a.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let N=m?["embedding"]:j.serviceKinds??["llm"];return m||N.includes(e)?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(o(),{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"}),l.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:`${j.color}15`},children:(0,a.jsx)(c.A,{src:`/providers/${j.id}.png`,alt:j.name,size:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",fallbackText:j.textIcon||j.id.slice(0,2).toUpperCase(),fallbackColor:j.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:j.name}),!m&&j.notice?.apiKeyUrl&&(0,a.jsxs)("a",{href:j.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:[m&&(0,a.jsxs)(d.Ex,{variant:"default",size:"sm",children:["Custom \xb7 ",x?.prefix]}),N.map(t=>(0,a.jsx)(d.Ex,{variant:t===e?"primary":"default",size:"sm",children:t.toUpperCase()},t))]})]}),m&&(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)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>y(!0),children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:p,children:"Delete"})]})]})]}),!m&&j.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:j.kindNotice[e]})]}),!m&&j.notice?.text&&!j.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:(0,i.Tl)(j.notice.text)}),j.notice.apiKeyUrl&&(0,a.jsx)("a",{href:j.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:(0,i.Tl)("Get API Key →")})]}),!m&&j.noAuth?(0,a.jsx)(d.gw,{providerId:t}):(0,a.jsx)(w,{providerId:t,isOAuth:!1}),"tts"!==e&&"webSearch"!==e&&"webFetch"!==e&&(0,a.jsx)($,{providerId:t,kindFilter:e,providerAliasOverride:m?x?.prefix:void 0}),!m&&(j.searchConfig||j.fetchConfig||j.ttsConfig||j.sttConfig||j.embeddingConfig||j.rerankConfig||j.systemoneConfig||j.searchViaChat)&&(0,a.jsx)(d.Wx,{config:"webFetch"===e?j.fetchConfig:"tts"===e?j.ttsConfig:"stt"===e?j.sttConfig:"embedding"===e?j.embeddingConfig:"rerank"===e?j.rerankConfig:"systemone"===e?j.systemoneConfig:j.searchConfig||{mode:"chat-completions",defaultModel:j.searchViaChat?.defaultModel,pricingUrl:j.searchViaChat?.pricingUrl,freeTier:j.searchViaChat?.freeTier},provider:j,title:`${l.label} Config`}),"embedding"===e&&(0,a.jsx)(_,{providerId:t,customAlias:x?.prefix}),"tts"===e&&(0,a.jsx)(O,{providerId:t}),"stt"===e&&!m&&(0,a.jsx)(U,{providerId:t}),!m&&E[e]&&(0,a.jsx)(D,{providerId:t,kind:e}),m&&(0,a.jsx)(d.x0,{isOpen:g,node:x,onClose:()=>y(!1),onSaved:e=>{h(e),y(!1)}})]}):(0,r.notFound)()}},43073:(e,t,s)=>{"use strict";s.d(t,{O:()=>r,l:()=>o});let a=/https:\/\/accounts\.google\.com\/(?:v3\/)?signin\/continue[^\s"'<>)\]]+/;function r(e){if("string"!=typeof e)return null;let t=a.exec(e);return t?t[0]:null}let l=/https:\/\/[^\s"'<>)\]]*account\.stepfun\.com\/security[^\s"'<>)\]]*/;function o(e){if("string"!=typeof e)return null;let t=l.exec(e);return t?t[0]:null}},70217:(e,t,s)=>{"use strict";function a(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"partial"===t?"warning":"error"===t||"expired"===t||"unavailable"===t||"needs-reauth"===t?"error":"default"}s.d(t,{g:()=>a})},90337:(e,t,s)=>{"use strict";s.d(t,{DY:()=>i});var a=s(73006),r=s(22862),l=s(43073);let o=/subscription_quota_exhausted|本周用量已满|本周额度已用完/i;function n(e,t){return(0,a.Tl)(e).replace("{n}",String(t))}function i(e){if(!e||"string"!=typeof e)return e??"";let t=(0,a.Tl)(e);if(t&&t!==e)return t;if(o.test(e))return(0,a.Tl)("Subscription quota used up. Please wait for the quota reset.");if(r.AZ.test(e)){let t=(0,l.l)(e),s=(0,a.Tl)("This account must complete real-name verification before StepFun will serve it. Complete it at {url}, then retry.");return s.replace("{url}",t||(0,a.Tl)("the provider's console"))}if(/Individual quota reached|QUOTA_EXHAUSTED|RESOURCE_EXHAUSTED/i.test(e)){let t,s,r,l,o,i,d,c,{delay:u,timestamp:m,model:p}=(t=String(e||""),s=null,r=null,l=/"quotaResetDelay"\s*:\s*"([^"]+)"/.exec(t),o=/\bResets in\s+([0-9hms.]+)/i.exec(t),(s=l&&l[1]||o&&o[1]||null)&&(s=s.replace(/\.+$/,"")),i=/"quotaResetTimeStamp"\s*:\s*"([^"]+)"/.exec(t),d=/"quotaResetTimeStamp"\s*:\s*(".*?"|\S+)/.exec(t),(r=i&&i[1]||d&&d[1]||null)&&(r=r.replace(/^"|"$/g,"")),{delay:s,timestamp:r,model:/"model"\s*:\s*"([^"]+)"/.exec(t)?.[1]||null}),x=function(e){if(!e)return"";let{h:t,m:s,s:a}=e;if(a>=60&&(s+=Math.floor(a/60),a%=60),s>=60&&(t+=Math.floor(s/60),s%=60),t>=24){let e=Math.floor(t/24),s=t%24;return s>0?`${n("{n}d",e)} ${n("{n}h",s)}`:n("{n}d",e)}let r=[];return t>0&&r.push(n("{n}h",t)),s>0&&r.push(n("{n}m",s)),(a>0||0===r.length)&&r.push(n("{n}s",a)),r.join(" ")}((c=/^(?:(\d+(?:\.\d+)?)h)?(?:(\d+(?:\.\d+)?)m)?(?:(\d+(?:\.\d+)?)s)?$/i.exec(String(u||"").trim()))&&(c[1]||c[2]||c[3])?{h:Math.floor(parseFloat(c[1]||0)),m:Math.floor(parseFloat(c[2]||0)),s:Math.round(parseFloat(c[3]||0))}:null),h=m?function(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e||"";try{return t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return t.toISOString()}}(m):"",f=(0,a.Tl)(p?"Individual quota reached for model {model}. Resets at {time} (in {duration}).":"Individual quota reached. Resets at {time} (in {duration}).");return(f=(f=f.replace("{model}",p||"")).replace("{time}",h||(0,a.Tl)("shortly"))).replace("{duration}",x||(0,a.Tl)("a short while"))}return t}}},e=>{e.O(0,[3170,305,1321,5497,6109,8441,3794,7358],()=>e(e.s=35139)),_N_E=e.O()}]);