@hilbras/omnihilbras 2.9.4 → 2.9.5

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 (505) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +16 -16
  3. package/app/.next-cli-build/build-manifest.json +3 -3
  4. package/app/.next-cli-build/prerender-manifest.json +1 -1
  5. package/app/.next-cli-build/react-loadable-manifest.json +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  75. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  78. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  79. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  80. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  81. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  82. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  83. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  84. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  85. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  86. package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  87. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  88. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
  89. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  90. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  92. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
  98. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
  100. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +1 -1
  102. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  104. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  113. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/combos/presets/route.js +1 -1
  131. package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  148. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  152. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/models/chat/route.js +1 -1
  155. package/app/.next-cli-build/server/app/api/models/chat/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  157. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  160. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  162. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/models/test-batch/route.js +1 -1
  164. package/app/.next-cli-build/server/app/api/models/test-batch/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  166. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  168. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  171. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  175. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  176. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  182. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  184. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
  186. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
  190. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  192. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  194. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  196. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  197. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js +1 -1
  199. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  201. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  203. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  205. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  207. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  210. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  213. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  215. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/providers/web-session/[id]/route.js +1 -1
  217. package/app/.next-cli-build/server/app/api/providers/web-session/[id]/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  230. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  232. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  234. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  237. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  240. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
  242. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  243. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  246. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  248. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  250. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  257. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  259. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  261. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  265. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/usage/rate-limit/route.js +1 -1
  267. package/app/.next-cli-build/server/app/api/usage/rate-limit/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  270. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  273. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  275. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  276. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  277. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  278. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  279. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  280. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  281. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  283. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  284. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  285. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  286. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  288. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  289. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js +1 -1
  290. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
  291. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  292. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  293. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  294. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  295. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  296. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  298. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  299. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  300. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  301. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  302. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  303. package/app/.next-cli-build/server/app/api/v1/systemone/route.js +1 -1
  304. package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
  305. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  306. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  307. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  308. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  309. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  310. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  311. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  312. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  313. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  314. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  315. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  316. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  317. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  318. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  319. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  320. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  321. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  322. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  323. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  324. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  325. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  326. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  327. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  328. package/app/.next-cli-build/server/app/callback.html +1 -1
  329. package/app/.next-cli-build/server/app/callback.rsc +3 -3
  330. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  331. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  332. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +3 -3
  333. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  334. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +3 -3
  335. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +3 -3
  336. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +3 -3
  337. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  338. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  339. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +3 -3
  340. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +3 -3
  341. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +3 -3
  342. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  343. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  344. package/app/.next-cli-build/server/app/dashboard/combos.rsc +3 -3
  345. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +3 -3
  346. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +3 -3
  347. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  348. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  349. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +3 -3
  350. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +3 -3
  351. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +3 -3
  352. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  353. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  354. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +3 -3
  355. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +3 -3
  356. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +3 -3
  357. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  358. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  359. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +3 -3
  360. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +3 -3
  361. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +3 -3
  362. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  363. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  364. package/app/.next-cli-build/server/app/dashboard/profile.rsc +3 -3
  365. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +3 -3
  366. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +3 -3
  367. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  368. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  369. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +3 -3
  370. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +3 -3
  371. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +3 -3
  372. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  373. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  374. package/app/.next-cli-build/server/app/dashboard/providers.rsc +3 -3
  375. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +3 -3
  376. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +3 -3
  377. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  378. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  379. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +3 -3
  380. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +3 -3
  381. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +3 -3
  382. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  383. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  384. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +3 -3
  385. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +3 -3
  386. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +3 -3
  387. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
  388. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  389. package/app/.next-cli-build/server/app/dashboard/quota.rsc +4 -4
  390. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +4 -4
  391. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +4 -4
  392. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  393. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  394. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  395. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  396. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  397. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
  398. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  399. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  400. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +3 -3
  401. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  402. package/app/.next-cli-build/server/app/dashboard/skills.rsc +3 -3
  403. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +3 -3
  404. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +3 -3
  405. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  406. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  407. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +3 -3
  408. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +3 -3
  409. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +3 -3
  410. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
  411. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  412. package/app/.next-cli-build/server/app/dashboard/translator.rsc +3 -3
  413. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +3 -3
  414. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +3 -3
  415. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  416. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  417. package/app/.next-cli-build/server/app/dashboard/usage.rsc +3 -3
  418. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +3 -3
  419. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +3 -3
  420. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  421. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  422. package/app/.next-cli-build/server/app/dashboard.rsc +3 -3
  423. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +3 -3
  424. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +3 -3
  425. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  426. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  427. package/app/.next-cli-build/server/app/index.html +1 -1
  428. package/app/.next-cli-build/server/app/index.rsc +3 -3
  429. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  430. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  431. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  432. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  433. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  434. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  435. package/app/.next-cli-build/server/app/landing.html +1 -1
  436. package/app/.next-cli-build/server/app/landing.rsc +3 -3
  437. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
  438. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  439. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +3 -3
  440. package/app/.next-cli-build/server/app/login/page.js +1 -1
  441. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  442. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  443. package/app/.next-cli-build/server/app/login.html +1 -1
  444. package/app/.next-cli-build/server/app/login.rsc +3 -3
  445. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +3 -3
  446. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  447. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +3 -3
  448. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  449. package/app/.next-cli-build/server/app/page.js +1 -1
  450. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  451. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  452. package/app/.next-cli-build/server/app-paths-manifest.json +16 -16
  453. package/app/.next-cli-build/server/chunks/1329.js +1 -1
  454. package/app/.next-cli-build/server/chunks/1375.js +1 -0
  455. package/app/.next-cli-build/server/chunks/2066.js +1 -0
  456. package/app/.next-cli-build/server/chunks/24.js +1 -1
  457. package/app/.next-cli-build/server/chunks/2617.js +1 -1
  458. package/app/.next-cli-build/server/chunks/2881.js +1 -1
  459. package/app/.next-cli-build/server/chunks/3943.js +1 -1
  460. package/app/.next-cli-build/server/chunks/412.js +1 -1
  461. package/app/.next-cli-build/server/chunks/4123.js +1 -1
  462. package/app/.next-cli-build/server/chunks/4199.js +1 -1
  463. package/app/.next-cli-build/server/chunks/436.js +1 -1
  464. package/app/.next-cli-build/server/chunks/5330.js +1 -1
  465. package/app/.next-cli-build/server/chunks/5615.js +1 -1
  466. package/app/.next-cli-build/server/chunks/6070.js +1 -1
  467. package/app/.next-cli-build/server/chunks/615.js +1 -1
  468. package/app/.next-cli-build/server/chunks/6503.js +1 -1
  469. package/app/.next-cli-build/server/chunks/6723.js +1 -1
  470. package/app/.next-cli-build/server/chunks/6908.js +10 -0
  471. package/app/.next-cli-build/server/chunks/7073.js +1 -1
  472. package/app/.next-cli-build/server/chunks/7211.js +1 -1
  473. package/app/.next-cli-build/server/chunks/7247.js +1 -1
  474. package/app/.next-cli-build/server/chunks/7716.js +1 -1
  475. package/app/.next-cli-build/server/chunks/7914.js +1 -1
  476. package/app/.next-cli-build/server/chunks/820.js +1 -1
  477. package/app/.next-cli-build/server/chunks/8251.js +1 -1
  478. package/app/.next-cli-build/server/chunks/8287.js +1 -1
  479. package/app/.next-cli-build/server/chunks/8402.js +1 -1
  480. package/app/.next-cli-build/server/chunks/8499.js +2 -2
  481. package/app/.next-cli-build/server/chunks/8525.js +1 -1
  482. package/app/.next-cli-build/server/instrumentation.js +1 -1
  483. package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
  484. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  485. package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
  486. package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
  487. package/app/.next-cli-build/server/pages/404.html +1 -1
  488. package/app/.next-cli-build/server/pages/500.html +1 -1
  489. package/app/.next-cli-build/static/chunks/2723-d221ebfdd8e24af9.js +1 -0
  490. package/app/.next-cli-build/static/chunks/{5497-27e3c950b5d97d41.js → 5497-ff9981be1db3d2b6.js} +1 -1
  491. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-9504fe975ef84185.js +27 -0
  492. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-76c864ae857eec68.js +1 -0
  493. package/app/.next-cli-build/static/chunks/{webpack-782105d317e211e2.js → webpack-075fa8a8c2879e61.js} +1 -1
  494. package/app/package.json +1 -1
  495. package/app/public/providers/zcode.png +0 -0
  496. package/package.json +1 -1
  497. package/src/cli/menus/settings.js +16 -9
  498. package/app/.next-cli-build/server/chunks/7992.js +0 -1
  499. package/app/.next-cli-build/server/chunks/9617.js +0 -1
  500. package/app/.next-cli-build/server/chunks/9696.js +0 -7
  501. package/app/.next-cli-build/static/chunks/2723-8def0af25f7b656c.js +0 -1
  502. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-7f56fcd67de5a4df.js +0 -27
  503. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-a2334bcea51abcc8.js +0 -1
  504. /package/app/.next-cli-build/static/{CLokmNR1eeMLVVvsXga7b → 6r83antfTY0m1gUj5v4UM}/_buildManifest.js +0 -0
  505. /package/app/.next-cli-build/static/{CLokmNR1eeMLVVvsXga7b → 6r83antfTY0m1gUj5v4UM}/_ssgManifest.js +0 -0
@@ -0,0 +1,27 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{10606:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var a=s(95155),l=s(12115),i=s(14051),r=s.n(i);function n({alias:e,onSetAlias:t,onClearAlias:s,size:i="md"}){let[r,o]=(0,l.useState)(!1),[d,c]=(0,l.useState)(""),m="sm"===i?"grid h-6 w-6 place-items-center rounded text-muted transition-colors hover:bg-surface hover:text-gold-text disabled:opacity-40":"grid h-8 w-8 place-items-center rounded-lg text-muted transition-colors hover:bg-surface hover:text-gold-text disabled:opacity-40",u="sm"===i?"text-[13px]":"text-[15px]",p=()=>{o(!1),c("")},x=async()=>{let a=d.trim();if(a){try{await t(a),e&&e!==a&&await s?.()}catch{return}o(!1),c("")}};return r?(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("input",{value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&x(),"Escape"===e.key&&p()},placeholder:"alias","aria-label":"Model alias",autoFocus:!0,className:"w-24 rounded-md border border-line bg-surface px-1.5 py-1 font-mono text-[10px] text-text outline-none focus:border-gold"}),(0,a.jsx)("button",{type:"button",onClick:x,disabled:!d.trim(),"aria-label":"Save alias",title:"Save alias",className:m,children:(0,a.jsx)("span",{className:`material-symbols-outlined ${u}`,"aria-hidden":"true",children:"check"})}),(0,a.jsx)("button",{type:"button",onClick:p,"aria-label":"Cancel alias",title:"Cancel",className:m,children:(0,a.jsx)("span",{className:`material-symbols-outlined ${u}`,"aria-hidden":"true",children:"close"})})]}):(0,a.jsx)("button",{type:"button",onClick:()=>{c(e||""),o(!0)},"aria-label":e?`Rename alias ${e}`:"Set an alias",title:e?`Rename alias (${e})`:"Set an alias",className:m,children:(0,a.jsx)("span",{className:`material-symbols-outlined ${u}`,"aria-hidden":"true",children:"label"})})}n.propTypes={alias:r().string,onSetAlias:r().func.isRequired,onClearAlias:r().func,size:r().oneOf(["sm","md"])}},30840:(e,t,s)=>{Promise.resolve().then(s.bind(s,32172))},32172:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>en});var a=s(95155),l=s(12115),i=s(14051),r=s.n(i),n=s(73321),o=s(98500),d=s.n(o),c=s(5772),m=s(8247),u=s(35497),p=s(88105),x=s(28777),h=s(67899),f=s(62630);s(67468);var g=s(13097);let y=["none","low","medium","high"],b=["none","thinking"],v=["none","low","medium","high","xhigh","max"],j={openai:["none","minimal","low","medium","high","xhigh"],"claude-adaptive":v,"claude-budget":v,"gemini-level":["minimal","low","medium","high"],"gemini-budget":y,zai:b,qwen:y,kimi:["none","low","medium","high","max"],zcode:["low","high","max"],deepseek:["none","high","max"],commandcode:["none","low","medium","high","xhigh","max"],minimax:b,hunyuan:y,step:y,nous:y},w=["none","minimal","low","medium","high","xhigh","max"],N=["none","low","medium","high","max"],k=[{pattern:"*gemini-4*",levels:["low","medium","high"]},{pattern:"*claude*4.6*",levels:N},{pattern:"*claude*4-6*",levels:N},{provider:"codex",pattern:"*gpt-6*",levels:w},{provider:"codex",pattern:"*gpt-5.6-sol*",levels:[...w,"ultra"]},{provider:"codex",pattern:"*gpt-5.6-terra*",levels:[...w,"ultra"]},{provider:"codex",pattern:"*gpt-5.6-luna*",levels:w},{pattern:"*codex*",levels:["low","medium","high","xhigh"]},{pattern:"*mimo*v2.6*",levels:["none","low","medium","high","xhigh"]},{pattern:"*mimo*v2.5-pro*",levels:["none","low","medium","high","xhigh"]},{provider:"codebuddy-cn",pattern:"deepseek-v4-pro",levels:["low","high","xhigh"]},{provider:"codebuddy-cn",pattern:"deepseek-v4.1-flash",levels:["low","high","max"]},{pattern:"*deepseek-v4.*",levels:["none","low","medium","high","xhigh","max"]},{provider:"codebuddy-cn",pattern:"glm-5.3",levels:["low","high","max"]},{provider:"codebuddy-cn",pattern:"glm-5.3-flash",levels:["low","high","max"]},{provider:"codebuddy-cn",pattern:"glm-5.2",levels:["high","xhigh"]},{provider:"codebuddy-cn",pattern:"kimi-k2.8-preview",levels:["low","medium","high"]},{provider:"codebuddy-cn",pattern:"hy3",levels:["low","high"]},{provider:"codebuddy-cn",pattern:"hy4-preview",levels:["high"]},{provider:"codebuddy-intl",pattern:"deepseek-v4*",levels:["low","high","xhigh"]},{provider:"minimax-code",pattern:"MiniMax-M3.1*",levels:["low","medium","high","xhigh","max"]},{provider:"minimax-code",pattern:"MiniMax-M3",levels:["none","high"]},{provider:"minimax-code-global",pattern:"MiniMax-M3.1*",levels:["low","medium","high","xhigh","max"]},{provider:"minimax-code-global",pattern:"MiniMax-M3",levels:["none","high"]}];function C(e,t){if("kiro"===e&&null===function(e){if("string"!=typeof e)return null;let t=e.toLowerCase().replace(/-/g,".");if(/(?:^|[/.])gpt[/.]5[/.]6(?:[/.]|$)/.test(t))return"reasoning";if(!t.includes("claude"))return null;let s=function(e){if("string"!=typeof e)return null;let t=e.toLowerCase().replace(/-/g,".").match(/(?:^|[/.])claude(?:[/.][a-z]+)*[/.](\d+)(?:[/.](\d+))?(?:[/.]|$)/);return t?{major:Number(t[1]),minor:void 0===t[2]?null:Number(t[2])}:null}(e);if(!s)return null;let{major:a,minor:l}=s;return a<4||4===a&&(null===l||l<=5||null!==l&&l>=1e3)?null:"output_config"}(t))return null;let s=(0,h.nl)(e,t);if(!s.reasoning)return null;let a=String(t||"").replace(/\([^()]+\)\s*$/,""),l="codex"===e?(0,g.SM)("cx").find(e=>e.id===a)?.thinkingLevels:null,i=k.find(s=>(!s.provider||s.provider===e)&&(0,f.gH)(s.pattern,t)),r=l||i?.levels||j[s.thinkingFormat]||y;return!1===s.thinkingCanDisable&&(r=r.filter(e=>"none"!==e)),r}var S=s(65921),A=s(5293),$=s(929),T=s(73006);let O=new Map;async function P(e,t,{force:s=!1}={}){if(!e?.url||!e?.type)return{data:[]};let a=`${e.url}::${t||""}`;if(!s){let e=O.get(a);if(e&&Date.now()<e.expiresAt)return e.payload}try{let s=new URLSearchParams({url:e.url,type:e.type});t&&s.set("provider",t);let l=await fetch(`/api/providers/suggested-models?${s}`),i=await l.json().catch(()=>({})),r={data:Array.isArray(i.data)?i.data:[],...i.error?{error:i.error}:{},...i.upstream?{upstream:i.upstream}:{},...l.ok?{}:{error:i.error||`Request failed (HTTP ${l.status})`}};return r.data.length>0&&!r.error&&O.set(a,{payload:r,expiresAt:Date.now()+6e5}),r}catch(e){return{data:[],error:e?.message||"Network error"}}}function I({customModels:e=[],modelAliases:t={},providerAlias:s,builtInModels:a=[],type:l="llm",includeLegacyAliases:i=!0}){let r=new Set(a.map(e=>e.id)),n=new Set,o=[];for(let t of e){if(!t?.id||t.providerAlias!==s)continue;let e=t?.kind||t?.type||"llm";if(l&&e!==l||r.has(t.id))continue;let a=`${s}/${t.id}`;n.has(a)||(n.add(a),o.push({id:t.id,name:t.name||t.id,fullModel:a,source:"custom",type:e,origin:t.origin}))}if(!i)return o;let d=`${s}/`;for(let[e,s]of Object.entries(t||{})){if("string"!=typeof s||!s.startsWith(d))continue;let t=s.slice(d.length);!t||r.has(t)||n.has(s)||(n.add(s),o.push({id:t,alias:e,fullModel:s,source:"legacyAlias",type:l||"llm"}))}return o}var E=s(10606);function D({model:e,fullModel:t,alias:s,copied:l,onCopy:i,onSetAlias:r,onClearAlias:n,testStatus:o,isCustom:d,isFree:c,onDeleteAlias:m,onTest:p,isTesting:x,onDisable:h,caps:f,thinkingSuffix:g}){let y=g?`${t}(${g})`:t,b=`model-${e.id}`;return(0,a.jsxs)("div",{className:"flex w-full min-w-0 max-w-full flex-col gap-3 rounded-xl border border-line bg-bg-soft/45 p-3.5 transition-colors hover:border-line-strong sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,a.jsx)("span",{className:`grid h-8 w-8 shrink-0 place-items-center rounded-lg border ${"ok"===o?"border-success/25 bg-success/10 text-success":"error"===o?"border-danger/25 bg-danger/10 text-danger":"border-line bg-surface text-muted"}`,children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] ${x?"animate-spin text-gold-text":""}`,"aria-hidden":"true",children:x?"progress_activity":"ok"===o?"check_circle":"error"===o?"cancel":"memory"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,a.jsx)("p",{className:"truncate text-xs font-semibold",title:y,children:y}),e.name&&e.name!==e.id&&(0,a.jsx)("p",{className:"truncate text-[10px] text-muted",children:e.name}),s&&(0,a.jsxs)("span",{className:"shrink-0 rounded border border-line bg-surface px-1.5 py-0.5 font-mono text-[9px] text-muted",children:["alias: ",s]}),d&&(0,a.jsx)("span",{className:"shrink-0 rounded border border-gold/30 bg-gold-soft px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-wide text-gold-text",children:"custom"}),c&&(0,a.jsx)("span",{className:"shrink-0 rounded border border-success/25 bg-success/10 px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-wide text-success",children:"free"}),(0,a.jsx)(u.nh,{caps:f,colorOverride:"text-muted",size:12})]}),(0,a.jsx)("code",{className:"mt-1 block truncate font-mono text-[10px] text-muted",children:y})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[r&&(0,a.jsx)(E.A,{alias:s,onSetAlias:r,onClearAlias:n}),(0,a.jsx)("button",{type:"button",onClick:()=>i(y,b),"aria-label":`Copy ${e.id} model ID`,className:"grid h-8 w-8 place-items-center rounded-lg text-muted transition-colors hover:bg-surface hover:text-gold-text",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px]","aria-hidden":"true",children:l===b?"check":"content_copy"})}),p&&(0,a.jsxs)("button",{type:"button",onClick:p,disabled:x,"aria-label":`Test ${e.id}`,"aria-busy":x,className:"btn-quiet !px-2 !py-2 !text-[11px]",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${x?"animate-spin":""}`,"aria-hidden":"true",children:x?"progress_activity":"bolt"}),x?"Testing":"Test"]}),d?(0,a.jsx)("button",{type:"button",onClick:m,className:"grid h-8 w-8 place-items-center rounded-lg text-muted transition-colors hover:bg-danger/10 hover:text-danger",title:"Remove custom model","aria-label":`Remove ${e.id}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px]","aria-hidden":"true",children:"close"})}):h?(0,a.jsx)("button",{type:"button",onClick:h,className:"grid h-8 w-8 place-items-center rounded-lg text-muted transition-colors hover:bg-danger/10 hover:text-danger sm:opacity-0 sm:group-hover/model-list:opacity-100",title:"Disable this model","aria-label":`Disable ${e.id}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px]","aria-hidden":"true",children:"close"})}):null]})]})}function R({modelId:e,fullModel:t,alias:s,copied:l,onCopy:i,onSetAlias:r,onClearAlias:n,onDeleteAlias:o,onTest:d,testStatus:c,isTesting:m}){let u="ok"===c?"#22c55e":"error"===c?"#ef4444":void 0;return(0,a.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===c?"border-green-500/40":"error"===c?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:u?{color:u}:void 0,children:"ok"===c?"check_circle":"error"===c?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:e}),s&&(0,a.jsxs)("span",{className:"shrink-0 rounded border border-line bg-surface px-1.5 py-0.5 font-mono text-[9px] text-muted",children:["alias: ",s]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:()=>i(t,`model-${e}`),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:l===`model-${e}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:l===`model-${e}`?"Copied!":"Copy"})]}),d&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:d,disabled:m,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:m?{animation:"spin 1s linear infinite"}:void 0,children:m?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:m?"Testing...":"Test"})]})]})]}),r&&(0,a.jsx)(E.A,{alias:s,onSetAlias:r,onClearAlias:n}),(0,a.jsx)("button",{onClick:o,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function z({providerAlias:e,modelAliases:t,customModels:s,copied:i,onCopy:r,onSetAlias:n,onDeleteAlias:o,onAddCustomModel:d,onDeleteCustomModel:c}){let[m,p]=(0,l.useState)(""),[x,h]=(0,l.useState)(!1),f=I({customModels:s,modelAliases:t,providerAlias:e,type:"llm"}),g=async()=>{if(!m.trim()||x)return;let e=m.trim();if(f.some(t=>t.id===e))return void alert("Model already exists for this provider.");h(!0);try{await d(e),p("")}catch(e){console.log("Error adding model:",e)}finally{h(!1)}};return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"This provider accepts any model id. Add models and create aliases for quick access."}),(0,a.jsxs)("div",{className:"flex items-end gap-2",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("label",{htmlFor:"new-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,a.jsx)("input",{id:"new-model-input",type:"text",value:m,onChange:e=>p(e.target.value),onKeyDown:e=>"Enter"===e.key&&g(),placeholder:"anthropic/claude-3-opus",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,a.jsx)(u.$n,{size:"sm",icon:"add",onClick:g,disabled:!m.trim()||x,children:x?"Adding...":"Add"})]}),f.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-3",children:f.map(({id:s,fullModel:l,alias:d,source:m})=>{let u=d||Object.entries(t).find(([,t])=>t===`${e}/${s}`)?.[0];return(0,a.jsx)(R,{modelId:s,fullModel:l,alias:u,copied:i,onCopy:r,onSetAlias:n?t=>n(s,t,e):void 0,onClearAlias:u?()=>o(u):void 0,onDeleteAlias:()=>"custom"===m?c(s):o(u)},`${m}-${l}`)})})]})}function M({modelId:e,fullModel:t,alias:s,copied:l,onCopy:i,onSetAlias:r,onClearAlias:n,onDeleteAlias:o,onTest:d,testStatus:c,isTesting:m}){let u="ok"===c?"#22c55e":"error"===c?"#ef4444":void 0;return(0,a.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===c?"border-green-500/40":"error"===c?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:u?{color:u}:void 0,children:"ok"===c?"check_circle":"error"===c?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:e}),s&&(0,a.jsxs)("span",{className:"shrink-0 rounded border border-line bg-surface px-1.5 py-0.5 font-mono text-[9px] text-muted",children:["alias: ",s]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:()=>i(t,`model-${e}`),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:l===`model-${e}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:l===`model-${e}`?"Copied!":"Copy"})]}),d&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:d,disabled:m,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:m?{animation:"spin 1s linear infinite"}:void 0,children:m?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:m?"Testing...":"Test"})]})]})]}),r&&(0,a.jsx)(E.A,{alias:s,onSetAlias:r,onClearAlias:n}),(0,a.jsx)("button",{onClick:o,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function q({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,customModels:i,copied:r,onCopy:n,onSetAlias:o,onDeleteAlias:d,onAddCustomModel:c,onDeleteCustomModel:m,connections:p,isAnthropic:x}){let[h,f]=(0,l.useState)(""),[g,y]=(0,l.useState)(!1),[b,v]=(0,l.useState)(!1),[j,w]=(0,l.useState)(null),[N,k]=(0,l.useState)({}),C=async t=>{if(!j){w(t);try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${e}/${t}`})}),a=await s.json();k(e=>({...e,[t]:a.ok?"ok":"error"}))}catch{k(e=>({...e,[t]:"error"}))}finally{w(null)}}},S=I({customModels:i,modelAliases:s,providerAlias:e,type:"llm"}),A=async()=>{if(!h.trim()||g)return;let e=h.trim();if(S.some(t=>t.id===e))return void alert("Model already exists for this provider.");y(!0);try{await c(e),f("")}catch(e){console.log("Error adding model:",e)}finally{y(!1)}},$=async()=>{if(b)return;let e=p.find(e=>!1!==e.isActive);if(e){v(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||"Failed to import models");let a=s.models||[];if(0===a.length)return void alert("No models returned from /models.");let l=0;for(let e of a){let t=e.id||e.name||e.model;t&&(S.some(e=>e.id===t)||(await c(t),l+=1))}0===l&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{v(!1)}}},T=p.some(e=>!1!==e.isActive);return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",x?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,a.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,a.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,a.jsx)("input",{id:"new-compatible-model-input",type:"text",value:h,onChange:e=>f(e.target.value),onKeyDown:e=>"Enter"===e.key&&A(),placeholder:x?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,a.jsx)(u.$n,{size:"sm",icon:"add",onClick:A,disabled:!h.trim()||g,children:g?"Adding...":"Add"}),(0,a.jsx)(u.$n,{size:"sm",variant:"secondary",icon:"download",onClick:$,disabled:!T||b,children:b?"Importing...":"Import from /models"})]}),!T&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),S.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-3",children:S.map(({id:l,alias:i,source:c})=>{let u=i||Object.entries(s).find(([,t])=>t===`${e}/${l}`)?.[0];return(0,a.jsx)(M,{modelId:l,fullModel:`${t}/${l}`,alias:u,copied:r,onCopy:n,onSetAlias:o?t=>o(l,t,e):void 0,onClearAlias:u?()=>d(u):void 0,onDeleteAlias:()=>"custom"===c?m(l):d(u),onTest:p.length>0?()=>C(l):void 0,testStatus:N[l],isTesting:j===l},`${c}-${e}/${l}`)})})]})}D.propTypes={model:r().shape({id:r().string.isRequired,name:r().string}).isRequired,fullModel:r().string.isRequired,alias:r().string,copied:r().string,onCopy:r().func.isRequired,onSetAlias:r().func,onClearAlias:r().func,testStatus:r().oneOf(["ok","error"]),isCustom:r().bool,isFree:r().bool,onDeleteAlias:r().func,onTest:r().func,isTesting:r().bool,onDisable:r().func,caps:r().object,thinkingSuffix:r().string},R.propTypes={modelId:r().string.isRequired,fullModel:r().string.isRequired,alias:r().string,copied:r().string,onCopy:r().func.isRequired,onSetAlias:r().func,onClearAlias:r().func,onDeleteAlias:r().func.isRequired,onTest:r().func,testStatus:r().oneOf(["ok","error"]),isTesting:r().bool},z.propTypes={providerAlias:r().string.isRequired,modelAliases:r().object.isRequired,customModels:r().arrayOf(r().object),copied:r().string,onCopy:r().func.isRequired,onSetAlias:r().func,onDeleteAlias:r().func.isRequired,onAddCustomModel:r().func.isRequired,onDeleteCustomModel:r().func.isRequired},q.propTypes={providerStorageAlias:r().string.isRequired,providerDisplayAlias:r().string.isRequired,modelAliases:r().object.isRequired,customModels:r().arrayOf(r().object),copied:r().string,onCopy:r().func.isRequired,onSetAlias:r().func,onDeleteAlias:r().func.isRequired,onAddCustomModel:r().func.isRequired,onDeleteCustomModel:r().func.isRequired,connections:r().arrayOf(r().shape({id:r().string,isActive:r().bool})).isRequired,isAnthropic:r().bool};var _=s(47650),U=s(70217);function K({until:e}){let[t,s]=(0,l.useState)("");return((0,l.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void s("");let a=Math.floor(t/1e3);if(a<60)s(`${a}s`);else if(a<3600)s(`${Math.floor(a/60)}m ${a%60}s`);else{let e=Math.floor(a/3600),t=Math.floor(a%3600/60);s(`${e}h ${t}m`)}};t();let a=setInterval(t,1e3);return()=>clearInterval(a)},[e]),t)?(0,a.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function F({connection:e,proxyPools:t,isOAuth:s,isFirst:i,isLast:r,onMoveUp:n,onMoveDown:o,onToggleActive:d,onUpdateProxy:c,onEdit:m,onDelete:p,oneByOneStatus:x=null,autoPing:h=null}){let[f,g]=(0,l.useState)(!1),[y,b]=(0,l.useState)(!1),v=(0,l.useRef)(null),j=(0,l.useRef)(null),[w,N]=(0,l.useState)(null),k=new Map((t||[]).map(e=>[e.id,e])),C=e.providerSpecificData?.proxyPoolId||null,S=C?k.get(C):null,A=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,$=!!C||A,T=S?`Pool: ${S.name}`:C?`Pool: ${C} (inactive/missing)`:A?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",O=(()=>{if(!h)return"";let e=[];return(h.reactiveOn&&e.push("On reset"),h.scheduleOn&&e.push(`Scheduled (${h.scheduleSummary||"active"})`),e.length>0)?`Auto-ping active: ${e.join(" + ")}. Click to configure.`:"codex"===h.provider?"Auto-starts the next 5h Codex window after reset or on schedule. Click to configure.":"Auto-starts a new window on quota reset or fixed schedule. Click to configure."})(),P="";if(S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);P=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{P=t}}let I=S?.noProxy||e.providerSpecificData?.connectionNoProxy||"",E="default";S?.isActive===!0?E="success":(C||A)&&(E="error"),(0,l.useEffect)(()=>{if(!f)return;let e=e=>{v.current?.contains(e.target)||j.current?.contains(e.target)||g(!1)},t=()=>g(!1);return document.addEventListener("mousedown",e),window.addEventListener("resize",t),document.addEventListener("scroll",t,!0),()=>{document.removeEventListener("mousedown",e),window.removeEventListener("resize",t),document.removeEventListener("scroll",t,!0)}},[f]);let D=async e=>{b(!0);try{await c("__none__"===e?null:e)}finally{b(!1),g(!1)}},R=e.authType||(s?"oauth":"apikey"),z="oauth"===R,M="cookie"===R,q=e.name?.trim()||e.email?.trim()||e.displayName?.trim()||(z?"OAuth Account":M?"Cookie Account":"API Key"),J=e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null,[L,H]=(0,l.useState)(!1),W=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,l.useEffect)(()=>{let t=()=>{H(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let s=W?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[W]);let B="unavailable"!==e.testStatus||L?e.testStatus:"active",Z=()=>x?"queued"===x.state?"queued":"testing"===x.state?"testing":"success"===x.state?"success":"failed"===x.state?x.error?`failed: ${x.error}`:"failed":null:null;return(0,a.jsxs)("div",{className:`group flex min-w-0 flex-col gap-3 rounded-lg p-2 transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between ${!1===e.isActive?"opacity-60":""}`,children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,a.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,a.jsx)("button",{onClick:n,disabled:i,className:`p-0.5 rounded ${i?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(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_down"})})]}),(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:M?"cookie":z?"lock":"key"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:q}),J&&(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:J}),(0,a.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,a.jsx)(u.Ex,{variant:(0,U.g)(e.isActive,B),size:"sm",dot:!0,children:!1===e.isActive?"disabled":B||"Unknown"}),(0,a.jsx)(u.Ex,{variant:"default",size:"sm",children:z?"OAuth":M?"Cookie":"API Key"}),$&&(0,a.jsx)(u.Ex,{variant:E,size:"sm",children:"Proxy"}),L&&!1!==e.isActive&&(0,a.jsx)(K,{until:W}),e.lastError&&!1!==e.isActive&&(0,a.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:e.lastError,children:e.lastError}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),Z()&&(0,a.jsx)(u.Ex,{variant:x?"success"===x.state?"success":"failed"===x.state?"error":"testing"===x.state?"primary":"default":"default",size:"sm",children:Z()})]}),$&&(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:T,children:T}),P&&(0,a.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[260px]",children:P}),I&&(0,a.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:I,children:["no_proxy: ",I]})]})]})]}),(0,a.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,a.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[(t||[]).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{ref:j,onClick:()=>{if(f)return void g(!1);let e=j.current?.getBoundingClientRect();if(!e)return void g(!0);let s=((t?.length||0)+1)*34+8,a=window.innerHeight-e.bottom,l=a<s&&e.top>a;N({position:"fixed",right:window.innerWidth-e.right,...l?{bottom:window.innerHeight-e.top+4,maxHeight:Math.max(e.top-8,120)}:{top:e.bottom+4,maxHeight:Math.max(a-8,120)}}),g(!0)},className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${$?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),f&&(0,_.createPortal)((0,a.jsxs)("div",{ref:v,style:w,className:"z-50 max-w-[78vw] min-w-[160px] overflow-y-auto rounded-lg border border-border bg-bg py-1 shadow-lg",children:[(0,a.jsx)("button",{onClick:()=>D("__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:()=>D(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))]}),document.body)]}),h&&(0,a.jsx)(u.m_,{text:O,children:(0,a.jsxs)("button",{onClick:h.onConfigure,className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${h.isActive?"text-primary":"text-text-muted hover:text-primary"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]})}),(0,a.jsxs)("button",{onClick:m,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",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:p,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 hover:bg-red-500/10",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)(u.lM,{size:"sm",checked:e.isActive??!0,onChange:d,title:e.isActive??!0?"Disable connection":"Enable connection"})]})]})}K.propTypes={until:r().string.isRequired},F.propTypes={connection:r().shape({id:r().string,name:r().string,email:r().string,displayName:r().string,modelLockUntil:r().string,testStatus:r().string,isActive:r().bool,lastError:r().string,priority:r().number,globalPriority:r().number}).isRequired,proxyPools:r().arrayOf(r().shape({id:r().string,name:r().string,proxyUrl:r().string,noProxy:r().string,isActive:r().bool})),isOAuth:r().bool.isRequired,isFirst:r().bool.isRequired,isLast:r().bool.isRequired,onMoveUp:r().func.isRequired,onMoveDown:r().func.isRequired,onToggleActive:r().func.isRequired,onUpdateProxy:r().func,onEdit:r().func.isRequired,onDelete:r().func.isRequired,oneByOneStatus:r().shape({state:r().string,error:r().string}),autoPing:r().shape({isActive:r().bool,provider:r().string,reactiveOn:r().bool,scheduleOn:r().bool,scheduleSummary:r().string,onConfigure:r().func})};let J=`name1|sk-key1
2
+ name2|sk-key2
3
+ sk-key-only-auto-named`;function L({isOpen:e,provider:t,providerName:s,isCompatible:i,isAnthropic:r,authType:n,authHint:o,website:d,proxyPools:c,error:m,existingNames:x,onSave:h,onBulkDone:f,onClose:g}){let y="__none__",b="ollama-local"===t,v="cookie"===n,j="xai"===t&&!v,w=v?"Cookie Value":"qoder"===t||"qoder-cn"===t?"Personal Access Token (PAT)":"API Key",N="azure"===t,k="cloudflare-ai"===t,C=p.Q2?.[t]?.credentialForm==="aws",S=p.Q2?.[t]?.apiKeyOptionalWith||null,A=p.Q2?.[t]?.regions||null,$=p.Q2?.[t]?.defaultRegion||A?.[0]?.id||"",[T,O]=(0,l.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:y,ollamaHostUrl:""}),[P,I]=(0,l.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[E,D]=(0,l.useState)({accountId:""}),[R,z]=(0,l.useState)({profile:"",region:"",accessKeyId:"",sessionToken:""}),[M,q]=(0,l.useState)($),[_,U]=(0,l.useState)(!1),[K,F]=(0,l.useState)(null),[H,W]=(0,l.useState)(!1),B=k?`name1|sk-key1|acc123456
4
+ name2|sk-key2|def789012
5
+ sk-key-only-auto-named`:"qoder"===t||"qoder-cn"===t?`name1|pt-xxxxx
6
+ name2|pt-yyyyy
7
+ pt-only-auto-named`:J,[Z,G]=(0,l.useState)("single"),[Q,V]=(0,l.useState)(""),[X,Y]=(0,l.useState)(null),ee=()=>{if(b&&T.ollamaHostUrl.trim())return{baseUrl:T.ollamaHostUrl.trim()};if(N)return{azureEndpoint:P.azureEndpoint,apiVersion:P.apiVersion,deployment:P.deployment,organization:P.organization};if(k)return{accountId:E.accountId};if(C){let e={};return R.profile.trim()&&(e.profile=R.profile.trim()),R.region.trim()&&(e.region=R.region.trim()),R.accessKeyId.trim()&&(e.accessKeyId=R.accessKeyId.trim()),R.sessionToken.trim()&&(e.sessionToken=R.sessionToken.trim()),Object.keys(e).length?e:void 0}if(A&&M)return{region:M}},et=()=>{let e=ee();return!!(S&&e?.[S])||(C?!!T.apiKey&&!!e?.accessKeyId:!!T.apiKey)},es=async()=>{U(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:T.apiKey,providerSpecificData:ee()})}),s=await e.json();F(s.valid?"success":"failed")}catch{F("failed")}finally{U(!1)}},ea=async()=>{if(t&&(b||et())&&(b||T.name)&&(!i||T.defaultModel.trim())){W(!0);try{let e=!1;try{U(!0),F(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:T.apiKey,providerSpecificData:ee()})});e=!!(await s.json()).valid,F(e?"success":"failed")}catch{F("failed")}finally{U(!1)}await h({name:T.name||(b?"Ollama Local":""),apiKey:T.apiKey,defaultModel:i?T.defaultModel.trim():void 0,priority:T.priority,proxyPoolId:T.proxyPoolId===y?null:T.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:ee()})}finally{W(!1)}}},el=async()=>{let e=Q.split("\n");if(!e.length)return;let s=function(e,t,s={}){let{isCloudflareAi:a=!1}=s,l=new Set((Array.isArray(t)?t:[]).map(e=>"string"==typeof e?e.toLowerCase():"")),i=[];for(let t of e){let e,s="string"==typeof t?t.trim():"";if(!s)continue;let r=function(e,t={}){let{isCloudflareAi:s=!1}=t,a=e.split("|");if(s&&a.length>=3){let e=a[0].trim();return{baseName:e||"Key",apiKey:a.slice(1,-1).join("|").trim(),providerSpecificData:{accountId:a[a.length-1].trim()}}}return a.length>=2?{baseName:a[0].trim()||"Key",apiKey:a.slice(1).join("|").trim()}:{baseName:"Key",apiKey:a[0].trim()}}(s,{isCloudflareAi:a});if(!r||!r.apiKey)continue;let n=r.baseName,o=1;for(;e=`${n} ${o}`,l.has(e.toLowerCase());)o+=1;l.add(e.toLowerCase());let d={name:e,apiKey:r.apiKey,skipped:!1};r.providerSpecificData&&(d.providerSpecificData=r.providerSpecificData),i.push(d)}return i}(e,x,{isCloudflareAi:k});if(!s.length)return;W(!0),Y(null);let a=0,l=0;for(let e of s)try{let s=!1;try{let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:e.apiKey})});s=!!(await a.json().catch(()=>({}))).valid}catch{s=!1}(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:e.apiKey,name:e.name,priority:1,testStatus:s?"active":"unknown",...e.providerSpecificData?{providerSpecificData:e.providerSpecificData}:{}})})).ok?a++:l++}catch{l++}W(!1),Y({success:a,failed:l}),a>0&&f&&f()};return t?(0,a.jsx)(u.aF,{isOpen:e,title:`Add ${s||t} ${w}`,onClose:g,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[!C&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(u.$n,{size:"sm",variant:"single"===Z?"primary":"ghost",onClick:()=>{G("single"),Y(null)},children:"Single"}),(0,a.jsx)(u.$n,{size:"sm",variant:"bulk"===Z?"primary":"ghost",onClick:()=>{G("bulk"),Y(null)},children:"Bulk Add"})]}),"bulk"===Z&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:k?(0,a.jsxs)(a.Fragment,{children:["One key per line. Format: ",(0,a.jsx)("code",{children:"name|apiKey|accountId"})," or just ",(0,a.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}):"qoder"===t||"qoder-cn"===t?(0,a.jsxs)(a.Fragment,{children:["One PAT per line. Format: ",(0,a.jsx)("code",{children:"name|pt-..."})," or just ",(0,a.jsx)("code",{children:"pt-..."})," (auto-named by index)."]}):(0,a.jsxs)(a.Fragment,{children:["One key per line. Format: ",(0,a.jsx)("code",{children:"name|apiKey"})," or just ",(0,a.jsx)("code",{children:"apiKey"})," (auto-named by index)."]})}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[140px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:B,value:Q,onChange:e=>V(e.target.value)}),X&&(0,a.jsxs)("div",{className:`text-sm font-medium ${X.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",X.success," added",X.failed>0?`, ✗ ${X.failed} failed`:""]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(u.$n,{onClick:el,fullWidth:!0,disabled:H||!Q.trim(),children:H?"Adding...":"Add All Keys"}),(0,a.jsx)(u.$n,{onClick:g,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===Z&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.pd,{label:"Name",value:T.name,onChange:e=>O({...T,name:e.target.value}),placeholder:b?"Ollama Local":"Production Key"}),b&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(u.pd,{label:"Ollama Host URL",value:T.ollamaHostUrl,onChange:e=>O({...T,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(u.$n,{onClick:es,disabled:_||H,variant:"secondary",children:_?"Checking...":"Check"})})]}),!b&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(u.pd,{label:w,type:v?"text":"password",value:T.apiKey,onChange:e=>O({...T,apiKey:e.target.value}),placeholder:v?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":j?"xai-...":"qoder"===t||"qoder-cn"===t?"pt-...":"",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(u.$n,{onClick:es,disabled:!et()||_||H,variant:"secondary",children:_?"Checking...":"Check"})})]}),j&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Use a direct xAI API key from console.x.ai. This is separate from Grok Build OAuth."}),v&&o&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[o,d&&(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsxs)("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",d.replace(/^https?:\/\//,"")]})]})]}),A&&(0,a.jsx)(u.l6,{label:"Region",value:M,onChange:e=>q(e.target.value),options:A.map(e=>({value:e.id,label:e.label}))}),i&&(0,a.jsx)(u.pd,{label:"Default Model",value:T.defaultModel,onChange:e=>O({...T,defaultModel:e.target.value}),placeholder:r?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),b&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,a.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,a.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),K&&(0,a.jsx)(u.Ex,{variant:"success"===K?"success":"error",children:"success"===K?"Valid":"Invalid"}),m&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:m}),i&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default."}),k&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,a.jsx)(u.pd,{label:"Account ID",value:E.accountId,onChange:e=>D({...E,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,a.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),C&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"AWS Bedrock Credentials"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(u.pd,{label:"AWS Profile (SSO — recommended)",value:R.profile,onChange:e=>z({...R,profile:e.target.value}),placeholder:"my-sso-profile"}),(0,a.jsx)(u.pd,{label:"Region",value:R.region,onChange:e=>z({...R,region:e.target.value}),placeholder:"us-east-1"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Set a profile from ",(0,a.jsx)("code",{children:"~/.aws/config"})," and leave the API key empty, then run"," ",(0,a.jsxs)("code",{children:["aws sso login --profile ",R.profile||"my-sso-profile"]}),". Credentials refresh automatically."]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 mt-4",children:[(0,a.jsx)(u.pd,{label:"Access Key ID (only for static keys)",value:R.accessKeyId,onChange:e=>z({...R,accessKeyId:e.target.value}),placeholder:"AKIA..."}),(0,a.jsx)(u.pd,{label:"Session Token (only for temporary ASIA… keys)",type:"password",value:R.sessionToken,onChange:e=>z({...R,sessionToken:e.target.value}),placeholder:"FwoGZXIvYXdz..."})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["For static keys instead: put the AWS ",(0,a.jsx)("strong",{children:"secret"})," access key in the API Key field above and the access key id here. A profile, if set, takes precedence."]})]}),N&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(u.pd,{label:"Azure Endpoint",value:P.azureEndpoint,onChange:e=>I({...P,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,a.jsx)(u.pd,{label:"Deployment Name",value:P.deployment,onChange:e=>I({...P,deployment:e.target.value}),placeholder:"gpt-4"}),(0,a.jsx)(u.pd,{label:"API Version",value:P.apiVersion,onChange:e=>I({...P,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,a.jsx)(u.pd,{label:"Organization",value:P.organization,onChange:e=>I({...P,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,a.jsx)(u.pd,{label:"Priority",type:"number",value:T.priority,onChange:e=>O({...T,priority:Number.parseInt(e.target.value)||1})}),(0,a.jsx)(u.l6,{label:"Proxy Pool",value:T.proxyPoolId,onChange:e=>O({...T,proxyPoolId:e.target.value}),options:[{value:y,label:"None"},...(c||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(c||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(u.$n,{onClick:ea,fullWidth:!0,disabled:H||!b&&(!T.name||!et())||i&&!T.defaultModel.trim()||N&&(!P.azureEndpoint||!P.deployment||!P.organization)||k&&!E.accountId,children:H?"Saving...":"Save"}),(0,a.jsx)(u.$n,{onClick:g,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function H({isOpen:e,node:t,onSave:s,onClose:i,isAnthropic:r}){let[n,o]=(0,l.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[d,c]=(0,l.useState)(!1),[m,p]=(0,l.useState)(""),[x,h]=(0,l.useState)(""),[f,g]=(0,l.useState)(!1),[y,b]=(0,l.useState)(null);(0,l.useEffect)(()=>{t&&o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(r?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,r]);let v=async()=>{if(n.name.trim()&&n.prefix.trim()&&n.baseUrl.trim()){c(!0);try{let e={name:n.name,prefix:n.prefix,baseUrl:n.baseUrl};r||(e.apiType=n.apiType),await s(e)}finally{c(!1)}}},j=async()=>{g(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:m,type:r?"anthropic-compatible":"openai-compatible",modelId:x.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{g(!1)}};return t?(0,a.jsx)(u.aF,{isOpen:e,title:`Edit ${r?"Anthropic":"OpenAI"} Compatible`,onClose:i,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(u.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:`${r?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,a.jsx)(u.pd,{label:"Prefix",value:n.prefix,onChange:e=>o({...n,prefix:e.target.value}),placeholder:r?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!r&&(0,a.jsx)(u.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:n.apiType,onChange:e=>o({...n,apiType:e.target.value})}),(0,a.jsx)(u.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>o({...n,baseUrl:e.target.value}),placeholder:r?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${r?"Anthropic":"OpenAI"}-compatible API.`}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(u.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>p(e.target.value),className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(u.$n,{onClick:j,disabled:!m||f||!n.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,a.jsx)(u.pd,{label:"Model ID (optional)",value:x,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),y&&(0,a.jsx)(u.Ex,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(u.$n,{onClick:v,fullWidth:!0,disabled:!n.name.trim()||!n.prefix.trim()||!n.baseUrl.trim()||d,children:d?"Saving...":"Save"}),(0,a.jsx)(u.$n,{onClick:i,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}L.propTypes={isOpen:r().bool.isRequired,provider:r().string,providerName:r().string,isCompatible:r().bool,isAnthropic:r().bool,authType:r().string,authHint:r().string,website:r().string,proxyPools:r().arrayOf(r().shape({id:r().string,name:r().string})),error:r().string,existingNames:r().arrayOf(r().string),onSave:r().func.isRequired,onBulkDone:r().func,onClose:r().func.isRequired},H.propTypes={isOpen:r().bool.isRequired,node:r().shape({id:r().string,name:r().string,prefix:r().string,apiType:r().string,baseUrl:r().string}),onSave:r().func.isRequired,onClose:r().func.isRequired,isAnthropic:r().bool};let W=()=>Object.fromEntries(Object.keys(x.bs).map(e=>[e,!1]));function B({isOpen:e,providerAlias:t,onSave:s,onClose:i}){let[r,n]=(0,l.useState)(""),[o,d]=(0,l.useState)(W),[c,m]=(0,l.useState)(null),[p,h]=(0,l.useState)(""),[f,g]=(0,l.useState)(!1),[y,b]=(0,l.useState)("");(0,l.useEffect)(()=>{e&&(n(""),d(W()),b(""),m(null),h(""))},[e]);let v=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},j=async()=>{let e=v(r.trim());if(e){m("testing"),h("");try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${e}`})}),a=await s.json();m(a.ok?"ok":"error"),h(a.error||"")}catch(e){m("error"),h(e.message)}}},w=async()=>{let e=v(r.trim());if(e&&!f){g(!0);try{await s(e,o,o.stt?y:null)}finally{g(!1)}}};return(0,a.jsx)(u.aF,{isOpen:e,onClose:i,title:"Add Custom Model",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:r,onChange:e=>{n(e.target.value),m(null),h("")},onKeyDown:e=>{"Enter"===e.key&&j()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,a.jsx)(u.$n,{variant:"secondary",icon:"science",loading:"testing"===c,onClick:j,disabled:!r.trim()||"testing"===c,children:"testing"===c?"Testing...":"Test"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,a.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:v(r.trim())||"model-id"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-4",children:Object.entries(x.bs).map(([e,t])=>(0,a.jsx)(u.lM,{checked:!!o[e],onChange:t=>d(s=>({...s,[e]:t})),label:t.label,description:t.desc,size:"sm"},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(u.lM,{checked:!!o.stt,onChange:e=>{d(t=>({...t,stt:e})),e||b("")},label:"Speech to text",description:"Transcribes audio via /v1/audio/transcriptions",size:"sm"}),o.stt&&(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)(u.l6,{label:"Transport",value:y,onChange:e=>b(e.target.value),placeholder:"Provider default (REST)",options:x.vp.map(e=>({value:e,label:x.qw[e].label})),hint:"Realtime transport marker for the STT dispatcher. Empty keeps the provider's REST format."})})]}),"ok"===c&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===c&&(0,a.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,a.jsx)("span",{children:p||"Model not reachable"})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(u.$n,{onClick:i,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(u.$n,{onClick:w,fullWidth:!0,size:"sm",disabled:!r.trim()||f,children:f?"Adding...":"Add Model"})]})]})})}B.propTypes={isOpen:r().bool.isRequired,providerAlias:r().string.isRequired,onSave:r().func.isRequired,onClose:r().func.isRequired};let Z=`[
8
+ {
9
+ "accessToken": "eyJhbGc...",
10
+ "refreshToken": "rt_...",
11
+ "idToken": "eyJhbGc...",
12
+ "email": "user@example.com"
13
+ }
14
+ ]`;function G({isOpen:e,onClose:t,onSuccess:s}){let[i,r]=(0,l.useState)(""),[n,o]=(0,l.useState)(!1),[d,c]=(0,l.useState)(""),[m,p]=(0,l.useState)(null),x=()=>{n||(r(""),c(""),p(null),t())},h=async()=>{var e;let t;c(""),p(null);let a=i.trim();if(!a)return;try{t=JSON.parse(a)}catch(e){c(`${(0,T.Tl)("Invalid JSON")}: ${e.message}`);return}let l=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!l||0===l.length)return void c((0,T.Tl)("No accounts found in input"));o(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:l})}),t=await e.json();if(!e.ok)return void c(t?.error||`Request failed: ${e.status}`);p(t),t.success>0&&"function"==typeof s&&s()}catch(e){c(e.message||(0,T.Tl)("Request failed"))}finally{o(!1)}},f=m?.results?.filter(e=>!e.ok)||[];return(0,a.jsx)(u.aF,{isOpen:e,title:(0,T.Tl)("Bulk Add Codex Accounts"),onClose:x,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:(0,T.Tl)("Paste an array of codex account JSON objects. Each must include accessToken (and ideally refreshToken, idToken).")}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:Z,value:i,onChange:e=>r(e.target.value),disabled:n}),d&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:d}),m&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${m.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",m.success," ",(0,T.Tl)("added"),m.failed>0?`, ✗ ${m.failed} ${(0,T.Tl)("failed")}`:""]}),f.length>0&&(0,a.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:f.map(e=>(0,a.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(u.$n,{onClick:h,fullWidth:!0,disabled:n||!i.trim(),children:n?(0,T.Tl)("Importing..."):(0,T.Tl)("Import All")}),(0,a.jsx)(u.$n,{onClick:x,variant:"ghost",fullWidth:!0,disabled:n,children:(0,T.Tl)("Close")})]})]})})}G.propTypes={isOpen:r().bool.isRequired,onClose:r().func.isRequired,onSuccess:r().func};let Q=`[
15
+ {
16
+ "access_token": "eyJ0eXAiOiJhdCtqd3Qi...",
17
+ "refresh_token": "LZhriF9bf88pPykpXCuZ9...",
18
+ "id_token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
19
+ "email": "account1@example.com"
20
+ },
21
+ {
22
+ "access_token": "eyJ0eXAiOiJhdCtqd3Qi...",
23
+ "refresh_token": "LZhriF9bf88pPykpXCuZ9...",
24
+ "id_token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
25
+ "email": "account2@example.com"
26
+ }
27
+ ]`;function V(e){let t,s=e.trim();if(!s)return[];try{t=JSON.parse(s)}catch(e){try{let e=s;e.startsWith("[")||((e=e.replace(/\}\s*,\s*\{/g,"},{").replace(/\}\s*\{/g,"},{")).endsWith(",")&&(e=e.slice(0,-1)),e=`[${e}]`),t=JSON.parse(e)}catch{throw e}}if(Array.isArray(t))return t;if(t&&"object"==typeof t)return Array.isArray(t.accounts)?t.accounts:[t];throw Error("Input must be a JSON object or array of objects")}function X({isOpen:e,onClose:t,onSuccess:s}){let[i,r]=(0,l.useState)(""),[n,o]=(0,l.useState)(!1),[d,c]=(0,l.useState)(""),[m,p]=(0,l.useState)(null),[x,h]=(0,l.useState)(!1),[f,g]=(0,l.useState)(null),y=(0,l.useRef)(null),b=()=>{n||(r(""),c(""),p(null),g(null),h(!1),t())},v=async e=>{if(!e||0===e.length)return;c("");let t=Array.from(e).filter(e=>e.name.endsWith(".json")||"application/json"===e.type||""===e.type);if(0===t.length)return void c((0,T.Tl)("Please select valid .json files"));try{let e=[];for(let s of t){let t=await s.text(),a=V(t);Array.isArray(a)?e.push(...a):a&&e.push(a)}if(0===e.length)return void c((0,T.Tl)("No accounts found in selected files"));r(JSON.stringify(e,null,2)),g({filesCount:t.length,accountsCount:e.length})}catch(e){c(`${(0,T.Tl)("Error reading files")}: ${e.message}`)}},j=async()=>{let e;c(""),p(null);try{e=V(i)}catch(e){c(`${(0,T.Tl)("Invalid JSON")}: ${e.message}`);return}if(!e||0===e.length)return void c((0,T.Tl)("No accounts found in input"));o(!0);try{let t=await fetch("/api/oauth/grok-cli/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:e})}),a=await t.json();if(!t.ok)return void c(a?.error||`Request failed: ${t.status}`);p(a),a.success>0&&"function"==typeof s&&s()}catch(e){c(e.message||(0,T.Tl)("Request failed"))}finally{o(!1)}},w=m?.results?.filter(e=>!e.ok)||[];return(0,a.jsx)(u.aF,{isOpen:e,title:(0,T.Tl)("Bulk Add Grok CLI Accounts"),onClose:b,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:(0,T.Tl)("Upload multiple .json files or paste JSON array / object.")}),(0,a.jsx)("input",{ref:y,type:"file",accept:".json,application/json",multiple:!0,className:"hidden",onChange:e=>{v(e.target.files),e.target&&(e.target.value="")}}),(0,a.jsx)(u.$n,{type:"button",size:"sm",variant:"secondary",icon:"upload_file",onClick:()=>y.current?.click(),disabled:n,children:(0,T.Tl)("Upload JSON Files")})]}),(0,a.jsxs)("div",{onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.preventDefault(),h(!1)},onDrop:e=>{e.preventDefault(),h(!1),e.dataTransfer?.files?.length>0&&v(e.dataTransfer.files)},className:`relative rounded border transition-colors ${x?"border-primary bg-primary/10 ring-2 ring-primary/30":"border-accent/30 bg-sidebar"}`,children:[(0,a.jsx)("textarea",{className:"w-full rounded bg-transparent p-2.5 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:Q,value:i,onChange:e=>{r(e.target.value),g(null)},disabled:n}),x&&(0,a.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-sidebar/90 rounded pointer-events-none backdrop-blur-xs",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary mb-1",children:"upload_file"}),(0,a.jsx)("span",{className:"text-sm font-medium text-primary",children:(0,T.Tl)("Drop .json files here")})]})]}),f&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-green-400 font-medium bg-green-500/10 border border-green-500/20 px-2.5 py-1.5 rounded",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check_circle"}),(0,a.jsxs)("span",{children:[(0,T.Tl)("Loaded")," ",f.accountsCount," ",(0,T.Tl)("account(s) from")," ",f.filesCount," ",(0,T.Tl)("file(s)")]})]}),d&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:d}),m&&m.failed>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-yellow-400",children:["✗ ",m.failed," ",(0,T.Tl)("failed")]}),w.length>0&&(0,a.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:w.map(e=>(0,a.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(u.$n,{onClick:j,fullWidth:!0,disabled:n||!i.trim(),children:n?(0,T.Tl)("Importing..."):(0,T.Tl)("Import All")}),(0,a.jsx)(u.$n,{onClick:b,variant:"ghost",fullWidth:!0,disabled:n,children:(0,T.Tl)("Close")})]})]})})}let Y=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],ee=/^[A-Za-z0-9-]+$/;function et({providerId:e}){let t=(0,S.i)(),[s,i]=(0,l.useState)(!1),[r,n]=(0,l.useState)([{name:"",value:""}]),[o,d]=(0,l.useState)({}),[c,m]=(0,l.useState)(!1),[p,x]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let t=!1;return fetch(`/api/providers/${e}/overrides`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{if(t||!e)return;let s=e.builtinHeaders||{},a=Object.entries({...s,...e.headers||{}}).map(([e,t])=>({name:e,value:t}));d(s),n(a.length?a:[{name:"",value:""}]),m(Object.keys(e.headers||{}).length>0)}).catch(()=>{}),()=>{t=!0}},[e]);let h=(e,t,s)=>{n(a=>a.map((a,l)=>l===e?{...a,[t]:s}:a))},f=(0,l.useCallback)(async()=>{let s={};for(let e of r.filter(e=>e.name.trim())){let a=e.name.trim();if(!ee.test(a))return void t.error(`Invalid header name: ${a}`);if(Y.includes(a.toLowerCase()))return void t.error(`Header ${a} cannot be overridden`);if(a in s)return void t.error(`Duplicate header name: ${a}`);e.value!==o[a]&&(s[a]=e.value)}x(!0);try{let a=await fetch(`/api/providers/${e}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:s})});if(!a.ok){let e=await a.json().catch(()=>({}));t.error(e.error||"Failed to save");return}m(Object.keys(s).length>0),t.success("Custom headers saved")}finally{x(!1)}},[r,o,e,t]);return 0!==Object.keys(o).length||c?(0,a.jsxs)(u.Zp,{padding:"xs",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),className:"flex w-full items-center justify-between text-left",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"tune"}),(0,a.jsx)("span",{className:"text-sm font-semibold",children:"Custom Headers"}),c&&(0,a.jsx)(u.Ex,{variant:"success",size:"sm",children:"Active"})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:s?"expand_less":"expand_more"})]}),s&&(0,a.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,a.jsx)("div",{className:"flex flex-col gap-2",children:r.map((e,t)=>{let s=e.name.trim()in o&&e.value!==o[e.name.trim()];return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{value:e.name,onChange:e=>h(t,"name",e.target.value),placeholder:"Header-Name",spellCheck:!1,className:"w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none"}),(0,a.jsx)("input",{value:e.value,onChange:e=>h(t,"value",e.target.value),placeholder:"Value",spellCheck:!1,title:s?"Overridden":e.name.trim()in o?"Registry default":"",className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none ${s?"border-amber-400/60":"border-border"}`}),(0,a.jsx)("button",{type:"button",title:"Remove header",onClick:()=>n(e=>e.length>1?e.filter((e,s)=>s!==t):[{name:"",value:""}]),className:"shrink-0 text-text-muted hover:text-red-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},t)})}),(0,a.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>n(e=>[...e,{name:"",value:""}]),className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add header"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{type:"button",disabled:p,onClick:()=>{n(Object.entries(o).map(([e,t])=>({name:e,value:t})))},className:"rounded-md border border-border px-3 py-1.5 text-xs hover:bg-black/[0.03] dark:hover:bg-white/[0.03] disabled:opacity-50",children:"Reset"}),(0,a.jsx)("button",{type:"button",disabled:p,onClick:f,className:"rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-white hover:opacity-90 disabled:opacity-50",children:p?"Saving...":"Save"})]})]})]})]}):null}et.propTypes={providerId:r().string.isRequired};var es=s(97132),ea=s(93195);let el=[{value:"all",label:"All"},{value:"untested",label:"Untested"},{value:"passed",label:"Passed"},{value:"failed",label:"Failed"}],ei={claude:"claudeAutoPing",codex:"codexAutoPing"};function er({label:e,value:t,icon:s,tone:l="text-muted"}){return(0,a.jsxs)("div",{className:"rounded-xl border border-line bg-bg-soft/70 p-3.5",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[17px] ${l}`,"aria-hidden":"true",children:s}),(0,a.jsx)("p",{className:"muted mt-3 text-[10px] uppercase tracking-[0.1em]",children:e}),(0,a.jsx)("p",{className:"mt-1 truncate font-mono text-sm font-semibold",children:t})]})}function en(){let e,t,s,i,r,o,h=(0,n.useParams)(),f=(0,n.useRouter)(),g=h.id,{getCaps:y}=(0,$.y)(),[b,v]=(0,l.useState)([]),[j,w]=(0,l.useState)(!0),[N,k]=(0,l.useState)(null),[O,E]=(0,l.useState)([]),[R,M]=(0,l.useState)(!1),[_,U]=(0,l.useState)(!1),[K,J]=(0,l.useState)(!1),[W,Z]=(0,l.useState)(!1),[Q,V]=(0,l.useState)(!1),[Y,ee]=(0,l.useState)(""),[en,eo]=(0,l.useState)(!1),[ed,ec]=(0,l.useState)(!1),[em,eu]=(0,l.useState)(!1),[ep,ex]=(0,l.useState)(!1),[eh,ef]=(0,l.useState)(!1),[eg,ey]=(0,l.useState)(null),[eb,ev]=(0,l.useState)({}),[ej,ew]=(0,l.useState)([]),[eN,ek]=(0,l.useState)(!1),[eC,eS]=(0,l.useState)({}),[eA,e$]=(0,l.useState)(""),[eT,eO]=(0,l.useState)(()=>new Set),[eP,eI]=(0,l.useState)(""),eE=(0,S.i)(),[eD,eR]=(0,l.useState)("all"),[ez,eM]=(0,l.useState)(!1),[eq,e_]=(0,l.useState)(null),[eU,eK]=(0,l.useState)(!1),[eF,eJ]=(0,l.useState)([]),[eL,eH]=(0,l.useState)(!1),[eW,eB]=(0,l.useState)(null),[eZ,eG]=(0,l.useState)(""),[eQ,eV]=(0,l.useState)("auto"),[eX,eY]=(0,l.useState)({enabled:!1,connections:{},schedules:{}}),[e0,e1]=(0,l.useState)(null),[e2,e5]=(0,l.useState)([]),[e3,e4]=(0,l.useState)(!1),[e6,e9]=(0,l.useState)(null),[e8,e7]=(0,l.useState)([]),[te,tt]=(0,l.useState)(null),[ts,ta]=(0,l.useState)([]),[tl,ti]=(0,l.useState)([]),[tr,tn]=(0,l.useState)(null),[to,td]=(0,l.useState)(!1),[tc,tm]=(0,l.useState)(!1),[tu,tp]=(0,l.useState)(!1),[tx,th]=(0,l.useState)(null),[tf,tg]=(0,l.useState)({}),[ty,tb]=(0,l.useState)(null),tv=(0,l.useRef)(!1),[tj,tw]=(0,l.useState)(!1),[tN,tk]=(0,l.useState)(!1),{copied:tC,copy:tS}=(0,A.C)(),tA="ag_risk_confirmed",t$=()=>{M(!0)},tT=()=>{"antigravity"===g&&"true"!==window.localStorage.getItem(tA)?td(!0):"xiaomi-mimo"===g?U(!0):tD?t$():(ee(""),V(!0))},tO=()=>{(ee(""),tW)?Z(!0):V(!0)},tP=()=>{tD?tT():tO()},tI=N?{id:N.id,name:N.name||("anthropic-compatible"===N.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===N.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===N.type?"AC":"OC",apiType:N.apiType,baseUrl:N.baseUrl,type:N.type}:p.zN[g]||p.fg[g]||p.IS[g]||p.nJ[g]||p.br[g]||p.mh[g],tE=tI?.authModes||[],tD=!!p.zN[g]||!!p.IS[g]||tE.includes("oauth"),tR=!!p.fg[g]||tE.includes("apikey"),tz=!!(p.IS[g]||p.nJ[g])?.noAuth,tM=(0,x.KC)(g),tq=(0,l.useMemo)(()=>(0,p.Q5)(g),[g]),t_="opencode"===g||!tq,tU=("cursor"===g||"zed"===g)&&e8.length>0,tK=(0,l.useMemo)(()=>tU?e8:t_?tM:[],[tU,t_,tM,e8]),tF=(0,p.wG)(g),tJ=(0,p.mq)(g),tL=(0,p.gb)(g),tH=tJ||tL,tW=!!p.mh[g],tB=(0,l.useMemo)(()=>[...tK,...ts.filter(e=>!tK.some(t=>t.id===e.id))].filter(e=>{let t=(0,x.CP)(e);return!t||"llm"===t}).map(e=>e.id),[tK,ts]),tZ=!tH&&tD&&tR,tG="xai"===g?"Grok Build OAuth":"grok-cli"===g?"Grok CLI Device Login":"kimi"===g?"Kimi Coding OAuth":"tokenharbor"===g?"Token Harbor Login":"OAuth",tQ="xai"===g?"xAI API Key":"kimi"===g?"Kimi API Key":"qoder"===g||"qoder-cn"===g?"PAT":"API Key",tV=e=>{if(!eQ||"auto"===eQ)return null;let t=C(g,e);return t&&t.includes(eQ)?eQ:null},tX=tH?g:tF,tY=(()=>{let e=new Set,t=new Set,s=s=>{if(!s||t.has(s))return;t.add(s);let a=C(g,s);a&&a.forEach(t=>{"none"!==t&&e.add(t)})};for(let e of tK)s(e.id);for(let e of ts)s(e.id);for(let e of ej)e.providerAlias===tX&&"llm"===(e.kind||e.type||"llm")&&s(e.id);return e.size?["auto",...e]:null})(),t0=tH?N?.prefix||g:tF,t1=(0,l.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tX)}`,{cache:"no-store"}),t=await e.json();e.ok&&ti(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tX]),t2=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tX,ids:[e]})})).ok&&await t1()}catch(e){console.log("Error disabling model:",e)}},t5=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tX)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await t1()}catch(e){console.log("Error enabling model:",e)}},t3=async e=>{e.length&&tn({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{tn(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tX,ids:e})})).ok&&await t1()}catch(e){console.log("Error disabling all models:",e)}}})},t4=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tX)}`,{method:"DELETE"})).ok&&await t1()}catch(e){console.log("Error enabling all models:",e)}},t6=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&ev(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),t9=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ew(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,l.useEffect)(()=>{"kilocode"===g&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&ta(e.models)}).catch(()=>{})},[g]);let t8=(0,l.useCallback)(async()=>{try{let[e,t,s,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),l=await e.json(),i=await t.json(),r=await s.json(),n=a.ok?await a.json():{};if(e.ok){let e=(l.connections||[]).filter(e=>e.provider===g);v(e)}s.ok&&E(r.proxyPools||[]);let o=(n.providerStrategies||{})[g]||{};eB(o.fallbackStrategy||null),eG(null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1");let d=(n.providerThinking||{})[g]||{};eV(d.mode||"auto");let c=ei[g],m=c&&n[c]||{};if(eY({enabled:!0===m.enabled,connections:m.connections||{},schedules:m.schedules||{}}),t.ok){let e=(i.nodes||[]).find(e=>e.id===g)||null;if(!e&&tH)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===g)||null))break}k(e)}}catch(e){console.log("Error fetching connections:",e)}finally{w(!1)}},[g,tH]),t7=async e=>{try{let t=await fetch(`/api/provider-nodes/${g}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(k(s.node),await t8(),ex(!1))}catch(e){console.log("Error updating provider node:",e)}},se=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},l={};e&&(l.fallbackStrategy=e),"round-robin"===e&&""!==t&&(l.stickyRoundRobinLimit=Number(t)||3);let i={...a};0===Object.keys(l).length?delete i[g]:i[g]=l,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:i})})}catch(e){console.log("Error saving provider strategy:",e)}},st=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?s[g]={mode:e}:delete s[g],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:s})})}catch(e){console.log("Error saving thinking config:",e)}},ss=async e=>{let t=ei[g];if(t){eY(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:e})})}catch(e){console.log("Error saving auto-ping config:",e)}}};(0,l.useEffect)(()=>{t8(),t6(),t9(),t1()},[t8,t6,t9,t1]),(0,l.useEffect)(()=>{if("cursor"!==g&&"zed"!==g)return void e7([]);let e=b.find(e=>!1!==e.isActive);if(!e?.id){e7([]),"zed"===g&&tt(null);return}let t=!1;return"zed"===g&&tt(null),fetch(`/api/providers/${e.id}/models`,{cache:"no-store"}).then(async e=>({ok:e.ok,data:await e.json().catch(()=>null)})).then(({ok:e,data:s})=>{if(!t){if(e&&Array.isArray(s?.models)&&s.models.length>0){e7(s.models),"zed"===g&&s?.warning&&tt(s.warning);return}"zed"===g&&(e7([]),tt(s?.warning||s?.error||"Zed returned no live models."))}}).catch(()=>{t||"zed"!==g||(e7([]),tt("Failed to reach the Zed model catalog."))}),()=>{t=!0}},[g,b]);let sa=async(e=!1,{autoAdd:t=!1}={})=>{if(tq){e4(!0);try{let{data:s,error:a}=await P(tq,g,{force:e});if(e5(s),0===s.length)return void e9({ok:!1,text:a||"The provider returned no models."});if(!t)return void e9({ok:!0,text:`Fetched ${s.length} models.`});let l=new Set;for(let e of tK)l.add(`${tX}/${e.id}`);for(let e of ej)e.providerAlias===tX&&e.id&&l.add(`${tX}/${e.id}`);for(let e of Object.values(eb))"string"==typeof e&&l.add(e);let i=0,r=0;for(let e of s)if(!l.has(`${tX}/${e.id}`))try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tX,id:e.id,type:"llm",name:e.name||e.id,origin:"fetch"})})).ok?i+=1:r+=1}catch{r+=1}i>0&&(await t9(),window.dispatchEvent(new CustomEvent("customModelChanged")));let n=s.length-i-r,o=[];i>0&&o.push(`Added ${i} model${1===i?"":"s"}`),r>0&&o.push(`${r} failed`),n>0&&o.push(`${n} already in the list`),e9({ok:0===r&&i>0,text:o.join(" \xb7 ")||"All models already in the list."})}finally{e4(!1)}}};(0,l.useEffect)(()=>{let e=!1;if(tq)return P(tq,g).then(({data:t})=>{e||e5(t)}),()=>{e=!0}},[g,tq]);let sl=async(e,t,s=tF)=>{let a=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})});if(e.ok)await t6();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},si=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await t6()}catch(e){console.log("Error deleting alias:",e)}},sr=async(e,t="llm",s=tX,a,l)=>{try{let i=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:s,id:e,type:t,...a?{caps:a}:{},...l?{transport:l}:{}})});if(i.ok)await t9(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await i.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},sn=async(e,t="llm",s=tX)=>{try{let a=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${a}`,{method:"DELETE"})).ok&&(await t9(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},so=async()=>{if(tj)return;let e=b.find(e=>!1!==e.isActive);if(!e)return void alert((0,T.Tl)("Please add an active Qoder connection first"));tw(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,T.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,T.Tl)("No models returned"));let l=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^(qoder-cn|qoder)\//,"");ej.some(e=>e.providerAlias===tX&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(eb).includes(`${tX}/${s}`)||(await sr(s,"llm",tX),l+=1)}0===l?alert((0,T.Tl)("All models already exist, no new models added")):alert((0,T.Tl)("Successfully added")+` ${l} `+(0,T.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,T.Tl)("Error fetching models")+": "+e.message)}finally{tw(!1)}},sd=async()=>{if(tN)return;let e=b.find(e=>!1!==e.isActive);if(!e)return void alert((0,T.Tl)("Please add an active Cline connection first"));tk(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,T.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,T.Tl)("No models returned"));let l=0;for(let e of a){let t=e.id||e.name;t&&(ej.some(e=>e.providerAlias===tX&&e.id===t&&"llm"===(e.kind||e.type||"llm"))||Object.values(eb).includes(`${tX}/${t}`)||(await sr(t,"llm",tX),l+=1))}0===l?alert((0,T.Tl)("All models already exist, no new models added")):alert((0,T.Tl)("Successfully added")+` ${l} `+(0,T.Tl)("models"))}catch(e){console.log("Error importing Cline models:",e),alert((0,T.Tl)("Error fetching models")+": "+e.message)}finally{tk(!1)}},sc=async()=>{if(tc||0===b.length)return;let e=Object.fromEntries(b.map(e=>[e.id,{state:"queued",error:null}]));tv.current=!1,tm(!0),tp(!1),th(null),tg(e),tb({total:b.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,s=0;try{for(let e=0;e<b.length;e+=1){if(tv.current){tb({total:b.length,completed:e,passed:t,failed:s,stopped:!0});break}let a=b[e];th(a.id),tg(e=>({...e,[a.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${a.id}/test`,{method:"POST"}),l=await e.json(),i=!!l.valid;i?t+=1:s+=1,tg(e=>({...e,[a.id]:{state:i?"success":"failed",error:i?null:l.error||null}}))}catch(e){s+=1,tg(t=>({...t,[a.id]:{state:"failed",error:e.message||"Test failed"}}))}tb({total:b.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<b.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{th(null),tm(!1),tp(!1),tv.current=!1}},sm=async e=>{tn({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{tn(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&v(t=>t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},su=()=>{t8(),M(!1)},sp=async e=>{ee("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:g,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await t8(),V(!1),sa(!0,{autoAdd:!0});return}ee(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),ee("Failed to save connection")}},sx=async e=>{try{(await fetch(`/api/providers/${eg.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await t8(),eu(!1),sa(!0,{autoAdd:!0}))}catch(e){console.log("Error updating connection:",e)}},sh=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&v(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},sf=async(e,t)=>{let s=[...b];[s[e],s[t]]=[s[t],s[e]],v(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(e){console.log("Error swapping priority:",e),await t8()}},sg=b.filter(e=>eF.includes(e.id)),sy=b.length>0&&eF.length===b.length;(0,l.useEffect)(()=>{eJ(e=>e.filter(e=>b.some(t=>t.id===e)))},[b]);let sb=(()=>{if(0===sg.length)return"";let e=new Set(sg.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return"All selected currently unbound";let s=O.find(e=>e.id===t);return`All selected currently bound to ${s?.name||t}`}return"Selected connections have mixed proxy bindings"})(),sv=()=>{eL||ef(!1)},sj=async e=>{eH(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:a}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:a})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await t8(),ef(!1)}finally{eH(!1)}},sw=e=>sj(sg.map(t=>({connectionId:t.id,proxyPoolId:e}))),sN=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03] max-h-[500px] overflow-y-auto pr-1",children:b.map((e,t)=>{let s;return(0,a.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,a.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,a.jsx)("input",{type:"checkbox",checked:(s=e.id,eF.includes(s)),onChange:()=>{var t;return t=e.id,void eJ(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(F,{connection:e,proxyPools:O,isOAuth:tD,isFirst:0===t,isLast:t===b.length-1,onMoveUp:()=>sf(t,t-1),onMoveDown:()=>sf(t,t+1),onToggleActive:t=>sh(e.id,t),autoPing:ei[g]&&"oauth"===e.authType?{isActive:!0===eX.connections[e.id]||eX.schedules?.[e.id]?.enabled===!0,reactiveOn:!0===eX.connections[e.id],provider:g,scheduleOn:eX.schedules?.[e.id]?.enabled===!0,scheduleSummary:(0,ea.JW)(eX.schedules?.[e.id]).join(" / "),onConfigure:()=>e1(e)}:null,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&v(s=>s.map(s=>s.id===e.id?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{ey(e),eu(!0)},onDelete:()=>sm(e.id),oneByOneStatus:tf[e.id]||null})})]},e.id)})}),sk=O.filter(e=>!0===e.isActive),sC=(0,a.jsx)(u.aF,{isOpen:eh,onClose:sv,title:`Apply Proxy (${sg.length} selected)`,children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("button",{onClick:()=>{let e=O.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):sj(sg.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:eL||0===sk.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,a.jsxs)("button",{onClick:()=>sw(null),disabled:eL,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),O.map(e=>(0,a.jsxs)("button",{onClick:()=>sw(e.id),disabled:eL||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,a.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),eL&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(u.$n,{onClick:sv,variant:"ghost",fullWidth:!0,disabled:eL,children:"Cancel"})]})}),sS=async e=>{if(!eT.has(e)){eO(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tX}/${e}`})}),s=await t.json();eS(t=>({...t,[e]:s.ok?"ok":"error"})),e$(s.ok?"":s.error||"Model not reachable")}catch{eS(t=>({...t,[e]:"error"})),e$("Network error")}finally{eO(t=>{let s=new Set(t);return s.delete(e),s})}}},sA=async()=>{if(!ez&&0!==tB.length){eM(!0),e_({done:0,total:tB.length}),e$("");try{let e=await fetch("/api/models/test-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({models:tB.map(e=>`${tX}/${e}`)})});if(!e.ok){let t=await e.json().catch(()=>({}));e$(t.error||"Batch test failed");return}let t=e.body?.getReader(),s=new TextDecoder,a="",l=null;for(;t;){let{done:e,value:i}=await t.read();if(e)break;let r=(a+=s.decode(i,{stream:!0})).split("\n");for(let e of(a=r.pop()||"",r)){let t,s=e.trim();if(!s)continue;try{t=JSON.parse(s)}catch{continue}if(t.done){l=t.summary;continue}let a=function(e,t){let s="string"==typeof e?e:"";if(!s)return"";let a=t?`${t}/`:"";return a&&s.startsWith(a)?s.slice(a.length):s}(t.model,tX);a&&(eS(e=>({...e,[a]:t.ok?"ok":"error"})),e_(e=>e?{...e,done:e.done+1}:e))}}if(l){let{passed:e,failed:t,total:s}=l;0===t?eE.success(`All ${s} models passed`):eE.warning(`${e}/${s} models passed, ${t} failed`)}}catch(e){e$(e?.message||"Batch test failed")}finally{eM(!1),e_(null)}}};if(j)return(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(u.Qv,{}),(0,a.jsx)(u.Qv,{})]});if(!tI)return(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,a.jsx)(d(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let s$=()=>tJ&&tI.apiType?"responses"===tI.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":tL?"/providers/anthropic-m.png":(0,m.HY)(tI.id);return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(d(),{href:"/dashboard/providers",className:"btn-quiet -ml-2 mb-4 !px-2 !py-1.5 !text-xs inline-flex",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"arrow_back"}),"Back to providers"]}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col justify-between gap-4 sm:flex-row sm:items-start",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-start gap-3.5 sm:gap-4",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl border border-line",style:{backgroundColor:`${tI.color}15`},children:eN||!s$()?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:tI.color},children:tI.textIcon||tI.id.slice(0,2).toUpperCase()}):(0,a.jsx)(c.A,{src:s$(),alt:tI.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>{(0,m.Kw)(tI.id),ek(!0)},loading:"lazy",decoding:"async"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 flex-wrap",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-[-0.035em] sm:text-3xl",children:tI.name}),b.length>0?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-success/25 bg-success/10 px-2 py-1 font-mono text-[9px] text-success",children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-success","aria-hidden":"true"}),b.length," Connected"]}):(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-line-strong bg-surface-2 px-2 py-1 font-mono text-[9px] text-muted",children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-muted","aria-hidden":"true"}),"Not connected"]})]}),(tI.notice?.apiKeyUrl||tI.notice?.signupUrl||tI.website)&&(0,a.jsxs)("a",{href:tI.notice?.apiKeyUrl||tI.notice?.signupUrl||tI.website,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1 text-xs text-gold-text hover:underline",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm","aria-hidden":"true",children:"open_in_new"}),tI.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]}),(0,a.jsxs)("p",{className:"muted mt-1 text-xs",children:[b.length," connection",1===b.length?"":"s"," \xb7 local workspace"]})]})]}),(0,a.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:(0,a.jsx)(u.$n,{size:"sm",icon:"add",onClick:tP,className:"btn-gold !px-3 !py-2.5 !text-xs",children:tW?"Connect Session":tH?"Add API Key":"Add connection"})})]})]}),(0,a.jsxs)("section",{className:"grid grid-cols-2 gap-3 xl:grid-cols-4","aria-label":"Provider summary",children:[(0,a.jsx)(er,{label:"Connections",value:String(b.length),icon:"key",tone:b.length>0?"text-success":"text-muted"}),(0,a.jsx)(er,{label:"Models",value:(e=[...tK,...ts.filter(e=>!tK.some(t=>t.id===e.id))].filter(e=>{let t=(0,x.CP)(e);return!t||"llm"===t}).length)>0?String(e):"—",icon:"memory",tone:"text-[#5d98e8]"}),(0,a.jsx)(er,{label:"Status",value:b.length>0?"Connected":"Not connected",icon:"activity",tone:b.length>0?"text-success":"text-muted"}),(0,a.jsx)(er,{label:"Endpoint",value:tI.website?new URL(tI.website).hostname:g,icon:"dns",tone:"text-gold-text"})]}),tI.deprecated&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:tI.deprecationNotice})]}),tI.notice?.text&&!tI.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:tI.notice.text}),tI.notice.apiKeyUrl&&(0,a.jsx)("a",{href:tI.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),tH&&N&&(0,a.jsx)(u.Zp,{children:(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:tL?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[tL?"Messages API":"responses"===N.apiType?"Responses API":"Chat Completions"," \xb7 ",(N.baseUrl||"").replace(/\/$/,""),"/",tL?"messages":"responses"===N.apiType?"responses":"chat/completions"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,a.jsx)(u.$n,{size:"sm",icon:"add",onClick:()=>{ee(""),V(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(u.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>ex(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(u.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{tn({title:"Delete Compatible Node",message:`Delete this ${tL?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{tn(null);try{(await fetch(`/api/provider-nodes/${g}`,{method:"DELETE"})).ok&&f.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),tz?(0,a.jsx)(u.gw,{providerId:g}):(0,a.jsxs)(u.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"Connections"}),(0,a.jsx)("p",{className:"muted mt-1 text-xs",children:"Credentials and endpoints used by this provider."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[b.length>0&&O.length>0&&(0,a.jsx)(u.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>{0!==sg.length&&ef(!0)},disabled:0===eF.length,title:sb||"Tick the connections the proxy pool should apply to",children:"Apply Proxy"}),b.length>0&&(0,a.jsxs)(a.Fragment,{children:[eF.length>0&&(0,a.jsxs)(u.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let e=eF.length;0!==e&&tn({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{tn(null);let e=0,t=[...eF];for(let s of t)try{(await fetch(`/api/providers/${s}`,{method:"DELETE"})).ok||(e+=1)}catch(t){console.log("Error deleting connection:",t),e+=1}v(e=>e.filter(e=>!t.includes(e.id))),eJ([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:["Delete Selected (",eF.length,")"]}),(0,a.jsx)(u.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:sc,disabled:tc,children:tc?"Testing Connection One-by-One...":"Test Connection One-by-One"}),tc&&(0,a.jsx)(u.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{tc&&(tv.current=!0,tp(!0))},disabled:tu,children:tu?"Stopping...":"Stop"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(u.lM,{checked:"round-robin"===eW,onChange:e=>{let t=e?"round-robin":null,s=e?eZ||"1":eZ;e&&!eZ&&eG("1"),eB(t),se(t,s)}}),"round-robin"===eW&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:eZ,onChange:e=>{var t;eG(t=e.target.value),se("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),0===b.length?(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:tD?"lock":"key"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tZ&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",tG," or ",tQ,"."]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:tZ?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tT,children:tG}),(0,a.jsx)(u.$n,{size:"sm",icon:"key",onClick:tO,children:tQ})]}):(0,a.jsxs)(a.Fragment,{children:[!tH&&"iflow"===g&&(0,a.jsx)(u.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>J(!0),children:"Cookie"}),"codex"===g&&(0,a.jsx)(u.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>eo(!0),children:(0,T.Tl)("Bulk Add")}),"grok-cli"===g&&(0,a.jsx)(u.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>ec(!0),children:(0,T.Tl)("Bulk Add")}),(0,a.jsx)(u.$n,{size:"sm",icon:"add",onClick:tP,children:tW?"Connect Session":tH?"Add API Key":"iflow"===g?"OAuth":"Add Connection"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[ty&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",ty.total]}),(0,a.jsxs)("span",{children:["Completed: ",ty.completed]}),(0,a.jsxs)("span",{children:["Passed: ",ty.passed]}),(0,a.jsxs)("span",{children:["Failed: ",ty.failed]}),ty.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),tc&&tx&&(0,a.jsxs)("span",{children:["Running: ",b.find(e=>e.id===tx)?.name||tx]})]})}),b.length>0&&(0,a.jsx)("div",{className:"mb-3 flex items-center gap-2 border-b border-black/[0.03] pb-2 dark:border-white/[0.03]",children:(0,a.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,a.jsx)("input",{type:"checkbox",checked:sy,onChange:()=>{sy?eJ([]):eJ(b.map(e=>e.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),sN,!tH&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===g&&(0,a.jsx)(u.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>J(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===g&&(0,a.jsx)(u.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>eo(!0),title:(0,T.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,T.Tl)("Bulk Add")}),"grok-cli"===g&&(0,a.jsx)(u.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>ec(!0),title:(0,T.Tl)("Bulk import Grok CLI accounts from JSON"),className:"w-full sm:w-auto",children:(0,T.Tl)("Bulk Add")}),tZ?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tT,className:"w-full sm:w-auto",children:tG}),(0,a.jsx)(u.$n,{size:"sm",icon:"key",onClick:tO,className:"w-full sm:w-auto",children:tQ})]}):(0,a.jsx)(u.$n,{size:"sm",icon:"add",onClick:tP,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,a.jsx)(et,{providerId:g}),(0,a.jsxs)(u.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col justify-between gap-3 sm:flex-row sm:items-start",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"Available models"}),(0,a.jsx)("p",{className:"muted mt-1 text-xs",children:"Models currently exposed by this provider route. Test sends one real minimal request."})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[e6&&(0,a.jsx)("span",{role:"status",className:`max-w-[240px] truncate rounded-lg border px-2 py-1 text-[11px] ${e6.ok?"border-success/25 bg-success/10 text-success":"border-danger/30 bg-danger/10 text-danger"}`,title:e6.text,children:e6.text}),tq&&(0,a.jsx)(u.$n,{size:"sm",variant:"secondary",icon:e3?"progress_activity":"cloud_download",onClick:()=>void sa(!0),disabled:e3,title:"Fetch the live model list from the provider API (uses your saved key)",className:e3?"[&_.material-symbols-outlined]:animate-spin":"",children:e3?"Fetching…":"Fetch models"}),!tH&&tB.length>0&&(0,a.jsx)(u.$n,{size:"sm",variant:"secondary",icon:ez?"progress_activity":"bolt",onClick:()=>void sA(),disabled:ez||0===b.length&&!tz,title:0!==b.length||tz?`Send one real request to each of the ${tB.length} models`:"Add a connection first — a model test needs a credential",className:ez?"[&_.material-symbols-outlined]:animate-spin":"",children:ez?`Testing ${eq?`${eq.done}/${eq.total}`:"…"}`:"Test all"}),tY&&(0,a.jsx)("select",{value:eQ,onChange:e=>{var t;eV(t=e.target.value),st(t)},title:"Appends (level) suffix to copied model names",className:"rounded-md border border-line bg-surface px-2 py-1 text-[11px] focus:border-gold focus:outline-none",children:tY.map(e=>(0,a.jsx)("option",{value:e,children:`Thinking: ${e.charAt(0).toUpperCase()+e.slice(1)}`},e))}),!tH&&(t=[...tK,...ts.filter(e=>!tK.some(t=>t.id===e.id))].filter(e=>{let t=(0,x.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!tl.includes(e)),(0,a.jsxs)(a.Fragment,{children:[tl.length>0&&(0,a.jsx)(u.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:t4,children:"Active All"}),t.length>0&&(0,a.jsx)(u.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>t3(t),children:"Disable All"})]}))]})]}),!tH&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,a.jsxs)("label",{className:"relative block flex-1",children:[(0,a.jsx)("span",{className:"sr-only",children:"Search models"}),(0,a.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-[15px] text-muted","aria-hidden":"true",children:"search"}),(0,a.jsx)("input",{value:eP,onChange:e=>eI(e.target.value),placeholder:"Search models","aria-label":"Search models",className:"input !h-9 !w-full !py-2 !pl-9 !pr-8 !text-xs",autoComplete:"off",spellCheck:!1}),eP&&(0,a.jsx)("button",{type:"button",onClick:()=>eI(""),"aria-label":"Clear model search",title:"Clear search",className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 text-muted transition-colors hover:text-text",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px]","aria-hidden":"true",children:"close"})})]}),(0,a.jsx)("div",{className:"flex shrink-0 overflow-x-auto rounded-lg border border-line bg-bg-soft p-0.5",role:"tablist","aria-label":"Filter models by test result",children:el.map(e=>(0,a.jsx)("button",{type:"button",role:"tab","aria-selected":eD===e.value,onClick:()=>eR(e.value),className:`whitespace-nowrap rounded-md px-2.5 py-1.5 text-[10px] font-medium transition-colors ${eD===e.value?"bg-surface text-gold-text shadow-sm":"text-muted hover:text-text"}`,children:e.label},e.value))})]}),!!eA&&(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:eA}),/RegionError|hosted in China|regionNotAllowed/i.test(eA)&&(i=(s="string"==typeof eA?eA:JSON.stringify(eA)).match(/https:\/\/opencode\.ai\/workspace\/[^\s"')]+/),r=s.match(/wrk_[0-9A-Za-z]+/),o=i?i[0].endsWith("/go")?i[0]:`${i[0]}/go`:r?`https://opencode.ai/workspace/${r[0]}/go`:"https://opencode.ai",(0,a.jsx)("div",{className:"mt-1.5",children:(0,a.jsxs)("a",{href:o,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-600 hover:bg-amber-500/20 dark:text-amber-400 transition-colors",children:[(0,a.jsx)("span",{children:"Allow China-hosted models"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"open_in_new"})]})}))]}),"zed"===g&&!!te&&(0,a.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:te}),(()=>{let e,t,s;if(tH)return(0,a.jsx)(q,{providerStorageAlias:tX,providerDisplayAlias:t0,modelAliases:eb,customModels:ej,copied:tC,onCopy:tS,onSetAlias:sl,onDeleteAlias:si,onAddCustomModel:e=>sr(e,"llm",tX),onDeleteCustomModel:e=>sn(e,"llm",tX),connections:b,isAnthropic:tL});let l=[...tK,...ts.filter(e=>!tK.some(t=>t.id===e.id))].filter(e=>{let t=(0,x.CP)(e);return!t||"llm"===t}),i=new Set(tl),r=eP.trim().toLowerCase(),n=e=>!r||e.id.toLowerCase().includes(r)||(e.name||"").toLowerCase().includes(r),o=e=>{if("all"===eD)return!0;let t=eC[e.id];return"untested"===eD?!t:"passed"===eD?"ok"===t:"failed"!==eD||"error"===t},d=l.filter(e=>!i.has(e.id)&&n(e)&&o(e)),c=l.filter(e=>i.has(e.id)),m=I({customModels:ej,modelAliases:eb,providerAlias:tX,builtInModels:tK,type:"llm"}).filter(e=>n({id:e.id,name:e.name})&&o({id:e.id}));return(0,a.jsxs)("div",{className:"group/model-list space-y-2",children:[0===m.length&&0===d.length&&(0,a.jsxs)("div",{className:"rounded-xl border border-dashed border-line-strong px-5 py-9 text-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined mx-auto text-[24px] text-muted","aria-hidden":"true",children:"memory"}),(0,a.jsx)("p",{className:"mt-3 text-sm font-semibold",children:eP.trim()||"all"!==eD?"No matching models":"No models discovered"}),(0,a.jsx)("p",{className:"muted mt-1 text-xs",children:eP.trim()||"all"!==eD?"Try a different search or filter.":"Connect the provider or add a custom model ID below."})]}),m.map(e=>{let t=e.alias||Object.entries(eb).find(([,t])=>t===`${tX}/${e.id}`)?.[0];return(0,a.jsx)(D,{model:{id:e.id,name:e.name},fullModel:`${t0}/${e.id}`,alias:t,copied:tC,onCopy:tS,onSetAlias:t=>sl(e.id,t,tX),onClearAlias:t?()=>si(t):void 0,onDeleteAlias:()=>{"custom"===e.source?sn(e.id,"llm",tX):si(t)},testStatus:eC[e.id],onTest:b.length>0||tz?()=>sS(e.id):void 0,isTesting:eT.has(e.id),isCustom:"fetch"!==e.origin,isFree:!1,caps:y(`${g}/${e.id}`),thinkingSuffix:tV(e.id)},`${e.source}-${e.fullModel}`)}),d.map(e=>{let t=`${tX}/${e.id}`,s=`${g}/${e.id}`,l=Object.entries(eb).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(D,{model:e,fullModel:`${t0}/${e.id}`,alias:l,copied:tC,onCopy:tS,onSetAlias:t=>sl(e.id,t,tX),onClearAlias:l?()=>si(l):void 0,onDeleteAlias:()=>si(l),testStatus:eC[e.id],onTest:b.length>0||tz?()=>sS(e.id):void 0,isTesting:eT.has(e.id),isFree:e.isFree,onDisable:()=>t2(e.id),caps:y(`${g}/${e.id}`),thinkingSuffix:tV(e.id)},e.id)}),(0,a.jsxs)("button",{onClick:()=>eK(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-gold/40 px-3 py-2 text-xs font-medium text-gold-text transition-colors hover:border-gold hover:bg-gold-soft sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm","aria-hidden":"true",children:"add"}),"Add Model"]}),("qoder"===g||"qoder-cn"===g)&&b.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:so,disabled:tj,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:tj?{animation:"spin 1s linear infinite"}:void 0,children:tj?"progress_activity":"download"}),tj?(0,T.Tl)("Fetching..."):(0,T.Tl)("Fetch Qoder Models")]}),("cline"===g||"clinepass"===g)&&b.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:sd,disabled:tN,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:tN?{animation:"spin 1s linear infinite"}:void 0,children:tN?"progress_activity":"download"}),tN?(0,T.Tl)("Fetching..."):(0,T.Tl)("Import from /models")]}),e2.length>0&&(e=new Set([...Object.values(eb),...m.map(e=>e.fullModel)]),t=new Set(tK.map(e=>e.id)),0===(s=e2.filter(s=>!e.has(`${tX}/${s.id}`)&&!t.has(s.id))).length?null:(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested models from the provider API:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,a.jsxs)("button",{onClick:async()=>{await sr(e.id,"llm",tX)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:e.contextLength?`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`:e.name||e.id,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),c.length>0&&(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",c.length,"):"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:c.map(e=>(0,a.jsxs)("button",{onClick:()=>t5(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]}),tI.passthroughModels&&(0,a.jsx)("div",{className:"w-full mt-4 border-t border-line pt-4",children:(0,a.jsx)(z,{providerAlias:tX,modelAliases:eb,customModels:ej,copied:tC,onCopy:tS,onSetAlias:(e,t)=>sl(e,t,tX),onDeleteAlias:si,onAddCustomModel:e=>sr(e,"llm",tX),onDeleteCustomModel:e=>sn(e,"llm",tX)})})]})})()]}),!tH&&tB.length>0&&(0,a.jsx)(u.Zp,{children:(0,a.jsx)(u.Tt,{providerId:g,providerName:tI?.name||g,models:tB,defaultModel:tB[0],connections:b})}),sC,"kiro"===g?(0,a.jsx)(u.Mh,{isOpen:R,providerInfo:tI,onSuccess:su,onClose:()=>M(!1)}):"cursor"===g?(0,a.jsx)(u.G9,{isOpen:R,onSuccess:su,onClose:()=>M(!1)}):"zed"===g?(0,a.jsx)(u.TE,{isOpen:R,providerInfo:tI,onSuccess:su,onClose:()=>M(!1)}):"gitlab"===g?(0,a.jsx)(u.vj,{isOpen:R,providerInfo:tI,onSuccess:su,onClose:()=>M(!1)}):"tokenharbor"===g?(0,a.jsx)(u.O1,{isOpen:R,providerInfo:tI,onSuccess:su,onClose:()=>M(!1)}):(0,a.jsx)(u.LF,{isOpen:R,provider:g,providerInfo:tI,onSuccess:su,onClose:()=>M(!1)}),(0,a.jsx)(u.LH,{isOpen:_,onSuccess:su,onClose:()=>U(!1)}),"iflow"===g&&(0,a.jsx)(u.vE,{isOpen:K,onSuccess:()=>{t8(),J(!1)},onClose:()=>J(!1)}),tW&&(0,a.jsx)(u.Sg,{isOpen:W,providerId:g,onSuccess:su,onClose:()=>Z(!1)}),(0,a.jsx)(L,{isOpen:Q,provider:g,providerName:tI.name,isCompatible:tH,isAnthropic:tL,authType:tI?.authType,authHint:tI?.authHint,website:tI?.website,proxyPools:O,error:Y,existingNames:b.map(e=>e.name).filter(Boolean),onSave:sp,onBulkDone:t8,onClose:()=>{ee(""),V(!1)}},g),(0,a.jsx)(u.wI,{isOpen:em,connection:eg,proxyPools:O,onSave:sx,onClose:()=>eu(!1)}),tH&&(0,a.jsx)(H,{isOpen:ep,node:N,onSave:t7,onClose:()=>ex(!1),isAnthropic:tL}),!tH&&(0,a.jsx)(B,{isOpen:eU,providerAlias:tX,onSave:async(e,t,s)=>{await sr(e,t?.stt?"stt":"llm",tX,t,s),eK(!1)},onClose:()=>eK(!1)}),"codex"===g&&(0,a.jsx)(G,{isOpen:en,onClose:()=>eo(!1),onSuccess:t8}),"grok-cli"===g&&(0,a.jsx)(X,{isOpen:ed,onClose:()=>ec(!1),onSuccess:t8}),e0&&(0,a.jsx)(es.A,{isOpen:!!e0,onClose:()=>e1(null),connection:e0,reactive:!0===eX.connections[e0.id],schedule:eX.schedules?.[e0.id]||null,onSave:e=>((e,{reactive:t,schedule:s})=>{ss({...eX,connections:{...eX.connections,[e]:t},schedules:{...eX.schedules,[e]:s}})})(e0.id,e)}),(0,a.jsx)(u.uo,{isOpen:to,onClose:()=>td(!1),onConfirm:()=>{(window.localStorage.setItem(tA,"true"),td(!1),tD)?t$():tO()},title:"Risk Notice",message:tI?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(u.uo,{isOpen:!!tr,onClose:()=>tn(null),onConfirm:tr?.onConfirm,title:tr?.title||"Confirm",message:tr?.message,variant:"danger"})]})}er.propTypes={label:r().string.isRequired,value:r().string.isRequired,icon:r().string.isRequired,tone:r().string}},93195:(e,t,s)=>{"use strict";function a(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}s.d(t,{JW:()=>o,Vm:()=>a,fB:()=>i,gy:()=>l,nz:()=>r});let l={anchor:"09:30",timezone:a(),windowHours:5,slotsPerDay:3};function i(e){let t=/^(\d{1,2}):(\d{2})$/.exec(String(e||"").trim());if(!t)return null;let s=Number(t[1]),a=Number(t[2]);return s>23||a>59?null:{hour:s,minute:a}}function r(e){return Math.max(1,Math.floor(24/e))}function n(e,t,s,a){let l="number"==typeof e?e:Number(e);return Number.isFinite(l)?Math.min(a,Math.max(s,l)):t}function o(e){let t=function(e){if(!e||!0!==e.enabled)return null;let t=i(e.anchor)||i(l.anchor),s=`${String(t.hour).padStart(2,"0")}:${String(t.minute).padStart(2,"0")}`,a=!function(e){if(!e||"string"!=typeof e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}(e.timezone)?l.timezone:e.timezone,o=n(e.windowHours,l.windowHours,.5,24),d=Math.round(n(e.slotsPerDay,l.slotsPerDay,1,r(o)));return{enabled:!0,anchor:s,timezone:a,windowHours:o,slotsPerDay:d}}(e);if(!t)return[];let{hour:s,minute:a}=i(t.anchor),o=60*s+a;return Array.from({length:t.slotsPerDay},(e,s)=>{let a=Math.round(o+s*t.windowHours*60)%1440;return`${String(Math.floor(a/60)).padStart(2,"0")}:${String(a%60).padStart(2,"0")}`})}},97132:(e,t,s)=>{"use strict";s.d(t,{A:()=>m});var a=s(95155),l=s(12115),i=s(14051),r=s.n(i),n=s(35497),o=s(31474),d=s(93195);let c=[{value:"off",label:"Off",icon:"block"},{value:"reset",label:"On reset",icon:"bolt"},{value:"schedule",label:"Schedule",icon:"schedule"}];function m({isOpen:e,onClose:t,onSave:s,connection:i,reactive:r=!1,schedule:u=null}){let[p,x]=(0,l.useState)(()=>({mode:u?.enabled===!0?"schedule":!0===r?"reset":"off",anchor:u?.anchor||d.gy.anchor,timezone:(0,d.Vm)(),windowHours:String(u?.windowHours??d.gy.windowHours),slotsPerDay:String(u?.slotsPerDay??d.gy.slotsPerDay)})),h=Number(p.windowHours),f=Number(p.slotsPerDay),g=!!(0,d.fB)(p.anchor),y=Number.isFinite(h)&&h>=.5&&h<=24,b=y?(0,d.nz)(h):24,v=Number.isInteger(f)&&f>=1&&f<=b,j=g&&y&&v,w="schedule"!==p.mode||j,N=j?(0,d.JW)({enabled:!0,...p,windowHours:h,slotsPerDay:f}):[],k=N.length&&y?(()=>{let{hour:e,minute:t}=(0,d.fB)(p.anchor),s=Math.round(60*e+t+f*h*60)%1440;return`${String(Math.floor(s/60)).padStart(2,"0")}:${String(s%60).padStart(2,"0")}`})():"",C=e=>x(t=>({...t,...e}));return(0,a.jsx)(n.aF,{isOpen:e,onClose:t,title:"Auto-ping settings",size:"lg",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.$n,{variant:"secondary",onClick:t,children:"Cancel"}),(0,a.jsx)(n.$n,{onClick:()=>{w&&(s({reactive:"reset"===p.mode,schedule:"schedule"===p.mode?{enabled:!0,anchor:p.anchor,timezone:p.timezone,windowHours:h,slotsPerDay:f}:{enabled:!1}}),t())},disabled:!w,children:"Save"})]}),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Configure automated quota pings",i?.name?` for ${i.name}`:""," — pick one mode."]}),(0,a.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-[10px] bg-surface-2 p-1",children:c.map(e=>{let t=p.mode===e.value;return(0,a.jsxs)("button",{type:"button",onClick:()=>C({mode:e.value}),className:(0,o.cn)("flex h-9 items-center justify-center gap-1.5 rounded-[8px] px-3 text-sm font-medium transition-all",t?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px] leading-none",children:e.icon}),(0,a.jsx)("span",{children:e.label})]},e.value)})}),"reset"===p.mode&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Pings right after the 5h quota window resets, so a new window starts immediately."}),"schedule"===p.mode&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Pings at fixed local times so the 5h windows align with your workday."}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[(0,a.jsx)(n.pd,{label:"Anchor time",type:"time",value:p.anchor,onChange:e=>C({anchor:e.target.value}),error:g?"":"Use HH:MM",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,a.jsx)(n.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:p.windowHours,onChange:e=>C({windowHours:e.target.value}),error:y?"":"0.5 – 24",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,a.jsx)(n.pd,{label:"Pings per day",type:"number",min:"1",max:String(b),step:"1",value:p.slotsPerDay,onChange:e=>C({slotsPerDay:e.target.value}),error:v?"":`1 – ${b}`,hint:v?`Max ${b}`:"",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"})]}),N.length>0&&(0,a.jsxs)("div",{className:"rounded-[10px] bg-surface-2 px-3 py-2.5",children:[(0,a.jsxs)("p",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:["Daily slots (",p.timezone,")"]}),(0,a.jsx)("p",{className:"mt-1 text-sm font-medium text-text-main",children:N.join(" → ")}),(0,a.jsxs)("p",{className:"mt-1 text-xs text-text-muted",children:["Covers ",N[0]," – ",k,", then pauses until ",N[0]," next day."]})]})]})]})})}m.propTypes={isOpen:r().bool.isRequired,onClose:r().func.isRequired,onSave:r().func.isRequired,connection:r().object,reactive:r().bool,schedule:r().object}}},e=>{e.O(0,[8500,246,5772,2723,705,5497,8441,3794,7358],()=>e(e.s=30840)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{898:(e,t,r)=>{Promise.resolve().then(r.bind(r,75095)),Promise.resolve().then(r.bind(r,25086))},75095:(e,t,r)=>{"use strict";r.d(t,{default:()=>L});var a=r(95155),i=r(12115),s=r(73321),n=r(57250),l=r(13097);let o="quotaAutoRefresh",d=[10,20,50,100],c=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],u=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}];function m(e){return e.name?.trim()||e.email?.trim()||e.displayName?.trim()||null}function x(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}function h(e){let t={};return e.forEach(e=>{t[e.id]=!0}),t}function p(e,t){let r=new Set(t.map(e=>e.id));return Object.fromEntries(Object.entries(e).filter(([e])=>r.has(e)))}async function b(e,t){return await e(t)}function g(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function f(e){return e&&"object"==typeof e?String(e.modelKey||e.name||"").trim():""}function y(e,t,r=[]){let a=t?.[e]?.hidden;return Array.isArray(a)&&0!==a.length?new Set((r.length>0?function(e=[],t=[]){if(!Array.isArray(e)||0===e.length)return[];let r=new Set(t.map(f).filter(Boolean));return[...new Set(e.map(e=>String(e).trim()).filter(e=>r.has(e)))]}(a,r):a).map(String)):new Set}function v({quotas:e=[],compact:t=!1,sortMode:r="default",onHideQuota:s=null}){let[n,l]=(0,i.useState)(1),o=(0,i.useMemo)(()=>e.map((e,t)=>({...e,index:t,remaining:e?.remaining!==void 0?Math.max(0,Math.round(e.remaining)):e?.remainingPercentage!==void 0?Math.round(e.remainingPercentage):g(e?.used,e?.total)})),[e]),d=(0,i.useMemo)(()=>"remaining-asc"===r?[...o].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...o].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):o,[o,r]),c=Math.max(1,Math.ceil(d.length/10));if((0,i.useEffect)(()=>{l(1)},[r,e]),(0,i.useEffect)(()=>{l(e=>Math.min(e,c))},[c]),!e||0===e.length)return(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No quota data available"})});let u=d.slice((n-1)*10,10*n),m=0===d.length?0:(n-1)*10+1,x=Math.min(10*n,d.length),h=t?"py-1 px-1.5":"py-2 px-3",p=t?"text-[11px]":"text-sm",b=t?"text-[11px]":"text-sm",f=t?"text-[10px] leading-tight":"text-xs",y="function"==typeof s;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-between gap-2",children:(0,a.jsxs)("div",{className:"text-[10px] text-text-muted",children:[d.length," quota",d.length>1?"s":""]})}),(0,a.jsx)("div",{className:"space-y-px",children:u.map(e=>{var r;let i=!0===e.unlimited,n=!0===e.isCreditBalance,l=n?{text:"text-blue-600 dark:text-blue-400",bg:"bg-blue-500",bgLight:"bg-blue-500/10",emoji:"\uD83D\uDCB0"}:i||(r=e.remaining)>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:r>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},o=e.neverExpires?"-":function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,r=new Date,a=t-r;if(a<=0)return"-";let i=Math.ceil(a/6e4);if(i<60)return`${i}m`;let s=Math.floor(i/60),n=i%60;if(s<24)return`${s}h ${n}m`;let l=Math.floor(s/24);return`${l}d ${s%24}h ${n}m`}catch(e){return"-"}}(e.resetAt),d=!e.neverExpires&&!e.resetAt&&!!e.detailUrl,c=e.neverExpires?"Never expires":d?"See details":function(e){if(!e)return null;try{let t=new Date(e),r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),i=new Date(a);i.setDate(i.getDate()+1);let s="";s=t>=a&&t<i?"Today":t>=i&&t<new Date(i.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let n=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${s}, ${n}`}catch{return null}}(e.resetAt),u=d&&e.detailUrl?e.detailUrl:c,m=!1!==e.recurring?`in ${o}`:`expires in ${o}`,x=t=>d?(0,a.jsxs)("a",{href:e.detailUrl,target:"_blank",rel:"noopener noreferrer",className:`${t} inline-flex items-center gap-0.5 hover:text-text-primary hover:underline`,title:`Open usage details: ${u}`,"aria-label":`Open usage details for ${e.name}`,children:[c,(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"open_in_new"})]}):c;return(0,a.jsxs)("div",{className:`flex items-center gap-2 border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${h}`,children:[(0,a.jsxs)("div",{className:"flex w-36 min-w-0 items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:l.emoji}),(0,a.jsx)("span",{className:`${p} font-medium text-text-primary truncate`,children:e.name})]}),(0,a.jsxs)("div",{className:`min-w-0 flex-1 ${t?"space-y-1":"space-y-1.5"}`,children:[!i&&!n&&(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${l.bgLight} ${0===e.remaining?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,a.jsx)("div",{className:`h-full transition-all duration-300 ${l.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between gap-1 min-w-0 ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsx)("span",{className:"text-text-muted truncate",title:i?`${e.used.toLocaleString()} used \xb7 Unlimited`:n?`Credit balance: ${e.total.toFixed(2)} ${e.currency||""}`:`${e.used.toLocaleString()} / ${e.total>0?e.total.toLocaleString():"∞"}`,children:i?`${e.used.toLocaleString()} used \xb7 Unlimited`:n?`Credit: ${e.total.toFixed(2)} ${e.currency||""}`:`${e.used.toLocaleString()} / ${e.total>0?e.total.toLocaleString():"∞"}${e.unit?` ${e.unit}`:""}`}),(0,a.jsx)("span",{className:`font-medium ${i?"text-green-600 dark:text-green-400":n?"text-blue-600 dark:text-blue-400":l.text} shrink-0`,children:i?"Unlimited":n?"":`${e.remaining}%`})]})]}),(0,a.jsx)("div",{className:"min-w-0 shrink",children:"-"!==o||c?t?(0,a.jsx)("div",{className:`${b} text-text-primary font-medium truncate`,title:u||"",children:"-"!==o?m:x(b)}):(0,a.jsxs)("div",{className:"min-w-0 space-y-0.5",children:["-"!==o&&(0,a.jsx)("div",{className:`${b} text-text-primary font-medium truncate`,children:m}),c&&(0,a.jsx)("div",{className:`${f} text-text-muted truncate`,children:x(f)})]}):(0,a.jsx)("div",{className:`${b} text-text-muted italic`,children:"N/A"})}),y&&(0,a.jsx)("button",{type:"button",onClick:()=>s(e),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-black/5 hover:text-text-primary dark:hover:bg-white/5",title:"Hide this quota row","aria-label":`Hide quota ${e.name}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px]",children:"visibility_off"})})]},`${e.name}-${e.index}`)})}),c>1&&(0,a.jsxs)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1.5 dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 text-[10px] text-text-muted",children:[(0,a.jsxs)("span",{children:["Showing ",m,"-",x," of ",d.length]}),(0,a.jsxs)("span",{children:["Page ",n," / ",c]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>l(e=>Math.max(1,e-1)),disabled:1===n,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Prev"}),(0,a.jsx)("button",{type:"button",onClick:()=>l(e=>Math.min(c,e+1)),disabled:n===c,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Next"})]})]})]})}var w=r(98542),k=r(97677),j=r(84588),N=r(35497),C=r(97132),A=r(93195),S=r(88105),$=r(5293);let P={"builder-id":"AWS Builder ID",idc:"IAM Identity Center",google:"Google",github:"GitHub",imported:"Imported Token",api_key:"API Key"},q={claude:"claudeAutoPing",codex:"codexAutoPing"};function E(e){return e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null}function _(e){let t=e.providerSpecificData?.region;if(t)return t;let r=e.providerSpecificData?.profileArn;return("string"==typeof r?r.split(":")[3]:"")||""}let D={five_hour:"session",seven_day:"weekly",seven_day_overage_included:"weekly",seven_day_opus:"Opus weekly",seven_day_sonnet:"Sonnet weekly"};function O(e){let t=[...new Set((e||[]).map(e=>D[e]).filter(Boolean))];return t.length?`${t.join(" + ")} limits`:"limits"}function T(e){return S.Q2[e]?.name||e}function M(e){if(!e)return"N/A";let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"N/A"}function F(e){if(!e)return"N/A";let t=new Date(e).getTime()-Date.now();if(!Number.isFinite(t))return"N/A";if(t<=0)return"Expired";let r=Math.ceil(t/36e5),a=Math.floor(r/24),i=r%24;return a>0?`${a}d ${i}h`:`${i}h`}function L(){let{copied:e,copy:t}=(0,$.C)(),r=(0,s.useSearchParams)(),D=(0,s.useRouter)(),L=(0,s.usePathname)(),[z,I]=(0,i.useState)([]),[R,U]=(0,i.useState)({}),[H,W]=(0,i.useState)({}),[B,J]=(0,i.useState)({}),[K,V]=(0,i.useState)(!0),[G,Q]=(0,i.useState)({claude:{},codex:{}}),[Z,Y]=(0,i.useState)(null),[X,ee]=(0,i.useState)(!1),[et,er]=(0,i.useState)(!1),[ea,ei]=(0,i.useState)(60),[es,en]=(0,i.useState)(!0),[el,eo]=(0,i.useState)(null),[ed,ec]=(0,i.useState)(null),[eu,em]=(0,i.useState)(null),[ex,eh]=(0,i.useState)(null),[ep,eb]=(0,i.useState)(null),[eg,ef]=(0,i.useState)(!1),[ey,ev]=(0,i.useState)(null),[ew,ek]=(0,i.useState)([]),[ej,eN]=(0,i.useState)(()=>r?.get("provider")||"all"),eC=(0,i.useCallback)(e=>{eN(e);try{let t=new URLSearchParams(r?.toString()||"");"all"===e?t.delete("provider"):t.set("provider",e);let a=t.toString()?`${L}?${t.toString()}`:L;D.replace(a,{scroll:!1})}catch{}},[L,D,r]),[eA,eS]=(0,i.useState)([]),[e$,eP]=(0,i.useState)("all"),[eq,eE]=(0,i.useState)("default"),[e_,eD]=(0,i.useState)({}),[eO,eT]=(0,i.useState)(!1),[eM,eF]=(0,i.useState)(!1),[eL,ez]=(0,i.useState)(!1),[eI,eR]=(0,i.useState)(1),[eU,eH]=(0,i.useState)(20),[eW,eB]=(0,i.useState)(String(20)),[eJ,eK]=(0,i.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eV,eG]=(0,i.useState)({eligibleConnections:0,providerFilteredConnections:0}),eQ=(0,i.useRef)(null),eZ=(0,i.useRef)(null),eY=(0,i.useRef)(0),eX=(0,i.useCallback)(async(e=eI)=>{try{var t,r;let a=new URLSearchParams({page:String(e),pageSize:String(eU),accountStatus:e$,sort:"priority"});"all"!==ej&&a.set("provider",ej);let i=await fetch(`/api/providers/client?${a.toString()}`);if(!i.ok)throw Error("Failed to fetch connections");let s=await i.json(),n=s.connections||[],l=(t=s.pagination,t||{page:1,pageSize:eU,total:0,totalPages:1}),o=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(s.totals,n.length);return I(n),eS(s.providerOptions||[]),eK(l),eG(o),eR((r=s.pagination,r?.page||e)),n}catch(e){return console.error("Error fetching connections:",e),I([]),eS([]),eK({page:1,pageSize:eU,total:0,totalPages:1}),eG({eligibleConnections:0,providerFilteredConnections:0}),[]}},[e$,eI,eU,ej]),e0=(0,i.useCallback)(async(e,t,{force:r=!1}={})=>{W(t=>({...t,[e]:!0})),J(t=>({...t,[e]:null}));try{console.log(`[ProviderLimits] Fetching quota for ${t} (${e})`);let a=`/api/usage/${e}${r?"?force=1":""}`,i=await fetch(a);if(!i.ok){let r=(await i.json().catch(()=>({}))).error||i.statusText;if(404===i.status)return void console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===i.status){console.warn(`[ProviderLimits] Auth error for ${t}:`,r);let a={quotas:[],message:r};U(t=>({...t,[e]:a}));return}throw Error(`HTTP ${i.status}: ${r}`)}let s=await i.json();console.log(`[ProviderLimits] Got quota for ${t}:`,s);let n={quotas:function(e,t){if(!t||"object"!=typeof t)return[];let r=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":if(t.quotas){let e=Object.entries(t.quotas),a=new Set(["gemini_weekly","claude_gpt_weekly"]),i=new Set(["gemini_session","claude_gpt_session"]),s=new Set([...a,...i]),n=e.filter(([e])=>e.startsWith("gemini-")&&!e.includes("image")),l=e.filter(([e])=>e.startsWith("claude-")),o=e.filter(([e])=>e.includes("image")),d=e.filter(([e])=>s.has(e)),c=e.filter(([e])=>!e.startsWith("gemini-")&&!e.startsWith("claude-")&&!e.includes("image")&&!s.has(e)),u=!!t.quotas.gemini_weekly,m=!!t.quotas.gemini_session,x=!!t.quotas.claude_gpt_weekly,h=!!t.quotas.claude_gpt_session;if(m)d.filter(([e])=>"gemini_session"===e).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});else if(n.length>0){let e=n.reduce((e,t)=>(t[1].remainingPercentage??100)<(e[1].remainingPercentage??100)?t:e)[1],a=t.quotas.gemini_weekly?.resetAt;u&&e.resetAt===a&&(e.remainingPercentage??0)===0||r.push({name:"Gemini (Flash / Pro)",modelKey:"gemini",used:e.used||0,total:e.total||0,resetAt:e.resetAt||null,remainingPercentage:e.remainingPercentage})}if(u&&d.filter(([e])=>"gemini_weekly"===e).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})}),h)d.filter(([e])=>"claude_gpt_session"===e).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});else if(l.length>0){let e=l.reduce((e,t)=>(t[1].remainingPercentage??100)<(e[1].remainingPercentage??100)?t:e)[1],a=t.quotas.claude_gpt_weekly?.resetAt;x&&e.resetAt===a&&(e.remainingPercentage??0)===0||r.push({name:"Claude (Sonnet / Opus)",modelKey:"claude",used:e.used||0,total:e.total||0,resetAt:e.resetAt||null,remainingPercentage:e.remainingPercentage})}x&&d.filter(([e])=>"claude_gpt_weekly"===e).forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})}),o.forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})}),x||h||c.forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})})}break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{let a=e;"spark_session"===e?a="Spark (5h)":"spark_weekly"===e?a="Spark (Weekly)":"session"===e?a="5h":"weekly"===e?a="Weekly":"review_session"===e?a="Review (5h)":"review_weekly"===e&&(a="Review (Weekly)"),r.push({name:a,quotaType:e,used:t.used||0,total:t.total||0,remaining:t.remaining,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"qoder":case"qoder-cn":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{t&&0!==(Number(t.total)||0)&&r.push({name:"user"===e?"Personal":"organization"===e?"Organization":"addOn"===e?"Add-on":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null,neverExpires:!0===t.neverExpires,detailUrl:t.detailUrl||null})});break;case"claude":t.message?r.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,remaining:void 0!==t.remaining?t.remaining:Math.max(0,(t.total||100)-(t.used||0)),remainingPercentage:void 0!==t.remainingPercentage?t.remainingPercentage:g(t.used,t.total),resetAt:t.resetAt||null})});break;case"vercel-ai-gateway":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codebuddy-cn":case"codebuddy-intl":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,recurring:!1!==t.recurring})});break;case"grok-cli":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"kimi":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"deepseek":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage,isCreditBalance:t.isCreditBalance??!0,currency:t.currency||(e.includes("(")?e.slice(e.indexOf("(")+1,e.indexOf(")")):"USD")})});break;case"cursor":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"groq":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"ollama":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"zed":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage,unlimited:t.unlimited})});break;case"minimax-code":case"minimax-code-global":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,remaining:t.remaining,remainingPercentage:t.remainingPercentage,resetAt:t.resetAt||null,message:t.message,isCreditBalance:t.isCreditBalance,currency:t.currency})});break;case"zcode":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,remainingPercentage:t.remainingPercentage,resetAt:t.resetAt||null,unlimited:!0===t.unlimited})});break;case"tokenharbor":case"nara-router":case"apmix":case"apinex":case"tiarina":case"xkiro":case"beatapi":case"kiraai":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total,remainingPercentage:t.remainingPercentage,resetAt:t.resetAt||null,unlimited:!0===t.unlimited,isCreditBalance:!0===t.isCreditBalance,currency:t.currency||"USD"})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}if(e?.toLowerCase()==="claude"){let e={"session (5h)":0,"weekly (7d)":1,"weekly fable (7d)":2,"weekly opus (7d)":3,"weekly sonnet (7d)":4};return r.sort((t,r)=>(e[t.name]??99)-(e[r.name]??99)),r}let a=(0,l.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));r.sort((t,r)=>{let a=t.modelKey||t.name,i=r.modelKey||r.name;return("gemini"===a||"gemini_session"===a)&&(a="gemini-3.8-flash-high"),("claude"===a||"claude_gpt_session"===a)&&(a="claude-sonnet-4-6"),("gemini"===i||"gemini_session"===i)&&(i="gemini-3.8-flash-high"),("claude"===i||"claude_gpt_session"===i)&&(i="claude-sonnet-4-6"),(e.get(a)??999)-(e.get(i)??999)})}return r}(t,s),plan:s.plan||null,message:s.message||null,raw:s};U(t=>({...t,[e]:n}))}catch(r){console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),J(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{W(t=>({...t,[e]:!1}))}},[]),e1=(0,i.useCallback)(async(e,t)=>{await e0(e,t,{force:!0})},[e0]),e5=(0,i.useCallback)(async(e,t)=>{if(("codex"===t||"claude"===t)&&!eu){em(e),J(t=>({...t,[e]:null}));try{let r="claude"===t?await fetch(`/api/usage/${e}/claude-reset`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grantId:R[e]?.raw?.resetCredits?.nextGrantId})}):await fetch(`/api/usage/${e}/codex-reset-credits`,{method:"POST"}),a=await r.json().catch(()=>({}));if(!r.ok)throw Error(a.message||a.error||a.code||"Failed to reset limit");await e0(e,t,{force:!0})}catch(t){J(r=>({...r,[e]:t.message||"Failed to reset limit"}))}finally{em(null)}}},[e0,eu,R]),e2=(0,i.useCallback)((e,t)=>{eb({connection:e,loading:!1,error:null,data:{kind:"claude",...t}})},[]),e3=(0,i.useCallback)(async e=>{eb({connection:e,loading:!0,error:null,data:null});try{let t=await fetch(`/api/usage/${e.id}/codex-reset-credits`,{cache:"no-store"}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(r.error||r.message||"Failed to load Codex reset credits");let a=Array.isArray(r.credits)?[...r.credits]:[];a.sort((e,t)=>(e.expiresAt?new Date(e.expiresAt).getTime():1/0)-(t.expiresAt?new Date(t.expiresAt).getTime():1/0)),eb({connection:e,loading:!1,error:null,data:{...r,credits:a}})}catch(t){eb({connection:e,loading:!1,error:t.message||"Failed to load Codex reset credits",data:null})}},[]),e4=(0,i.useCallback)(async e=>{if(confirm("Delete this connection?")){eo(e);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&(U(t=>{let r={...t};return delete r[e],r}),W(t=>{let r={...t};return delete r[e],r}),J(t=>{let r={...t};return delete r[e],r}),await b(eX,eI))}catch(e){console.error("Error deleting connection:",e)}finally{eo(null)}}},[eX,eI]),e8=(0,i.useCallback)(async(e,t)=>{ec(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&await b(eX,eI)}catch(e){console.error("Error updating connection status:",e)}finally{ec(null)}},[eX,eI]),e6=(0,i.useCallback)(async e=>{if(!ey?.id)return;let t=ey.id,r=ey.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eX(),ef(!1),ev(null),S.wb.includes(r)&&await e0(t,r))}catch(e){console.error("Error saving connection:",e)}},[ey,eX,e0]);(0,i.useEffect)(()=>{let e=!1;return fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).then(t=>{!e&&t?.proxyPools&&ek(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let e9=(0,i.useCallback)(async(e=!1)=>{if(et)return;er(!0),ei(60);let t=eY.current+=1;try{let r=await eX(eI),a=function(e,{force:t=!1,tick:r=1,claudeEvery:a=1}={}){return e.filter(e=>t||"claude"!==e.provider||r%a==0)}(r,{force:e,tick:t,claudeEvery:10});W(h(a)),J(e=>p(e,r)),U(e=>p(e,r)),await Promise.all(a.map(e=>e0(e.id,e.provider)))}catch(e){console.error("Error refreshing all providers:",e)}finally{er(!1)}},[et,eX,e0,eI]);(0,i.useEffect)(()=>{(async()=>{en(!0);let e=await eX(eI);en(!1),W(h(e)),J(t=>p(t,e)),U(t=>p(t,e)),await Promise.all(e.map(e=>e0(e.id,e.provider)))})()},[eX,e0,eI]),(0,i.useEffect)(()=>{let e=window.localStorage.getItem(o);V(null===e||"true"===e),ee(!0)},[]),(0,i.useEffect)(()=>{X&&window.localStorage.setItem(o,String(K))},[K,X]),(0,i.useEffect)(()=>{fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{}).then(e=>{Q({claude:e?.claudeAutoPing||{},codex:e?.codexAutoPing||{}}),eD(e?.quotaVisibility||{})}).catch(()=>{})},[]);let e7=(0,i.useCallback)(async(e,t,{reactive:r,schedule:a})=>{let i=q[t];if(!i)return;let s=G[t]||{},n={...s,connections:{...s.connections||{},[e]:r},schedules:{...s.schedules||{},[e]:a}};Q({...G,[t]:n});try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[i]||{},connections:n.connections,schedules:n.schedules};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[i]:t})})}catch{Q(G)}},[G]),te=(0,i.useCallback)(async(e,t)=>{eD(e);try{if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({quotaVisibility:e})})).ok)throw Error("Failed to update quota visibility")}catch(e){console.error("Error updating quota visibility:",e),eD(t)}},[]),tt=(0,i.useCallback)((e,t)=>{let r=f(t);if(!e||!r)return;let a=e_[e]||{},i=new Set(a.hidden||[]);if(i.add(r),"antigravity"===e){if("gemini"===r)for(let e of i)e.startsWith("gemini-")&&!e.includes("image")&&i.delete(e);else if("claude"===r)for(let e of i)e.startsWith("claude-")&&i.delete(e)}te({...e_,[e]:{...a,hidden:[...i]}},e_)},[e_,te]),tr=(0,i.useCallback)((e,t)=>{let r=f(t);if(!e||!r)return;let a=e_[e]||{},i=new Set(a.hidden||[]);if(i.delete(r),"antigravity"===e){if("gemini"===r)for(let e of i)e.startsWith("gemini-")&&!e.includes("image")&&i.delete(e);else if("claude"===r)for(let e of i)e.startsWith("claude-")&&i.delete(e)}te({...e_,[e]:{...a,hidden:[...i]}},e_)},[e_,te]);(0,i.useEffect)(()=>{if(!X||!K){eQ.current&&(clearInterval(eQ.current),eQ.current=null),eZ.current&&(clearInterval(eZ.current),eZ.current=null);return}return eQ.current=setInterval(()=>{e9()},6e4),eZ.current=setInterval(()=>{ei(e=>e<=1?60:e-1)},1e3),()=>{eQ.current&&clearInterval(eQ.current),eZ.current&&clearInterval(eZ.current)}},[K,e9,X]),(0,i.useEffect)(()=>{let e=()=>{document.hidden?(eQ.current&&(clearInterval(eQ.current),eQ.current=null),eZ.current&&(clearInterval(eZ.current),eZ.current=null)):K&&X&&(eQ.current&&(clearInterval(eQ.current),eQ.current=null),eZ.current&&(clearInterval(eZ.current),eZ.current=null),eQ.current=setInterval(()=>e9(),6e4),eZ.current=setInterval(()=>{ei(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[K,e9,X]);let ta=(0,i.useMemo)(()=>(function(e,t,r,a,i){if("codex"===a&&"default"!==i)return[...e].sort((e,r)=>{let a=x(e,t),s=x(r,t),n="remaining-asc"===i?a-s:s-a;return 0!==n?n:(m(e)||"").localeCompare(m(r)||"")});if(!r){let t=new Map;for(let r of e){let e=r.provider||"";t.has(e)||t.set(e,[]),t.get(e).push(r)}return Array.from(t.values()).flat()}let s=e=>{let r=(t[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return r.length>0?Math.min(...r):1/0};return[...e].sort((e,t)=>{let r=s(e)-s(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(m(e)||"").localeCompare(m(t)||"")})})(z,R,eO,ej,eq),[z,R,eO,ej,eq]),ti=e=>{let t=R[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=g(e.used,e.total))},ts=(0,i.useCallback)(async(e,t)=>{if(e.length&&!eL){ez(!0);try{await Promise.all(e.map(e=>fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})}))),await b(eX,eI)}catch(e){console.error("Error bulk toggling connections:",e)}finally{ez(!1)}}},[eL,eX,eI]),tn="all"===ej?"All providers":T(ej),tl=eV.eligibleConnections>0,to=ta.length>0,td=eV.eligibleConnections?eV.providerFilteredConnections?{icon:"filter_alt_off",title:"No Accounts On This Page",description:"Try moving to another page or refreshing the current filters."}:{icon:"filter_alt_off",title:"No Accounts Match Current Filters",description:"all"===ej?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===e$?"turned off":"active"===e$?"active":"matching"} accounts found for ${ej}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},tc=function(e){var t;let{start:r,end:a}=(t=e).total?{start:(t.page-1)*t.pageSize+1,end:Math.min(t.page*t.pageSize,t.total)}:{start:0,end:0};return`Showing ${r}-${a} of ${e.total}`}(eJ),tu=!d.includes(eU);return es||tl?es||to?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-end",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>eF(e=>!e),className:"flex h-8 items-center justify-between gap-1 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-haspopup":"menu","aria-expanded":eM,title:"Filter quota providers",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===ej?(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"apps"}):(0,a.jsx)(n.A,{src:`/providers/${ej}.png`,alt:ej,size:18,className:"size-[18px] rounded object-contain",fallbackText:ej.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"truncate hidden lg:inline",children:tn})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),eM&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"fixed inset-0 z-30 bg-transparent","aria-label":"Close provider filter",onClick:()=>eF(!1)}),(0,a.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-2xl border border-black/10 bg-surface/95 p-1.5 shadow-xl shadow-black/10 backdrop-blur dark:border-white/10 dark:bg-surface/95 sm:w-72",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{"all"!==ej&&eR(1),eC("all"),eF(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===ej?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"apps"}),(0,a.jsx)("span",{className:"font-medium",children:"All providers"}),"all"===ej&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]}),(0,a.jsx)("div",{className:"my-1 h-px bg-black/10 dark:bg-white/10"}),(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto pr-1",children:eA.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{ej!==e&&eR(1),eC(e),eF(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${ej===e?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)(n.A,{src:`/providers/${e}.png`,alt:e,size:24,className:"size-6 rounded-md object-contain",fallbackText:e.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"font-medium",children:T(e)}),ej===e&&(0,a.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,a.jsx)("select",{value:e$,onChange:e=>{let t=e.target.value;e$!==t&&eR(1),eP(t)},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Filter accounts by status",children:c.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===ej&&(0,a.jsx)("select",{value:eq,onChange:e=>eE(e.target.value),className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Sort Codex quotas by remaining",children:u.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)("button",{type:"button",onClick:()=>eT(e=>!e),"aria-pressed":eO,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${eO?"border-amber-500/40 bg-amber-500/10 text-amber-500":"border-black/10 text-text-primary hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,title:"Sort accounts by earliest quota reset time",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"hourglass_top"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Expiring first"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{ts(ta.filter(e=>(e.isActive??!0)&&ti(e)).map(e=>e.id),!1)},disabled:eL,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-red-500/30 px-2 text-xs text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50",title:"Disable connections with depleted quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"block"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn off Empty"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{ts(ta.filter(e=>!(e.isActive??!0)&&!ti(e)).map(e=>e.id),!0)},disabled:eL,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-emerald-500/30 px-2 text-xs text-emerald-500 transition-colors hover:bg-emerald-500/10 disabled:opacity-50",title:"Enable connections that still have quota on the current page",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn on Available"})]}),(0,a.jsxs)("button",{onClick:()=>V(e=>!e),className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5",title:K?"Disable auto-refresh":"Enable auto-refresh",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${K?"text-primary":"text-text-muted"}`,children:K?"toggle_on":"toggle_off"}),(0,a.jsx)("span",{className:"hidden text-text-primary sm:inline",children:"Auto-refresh"}),K&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",ea,"s)"]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>e9(!0),disabled:et,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5 disabled:opacity-50",title:"Refresh all",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${et?"animate-spin":""}`,children:"refresh"})})]})}),eO&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:"Expiring-first currently reorders accounts inside the current page. Cross-page ordering still follows backend pagination."}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:ta.map(r=>{let i,s,l,o=R[r.id],d=H[r.id],c=B[r.id],u=!1===r.isActive,x="codex"===r.provider,h="claude"===r.provider?o?.raw?.resetCredits:null,p=x?"Codex reset credit":"Claude limit reset",b=Number.isFinite(s="number"==typeof(i=o?.raw?.resetCredits?.availableCount)?i:Number(i))?Math.max(0,s):0,g=eu===r.id,N=el===r.id||ed===r.id||g,C=o?.quotas||[],S=function(e,t=[],r={}){if(!Array.isArray(t)||0===t.length)return[];let a=y(e,r,t);return 0===a.size?t:t.filter(e=>!a.has(f(e)))}(r.provider,C,e_),$=function(e,t=[],r={}){if(!Array.isArray(t)||0===t.length)return[];let a=y(e,r,t);return 0===a.size?[]:t.filter(e=>a.has(f(e)))}(r.provider,C,e_);return(0,a.jsxs)(j.default,{padding:"none",className:`min-w-0 ${u?"opacity-60":""}`,children:[(0,a.jsx)("div",{className:"px-3 py-2 border-b border-black/10 dark:border-white/10",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,a.jsx)(n.A,{src:`/providers/${r.provider}.png`,alt:r.provider,size:32,className:"object-contain",fallbackText:r.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-text-primary truncate",children:T(r.provider)}),m(r)?(0,a.jsx)("p",{className:"text-xs text-text-muted truncate",children:m(r)}):null,E(r)?(0,a.jsx)("p",{className:"text-[11px] text-text-muted/80 truncate",children:E(r)}):null,"kiro"===r.provider&&(0,a.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[(0,a.jsx)("span",{className:"rounded-full bg-brand-500/10 px-2 py-0.5 text-[10px] font-semibold text-brand-600 dark:text-brand-300",children:(l=r.providerSpecificData?.authMethod)&&P[l]?P[l]:"api_key"===r.authType?"API Key":"OAuth"}),_(r)&&(0,a.jsx)("span",{className:"rounded-full bg-blue-500/10 px-2 py-0.5 text-[10px] font-semibold text-blue-600 dark:text-blue-400",children:_(r)}),(0,a.jsx)("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-semibold ${u?"bg-surface-2 text-text-muted":"active"===r.testStatus||"success"===r.testStatus?"bg-green-500/10 text-green-600 dark:text-green-400":"error"===r.testStatus||"expired"===r.testStatus||"unavailable"===r.testStatus?"bg-red-500/10 text-red-600 dark:text-red-400":"bg-surface-2 text-text-muted"}`,children:u?"disabled":r.testStatus||"unknown"}),r.providerSpecificData?.profileArn&&(0,a.jsxs)("button",{type:"button",onClick:()=>t(r.providerSpecificData.profileArn,r.id),title:r.providerSpecificData.profileArn,className:"inline-flex max-w-full items-center gap-1 rounded-full border border-border-subtle px-2 py-0.5 text-[10px] text-text-muted transition-colors hover:text-primary",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:e===r.id?"check":"content_copy"}),(0,a.jsx)("code",{className:"truncate font-mono",children:r.providerSpecificData.profileArn})]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(x||h)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k.default,{text:b>0?h?`Use your reset now (${b} left, use by ${M(h.expiresAt)}) \xb7 refills ${O(h.clears)}`:`Use one ${p}. Available: ${b}`:`No ${p}s available`,children:(0,a.jsxs)("button",{type:"button",onClick:()=>eh({connection:r,resetCreditCount:b}),disabled:b<=0||d||N,"aria-label":b>0?`Use one ${p}. ${b} available.`:`No ${p}s available`,className:`flex h-8 min-w-10 items-center justify-center gap-1 rounded-lg border px-2 text-[11px] font-medium tabular-nums transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary/60 disabled:cursor-not-allowed disabled:opacity-60 ${b>0?"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10":"border-black/10 bg-black/[0.02] text-text-muted dark:border-white/10 dark:bg-white/[0.03]"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[15px] ${g?"animate-spin":""}`,children:g?"progress_activity":"restart_alt"}),(0,a.jsx)("span",{children:b})]})}),(0,a.jsx)(k.default,{text:x?"View Codex reset credit expiry":"View Claude Code reset expiry",children:(0,a.jsx)("button",{type:"button",onClick:()=>x?e3(r):e2(r,h),disabled:d||N,"aria-label":x?"View Codex reset credit expiry":"View Claude Code reset expiry",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-muted transition-colors hover:bg-black/5 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10 dark:hover:bg-white/5",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"schedule"})})})]}),q[r.provider]&&"oauth"===r.authType&&(()=>{let e=G[r.provider]||{},t=e.connections?.[r.id]===!0,i=e.schedules?.[r.id],s=i?.enabled===!0,n=[];if(t&&n.push("On reset"),s){let e=(0,A.JW)(i).join(" / ");n.push(`Scheduled (${e||"active"})`)}let l=n.length>0?`Auto-ping active: ${n.join(" + ")}. Click to configure.`:"codex"===r.provider?"Auto-starts the next 5h Codex window after reset or on schedule. Click to configure.":"Auto-starts a new window on quota reset or fixed schedule. Click to configure.";return(0,a.jsx)(k.default,{text:l,children:(0,a.jsx)("button",{type:"button",onClick:()=>Y(r),"aria-label":"Configure auto-ping",className:`flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${t||s?"text-primary":"text-text-muted"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"})})})})(),(0,a.jsx)(k.default,{text:"Refresh quota",children:(0,a.jsx)("button",{type:"button",onClick:()=>e1(r.id,r.provider),disabled:d||N,"aria-label":"Refresh quota",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${d?"animate-spin":""}`,children:"refresh"})})}),(0,a.jsx)(k.default,{text:"Edit connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>{ev(r),ef(!0)},disabled:N,"aria-label":"Edit connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})})}),(0,a.jsx)(k.default,{text:"Delete connection",children:(0,a.jsx)("button",{type:"button",onClick:()=>e4(r.id),disabled:N,"aria-label":"Delete connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-red-500/10 text-red-500 transition-colors disabled:opacity-50",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${el===r.id?"animate-pulse":""}`,children:"delete"})})}),(0,a.jsx)("div",{className:"inline-flex items-center pl-0.5",title:r.isActive??!0?"Disable connection":"Enable connection",children:(0,a.jsx)(w.default,{size:"sm",checked:r.isActive??!0,disabled:N,onChange:e=>e8(r.id,e)})})]})]})}),(0,a.jsxs)("div",{className:"px-2 py-1.5",children:[d?(0,a.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] animate-spin",children:"progress_activity"})}):c?(0,a.jsxs)("div",{className:"text-center py-5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:c})]}):o?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-text-muted",children:o.message})}):(0,a.jsx)(v,{quotas:S,compact:!0,sortMode:"default",onHideQuota:e=>tt(r.provider,e)}),$.length>0&&(0,a.jsxs)("div",{className:"mt-2 flex min-w-0 items-center gap-1 border-t border-black/5 pt-2 text-[10px] text-text-muted dark:border-white/5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[14px]",children:"visibility_off"}),(0,a.jsx)("span",{className:"shrink-0",children:"Hidden:"}),(0,a.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto whitespace-nowrap pb-2",children:$.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>tr(r.provider,e),className:"shrink-0 rounded-md border border-black/10 px-1.5 py-0.5 transition-colors hover:bg-black/5 hover:text-text-primary dark:border-white/10 dark:hover:bg-white/5",title:"Show this quota row",children:e.name},f(e)))})]})]})]},r.id)})}),(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:tc}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:tu?"custom":String(eU),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(eR(1),eH(r),eB(String(r)))},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Accounts per page",children:[d.map(e=>(0,a.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,a.jsx)("option",{value:"custom",children:"Custom"})]}),(0,a.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eW,onChange:e=>eB(e.target.value),onBlur:()=>{let e=Number.parseInt(eW,10);if(!Number.isFinite(e))return void eB(String(eU));let t=Math.min(500,Math.max(1,e));eR(1),eH(t),eB(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eW,10);if(!Number.isFinite(t))return void eB(String(eU));let r=Math.min(500,Math.max(1,t));eR(1),eH(r),eB(String(r))},className:"h-8 w-20 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Page ",eJ.page," / ",eJ.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eR(1),disabled:eJ.page<=1||es||et,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"First Page"}),(0,a.jsx)("button",{type:"button",onClick:()=>eR(e=>Math.max(1,e-1)),disabled:eJ.page<=1||es||et,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Previous accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_left"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eR(e=>Math.min(eJ.totalPages,e+1)),disabled:eJ.page>=eJ.totalPages||es||et,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Next accounts page",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_right"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eR(eJ.totalPages),disabled:eJ.page>=eJ.totalPages||es||et,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Last Page"})]})]})}),(0,a.jsx)(N.uo,{isOpen:!!ex,onClose:()=>{eu||eh(null)},onConfirm:async()=>{let e=ex?.connection;e&&(await e5(e.id,e.provider),eh(null))},title:ex?.connection?.provider==="claude"?"Reset Claude limits?":"Reset Codex limit?",message:ex?.connection?.provider==="claude"?`Refills your ${O(R[ex.connection.id]?.raw?.resetCredits?.clears)} now for ${m(ex.connection)||"this account"} \xb7 your weekly reset day stays ${M(R[ex.connection.id]?.raw?.resetCredits?.weeklyResetsAt)}. This cannot be undone. Resets left: ${ex.resetCreditCount??0}.`:`Use 1 Codex reset credit for ${m(ex?.connection||{})||"this account"}. This cannot be undone. Remaining credits: ${ex?.resetCreditCount??0}.`,confirmText:"Reset limit",cancelText:"Cancel",variant:"danger",loading:!!eu}),ep&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"w-full max-w-2xl overflow-hidden rounded-2xl border border-black/15 bg-white shadow-2xl ring-1 ring-black/10 dark:border-white/15 dark:bg-neutral-950 dark:ring-white/10",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3 border-b border-black/10 bg-black/[0.03] px-4 py-3 dark:border-white/10 dark:bg-white/[0.04]",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-base font-semibold text-text-primary",children:ep.data?.kind==="claude"?"Claude Code Limit Resets":"Codex Reset Credit Expiry"}),(0,a.jsx)("p",{className:"mt-0.5 truncate text-xs text-text-muted",children:m(ep.connection)||(ep.data?.kind==="claude"?"Claude account":"Codex account")})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eb(null),className:"flex h-8 w-8 items-center justify-center rounded-lg text-text-muted transition-colors hover:bg-black/5 hover:text-text-primary dark:hover:bg-white/5","aria-label":"Close reset credit expiry modal",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),(0,a.jsx)("div",{className:"max-h-[70vh] overflow-auto bg-white p-4 dark:bg-neutral-950",children:ep.loading?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),"Loading reset credits..."]}):ep.error?(0,a.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-300",children:ep.error}):ep.data?.kind==="claude"&&ep.data.grants?.length?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("span",{children:[ep.data.availableCount??0," reset",1===ep.data.availableCount?"":"s"," left"]}),(0,a.jsxs)("span",{children:["Weekly reset day: ",M(ep.data.weeklyResetsAt)]})]}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-xl border border-black/10 dark:border-white/10",children:(0,a.jsxs)("table",{className:"w-full min-w-[560px] text-left text-sm",children:[(0,a.jsx)("thead",{className:"bg-black/[0.03] text-xs uppercase tracking-wide text-text-muted dark:bg-white/[0.04]",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Reset"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Left"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Refills"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Use By"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Remaining"})]})}),(0,a.jsx)("tbody",{children:(ep.data.grants||[]).map(e=>(0,a.jsxs)("tr",{className:"border-t border-black/5 dark:border-white/5",children:[(0,a.jsxs)("td",{className:"px-3 py-2",children:[(0,a.jsx)("div",{className:"text-text-primary",children:e.label||e.id}),(0,a.jsx)("span",{className:"mt-1 inline-block rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:e.resetsLeft<=0?"used":e.paused?"paused":e.endsAt&&new Date(e.endsAt).getTime()<=Date.now()?"expired":e.usableNow?"usable now":e.startsAt&&new Date(e.startsAt).getTime()>Date.now()?"not started":e.useRequiresLimit?"at limit only":"unavailable"})]}),(0,a.jsxs)("td",{className:"whitespace-nowrap px-3 py-2 font-medium tabular-nums text-text-primary",children:[e.resetsLeft," / ",e.resetsTotal]}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-muted",children:O(e.clears)}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-primary",children:M(e.endsAt)}),(0,a.jsx)("td",{className:"whitespace-nowrap px-3 py-2 font-medium text-text-primary",children:F(e.endsAt)})]},e.id))})]})})]}):ep.data?.credits?.length?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("span",{children:[ep.data.credits.length," reset credit",1===ep.data.credits.length?"":"s"]}),(0,a.jsxs)("span",{children:[ep.data.availableCount??0," available"]})]}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-xl border border-black/10 dark:border-white/10",children:(0,a.jsxs)("table",{className:"w-full min-w-[560px] text-left text-sm",children:[(0,a.jsx)("thead",{className:"bg-black/[0.03] text-xs uppercase tracking-wide text-text-muted dark:bg-white/[0.04]",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Status"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Granted At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Expires At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Remaining"})]})}),(0,a.jsx)("tbody",{children:ep.data.credits.map((e,t)=>(0,a.jsxs)("tr",{className:"border-t border-black/5 dark:border-white/5",children:[(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsx)("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:e.status||"unknown"})}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-muted",children:M(e.grantedAt)}),(0,a.jsx)("td",{className:"px-3 py-2 text-text-primary",children:M(e.expiresAt)}),(0,a.jsx)("td",{className:"px-3 py-2 font-medium text-text-primary",children:F(e.expiresAt)})]},`${e.status}-${e.expiresAt||t}`))})]})})]}):(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-8 text-center text-sm text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:ep.data?.kind==="claude"?"No limit resets available for this account.":"No reset credit details returned for this account."})})]})}),(0,a.jsx)(N.wI,{isOpen:eg,connection:ey,proxyPools:ew,onSave:e6,onClose:()=>{ef(!1),ev(null)}}),Z&&(0,a.jsx)(C.A,{isOpen:!!Z,onClose:()=>Y(null),connection:Z,reactive:G[Z.provider]?.connections?.[Z.id]===!0,schedule:G[Z.provider]?.schedules?.[Z.id]||null,onSave:e=>e7(Z.id,Z.provider,e)})]}):(0,a.jsx)(j.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:td.icon}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:td.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:td.description})]})}):(0,a.jsx)(j.default,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:"cloud_off"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"No Providers Connected"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})})}},93195:(e,t,r)=>{"use strict";function a(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}r.d(t,{JW:()=>o,Vm:()=>a,fB:()=>s,gy:()=>i,nz:()=>n});let i={anchor:"09:30",timezone:a(),windowHours:5,slotsPerDay:3};function s(e){let t=/^(\d{1,2}):(\d{2})$/.exec(String(e||"").trim());if(!t)return null;let r=Number(t[1]),a=Number(t[2]);return r>23||a>59?null:{hour:r,minute:a}}function n(e){return Math.max(1,Math.floor(24/e))}function l(e,t,r,a){let i="number"==typeof e?e:Number(e);return Number.isFinite(i)?Math.min(a,Math.max(r,i)):t}function o(e){let t=function(e){if(!e||!0!==e.enabled)return null;let t=s(e.anchor)||s(i.anchor),r=`${String(t.hour).padStart(2,"0")}:${String(t.minute).padStart(2,"0")}`,a=!function(e){if(!e||"string"!=typeof e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}(e.timezone)?i.timezone:e.timezone,o=l(e.windowHours,i.windowHours,.5,24),d=Math.round(l(e.slotsPerDay,i.slotsPerDay,1,n(o)));return{enabled:!0,anchor:r,timezone:a,windowHours:o,slotsPerDay:d}}(e);if(!t)return[];let{hour:r,minute:a}=s(t.anchor),o=60*r+a;return Array.from({length:t.slotsPerDay},(e,r)=>{let a=Math.round(o+r*t.windowHours*60)%1440;return`${String(Math.floor(a/60)).padStart(2,"0")}:${String(a%60).padStart(2,"0")}`})}},97132:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var a=r(95155),i=r(12115),s=r(14051),n=r.n(s),l=r(35497),o=r(31474),d=r(93195);let c=[{value:"off",label:"Off",icon:"block"},{value:"reset",label:"On reset",icon:"bolt"},{value:"schedule",label:"Schedule",icon:"schedule"}];function u({isOpen:e,onClose:t,onSave:r,connection:s,reactive:n=!1,schedule:m=null}){let[x,h]=(0,i.useState)(()=>({mode:m?.enabled===!0?"schedule":!0===n?"reset":"off",anchor:m?.anchor||d.gy.anchor,timezone:(0,d.Vm)(),windowHours:String(m?.windowHours??d.gy.windowHours),slotsPerDay:String(m?.slotsPerDay??d.gy.slotsPerDay)})),p=Number(x.windowHours),b=Number(x.slotsPerDay),g=!!(0,d.fB)(x.anchor),f=Number.isFinite(p)&&p>=.5&&p<=24,y=f?(0,d.nz)(p):24,v=Number.isInteger(b)&&b>=1&&b<=y,w=g&&f&&v,k="schedule"!==x.mode||w,j=w?(0,d.JW)({enabled:!0,...x,windowHours:p,slotsPerDay:b}):[],N=j.length&&f?(()=>{let{hour:e,minute:t}=(0,d.fB)(x.anchor),r=Math.round(60*e+t+b*p*60)%1440;return`${String(Math.floor(r/60)).padStart(2,"0")}:${String(r%60).padStart(2,"0")}`})():"",C=e=>h(t=>({...t,...e}));return(0,a.jsx)(l.aF,{isOpen:e,onClose:t,title:"Auto-ping settings",size:"lg",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.$n,{variant:"secondary",onClick:t,children:"Cancel"}),(0,a.jsx)(l.$n,{onClick:()=>{k&&(r({reactive:"reset"===x.mode,schedule:"schedule"===x.mode?{enabled:!0,anchor:x.anchor,timezone:x.timezone,windowHours:p,slotsPerDay:b}:{enabled:!1}}),t())},disabled:!k,children:"Save"})]}),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Configure automated quota pings",s?.name?` for ${s.name}`:""," — pick one mode."]}),(0,a.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-[10px] bg-surface-2 p-1",children:c.map(e=>{let t=x.mode===e.value;return(0,a.jsxs)("button",{type:"button",onClick:()=>C({mode:e.value}),className:(0,o.cn)("flex h-9 items-center justify-center gap-1.5 rounded-[8px] px-3 text-sm font-medium transition-all",t?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px] leading-none",children:e.icon}),(0,a.jsx)("span",{children:e.label})]},e.value)})}),"reset"===x.mode&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Pings right after the 5h quota window resets, so a new window starts immediately."}),"schedule"===x.mode&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Pings at fixed local times so the 5h windows align with your workday."}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[(0,a.jsx)(l.pd,{label:"Anchor time",type:"time",value:x.anchor,onChange:e=>C({anchor:e.target.value}),error:g?"":"Use HH:MM",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,a.jsx)(l.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:x.windowHours,onChange:e=>C({windowHours:e.target.value}),error:f?"":"0.5 – 24",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,a.jsx)(l.pd,{label:"Pings per day",type:"number",min:"1",max:String(y),step:"1",value:x.slotsPerDay,onChange:e=>C({slotsPerDay:e.target.value}),error:v?"":`1 – ${y}`,hint:v?`Max ${y}`:"",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"})]}),j.length>0&&(0,a.jsxs)("div",{className:"rounded-[10px] bg-surface-2 px-3 py-2.5",children:[(0,a.jsxs)("p",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:["Daily slots (",x.timezone,")"]}),(0,a.jsx)("p",{className:"mt-1 text-sm font-medium text-text-main",children:j.join(" → ")}),(0,a.jsxs)("p",{className:"mt-1 text-xs text-text-muted",children:["Covers ",j[0]," – ",N,", then pauses until ",j[0]," next day."]})]})]})]})})}u.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onSave:n().func.isRequired,connection:n().object,reactive:n().bool,schedule:n().object}}},e=>{e.O(0,[8500,246,2723,705,5497,8441,3794,7358],()=>e(e.s=898)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (()=>{"use strict";var e,t,r,o,n,a,i,c,s,l={},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var r=u[e]={exports:{}},o=!0;try{l[e].call(r.exports,r,r.exports,d),o=!1}finally{o&&delete u[e]}return r.exports}d.m=l,e=[],d.O=(t,r,o,n)=>{if(r){n=n||0;for(var a=e.length;a>0&&e[a-1][2]>n;a--)e[a]=e[a-1];e[a]=[r,o,n];return}for(var i=1/0,a=0;a<e.length;a++){for(var[r,o,n]=e[a],c=!0,s=0;s<r.length;s++)(!1&n||i>=n)&&Object.keys(d.O).every(e=>d.O[e](r[s]))?r.splice(s--,1):(c=!1,n<i&&(i=n));if(c){e.splice(a--,1);var l=o();void 0!==l&&(t=l)}}return t},d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(e,o){if(1&o&&(e=this(e)),8&o||"object"==typeof e&&e&&(4&o&&e.__esModule||16&o&&"function"==typeof e.then))return e;var n=Object.create(null);d.r(n);var a={};t=t||[null,r({}),r([]),r(r)];for(var i=2&o&&e;"object"==typeof i&&!~t.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(t=>a[t]=()=>e[t]);return a.default=()=>e,d.d(n,a),n},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce((t,r)=>(d.f[r](e,t),t),[])),d.u=e=>2723===e?"static/chunks/2723-8def0af25f7b656c.js":6808===e?"static/chunks/6808-ada8d917f8f60e64.js":3842===e?"static/chunks/3842-cc4f39fa50ab8b93.js":5815===e?"static/chunks/5815-2eb6990de66e825b.js":1649===e?"static/chunks/1649-772a31b7f3a65900.js":"static/chunks/"+(3862===e?"1a258343":e)+"."+({6:"14774bfbac824225",124:"c092990b4bdb9713",2435:"8a5a02e626c780d0",3521:"3af5cf89706546d6",3862:"290297ea7c7f28c0",5462:"c82c64c26a864ec0",6357:"99dc54a064c984c0",8202:"69dace5daa86686d",8569:"df0d706176dc1f57",9233:"b5ad25d75f88baa7"})[e]+".js",d.miniCssF=e=>"static/css/e07f2bf4fa519943.css",d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o={},d.l=(e,t,r,n)=>{if(o[e])return void o[e].push(t);if(void 0!==r)for(var a,i,c=document.getElementsByTagName("script"),s=0;s<c.length;s++){var l=c[s];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="_N_E:"+r){a=l;break}}a||(i=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,d.nc&&a.setAttribute("nonce",d.nc),a.setAttribute("data-webpack","_N_E:"+r),a.src=d.tu(e)),o[e]=[t];var u=(t,r)=>{a.onerror=a.onload=null,clearTimeout(f);var n=o[e];if(delete o[e],a.parentNode&&a.parentNode.removeChild(a),n&&n.forEach(e=>e(r)),t)return t(r)},f=setTimeout(u.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=u.bind(null,a.onerror),a.onload=u.bind(null,a.onload),i&&document.head.appendChild(a)},d.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.tt=()=>(void 0===n&&(n={createScriptURL:e=>e},"u">typeof trustedTypes&&trustedTypes.createPolicy&&(n=trustedTypes.createPolicy("nextjs#bundler",n))),n),d.tu=e=>d.tt().createScriptURL(e),d.p="/_next/",a={8068:0},d.f.miniCss=(e,t)=>{if(a[e])t.push(a[e]);else 0!==a[e]&&({2574:1})[e]&&t.push(a[e]=new Promise((t,r)=>{var o=d.miniCssF(e),n=d.p+o;if(((e,t)=>{for(var r=document.getElementsByTagName("link"),o=0;o<r.length;o++){var n=r[o],a=n.getAttribute("data-href")||n.getAttribute("href");if("stylesheet"===n.rel&&(a===e||a===t))return n}for(var i=document.getElementsByTagName("style"),o=0;o<i.length;o++){var n=i[o],a=n.getAttribute("data-href");if(a===e||a===t)return n}})(o,n))return t();((e,t,r,o)=>{var n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.onerror=n.onload=a=>{if(n.onerror=n.onload=null,"load"===a.type)r();else{var i=a&&("load"===a.type?"missing":a.type),c=a&&a.target&&a.target.href||t,s=Error("Loading CSS chunk "+e+" failed.\n("+c+")");s.code="CSS_CHUNK_LOAD_FAILED",s.type=i,s.request=c,n.parentNode.removeChild(n),o(s)}},n.href=t;if("function"==typeof _N_E_STYLE_LOAD){var a=n.href,i=n.onload,c=n.onerror;_N_E_STYLE_LOAD(0===a.indexOf(window.location.origin)?new URL(a).pathname:a).then(function(){i&&i.call(n,{type:"load"})},function(){c&&c.call(n,{})})}else document.head.appendChild(n)})(e,n,t,r)}).then(()=>{a[e]=0},t=>{throw delete a[e],t}))},i={8068:0,8982:0,3334:0},d.f.j=(e,t)=>{var r=d.o(i,e)?i[e]:void 0;if(0!==r)if(r)t.push(r[2]);else if(/^(2574|3334|8068|8982)$/.test(e))i[e]=0;else{var o=new Promise((t,o)=>r=i[e]=[t,o]);t.push(r[2]=o);var n=d.p+d.u(e),a=Error();d.l(n,t=>{if(d.o(i,e)&&(0!==(r=i[e])&&(i[e]=void 0),r)){var o=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+o+": "+n+")",a.name="ChunkLoadError",a.type=o,a.request=n,r[1](a)}},"chunk-"+e,e)}},d.O.j=e=>0===i[e],c=(e,t)=>{var r,o,[n,a,c]=t,s=0;if(n.some(e=>0!==i[e])){for(r in a)d.o(a,r)&&(d.m[r]=a[r]);if(c)var l=c(d)}for(e&&e(t);s<n.length;s++)o=n[s],d.o(i,o)&&i[o]&&i[o][0](),i[o]=0;return d.O(l)},(s=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(c.bind(null,0)),s.push=c.bind(null,s.push.bind(s))})();
1
+ (()=>{"use strict";var e,t,r,o,n,a,i,c,s,l={},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var r=u[e]={exports:{}},o=!0;try{l[e].call(r.exports,r,r.exports,d),o=!1}finally{o&&delete u[e]}return r.exports}d.m=l,e=[],d.O=(t,r,o,n)=>{if(r){n=n||0;for(var a=e.length;a>0&&e[a-1][2]>n;a--)e[a]=e[a-1];e[a]=[r,o,n];return}for(var i=1/0,a=0;a<e.length;a++){for(var[r,o,n]=e[a],c=!0,s=0;s<r.length;s++)(!1&n||i>=n)&&Object.keys(d.O).every(e=>d.O[e](r[s]))?r.splice(s--,1):(c=!1,n<i&&(i=n));if(c){e.splice(a--,1);var l=o();void 0!==l&&(t=l)}}return t},d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(e,o){if(1&o&&(e=this(e)),8&o||"object"==typeof e&&e&&(4&o&&e.__esModule||16&o&&"function"==typeof e.then))return e;var n=Object.create(null);d.r(n);var a={};t=t||[null,r({}),r([]),r(r)];for(var i=2&o&&e;"object"==typeof i&&!~t.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(t=>a[t]=()=>e[t]);return a.default=()=>e,d.d(n,a),n},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce((t,r)=>(d.f[r](e,t),t),[])),d.u=e=>2723===e?"static/chunks/2723-d221ebfdd8e24af9.js":6808===e?"static/chunks/6808-ada8d917f8f60e64.js":3842===e?"static/chunks/3842-cc4f39fa50ab8b93.js":5815===e?"static/chunks/5815-2eb6990de66e825b.js":1649===e?"static/chunks/1649-772a31b7f3a65900.js":"static/chunks/"+(3862===e?"1a258343":e)+"."+({6:"14774bfbac824225",124:"c092990b4bdb9713",2435:"8a5a02e626c780d0",3521:"3af5cf89706546d6",3862:"290297ea7c7f28c0",5462:"c82c64c26a864ec0",6357:"99dc54a064c984c0",8202:"69dace5daa86686d",8569:"df0d706176dc1f57",9233:"b5ad25d75f88baa7"})[e]+".js",d.miniCssF=e=>"static/css/e07f2bf4fa519943.css",d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o={},d.l=(e,t,r,n)=>{if(o[e])return void o[e].push(t);if(void 0!==r)for(var a,i,c=document.getElementsByTagName("script"),s=0;s<c.length;s++){var l=c[s];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="_N_E:"+r){a=l;break}}a||(i=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,d.nc&&a.setAttribute("nonce",d.nc),a.setAttribute("data-webpack","_N_E:"+r),a.src=d.tu(e)),o[e]=[t];var u=(t,r)=>{a.onerror=a.onload=null,clearTimeout(f);var n=o[e];if(delete o[e],a.parentNode&&a.parentNode.removeChild(a),n&&n.forEach(e=>e(r)),t)return t(r)},f=setTimeout(u.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=u.bind(null,a.onerror),a.onload=u.bind(null,a.onload),i&&document.head.appendChild(a)},d.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.tt=()=>(void 0===n&&(n={createScriptURL:e=>e},"u">typeof trustedTypes&&trustedTypes.createPolicy&&(n=trustedTypes.createPolicy("nextjs#bundler",n))),n),d.tu=e=>d.tt().createScriptURL(e),d.p="/_next/",a={8068:0},d.f.miniCss=(e,t)=>{if(a[e])t.push(a[e]);else 0!==a[e]&&({2574:1})[e]&&t.push(a[e]=new Promise((t,r)=>{var o=d.miniCssF(e),n=d.p+o;if(((e,t)=>{for(var r=document.getElementsByTagName("link"),o=0;o<r.length;o++){var n=r[o],a=n.getAttribute("data-href")||n.getAttribute("href");if("stylesheet"===n.rel&&(a===e||a===t))return n}for(var i=document.getElementsByTagName("style"),o=0;o<i.length;o++){var n=i[o],a=n.getAttribute("data-href");if(a===e||a===t)return n}})(o,n))return t();((e,t,r,o)=>{var n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.onerror=n.onload=a=>{if(n.onerror=n.onload=null,"load"===a.type)r();else{var i=a&&("load"===a.type?"missing":a.type),c=a&&a.target&&a.target.href||t,s=Error("Loading CSS chunk "+e+" failed.\n("+c+")");s.code="CSS_CHUNK_LOAD_FAILED",s.type=i,s.request=c,n.parentNode.removeChild(n),o(s)}},n.href=t;if("function"==typeof _N_E_STYLE_LOAD){var a=n.href,i=n.onload,c=n.onerror;_N_E_STYLE_LOAD(0===a.indexOf(window.location.origin)?new URL(a).pathname:a).then(function(){i&&i.call(n,{type:"load"})},function(){c&&c.call(n,{})})}else document.head.appendChild(n)})(e,n,t,r)}).then(()=>{a[e]=0},t=>{throw delete a[e],t}))},i={8068:0,8982:0,3334:0},d.f.j=(e,t)=>{var r=d.o(i,e)?i[e]:void 0;if(0!==r)if(r)t.push(r[2]);else if(/^(2574|3334|8068|8982)$/.test(e))i[e]=0;else{var o=new Promise((t,o)=>r=i[e]=[t,o]);t.push(r[2]=o);var n=d.p+d.u(e),a=Error();d.l(n,t=>{if(d.o(i,e)&&(0!==(r=i[e])&&(i[e]=void 0),r)){var o=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+o+": "+n+")",a.name="ChunkLoadError",a.type=o,a.request=n,r[1](a)}},"chunk-"+e,e)}},d.O.j=e=>0===i[e],c=(e,t)=>{var r,o,[n,a,c]=t,s=0;if(n.some(e=>0!==i[e])){for(r in a)d.o(a,r)&&(d.m[r]=a[r]);if(c)var l=c(d)}for(e&&e(t);s<n.length;s++)o=n[s],d.o(i,o)&&i[o]&&i[o][0](),i[o]=0;return d.O(l)},(s=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(c.bind(null,0)),s.push=c.bind(null,s.push.bind(s))})();
package/app/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnihilbras-app",
3
- "version": "2.9.4",
3
+ "version": "2.9.5",
4
4
  "description": "OmniHilbras web dashboard",
5
5
  "private": true,
6
6
  "scripts": {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hilbras/omnihilbras",
3
- "version": "2.9.4",
3
+ "version": "2.9.5",
4
4
  "description": "OmniHilbras CLI - Start and manage OmniHilbras server",
5
5
  "bin": {
6
6
  "omnihilbras": "./cli.js"