@hilbras/omnihilbras 2.6.0 → 2.6.1

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 (211) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +20 -20
  3. package/app/.next-cli-build/build-manifest.json +3 -3
  4. package/app/.next-cli-build/react-loadable-manifest.json +1 -1
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  34. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  35. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  36. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  37. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  38. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  39. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  40. package/app/.next-cli-build/server/app/_not-found.rsc +2 -2
  41. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +2 -2
  42. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  43. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  44. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  45. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  46. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  47. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  48. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  49. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  50. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  51. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  52. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  53. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  54. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  55. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  56. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  57. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  58. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  59. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  60. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  61. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  62. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  63. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  64. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  65. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  66. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  67. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  68. package/app/.next-cli-build/server/app/api/v1/systemone/route.js +1 -1
  69. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  70. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  71. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  72. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  73. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  74. package/app/.next-cli-build/server/app/callback.html +1 -1
  75. package/app/.next-cli-build/server/app/callback.rsc +2 -2
  76. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +2 -2
  77. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  78. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +2 -2
  79. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  80. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +2 -2
  81. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  82. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +2 -2
  83. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  84. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  85. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +2 -2
  86. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  87. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +2 -2
  88. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  89. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  90. package/app/.next-cli-build/server/app/dashboard/combos.rsc +2 -2
  91. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  92. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +2 -2
  93. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  94. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  95. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +2 -2
  96. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  97. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +2 -2
  98. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  99. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  100. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +2 -2
  101. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  102. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +2 -2
  103. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  104. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  105. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +2 -2
  106. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  107. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +2 -2
  108. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  109. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  110. package/app/.next-cli-build/server/app/dashboard/profile.rsc +2 -2
  111. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  112. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +2 -2
  113. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  114. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  115. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +2 -2
  116. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  117. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +2 -2
  118. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  119. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  120. package/app/.next-cli-build/server/app/dashboard/providers.rsc +2 -2
  121. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  122. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +2 -2
  123. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  124. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  125. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +2 -2
  126. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  127. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +2 -2
  128. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  129. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  130. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +2 -2
  131. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
  132. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +2 -2
  133. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
  134. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  135. package/app/.next-cli-build/server/app/dashboard/quota.rsc +2 -2
  136. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +2 -2
  137. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +2 -2
  138. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  139. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  140. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  141. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +2 -2
  142. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +2 -2
  143. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  144. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
  145. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  146. package/app/.next-cli-build/server/app/dashboard/skills.rsc +2 -2
  147. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  148. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +2 -2
  149. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  150. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  151. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +2 -2
  152. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
  153. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +2 -2
  154. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
  155. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  156. package/app/.next-cli-build/server/app/dashboard/translator.rsc +2 -2
  157. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  158. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +2 -2
  159. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  160. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  161. package/app/.next-cli-build/server/app/dashboard/usage.rsc +2 -2
  162. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  163. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +2 -2
  164. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  165. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  166. package/app/.next-cli-build/server/app/dashboard.rsc +2 -2
  167. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  168. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +2 -2
  169. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  170. package/app/.next-cli-build/server/app/index.html +1 -1
  171. package/app/.next-cli-build/server/app/index.rsc +2 -2
  172. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  173. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +2 -2
  174. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  175. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  176. package/app/.next-cli-build/server/app/landing.html +1 -1
  177. package/app/.next-cli-build/server/app/landing.rsc +2 -2
  178. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +2 -2
  179. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  180. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
  181. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  182. package/app/.next-cli-build/server/app/login.html +1 -1
  183. package/app/.next-cli-build/server/app/login.rsc +2 -2
  184. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +2 -2
  185. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  186. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  187. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  188. package/app/.next-cli-build/server/app-paths-manifest.json +20 -20
  189. package/app/.next-cli-build/server/chunks/1329.js +1 -1
  190. package/app/.next-cli-build/server/chunks/3770.js +1 -1
  191. package/app/.next-cli-build/server/chunks/3799.js +1 -1
  192. package/app/.next-cli-build/server/chunks/436.js +1 -1
  193. package/app/.next-cli-build/server/chunks/4663.js +1 -1
  194. package/app/.next-cli-build/server/chunks/5245.js +1 -1
  195. package/app/.next-cli-build/server/chunks/5299.js +2 -2
  196. package/app/.next-cli-build/server/chunks/615.js +1 -1
  197. package/app/.next-cli-build/server/chunks/827.js +1 -1
  198. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  199. package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
  200. package/app/.next-cli-build/server/middleware.js +2 -2
  201. package/app/.next-cli-build/server/pages/404.html +1 -1
  202. package/app/.next-cli-build/server/pages/500.html +1 -1
  203. package/app/.next-cli-build/static/chunks/{85-c9d2b6e00b6ee6eb.js → 85-324ccdbb00ecb8c6.js} +1 -1
  204. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-a6704c37e390b7f0.js → page-48b85c71658e5c32.js} +1 -1
  205. package/app/.next-cli-build/static/chunks/webpack-cae378b24d238fa2.js +1 -0
  206. package/app/cli/.build-home/.omnihilbras/db/data.sqlite +0 -0
  207. package/app/package.json +1 -1
  208. package/package.json +1 -1
  209. package/app/.next-cli-build/static/chunks/webpack-908043815b1b426f.js +0 -1
  210. /package/app/.next-cli-build/static/{dbkOt5w7oPLAPpclnaoiZ → ICmC54SqqtWA8-umxsoE6}/_buildManifest.js +0 -0
  211. /package/app/.next-cli-build/static/{dbkOt5w7oPLAPpclnaoiZ → ICmC54SqqtWA8-umxsoE6}/_ssgManifest.js +0 -0
@@ -24,4 +24,4 @@ pt-only-auto-named`:M,[G,Z]=(0,a.useState)("single"),[Q,V]=(0,a.useState)(""),[X
24
24
  "id_token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
25
25
  "email": "account2@example.com"
26
26
  }
27
- ]`;function B(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 G({isOpen:e,onClose:t,onSuccess:s}){let[l,r]=(0,a.useState)(""),[n,o]=(0,a.useState)(!1),[d,c]=(0,a.useState)(""),[m,u]=(0,a.useState)(null),[x,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(null),y=(0,a.useRef)(null),b=()=>{n||(r(""),c(""),u(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,$.Tl)("Please select valid .json files"));try{let e=[];for(let s of t){let t=await s.text(),i=B(t);Array.isArray(i)?e.push(...i):i&&e.push(i)}if(0===e.length)return void c((0,$.Tl)("No accounts found in selected files"));r(JSON.stringify(e,null,2)),g({filesCount:t.length,accountsCount:e.length})}catch(e){c(`${(0,$.Tl)("Error reading files")}: ${e.message}`)}},j=async()=>{let e;c(""),u(null);try{e=B(l)}catch(e){c(`${(0,$.Tl)("Invalid JSON")}: ${e.message}`);return}if(!e||0===e.length)return void c((0,$.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})}),i=await t.json();if(!t.ok)return void c(i?.error||`Request failed: ${t.status}`);u(i),i.success>0&&"function"==typeof s&&s()}catch(e){c(e.message||(0,$.Tl)("Request failed"))}finally{o(!1)}},w=m?.results?.filter(e=>!e.ok)||[];return(0,i.jsx)(p.aF,{isOpen:e,title:(0,$.Tl)("Bulk Add Grok CLI Accounts"),onClose:b,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:(0,$.Tl)("Upload multiple .json files or paste JSON array / object.")}),(0,i.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,i.jsx)(p.$n,{type:"button",size:"sm",variant:"secondary",icon:"upload_file",onClick:()=>y.current?.click(),disabled:n,children:(0,$.Tl)("Upload JSON Files")})]}),(0,i.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,i.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:W,value:l,onChange:e=>{r(e.target.value),g(null)},disabled:n}),x&&(0,i.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,i.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary mb-1",children:"upload_file"}),(0,i.jsx)("span",{className:"text-sm font-medium text-primary",children:(0,$.Tl)("Drop .json files here")})]})]}),f&&(0,i.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,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check_circle"}),(0,i.jsxs)("span",{children:[(0,$.Tl)("Loaded")," ",f.accountsCount," ",(0,$.Tl)("account(s) from")," ",f.filesCount," ",(0,$.Tl)("file(s)")]})]}),d&&(0,i.jsx)("p",{className:"text-xs text-red-500 break-words",children:d}),m&&m.failed>0&&(0,i.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,i.jsxs)("div",{className:"text-sm font-medium text-yellow-400",children:["✗ ",m.failed," ",(0,$.Tl)("failed")]}),w.length>0&&(0,i.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,i.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.$n,{onClick:j,fullWidth:!0,disabled:n||!l.trim(),children:n?(0,$.Tl)("Importing..."):(0,$.Tl)("Import All")}),(0,i.jsx)(p.$n,{onClick:b,variant:"ghost",fullWidth:!0,disabled:n,children:(0,$.Tl)("Close")})]})]})})}var Z=s(65921);let Q=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],V=/^[A-Za-z0-9-]+$/;function X({providerId:e}){let t=(0,Z.i)(),[s,l]=(0,a.useState)(!1),[r,n]=(0,a.useState)([{name:"",value:""}]),[o,d]=(0,a.useState)({}),[c,m]=(0,a.useState)(!1),[u,x]=(0,a.useState)(!1);(0,a.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||{},i=Object.entries({...s,...e.headers||{}}).map(([e,t])=>({name:e,value:t}));d(s),n(i.length?i:[{name:"",value:""}]),m(Object.keys(e.headers||{}).length>0)}).catch(()=>{}),()=>{t=!0}},[e]);let h=(e,t,s)=>{n(i=>i.map((i,a)=>a===e?{...i,[t]:s}:i))},f=(0,a.useCallback)(async()=>{let s={};for(let e of r.filter(e=>e.name.trim())){let i=e.name.trim();if(!V.test(i))return void t.error(`Invalid header name: ${i}`);if(Q.includes(i.toLowerCase()))return void t.error(`Header ${i} cannot be overridden`);if(i in s)return void t.error(`Duplicate header name: ${i}`);e.value!==o[i]&&(s[i]=e.value)}x(!0);try{let i=await fetch(`/api/providers/${e}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:s})});if(!i.ok){let e=await i.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,i.jsxs)(p.Zp,{padding:"xs",children:[(0,i.jsxs)("button",{type:"button",onClick:()=>l(e=>!e),className:"flex w-full items-center justify-between text-left",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"tune"}),(0,i.jsx)("span",{className:"text-sm font-semibold",children:"Custom Headers"}),c&&(0,i.jsx)(p.Ex,{variant:"success",size:"sm",children:"Active"})]}),(0,i.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:s?"expand_less":"expand_more"})]}),s&&(0,i.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,i.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,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.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,i.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,i.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,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},t)})}),(0,i.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,i.jsxs)("button",{type:"button",onClick:()=>n(e=>[...e,{name:"",value:""}]),className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add header"]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("button",{type:"button",disabled:u,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,i.jsx)("button",{type:"button",disabled:u,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:u?"Saving...":"Save"})]})]})]})]}):null}X.propTypes={providerId:r().string.isRequired};var Y=s(97132),ee=s(93195);let et=[{value:"all",label:"All"},{value:"untested",label:"Untested"},{value:"passed",label:"Passed"},{value:"failed",label:"Failed"}],es={claude:"claudeAutoPing",codex:"codexAutoPing"};function ei({label:e,value:t,icon:s,tone:a="text-muted"}){return(0,i.jsxs)("div",{className:"rounded-xl border border-line bg-bg-soft/70 p-3.5",children:[(0,i.jsx)("span",{className:`material-symbols-outlined text-[17px] ${a}`,"aria-hidden":"true",children:s}),(0,i.jsx)("p",{className:"muted mt-3 text-[10px] uppercase tracking-[0.1em]",children:e}),(0,i.jsx)("p",{className:"mt-1 truncate font-mono text-sm font-semibold",children:t})]})}function ea(){let e,t,s,l,r,o,h=(0,n.useParams)(),f=(0,n.useRouter)(),g=h.id,{getCaps:y}=(0,A.y)(),[b,v]=(0,a.useState)([]),[j,w]=(0,a.useState)(!0),[k,N]=(0,a.useState)(null),[T,E]=(0,a.useState)([]),[R,z]=(0,a.useState)(!1),[q,M]=(0,a.useState)(!1),[F,J]=(0,a.useState)(!1),[W,B]=(0,a.useState)(!1),[Z,Q]=(0,a.useState)(!1),[V,ea]=(0,a.useState)(""),[el,er]=(0,a.useState)(!1),[en,eo]=(0,a.useState)(!1),[ed,ec]=(0,a.useState)(!1),[em,ep]=(0,a.useState)(!1),[eu,ex]=(0,a.useState)(!1),[eh,ef]=(0,a.useState)(null),[eg,ey]=(0,a.useState)({}),[eb,ev]=(0,a.useState)([]),[ej,ew]=(0,a.useState)(!1),[ek,eN]=(0,a.useState)({}),[eC,eS]=(0,a.useState)(""),[eA,e$]=(0,a.useState)(()=>new Set),[eT,eO]=(0,a.useState)(""),[eP,eI]=(0,a.useState)("all"),[eE,eD]=(0,a.useState)(!1),[eR,ez]=(0,a.useState)([]),[eq,e_]=(0,a.useState)("__none__"),[eM,eU]=(0,a.useState)(!1),[eK,eF]=(0,a.useState)(null),[eL,eJ]=(0,a.useState)(""),[eH,eW]=(0,a.useState)("auto"),[eB,eG]=(0,a.useState)({enabled:!1,connections:{},schedules:{}}),[eZ,eQ]=(0,a.useState)(null),[eV,eX]=(0,a.useState)([]),[eY,e0]=(0,a.useState)(!1),[e1,e2]=(0,a.useState)(null),[e5,e3]=(0,a.useState)([]),[e4,e6]=(0,a.useState)(null),[e9,e8]=(0,a.useState)([]),[e7,te]=(0,a.useState)([]),[tt,ts]=(0,a.useState)(null),[ti,ta]=(0,a.useState)(!1),[tl,tr]=(0,a.useState)(!1),[tn,to]=(0,a.useState)(!1),[td,tc]=(0,a.useState)(null),[tm,tp]=(0,a.useState)({}),[tu,tx]=(0,a.useState)(null),th=(0,a.useRef)(!1),[tf,tg]=(0,a.useState)(!1),[ty,tb]=(0,a.useState)(!1),{copied:tv,copy:tj}=(0,S.C)(),tw="ag_risk_confirmed",tk=()=>{z(!0)},tN=()=>{"antigravity"===g&&"true"!==window.localStorage.getItem(tw)?ta(!0):"xiaomi-mimo"===g?M(!0):tT?tk():(ea(""),Q(!0))},tC=()=>{(ea(""),tU)?B(!0):Q(!0)},tS=()=>{tT?tN():tC()},tA=k?{id:k.id,name:k.name||("anthropic-compatible"===k.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===k.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===k.type?"AC":"OC",apiType:k.apiType,baseUrl:k.baseUrl,type:k.type}:u.zN[g]||u.fg[g]||u.IS[g]||u.nJ[g]||u.br[g],t$=tA?.authModes||[],tT=!!u.zN[g]||!!u.IS[g]||t$.includes("oauth"),tO=!!u.fg[g]||t$.includes("apikey"),tP=!!u.IS[g]?.noAuth,tI=(0,x.KC)(g),tE=(0,a.useMemo)(()=>(0,u.Q5)(g),[g]),tD="opencode"===g||!tE,tR=("cursor"===g||"zed"===g)&&e5.length>0?e5:tD?tI:[],tz=(0,u.wG)(g),tq=(0,u.mq)(g),t_=(0,u.gb)(g),tM=tq||t_,tU=!!u.mh[g],tK=!tM&&tT&&tO,tF="xai"===g?"Grok Build OAuth":"grok-cli"===g?"Grok CLI Device Login":"kimi"===g?"Kimi Coding OAuth":"tokenharbor"===g?"Token Harbor Login":"OAuth",tL="xai"===g?"xAI API Key":"kimi"===g?"Kimi API Key":"qoder"===g||"qoder-cn"===g?"PAT":"API Key",tJ=e=>{if(!eH||"auto"===eH)return null;let t=C(g,e);return t&&t.includes(eH)?eH:null},tH=tM?g:tz,tW=(()=>{let e=new Set,t=new Set,s=s=>{if(!s||t.has(s))return;t.add(s);let i=C(g,s);i&&i.forEach(t=>{"none"!==t&&e.add(t)})};for(let e of tR)s(e.id);for(let e of e9)s(e.id);for(let e of eb)e.providerAlias===tH&&"llm"===(e.kind||e.type||"llm")&&s(e.id);return e.size?["auto",...e]:null})(),tB=tM?k?.prefix||g:tz,tG=(0,a.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tH)}`,{cache:"no-store"}),t=await e.json();e.ok&&te(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tH]),tZ=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tH,ids:[e]})})).ok&&await tG()}catch(e){console.log("Error disabling model:",e)}},tQ=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tH)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tG()}catch(e){console.log("Error enabling model:",e)}},tV=async e=>{e.length&&ts({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{ts(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tH,ids:e})})).ok&&await tG()}catch(e){console.log("Error disabling all models:",e)}}})},tX=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tH)}`,{method:"DELETE"})).ok&&await tG()}catch(e){console.log("Error enabling all models:",e)}},tY=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&ey(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),t0=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ev(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,a.useEffect)(()=>{"kilocode"===g&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&e8(e.models)}).catch(()=>{})},[g]);let t1=(0,a.useCallback)(async()=>{try{let[e,t,s,i]=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"})]),a=await e.json(),l=await t.json(),r=await s.json(),n=i.ok?await i.json():{};if(e.ok){let e=(a.connections||[]).filter(e=>e.provider===g);v(e)}s.ok&&E(r.proxyPools||[]);let o=(n.providerStrategies||{})[g]||{};eF(o.fallbackStrategy||null),eJ(null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1");let d=(n.providerThinking||{})[g]||{};eW(d.mode||"auto");let c=es[g],m=c&&n[c]||{};if(eG({enabled:!0===m.enabled,connections:m.connections||{},schedules:m.schedules||{}}),t.ok){let e=(l.nodes||[]).find(e=>e.id===g)||null;if(!e&&tM)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}N(e)}}catch(e){console.log("Error fetching connections:",e)}finally{w(!1)}},[g,tM]),t2=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&&(N(s.node),await t1(),ep(!1))}catch(e){console.log("Error updating provider node:",e)}},t5=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),i=(s.ok?await s.json():{}).providerStrategies||{},a={};e&&(a.fallbackStrategy=e),"round-robin"===e&&""!==t&&(a.stickyRoundRobinLimit=Number(t)||3);let l={...i};0===Object.keys(a).length?delete l[g]:l[g]=a,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})})}catch(e){console.log("Error saving provider strategy:",e)}},t3=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)}},t4=async e=>{let t=es[g];if(t){eG(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,a.useEffect)(()=>{t1(),tY(),t0(),tG()},[t1,tY,t0,tG]),(0,a.useEffect)(()=>{if("cursor"!==g&&"zed"!==g)return void e3([]);let e=b.find(e=>!1!==e.isActive);if(!e?.id){e3([]),"zed"===g&&e6(null);return}let t=!1;return"zed"===g&&e6(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){e3(s.models),"zed"===g&&s?.warning&&e6(s.warning);return}"zed"===g&&(e3([]),e6(s?.warning||s?.error||"Zed returned no live models."))}}).catch(()=>{t||"zed"!==g||(e3([]),e6("Failed to reach the Zed model catalog."))}),()=>{t=!0}},[g,b]);let t6=async(e=!1,{autoAdd:t=!1}={})=>{if(tE){e0(!0);try{let{data:s,error:i}=await O(tE,g,{force:e});if(eX(s),0===s.length)return void e2({ok:!1,text:i||"The provider returned no models."});if(!t)return void e2({ok:!0,text:`Fetched ${s.length} models.`});let a=new Set;for(let e of tR)a.add(`${tH}/${e.id}`);for(let e of eb)e.providerAlias===tH&&e.id&&a.add(`${tH}/${e.id}`);for(let e of Object.values(eg))"string"==typeof e&&a.add(e);let l=0,r=0;for(let e of s)if(!a.has(`${tH}/${e.id}`))try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tH,id:e.id,type:"llm",name:e.name||e.id,origin:"fetch"})})).ok?l+=1:r+=1}catch{r+=1}l>0&&(await t0(),window.dispatchEvent(new CustomEvent("customModelChanged")));let n=s.length-l-r,o=[];l>0&&o.push(`Added ${l} model${1===l?"":"s"}`),r>0&&o.push(`${r} failed`),n>0&&o.push(`${n} already in the list`),e2({ok:0===r&&l>0,text:o.join(" \xb7 ")||"All models already in the list."})}finally{e0(!1)}}};(0,a.useEffect)(()=>{let e=!1;if(tE)return O(tE,g).then(({data:t})=>{e||eX(t)}),()=>{e=!0}},[g,tE]);let t9=async(e,t,s=tz)=>{let i=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:i,alias:t})});if(e.ok)await tY();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},t8=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tY()}catch(e){console.log("Error deleting alias:",e)}},t7=async(e,t="llm",s=tH,i,a)=>{try{let l=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:s,id:e,type:t,...i?{caps:i}:{},...a?{transport:a}:{}})});if(l.ok)await t0(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await l.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},se=async(e,t="llm",s=tH)=>{try{let i=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${i}`,{method:"DELETE"})).ok&&(await t0(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},st=async()=>{if(tf)return;let e=b.find(e=>!1!==e.isActive);if(!e)return void alert((0,$.Tl)("Please add an active Qoder connection first"));tg(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,$.Tl)("Failed to fetch models"));let i=s.models||[];if(0===i.length)return void alert((0,$.Tl)("No models returned"));let a=0;for(let e of i){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^(qoder-cn|qoder)\//,"");eb.some(e=>e.providerAlias===tH&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(eg).includes(`${tH}/${s}`)||(await t7(s,"llm",tH),a+=1)}0===a?alert((0,$.Tl)("All models already exist, no new models added")):alert((0,$.Tl)("Successfully added")+` ${a} `+(0,$.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,$.Tl)("Error fetching models")+": "+e.message)}finally{tg(!1)}},ss=async()=>{if(ty)return;let e=b.find(e=>!1!==e.isActive);if(!e)return void alert((0,$.Tl)("Please add an active Cline connection first"));tb(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,$.Tl)("Failed to fetch models"));let i=s.models||[];if(0===i.length)return void alert((0,$.Tl)("No models returned"));let a=0;for(let e of i){let t=e.id||e.name;t&&(eb.some(e=>e.providerAlias===tH&&e.id===t&&"llm"===(e.kind||e.type||"llm"))||Object.values(eg).includes(`${tH}/${t}`)||(await t7(t,"llm",tH),a+=1))}0===a?alert((0,$.Tl)("All models already exist, no new models added")):alert((0,$.Tl)("Successfully added")+` ${a} `+(0,$.Tl)("models"))}catch(e){console.log("Error importing Cline models:",e),alert((0,$.Tl)("Error fetching models")+": "+e.message)}finally{tb(!1)}},si=async()=>{if(tl||0===b.length)return;let e=Object.fromEntries(b.map(e=>[e.id,{state:"queued",error:null}]));th.current=!1,tr(!0),to(!1),tc(null),tp(e),tx({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(th.current){tx({total:b.length,completed:e,passed:t,failed:s,stopped:!0});break}let i=b[e];tc(i.id),tp(e=>({...e,[i.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${i.id}/test`,{method:"POST"}),a=await e.json(),l=!!a.valid;l?t+=1:s+=1,tp(e=>({...e,[i.id]:{state:l?"success":"failed",error:l?null:a.error||null}}))}catch(e){s+=1,tp(t=>({...t,[i.id]:{state:"failed",error:e.message||"Test failed"}}))}tx({total:b.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<b.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{tc(null),tr(!1),to(!1),th.current=!1}},sa=async e=>{ts({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{ts(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)}}})},sl=()=>{t1(),z(!1)},sr=async e=>{ea("");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 t1(),Q(!1),t6(!0,{autoAdd:!0});return}ea(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),ea("Failed to save connection")}},sn=async e=>{try{(await fetch(`/api/providers/${eh.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await t1(),ec(!1),t6(!0,{autoAdd:!0}))}catch(e){console.log("Error updating connection:",e)}},so=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)}},sd=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 t1()}},sc=b.filter(e=>eR.includes(e.id)),sm=b.length>0&&eR.length===b.length;(0,a.useEffect)(()=>{ez(e=>e.filter(e=>b.some(t=>t.id===e)))},[b]),(()=>{if(0===sc.length)return;let e=new Set(sc.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=T.find(e=>e.id===t);return s?.name}})();let sp=()=>{eM||ex(!1)},su=async e=>{eU(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:i}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:i})})).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 t1(),ex(!1)}finally{eU(!1)}},sx=e=>su(b.map(t=>({connectionId:t.id,proxyPoolId:e}))),sh=(0,i.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,i.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,i.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,i.jsx)("input",{type:"checkbox",checked:(s=e.id,eR.includes(s)),onChange:()=>{var t;return t=e.id,void ez(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,i.jsx)("div",{className:"flex-1 min-w-0",children:(0,i.jsx)(_,{connection:e,proxyPools:T,isOAuth:tT,isFirst:0===t,isLast:t===b.length-1,onMoveUp:()=>sd(t,t-1),onMoveDown:()=>sd(t,t+1),onToggleActive:t=>so(e.id,t),autoPing:es[g]&&"oauth"===e.authType?{isActive:!0===eB.connections[e.id]||eB.schedules?.[e.id]?.enabled===!0,reactiveOn:!0===eB.connections[e.id],provider:g,scheduleOn:eB.schedules?.[e.id]?.enabled===!0,scheduleSummary:(0,ee.JW)(eB.schedules?.[e.id]).join(" / "),onConfigure:()=>eQ(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:()=>{ef(e),ec(!0)},onDelete:()=>sa(e.id),oneByOneStatus:tm[e.id]||null})})]},e.id)})}),sf=T.filter(e=>!0===e.isActive),sg=(0,i.jsx)(p.aF,{isOpen:eu,onClose:sp,title:`Apply Proxy (${b.length} connections)`,children:(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsxs)("div",{className:"flex flex-col",children:[(0,i.jsxs)("button",{onClick:()=>{let e=T.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):su(b.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:eM||0===sf.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,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,i.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,i.jsxs)("button",{onClick:()=>sx(null),disabled:eM,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,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,i.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),T.map(e=>(0,i.jsxs)("button",{onClick:()=>sx(e.id),disabled:eM||!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,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,i.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,i.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),eM&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,i.jsx)(p.$n,{onClick:sp,variant:"ghost",fullWidth:!0,disabled:eM,children:"Cancel"})]})}),sy=async e=>{if(!eA.has(e)){e$(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:`${tH}/${e}`})}),s=await t.json();eN(t=>({...t,[e]:s.ok?"ok":"error"})),eS(s.ok?"":s.error||"Model not reachable")}catch{eN(t=>({...t,[e]:"error"})),eS("Network error")}finally{e$(t=>{let s=new Set(t);return s.delete(e),s})}}};if(j)return(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsx)(p.Qv,{}),(0,i.jsx)(p.Qv,{})]});if(!tA)return(0,i.jsxs)("div",{className:"text-center py-20",children:[(0,i.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,i.jsx)(d(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let sb=()=>tq&&tA.apiType?"responses"===tA.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":t_?"/providers/anthropic-m.png":(0,m.HY)(tA.id);return(0,i.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)(d(),{href:"/dashboard/providers",className:"btn-quiet -ml-2 mb-4 !px-2 !py-1.5 !text-xs inline-flex",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"arrow_back"}),"Back to providers"]}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-col justify-between gap-4 sm:flex-row sm:items-start",children:[(0,i.jsxs)("div",{className:"flex min-w-0 items-start gap-3.5 sm:gap-4",children:[(0,i.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl border border-line",style:{backgroundColor:`${tA.color}15`},children:ej||!sb()?(0,i.jsx)("span",{className:"text-sm font-bold",style:{color:tA.color},children:tA.textIcon||tA.id.slice(0,2).toUpperCase()}):(0,i.jsx)(c.A,{src:sb(),alt:tA.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>{(0,m.Kw)(tA.id),ew(!0)},loading:"lazy",decoding:"async"})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2.5 flex-wrap",children:[(0,i.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-[-0.035em] sm:text-3xl",children:tA.name}),b.length>0?(0,i.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,i.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-success","aria-hidden":"true"}),b.length," Connected"]}):(0,i.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,i.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-muted","aria-hidden":"true"}),"Not connected"]})]}),(tA.notice?.apiKeyUrl||tA.notice?.signupUrl||tA.website)&&(0,i.jsxs)("a",{href:tA.notice?.apiKeyUrl||tA.notice?.signupUrl||tA.website,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1 text-xs text-gold-text hover:underline",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm","aria-hidden":"true",children:"open_in_new"}),tA.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]}),(0,i.jsxs)("p",{className:"muted mt-1 text-xs",children:[b.length," connection",1===b.length?"":"s"," \xb7 local workspace"]})]})]}),(0,i.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:tS,className:"btn-gold !px-3 !py-2.5 !text-xs",children:tU?"Connect Session":tM?"Add API Key":"Add connection"})})]})]}),(0,i.jsxs)("section",{className:"grid grid-cols-2 gap-3 xl:grid-cols-4","aria-label":"Provider summary",children:[(0,i.jsx)(ei,{label:"Connections",value:String(b.length),icon:"key",tone:b.length>0?"text-success":"text-muted"}),(0,i.jsx)(ei,{label:"Models",value:(e=[...tR,...e9.filter(e=>!tR.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,i.jsx)(ei,{label:"Status",value:b.length>0?"Connected":"Not connected",icon:"activity",tone:b.length>0?"text-success":"text-muted"}),(0,i.jsx)(ei,{label:"Endpoint",value:tA.website?new URL(tA.website).hostname:g,icon:"dns",tone:"text-gold-text"})]}),tA.deprecated&&(0,i.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,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,i.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:tA.deprecationNotice})]}),tA.notice?.text&&!tA.deprecated&&(0,i.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,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,i.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:tA.notice.text}),tA.notice.apiKeyUrl&&(0,i.jsx)("a",{href:tA.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 →"})]}),tM&&k&&(0,i.jsx)(p.Zp,{children:(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:t_?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,i.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[t_?"Messages API":"responses"===k.apiType?"Responses API":"Chat Completions"," \xb7 ",(k.baseUrl||"").replace(/\/$/,""),"/",t_?"messages":"responses"===k.apiType?"responses":"chat/completions"]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>{ea(""),Q(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>ep(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{ts({title:"Delete Compatible Node",message:`Delete this ${t_?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{ts(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"})]})]})}),tP?(0,i.jsx)(p.gw,{providerId:g}):(0,i.jsxs)(p.Zp,{children:[(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-sm font-semibold",children:"Connections"}),(0,i.jsx)("p",{className:"muted mt-1 text-xs",children:"Credentials and endpoints used by this provider."})]}),(0,i.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[b.length>0&&T.length>0&&(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>ex(!0),children:"Apply Proxy"}),b.length>0&&(0,i.jsxs)(i.Fragment,{children:[eR.length>0&&(0,i.jsxs)(p.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let e=eR.length;0!==e&&ts({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{ts(null);let e=0,t=[...eR];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))),ez([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:["Delete Selected (",eR.length,")"]}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:si,disabled:tl,children:tl?"Testing Connection One-by-One...":"Test Connection One-by-One"}),tl&&(0,i.jsx)(p.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{tl&&(th.current=!0,to(!0))},disabled:tn,children:tn?"Stopping...":"Stop"})]}),(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,i.jsx)(p.lM,{checked:"round-robin"===eK,onChange:e=>{let t=e?"round-robin":null,s=e?eL||"1":eL;e&&!eL&&eJ("1"),eF(t),t5(t,s)}}),"round-robin"===eK&&(0,i.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,i.jsx)("input",{type:"number",min:1,value:eL,onChange:e=>{var t;eJ(t=e.target.value),t5("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,i.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:tT?"lock":"key"})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tK&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",tF," or ",tL,"."]})]})]}),(0,i.jsx)("div",{className:"flex gap-2",children:tK?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tN,children:tF}),(0,i.jsx)(p.$n,{size:"sm",icon:"key",onClick:tC,children:tL})]}):(0,i.jsxs)(i.Fragment,{children:[!tM&&"iflow"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>J(!0),children:"Cookie"}),"codex"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>er(!0),children:(0,$.Tl)("Bulk Add")}),"grok-cli"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>eo(!0),children:(0,$.Tl)("Bulk Add")}),(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:tS,children:tU?"Connect Session":tM?"Add API Key":"iflow"===g?"OAuth":"Add Connection"})]})})]}):(0,i.jsxs)(i.Fragment,{children:[tu&&(0,i.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,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,i.jsxs)("span",{children:["Total: ",tu.total]}),(0,i.jsxs)("span",{children:["Completed: ",tu.completed]}),(0,i.jsxs)("span",{children:["Passed: ",tu.passed]}),(0,i.jsxs)("span",{children:["Failed: ",tu.failed]}),tu.stopped&&(0,i.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),tl&&td&&(0,i.jsxs)("span",{children:["Running: ",b.find(e=>e.id===td)?.name||td]})]})}),b.length>0&&(0,i.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,i.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,i.jsx)("input",{type:"checkbox",checked:sm,onChange:()=>{sm?ez([]):ez(b.map(e=>e.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),sh,!tM&&(0,i.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===g&&(0,i.jsx)(p.$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,i.jsx)(p.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>er(!0),title:(0,$.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,$.Tl)("Bulk Add")}),"grok-cli"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>eo(!0),title:(0,$.Tl)("Bulk import Grok CLI accounts from JSON"),className:"w-full sm:w-auto",children:(0,$.Tl)("Bulk Add")}),tK?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tN,className:"w-full sm:w-auto",children:tF}),(0,i.jsx)(p.$n,{size:"sm",icon:"key",onClick:tC,className:"w-full sm:w-auto",children:tL})]}):(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:tS,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,i.jsx)(X,{providerId:g}),(0,i.jsxs)(p.Zp,{children:[(0,i.jsxs)("div",{className:"flex flex-col justify-between gap-3 sm:flex-row sm:items-start",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-sm font-semibold",children:"Available models"}),(0,i.jsx)("p",{className:"muted mt-1 text-xs",children:"Models currently exposed by this provider route. Test sends one real minimal request."})]}),(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[e1&&(0,i.jsx)("span",{role:"status",className:`max-w-[240px] truncate rounded-lg border px-2 py-1 text-[11px] ${e1.ok?"border-success/25 bg-success/10 text-success":"border-danger/30 bg-danger/10 text-danger"}`,title:e1.text,children:e1.text}),tE&&(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:eY?"progress_activity":"cloud_download",onClick:()=>void t6(!0),disabled:eY,title:"Fetch the live model list from the provider API (uses your saved key)",className:eY?"[&_.material-symbols-outlined]:animate-spin":"",children:eY?"Fetching…":"Fetch models"}),tW&&(0,i.jsx)("select",{value:eH,onChange:e=>{var t;eW(t=e.target.value),t3(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:tW.map(e=>(0,i.jsx)("option",{value:e,children:`Thinking: ${e.charAt(0).toUpperCase()+e.slice(1)}`},e))}),!tM&&(t=[...tR,...e9.filter(e=>!tR.some(t=>t.id===e.id))].filter(e=>{let t=(0,x.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!e7.includes(e)),(0,i.jsxs)(i.Fragment,{children:[e7.length>0&&(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tX,children:"Active All"}),t.length>0&&(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>tV(t),children:"Disable All"})]}))]})]}),!tM&&(0,i.jsxs)("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,i.jsxs)("label",{className:"relative block flex-1",children:[(0,i.jsx)("span",{className:"sr-only",children:"Search models"}),(0,i.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,i.jsx)("input",{value:eT,onChange:e=>eO(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}),eT&&(0,i.jsx)("button",{type:"button",onClick:()=>eO(""),"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,i.jsx)("span",{className:"material-symbols-outlined text-[15px]","aria-hidden":"true",children:"close"})})]}),(0,i.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:et.map(e=>(0,i.jsx)("button",{type:"button",role:"tab","aria-selected":eP===e.value,onClick:()=>eI(e.value),className:`whitespace-nowrap rounded-md px-2.5 py-1.5 text-[10px] font-medium transition-colors ${eP===e.value?"bg-surface text-gold-text shadow-sm":"text-muted hover:text-text"}`,children:e.label},e.value))})]}),!!eC&&(0,i.jsxs)("div",{className:"mb-3",children:[(0,i.jsx)("p",{className:"text-xs text-red-500 break-words",children:eC}),/RegionError|hosted in China|regionNotAllowed/i.test(eC)&&(l=(s="string"==typeof eC?eC:JSON.stringify(eC)).match(/https:\/\/opencode\.ai\/workspace\/[^\s"')]+/),r=s.match(/wrk_[0-9A-Za-z]+/),o=l?l[0].endsWith("/go")?l[0]:`${l[0]}/go`:r?`https://opencode.ai/workspace/${r[0]}/go`:"https://opencode.ai",(0,i.jsx)("div",{className:"mt-1.5",children:(0,i.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,i.jsx)("span",{children:"Allow China-hosted models"}),(0,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"open_in_new"})]})}))]}),"zed"===g&&!!e4&&(0,i.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:e4}),(()=>{let e,t,s;if(tM)return(0,i.jsx)(D,{providerStorageAlias:tH,providerDisplayAlias:tB,modelAliases:eg,customModels:eb,copied:tv,onCopy:tj,onSetAlias:t9,onDeleteAlias:t8,onAddCustomModel:e=>t7(e,"llm",tH),onDeleteCustomModel:e=>se(e,"llm",tH),connections:b,isAnthropic:t_});let a=[...tR,...e9.filter(e=>!tR.some(t=>t.id===e.id))].filter(e=>{let t=(0,x.CP)(e);return!t||"llm"===t}),l=new Set(e7),r=eT.trim().toLowerCase(),n=e=>!r||e.id.toLowerCase().includes(r)||(e.name||"").toLowerCase().includes(r),o=e=>{if("all"===eP)return!0;let t=ek[e.id];return"untested"===eP?!t:"passed"===eP?"ok"===t:"failed"!==eP||"error"===t},d=a.filter(e=>!l.has(e.id)&&n(e)&&o(e)),c=a.filter(e=>l.has(e.id)),m=P({customModels:eb,modelAliases:eg,providerAlias:tH,builtInModels:tR,type:"llm"}).filter(e=>n({id:e.id,name:e.name})&&o({id:e.id}));return(0,i.jsxs)("div",{className:"group/model-list space-y-2",children:[0===m.length&&0===d.length&&(0,i.jsxs)("div",{className:"rounded-xl border border-dashed border-line-strong px-5 py-9 text-center",children:[(0,i.jsx)("span",{className:"material-symbols-outlined mx-auto text-[24px] text-muted","aria-hidden":"true",children:"memory"}),(0,i.jsx)("p",{className:"mt-3 text-sm font-semibold",children:eT.trim()||"all"!==eP?"No matching models":"No models discovered"}),(0,i.jsx)("p",{className:"muted mt-1 text-xs",children:eT.trim()||"all"!==eP?"Try a different search or filter.":"Connect the provider or add a custom model ID below."})]}),m.map(e=>(0,i.jsx)(I,{model:{id:e.id,name:e.name},fullModel:`${tB}/${e.id}`,alias:e.alias,copied:tv,onCopy:tj,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?se(e.id,"llm",tH):t8(e.alias)},testStatus:ek[e.id],onTest:b.length>0||tP?()=>sy(e.id):void 0,isTesting:eA.has(e.id),isCustom:"fetch"!==e.origin,isFree:!1,caps:y(`${g}/${e.id}`),thinkingSuffix:tJ(e.id)},`${e.source}-${e.fullModel}`)),d.map(e=>{let t=`${tH}/${e.id}`,s=`${g}/${e.id}`,a=Object.entries(eg).find(([,e])=>e===t||e===s)?.[0];return(0,i.jsx)(I,{model:e,fullModel:`${tB}/${e.id}`,alias:a,copied:tv,onCopy:tj,onSetAlias:t=>t9(e.id,t,tH),onDeleteAlias:()=>t8(a),testStatus:ek[e.id],onTest:b.length>0||tP?()=>sy(e.id):void 0,isTesting:eA.has(e.id),isFree:e.isFree,onDisable:()=>tZ(e.id),caps:y(`${g}/${e.id}`),thinkingSuffix:tJ(e.id)},e.id)}),(0,i.jsxs)("button",{onClick:()=>eD(!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,i.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,i.jsxs)("button",{onClick:st,disabled:tf,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,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:tf?{animation:"spin 1s linear infinite"}:void 0,children:tf?"progress_activity":"download"}),tf?(0,$.Tl)("Fetching..."):(0,$.Tl)("Fetch Qoder Models")]}),("cline"===g||"clinepass"===g)&&b.some(e=>!1!==e.isActive)&&(0,i.jsxs)("button",{onClick:ss,disabled:ty,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,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:ty?{animation:"spin 1s linear infinite"}:void 0,children:ty?"progress_activity":"download"}),ty?(0,$.Tl)("Fetching..."):(0,$.Tl)("Import from /models")]}),eV.length>0&&(e=new Set([...Object.values(eg),...m.map(e=>e.fullModel)]),t=new Set(tR.map(e=>e.id)),0===(s=eV.filter(s=>!e.has(`${tH}/${s.id}`)&&!t.has(s.id))).length?null:(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested models from the provider API:"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,i.jsxs)("button",{onClick:async()=>{await t7(e.id,"llm",tH)},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,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),c.length>0&&(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",c.length,"):"]}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:c.map(e=>(0,i.jsxs)("button",{onClick:()=>tQ(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,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),sg,"kiro"===g?(0,i.jsx)(p.Mh,{isOpen:R,providerInfo:tA,onSuccess:sl,onClose:()=>z(!1)}):"cursor"===g?(0,i.jsx)(p.G9,{isOpen:R,onSuccess:sl,onClose:()=>z(!1)}):"zed"===g?(0,i.jsx)(p.TE,{isOpen:R,providerInfo:tA,onSuccess:sl,onClose:()=>z(!1)}):"gitlab"===g?(0,i.jsx)(p.vj,{isOpen:R,providerInfo:tA,onSuccess:sl,onClose:()=>z(!1)}):"tokenharbor"===g?(0,i.jsx)(p.O1,{isOpen:R,providerInfo:tA,onSuccess:sl,onClose:()=>z(!1)}):(0,i.jsx)(p.LF,{isOpen:R,provider:g,providerInfo:tA,onSuccess:sl,onClose:()=>z(!1)}),(0,i.jsx)(p.LH,{isOpen:q,onSuccess:sl,onClose:()=>M(!1)}),"iflow"===g&&(0,i.jsx)(p.vE,{isOpen:F,onSuccess:()=>{t1(),J(!1)},onClose:()=>J(!1)}),tU&&(0,i.jsx)(p.Sg,{isOpen:W,providerId:g,onSuccess:sl,onClose:()=>B(!1)}),(0,i.jsx)(U,{isOpen:Z,provider:g,providerName:tA.name,isCompatible:tM,isAnthropic:t_,authType:tA?.authType,authHint:tA?.authHint,website:tA?.website,proxyPools:T,error:V,existingNames:b.map(e=>e.name).filter(Boolean),onSave:sr,onBulkDone:t1,onClose:()=>{ea(""),Q(!1)}}),(0,i.jsx)(p.wI,{isOpen:ed,connection:eh,proxyPools:T,onSave:sn,onClose:()=>ec(!1)}),tM&&(0,i.jsx)(K,{isOpen:em,node:k,onSave:t2,onClose:()=>ep(!1),isAnthropic:t_}),!tM&&(0,i.jsx)(L,{isOpen:eE,providerAlias:tH,providerDisplayAlias:tB,onSave:async(e,t,s)=>{await t7(e,t?.stt?"stt":"llm",tH,t,s),eD(!1)},onClose:()=>eD(!1)}),"codex"===g&&(0,i.jsx)(H,{isOpen:el,onClose:()=>er(!1),onSuccess:t1}),"grok-cli"===g&&(0,i.jsx)(G,{isOpen:en,onClose:()=>eo(!1),onSuccess:t1}),eZ&&(0,i.jsx)(Y.A,{isOpen:!!eZ,onClose:()=>eQ(null),connection:eZ,reactive:!0===eB.connections[eZ.id],schedule:eB.schedules?.[eZ.id]||null,onSave:e=>((e,{reactive:t,schedule:s})=>{t4({...eB,connections:{...eB.connections,[e]:t},schedules:{...eB.schedules,[e]:s}})})(eZ.id,e)}),(0,i.jsx)(p.uo,{isOpen:ti,onClose:()=>ta(!1),onConfirm:()=>{(window.localStorage.setItem(tw,"true"),ta(!1),tT)?tk():tC()},title:"Risk Notice",message:tA?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,i.jsx)(p.uo,{isOpen:!!tt,onClose:()=>ts(null),onConfirm:tt?.onConfirm,title:tt?.title||"Confirm",message:tt?.message,variant:"danger"})]})}ei.propTypes={label:r().string.isRequired,value:r().string.isRequired,icon:r().string.isRequired,tone:r().string}},93195:(e,t,s)=>{"use strict";function i(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}s.d(t,{JW:()=>o,Vm:()=>i,fB:()=>l,gy:()=>a,nz:()=>r});let a={anchor:"09:30",timezone:i(),windowHours:5,slotsPerDay:3};function l(e){let t=/^(\d{1,2}):(\d{2})$/.exec(String(e||"").trim());if(!t)return null;let s=Number(t[1]),i=Number(t[2]);return s>23||i>59?null:{hour:s,minute:i}}function r(e){return Math.max(1,Math.floor(24/e))}function n(e,t,s,i){let a="number"==typeof e?e:Number(e);return Number.isFinite(a)?Math.min(i,Math.max(s,a)):t}function o(e){let t=function(e){if(!e||!0!==e.enabled)return null;let t=l(e.anchor)||l(a.anchor),s=`${String(t.hour).padStart(2,"0")}:${String(t.minute).padStart(2,"0")}`,i=!function(e){if(!e||"string"!=typeof e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}(e.timezone)?a.timezone:e.timezone,o=n(e.windowHours,a.windowHours,.5,24),d=Math.round(n(e.slotsPerDay,a.slotsPerDay,1,r(o)));return{enabled:!0,anchor:s,timezone:i,windowHours:o,slotsPerDay:d}}(e);if(!t)return[];let{hour:s,minute:i}=l(t.anchor),o=60*s+i;return Array.from({length:t.slotsPerDay},(e,s)=>{let i=Math.round(o+s*t.windowHours*60)%1440;return`${String(Math.floor(i/60)).padStart(2,"0")}:${String(i%60).padStart(2,"0")}`})}},97132:(e,t,s)=>{"use strict";s.d(t,{A:()=>m});var i=s(95155),a=s(12115),l=s(14051),r=s.n(l),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:l,reactive:r=!1,schedule:p=null}){let[u,x]=(0,a.useState)(()=>({mode:p?.enabled===!0?"schedule":!0===r?"reset":"off",anchor:p?.anchor||d.gy.anchor,timezone:(0,d.Vm)(),windowHours:String(p?.windowHours??d.gy.windowHours),slotsPerDay:String(p?.slotsPerDay??d.gy.slotsPerDay)})),h=Number(u.windowHours),f=Number(u.slotsPerDay),g=!!(0,d.fB)(u.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"!==u.mode||j,k=j?(0,d.JW)({enabled:!0,...u,windowHours:h,slotsPerDay:f}):[],N=k.length&&y?(()=>{let{hour:e,minute:t}=(0,d.fB)(u.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,i.jsx)(n.aF,{isOpen:e,onClose:t,title:"Auto-ping settings",size:"lg",footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.$n,{variant:"secondary",onClick:t,children:"Cancel"}),(0,i.jsx)(n.$n,{onClick:()=>{w&&(s({reactive:"reset"===u.mode,schedule:"schedule"===u.mode?{enabled:!0,anchor:u.anchor,timezone:u.timezone,windowHours:h,slotsPerDay:f}:{enabled:!1}}),t())},disabled:!w,children:"Save"})]}),children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:["Configure automated quota pings",l?.name?` for ${l.name}`:""," — pick one mode."]}),(0,i.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-[10px] bg-surface-2 p-1",children:c.map(e=>{let t=u.mode===e.value;return(0,i.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,i.jsx)("span",{className:"material-symbols-outlined text-[15px] leading-none",children:e.icon}),(0,i.jsx)("span",{children:e.label})]},e.value)})}),"reset"===u.mode&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Pings right after the 5h quota window resets, so a new window starts immediately."}),"schedule"===u.mode&&(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Pings at fixed local times so the 5h windows align with your workday."}),(0,i.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[(0,i.jsx)(n.pd,{label:"Anchor time",type:"time",value:u.anchor,onChange:e=>C({anchor:e.target.value}),error:g?"":"Use HH:MM",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,i.jsx)(n.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:u.windowHours,onChange:e=>C({windowHours:e.target.value}),error:y?"":"0.5 – 24",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,i.jsx)(n.pd,{label:"Pings per day",type:"number",min:"1",max:String(b),step:"1",value:u.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"})]}),k.length>0&&(0,i.jsxs)("div",{className:"rounded-[10px] bg-surface-2 px-3 py-2.5",children:[(0,i.jsxs)("p",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:["Daily slots (",u.timezone,")"]}),(0,i.jsx)("p",{className:"mt-1 text-sm font-medium text-text-main",children:k.join(" → ")}),(0,i.jsxs)("p",{className:"mt-1 text-xs text-text-muted",children:["Covers ",k[0]," – ",N,", then pauses until ",k[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,85,705,5497,8441,3794,7358],()=>e(e.s=30840)),_N_E=e.O()}]);
27
+ ]`;function B(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 G({isOpen:e,onClose:t,onSuccess:s}){let[l,r]=(0,a.useState)(""),[n,o]=(0,a.useState)(!1),[d,c]=(0,a.useState)(""),[m,u]=(0,a.useState)(null),[x,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(null),y=(0,a.useRef)(null),b=()=>{n||(r(""),c(""),u(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,$.Tl)("Please select valid .json files"));try{let e=[];for(let s of t){let t=await s.text(),i=B(t);Array.isArray(i)?e.push(...i):i&&e.push(i)}if(0===e.length)return void c((0,$.Tl)("No accounts found in selected files"));r(JSON.stringify(e,null,2)),g({filesCount:t.length,accountsCount:e.length})}catch(e){c(`${(0,$.Tl)("Error reading files")}: ${e.message}`)}},j=async()=>{let e;c(""),u(null);try{e=B(l)}catch(e){c(`${(0,$.Tl)("Invalid JSON")}: ${e.message}`);return}if(!e||0===e.length)return void c((0,$.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})}),i=await t.json();if(!t.ok)return void c(i?.error||`Request failed: ${t.status}`);u(i),i.success>0&&"function"==typeof s&&s()}catch(e){c(e.message||(0,$.Tl)("Request failed"))}finally{o(!1)}},w=m?.results?.filter(e=>!e.ok)||[];return(0,i.jsx)(p.aF,{isOpen:e,title:(0,$.Tl)("Bulk Add Grok CLI Accounts"),onClose:b,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:(0,$.Tl)("Upload multiple .json files or paste JSON array / object.")}),(0,i.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,i.jsx)(p.$n,{type:"button",size:"sm",variant:"secondary",icon:"upload_file",onClick:()=>y.current?.click(),disabled:n,children:(0,$.Tl)("Upload JSON Files")})]}),(0,i.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,i.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:W,value:l,onChange:e=>{r(e.target.value),g(null)},disabled:n}),x&&(0,i.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,i.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary mb-1",children:"upload_file"}),(0,i.jsx)("span",{className:"text-sm font-medium text-primary",children:(0,$.Tl)("Drop .json files here")})]})]}),f&&(0,i.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,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check_circle"}),(0,i.jsxs)("span",{children:[(0,$.Tl)("Loaded")," ",f.accountsCount," ",(0,$.Tl)("account(s) from")," ",f.filesCount," ",(0,$.Tl)("file(s)")]})]}),d&&(0,i.jsx)("p",{className:"text-xs text-red-500 break-words",children:d}),m&&m.failed>0&&(0,i.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,i.jsxs)("div",{className:"text-sm font-medium text-yellow-400",children:["✗ ",m.failed," ",(0,$.Tl)("failed")]}),w.length>0&&(0,i.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,i.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.$n,{onClick:j,fullWidth:!0,disabled:n||!l.trim(),children:n?(0,$.Tl)("Importing..."):(0,$.Tl)("Import All")}),(0,i.jsx)(p.$n,{onClick:b,variant:"ghost",fullWidth:!0,disabled:n,children:(0,$.Tl)("Close")})]})]})})}var Z=s(65921);let Q=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],V=/^[A-Za-z0-9-]+$/;function X({providerId:e}){let t=(0,Z.i)(),[s,l]=(0,a.useState)(!1),[r,n]=(0,a.useState)([{name:"",value:""}]),[o,d]=(0,a.useState)({}),[c,m]=(0,a.useState)(!1),[u,x]=(0,a.useState)(!1);(0,a.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||{},i=Object.entries({...s,...e.headers||{}}).map(([e,t])=>({name:e,value:t}));d(s),n(i.length?i:[{name:"",value:""}]),m(Object.keys(e.headers||{}).length>0)}).catch(()=>{}),()=>{t=!0}},[e]);let h=(e,t,s)=>{n(i=>i.map((i,a)=>a===e?{...i,[t]:s}:i))},f=(0,a.useCallback)(async()=>{let s={};for(let e of r.filter(e=>e.name.trim())){let i=e.name.trim();if(!V.test(i))return void t.error(`Invalid header name: ${i}`);if(Q.includes(i.toLowerCase()))return void t.error(`Header ${i} cannot be overridden`);if(i in s)return void t.error(`Duplicate header name: ${i}`);e.value!==o[i]&&(s[i]=e.value)}x(!0);try{let i=await fetch(`/api/providers/${e}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:s})});if(!i.ok){let e=await i.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,i.jsxs)(p.Zp,{padding:"xs",children:[(0,i.jsxs)("button",{type:"button",onClick:()=>l(e=>!e),className:"flex w-full items-center justify-between text-left",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"tune"}),(0,i.jsx)("span",{className:"text-sm font-semibold",children:"Custom Headers"}),c&&(0,i.jsx)(p.Ex,{variant:"success",size:"sm",children:"Active"})]}),(0,i.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:s?"expand_less":"expand_more"})]}),s&&(0,i.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,i.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,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.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,i.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,i.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,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},t)})}),(0,i.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,i.jsxs)("button",{type:"button",onClick:()=>n(e=>[...e,{name:"",value:""}]),className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add header"]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("button",{type:"button",disabled:u,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,i.jsx)("button",{type:"button",disabled:u,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:u?"Saving...":"Save"})]})]})]})]}):null}X.propTypes={providerId:r().string.isRequired};var Y=s(97132),ee=s(93195);let et=[{value:"all",label:"All"},{value:"untested",label:"Untested"},{value:"passed",label:"Passed"},{value:"failed",label:"Failed"}],es={claude:"claudeAutoPing",codex:"codexAutoPing"};function ei({label:e,value:t,icon:s,tone:a="text-muted"}){return(0,i.jsxs)("div",{className:"rounded-xl border border-line bg-bg-soft/70 p-3.5",children:[(0,i.jsx)("span",{className:`material-symbols-outlined text-[17px] ${a}`,"aria-hidden":"true",children:s}),(0,i.jsx)("p",{className:"muted mt-3 text-[10px] uppercase tracking-[0.1em]",children:e}),(0,i.jsx)("p",{className:"mt-1 truncate font-mono text-sm font-semibold",children:t})]})}function ea(){let e,t,s,l,r,o,h=(0,n.useParams)(),f=(0,n.useRouter)(),g=h.id,{getCaps:y}=(0,A.y)(),[b,v]=(0,a.useState)([]),[j,w]=(0,a.useState)(!0),[k,N]=(0,a.useState)(null),[T,E]=(0,a.useState)([]),[R,z]=(0,a.useState)(!1),[q,M]=(0,a.useState)(!1),[F,J]=(0,a.useState)(!1),[W,B]=(0,a.useState)(!1),[Z,Q]=(0,a.useState)(!1),[V,ea]=(0,a.useState)(""),[el,er]=(0,a.useState)(!1),[en,eo]=(0,a.useState)(!1),[ed,ec]=(0,a.useState)(!1),[em,ep]=(0,a.useState)(!1),[eu,ex]=(0,a.useState)(!1),[eh,ef]=(0,a.useState)(null),[eg,ey]=(0,a.useState)({}),[eb,ev]=(0,a.useState)([]),[ej,ew]=(0,a.useState)(!1),[ek,eN]=(0,a.useState)({}),[eC,eS]=(0,a.useState)(""),[eA,e$]=(0,a.useState)(()=>new Set),[eT,eO]=(0,a.useState)(""),[eP,eI]=(0,a.useState)("all"),[eE,eD]=(0,a.useState)(!1),[eR,ez]=(0,a.useState)([]),[eq,e_]=(0,a.useState)("__none__"),[eM,eU]=(0,a.useState)(!1),[eK,eF]=(0,a.useState)(null),[eL,eJ]=(0,a.useState)(""),[eH,eW]=(0,a.useState)("auto"),[eB,eG]=(0,a.useState)({enabled:!1,connections:{},schedules:{}}),[eZ,eQ]=(0,a.useState)(null),[eV,eX]=(0,a.useState)([]),[eY,e0]=(0,a.useState)(!1),[e1,e2]=(0,a.useState)(null),[e5,e3]=(0,a.useState)([]),[e4,e6]=(0,a.useState)(null),[e9,e8]=(0,a.useState)([]),[e7,te]=(0,a.useState)([]),[tt,ts]=(0,a.useState)(null),[ti,ta]=(0,a.useState)(!1),[tl,tr]=(0,a.useState)(!1),[tn,to]=(0,a.useState)(!1),[td,tc]=(0,a.useState)(null),[tm,tp]=(0,a.useState)({}),[tu,tx]=(0,a.useState)(null),th=(0,a.useRef)(!1),[tf,tg]=(0,a.useState)(!1),[ty,tb]=(0,a.useState)(!1),{copied:tv,copy:tj}=(0,S.C)(),tw="ag_risk_confirmed",tk=()=>{z(!0)},tN=()=>{"antigravity"===g&&"true"!==window.localStorage.getItem(tw)?ta(!0):"xiaomi-mimo"===g?M(!0):tT?tk():(ea(""),Q(!0))},tC=()=>{(ea(""),tU)?B(!0):Q(!0)},tS=()=>{tT?tN():tC()},tA=k?{id:k.id,name:k.name||("anthropic-compatible"===k.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===k.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===k.type?"AC":"OC",apiType:k.apiType,baseUrl:k.baseUrl,type:k.type}:u.zN[g]||u.fg[g]||u.IS[g]||u.nJ[g]||u.br[g]||u.mh[g],t$=tA?.authModes||[],tT=!!u.zN[g]||!!u.IS[g]||t$.includes("oauth"),tO=!!u.fg[g]||t$.includes("apikey"),tP=!!u.IS[g]?.noAuth,tI=(0,x.KC)(g),tE=(0,a.useMemo)(()=>(0,u.Q5)(g),[g]),tD="opencode"===g||!tE,tR=("cursor"===g||"zed"===g)&&e5.length>0?e5:tD?tI:[],tz=(0,u.wG)(g),tq=(0,u.mq)(g),t_=(0,u.gb)(g),tM=tq||t_,tU=!!u.mh[g],tK=!tM&&tT&&tO,tF="xai"===g?"Grok Build OAuth":"grok-cli"===g?"Grok CLI Device Login":"kimi"===g?"Kimi Coding OAuth":"tokenharbor"===g?"Token Harbor Login":"OAuth",tL="xai"===g?"xAI API Key":"kimi"===g?"Kimi API Key":"qoder"===g||"qoder-cn"===g?"PAT":"API Key",tJ=e=>{if(!eH||"auto"===eH)return null;let t=C(g,e);return t&&t.includes(eH)?eH:null},tH=tM?g:tz,tW=(()=>{let e=new Set,t=new Set,s=s=>{if(!s||t.has(s))return;t.add(s);let i=C(g,s);i&&i.forEach(t=>{"none"!==t&&e.add(t)})};for(let e of tR)s(e.id);for(let e of e9)s(e.id);for(let e of eb)e.providerAlias===tH&&"llm"===(e.kind||e.type||"llm")&&s(e.id);return e.size?["auto",...e]:null})(),tB=tM?k?.prefix||g:tz,tG=(0,a.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tH)}`,{cache:"no-store"}),t=await e.json();e.ok&&te(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tH]),tZ=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tH,ids:[e]})})).ok&&await tG()}catch(e){console.log("Error disabling model:",e)}},tQ=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tH)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tG()}catch(e){console.log("Error enabling model:",e)}},tV=async e=>{e.length&&ts({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{ts(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tH,ids:e})})).ok&&await tG()}catch(e){console.log("Error disabling all models:",e)}}})},tX=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tH)}`,{method:"DELETE"})).ok&&await tG()}catch(e){console.log("Error enabling all models:",e)}},tY=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&ey(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),t0=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ev(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,a.useEffect)(()=>{"kilocode"===g&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&e8(e.models)}).catch(()=>{})},[g]);let t1=(0,a.useCallback)(async()=>{try{let[e,t,s,i]=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"})]),a=await e.json(),l=await t.json(),r=await s.json(),n=i.ok?await i.json():{};if(e.ok){let e=(a.connections||[]).filter(e=>e.provider===g);v(e)}s.ok&&E(r.proxyPools||[]);let o=(n.providerStrategies||{})[g]||{};eF(o.fallbackStrategy||null),eJ(null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1");let d=(n.providerThinking||{})[g]||{};eW(d.mode||"auto");let c=es[g],m=c&&n[c]||{};if(eG({enabled:!0===m.enabled,connections:m.connections||{},schedules:m.schedules||{}}),t.ok){let e=(l.nodes||[]).find(e=>e.id===g)||null;if(!e&&tM)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}N(e)}}catch(e){console.log("Error fetching connections:",e)}finally{w(!1)}},[g,tM]),t2=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&&(N(s.node),await t1(),ep(!1))}catch(e){console.log("Error updating provider node:",e)}},t5=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),i=(s.ok?await s.json():{}).providerStrategies||{},a={};e&&(a.fallbackStrategy=e),"round-robin"===e&&""!==t&&(a.stickyRoundRobinLimit=Number(t)||3);let l={...i};0===Object.keys(a).length?delete l[g]:l[g]=a,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})})}catch(e){console.log("Error saving provider strategy:",e)}},t3=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)}},t4=async e=>{let t=es[g];if(t){eG(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,a.useEffect)(()=>{t1(),tY(),t0(),tG()},[t1,tY,t0,tG]),(0,a.useEffect)(()=>{if("cursor"!==g&&"zed"!==g)return void e3([]);let e=b.find(e=>!1!==e.isActive);if(!e?.id){e3([]),"zed"===g&&e6(null);return}let t=!1;return"zed"===g&&e6(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){e3(s.models),"zed"===g&&s?.warning&&e6(s.warning);return}"zed"===g&&(e3([]),e6(s?.warning||s?.error||"Zed returned no live models."))}}).catch(()=>{t||"zed"!==g||(e3([]),e6("Failed to reach the Zed model catalog."))}),()=>{t=!0}},[g,b]);let t6=async(e=!1,{autoAdd:t=!1}={})=>{if(tE){e0(!0);try{let{data:s,error:i}=await O(tE,g,{force:e});if(eX(s),0===s.length)return void e2({ok:!1,text:i||"The provider returned no models."});if(!t)return void e2({ok:!0,text:`Fetched ${s.length} models.`});let a=new Set;for(let e of tR)a.add(`${tH}/${e.id}`);for(let e of eb)e.providerAlias===tH&&e.id&&a.add(`${tH}/${e.id}`);for(let e of Object.values(eg))"string"==typeof e&&a.add(e);let l=0,r=0;for(let e of s)if(!a.has(`${tH}/${e.id}`))try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tH,id:e.id,type:"llm",name:e.name||e.id,origin:"fetch"})})).ok?l+=1:r+=1}catch{r+=1}l>0&&(await t0(),window.dispatchEvent(new CustomEvent("customModelChanged")));let n=s.length-l-r,o=[];l>0&&o.push(`Added ${l} model${1===l?"":"s"}`),r>0&&o.push(`${r} failed`),n>0&&o.push(`${n} already in the list`),e2({ok:0===r&&l>0,text:o.join(" \xb7 ")||"All models already in the list."})}finally{e0(!1)}}};(0,a.useEffect)(()=>{let e=!1;if(tE)return O(tE,g).then(({data:t})=>{e||eX(t)}),()=>{e=!0}},[g,tE]);let t9=async(e,t,s=tz)=>{let i=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:i,alias:t})});if(e.ok)await tY();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},t8=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tY()}catch(e){console.log("Error deleting alias:",e)}},t7=async(e,t="llm",s=tH,i,a)=>{try{let l=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:s,id:e,type:t,...i?{caps:i}:{},...a?{transport:a}:{}})});if(l.ok)await t0(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await l.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},se=async(e,t="llm",s=tH)=>{try{let i=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${i}`,{method:"DELETE"})).ok&&(await t0(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},st=async()=>{if(tf)return;let e=b.find(e=>!1!==e.isActive);if(!e)return void alert((0,$.Tl)("Please add an active Qoder connection first"));tg(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,$.Tl)("Failed to fetch models"));let i=s.models||[];if(0===i.length)return void alert((0,$.Tl)("No models returned"));let a=0;for(let e of i){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^(qoder-cn|qoder)\//,"");eb.some(e=>e.providerAlias===tH&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(eg).includes(`${tH}/${s}`)||(await t7(s,"llm",tH),a+=1)}0===a?alert((0,$.Tl)("All models already exist, no new models added")):alert((0,$.Tl)("Successfully added")+` ${a} `+(0,$.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,$.Tl)("Error fetching models")+": "+e.message)}finally{tg(!1)}},ss=async()=>{if(ty)return;let e=b.find(e=>!1!==e.isActive);if(!e)return void alert((0,$.Tl)("Please add an active Cline connection first"));tb(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,$.Tl)("Failed to fetch models"));let i=s.models||[];if(0===i.length)return void alert((0,$.Tl)("No models returned"));let a=0;for(let e of i){let t=e.id||e.name;t&&(eb.some(e=>e.providerAlias===tH&&e.id===t&&"llm"===(e.kind||e.type||"llm"))||Object.values(eg).includes(`${tH}/${t}`)||(await t7(t,"llm",tH),a+=1))}0===a?alert((0,$.Tl)("All models already exist, no new models added")):alert((0,$.Tl)("Successfully added")+` ${a} `+(0,$.Tl)("models"))}catch(e){console.log("Error importing Cline models:",e),alert((0,$.Tl)("Error fetching models")+": "+e.message)}finally{tb(!1)}},si=async()=>{if(tl||0===b.length)return;let e=Object.fromEntries(b.map(e=>[e.id,{state:"queued",error:null}]));th.current=!1,tr(!0),to(!1),tc(null),tp(e),tx({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(th.current){tx({total:b.length,completed:e,passed:t,failed:s,stopped:!0});break}let i=b[e];tc(i.id),tp(e=>({...e,[i.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${i.id}/test`,{method:"POST"}),a=await e.json(),l=!!a.valid;l?t+=1:s+=1,tp(e=>({...e,[i.id]:{state:l?"success":"failed",error:l?null:a.error||null}}))}catch(e){s+=1,tp(t=>({...t,[i.id]:{state:"failed",error:e.message||"Test failed"}}))}tx({total:b.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<b.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{tc(null),tr(!1),to(!1),th.current=!1}},sa=async e=>{ts({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{ts(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)}}})},sl=()=>{t1(),z(!1)},sr=async e=>{ea("");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 t1(),Q(!1),t6(!0,{autoAdd:!0});return}ea(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),ea("Failed to save connection")}},sn=async e=>{try{(await fetch(`/api/providers/${eh.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await t1(),ec(!1),t6(!0,{autoAdd:!0}))}catch(e){console.log("Error updating connection:",e)}},so=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)}},sd=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 t1()}},sc=b.filter(e=>eR.includes(e.id)),sm=b.length>0&&eR.length===b.length;(0,a.useEffect)(()=>{ez(e=>e.filter(e=>b.some(t=>t.id===e)))},[b]),(()=>{if(0===sc.length)return;let e=new Set(sc.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=T.find(e=>e.id===t);return s?.name}})();let sp=()=>{eM||ex(!1)},su=async e=>{eU(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:i}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:i})})).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 t1(),ex(!1)}finally{eU(!1)}},sx=e=>su(b.map(t=>({connectionId:t.id,proxyPoolId:e}))),sh=(0,i.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,i.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,i.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,i.jsx)("input",{type:"checkbox",checked:(s=e.id,eR.includes(s)),onChange:()=>{var t;return t=e.id,void ez(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,i.jsx)("div",{className:"flex-1 min-w-0",children:(0,i.jsx)(_,{connection:e,proxyPools:T,isOAuth:tT,isFirst:0===t,isLast:t===b.length-1,onMoveUp:()=>sd(t,t-1),onMoveDown:()=>sd(t,t+1),onToggleActive:t=>so(e.id,t),autoPing:es[g]&&"oauth"===e.authType?{isActive:!0===eB.connections[e.id]||eB.schedules?.[e.id]?.enabled===!0,reactiveOn:!0===eB.connections[e.id],provider:g,scheduleOn:eB.schedules?.[e.id]?.enabled===!0,scheduleSummary:(0,ee.JW)(eB.schedules?.[e.id]).join(" / "),onConfigure:()=>eQ(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:()=>{ef(e),ec(!0)},onDelete:()=>sa(e.id),oneByOneStatus:tm[e.id]||null})})]},e.id)})}),sf=T.filter(e=>!0===e.isActive),sg=(0,i.jsx)(p.aF,{isOpen:eu,onClose:sp,title:`Apply Proxy (${b.length} connections)`,children:(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsxs)("div",{className:"flex flex-col",children:[(0,i.jsxs)("button",{onClick:()=>{let e=T.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):su(b.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:eM||0===sf.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,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,i.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,i.jsxs)("button",{onClick:()=>sx(null),disabled:eM,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,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,i.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),T.map(e=>(0,i.jsxs)("button",{onClick:()=>sx(e.id),disabled:eM||!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,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,i.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,i.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),eM&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,i.jsx)(p.$n,{onClick:sp,variant:"ghost",fullWidth:!0,disabled:eM,children:"Cancel"})]})}),sy=async e=>{if(!eA.has(e)){e$(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:`${tH}/${e}`})}),s=await t.json();eN(t=>({...t,[e]:s.ok?"ok":"error"})),eS(s.ok?"":s.error||"Model not reachable")}catch{eN(t=>({...t,[e]:"error"})),eS("Network error")}finally{e$(t=>{let s=new Set(t);return s.delete(e),s})}}};if(j)return(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsx)(p.Qv,{}),(0,i.jsx)(p.Qv,{})]});if(!tA)return(0,i.jsxs)("div",{className:"text-center py-20",children:[(0,i.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,i.jsx)(d(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let sb=()=>tq&&tA.apiType?"responses"===tA.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":t_?"/providers/anthropic-m.png":(0,m.HY)(tA.id);return(0,i.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)(d(),{href:"/dashboard/providers",className:"btn-quiet -ml-2 mb-4 !px-2 !py-1.5 !text-xs inline-flex",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"arrow_back"}),"Back to providers"]}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-col justify-between gap-4 sm:flex-row sm:items-start",children:[(0,i.jsxs)("div",{className:"flex min-w-0 items-start gap-3.5 sm:gap-4",children:[(0,i.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl border border-line",style:{backgroundColor:`${tA.color}15`},children:ej||!sb()?(0,i.jsx)("span",{className:"text-sm font-bold",style:{color:tA.color},children:tA.textIcon||tA.id.slice(0,2).toUpperCase()}):(0,i.jsx)(c.A,{src:sb(),alt:tA.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>{(0,m.Kw)(tA.id),ew(!0)},loading:"lazy",decoding:"async"})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2.5 flex-wrap",children:[(0,i.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-[-0.035em] sm:text-3xl",children:tA.name}),b.length>0?(0,i.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,i.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-success","aria-hidden":"true"}),b.length," Connected"]}):(0,i.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,i.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-muted","aria-hidden":"true"}),"Not connected"]})]}),(tA.notice?.apiKeyUrl||tA.notice?.signupUrl||tA.website)&&(0,i.jsxs)("a",{href:tA.notice?.apiKeyUrl||tA.notice?.signupUrl||tA.website,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1 text-xs text-gold-text hover:underline",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm","aria-hidden":"true",children:"open_in_new"}),tA.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]}),(0,i.jsxs)("p",{className:"muted mt-1 text-xs",children:[b.length," connection",1===b.length?"":"s"," \xb7 local workspace"]})]})]}),(0,i.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:tS,className:"btn-gold !px-3 !py-2.5 !text-xs",children:tU?"Connect Session":tM?"Add API Key":"Add connection"})})]})]}),(0,i.jsxs)("section",{className:"grid grid-cols-2 gap-3 xl:grid-cols-4","aria-label":"Provider summary",children:[(0,i.jsx)(ei,{label:"Connections",value:String(b.length),icon:"key",tone:b.length>0?"text-success":"text-muted"}),(0,i.jsx)(ei,{label:"Models",value:(e=[...tR,...e9.filter(e=>!tR.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,i.jsx)(ei,{label:"Status",value:b.length>0?"Connected":"Not connected",icon:"activity",tone:b.length>0?"text-success":"text-muted"}),(0,i.jsx)(ei,{label:"Endpoint",value:tA.website?new URL(tA.website).hostname:g,icon:"dns",tone:"text-gold-text"})]}),tA.deprecated&&(0,i.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,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,i.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:tA.deprecationNotice})]}),tA.notice?.text&&!tA.deprecated&&(0,i.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,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,i.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:tA.notice.text}),tA.notice.apiKeyUrl&&(0,i.jsx)("a",{href:tA.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 →"})]}),tM&&k&&(0,i.jsx)(p.Zp,{children:(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:t_?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,i.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[t_?"Messages API":"responses"===k.apiType?"Responses API":"Chat Completions"," \xb7 ",(k.baseUrl||"").replace(/\/$/,""),"/",t_?"messages":"responses"===k.apiType?"responses":"chat/completions"]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>{ea(""),Q(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>ep(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{ts({title:"Delete Compatible Node",message:`Delete this ${t_?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{ts(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"})]})]})}),tP?(0,i.jsx)(p.gw,{providerId:g}):(0,i.jsxs)(p.Zp,{children:[(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-sm font-semibold",children:"Connections"}),(0,i.jsx)("p",{className:"muted mt-1 text-xs",children:"Credentials and endpoints used by this provider."})]}),(0,i.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[b.length>0&&T.length>0&&(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>ex(!0),children:"Apply Proxy"}),b.length>0&&(0,i.jsxs)(i.Fragment,{children:[eR.length>0&&(0,i.jsxs)(p.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let e=eR.length;0!==e&&ts({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{ts(null);let e=0,t=[...eR];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))),ez([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:["Delete Selected (",eR.length,")"]}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:si,disabled:tl,children:tl?"Testing Connection One-by-One...":"Test Connection One-by-One"}),tl&&(0,i.jsx)(p.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{tl&&(th.current=!0,to(!0))},disabled:tn,children:tn?"Stopping...":"Stop"})]}),(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,i.jsx)(p.lM,{checked:"round-robin"===eK,onChange:e=>{let t=e?"round-robin":null,s=e?eL||"1":eL;e&&!eL&&eJ("1"),eF(t),t5(t,s)}}),"round-robin"===eK&&(0,i.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,i.jsx)("input",{type:"number",min:1,value:eL,onChange:e=>{var t;eJ(t=e.target.value),t5("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,i.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:tT?"lock":"key"})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tK&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",tF," or ",tL,"."]})]})]}),(0,i.jsx)("div",{className:"flex gap-2",children:tK?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tN,children:tF}),(0,i.jsx)(p.$n,{size:"sm",icon:"key",onClick:tC,children:tL})]}):(0,i.jsxs)(i.Fragment,{children:[!tM&&"iflow"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>J(!0),children:"Cookie"}),"codex"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>er(!0),children:(0,$.Tl)("Bulk Add")}),"grok-cli"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>eo(!0),children:(0,$.Tl)("Bulk Add")}),(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:tS,children:tU?"Connect Session":tM?"Add API Key":"iflow"===g?"OAuth":"Add Connection"})]})})]}):(0,i.jsxs)(i.Fragment,{children:[tu&&(0,i.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,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,i.jsxs)("span",{children:["Total: ",tu.total]}),(0,i.jsxs)("span",{children:["Completed: ",tu.completed]}),(0,i.jsxs)("span",{children:["Passed: ",tu.passed]}),(0,i.jsxs)("span",{children:["Failed: ",tu.failed]}),tu.stopped&&(0,i.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),tl&&td&&(0,i.jsxs)("span",{children:["Running: ",b.find(e=>e.id===td)?.name||td]})]})}),b.length>0&&(0,i.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,i.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,i.jsx)("input",{type:"checkbox",checked:sm,onChange:()=>{sm?ez([]):ez(b.map(e=>e.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),sh,!tM&&(0,i.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===g&&(0,i.jsx)(p.$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,i.jsx)(p.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>er(!0),title:(0,$.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,$.Tl)("Bulk Add")}),"grok-cli"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>eo(!0),title:(0,$.Tl)("Bulk import Grok CLI accounts from JSON"),className:"w-full sm:w-auto",children:(0,$.Tl)("Bulk Add")}),tK?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:tN,className:"w-full sm:w-auto",children:tF}),(0,i.jsx)(p.$n,{size:"sm",icon:"key",onClick:tC,className:"w-full sm:w-auto",children:tL})]}):(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:tS,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,i.jsx)(X,{providerId:g}),(0,i.jsxs)(p.Zp,{children:[(0,i.jsxs)("div",{className:"flex flex-col justify-between gap-3 sm:flex-row sm:items-start",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-sm font-semibold",children:"Available models"}),(0,i.jsx)("p",{className:"muted mt-1 text-xs",children:"Models currently exposed by this provider route. Test sends one real minimal request."})]}),(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[e1&&(0,i.jsx)("span",{role:"status",className:`max-w-[240px] truncate rounded-lg border px-2 py-1 text-[11px] ${e1.ok?"border-success/25 bg-success/10 text-success":"border-danger/30 bg-danger/10 text-danger"}`,title:e1.text,children:e1.text}),tE&&(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:eY?"progress_activity":"cloud_download",onClick:()=>void t6(!0),disabled:eY,title:"Fetch the live model list from the provider API (uses your saved key)",className:eY?"[&_.material-symbols-outlined]:animate-spin":"",children:eY?"Fetching…":"Fetch models"}),tW&&(0,i.jsx)("select",{value:eH,onChange:e=>{var t;eW(t=e.target.value),t3(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:tW.map(e=>(0,i.jsx)("option",{value:e,children:`Thinking: ${e.charAt(0).toUpperCase()+e.slice(1)}`},e))}),!tM&&(t=[...tR,...e9.filter(e=>!tR.some(t=>t.id===e.id))].filter(e=>{let t=(0,x.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!e7.includes(e)),(0,i.jsxs)(i.Fragment,{children:[e7.length>0&&(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tX,children:"Active All"}),t.length>0&&(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>tV(t),children:"Disable All"})]}))]})]}),!tM&&(0,i.jsxs)("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,i.jsxs)("label",{className:"relative block flex-1",children:[(0,i.jsx)("span",{className:"sr-only",children:"Search models"}),(0,i.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,i.jsx)("input",{value:eT,onChange:e=>eO(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}),eT&&(0,i.jsx)("button",{type:"button",onClick:()=>eO(""),"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,i.jsx)("span",{className:"material-symbols-outlined text-[15px]","aria-hidden":"true",children:"close"})})]}),(0,i.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:et.map(e=>(0,i.jsx)("button",{type:"button",role:"tab","aria-selected":eP===e.value,onClick:()=>eI(e.value),className:`whitespace-nowrap rounded-md px-2.5 py-1.5 text-[10px] font-medium transition-colors ${eP===e.value?"bg-surface text-gold-text shadow-sm":"text-muted hover:text-text"}`,children:e.label},e.value))})]}),!!eC&&(0,i.jsxs)("div",{className:"mb-3",children:[(0,i.jsx)("p",{className:"text-xs text-red-500 break-words",children:eC}),/RegionError|hosted in China|regionNotAllowed/i.test(eC)&&(l=(s="string"==typeof eC?eC:JSON.stringify(eC)).match(/https:\/\/opencode\.ai\/workspace\/[^\s"')]+/),r=s.match(/wrk_[0-9A-Za-z]+/),o=l?l[0].endsWith("/go")?l[0]:`${l[0]}/go`:r?`https://opencode.ai/workspace/${r[0]}/go`:"https://opencode.ai",(0,i.jsx)("div",{className:"mt-1.5",children:(0,i.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,i.jsx)("span",{children:"Allow China-hosted models"}),(0,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"open_in_new"})]})}))]}),"zed"===g&&!!e4&&(0,i.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:e4}),(()=>{let e,t,s;if(tM)return(0,i.jsx)(D,{providerStorageAlias:tH,providerDisplayAlias:tB,modelAliases:eg,customModels:eb,copied:tv,onCopy:tj,onSetAlias:t9,onDeleteAlias:t8,onAddCustomModel:e=>t7(e,"llm",tH),onDeleteCustomModel:e=>se(e,"llm",tH),connections:b,isAnthropic:t_});let a=[...tR,...e9.filter(e=>!tR.some(t=>t.id===e.id))].filter(e=>{let t=(0,x.CP)(e);return!t||"llm"===t}),l=new Set(e7),r=eT.trim().toLowerCase(),n=e=>!r||e.id.toLowerCase().includes(r)||(e.name||"").toLowerCase().includes(r),o=e=>{if("all"===eP)return!0;let t=ek[e.id];return"untested"===eP?!t:"passed"===eP?"ok"===t:"failed"!==eP||"error"===t},d=a.filter(e=>!l.has(e.id)&&n(e)&&o(e)),c=a.filter(e=>l.has(e.id)),m=P({customModels:eb,modelAliases:eg,providerAlias:tH,builtInModels:tR,type:"llm"}).filter(e=>n({id:e.id,name:e.name})&&o({id:e.id}));return(0,i.jsxs)("div",{className:"group/model-list space-y-2",children:[0===m.length&&0===d.length&&(0,i.jsxs)("div",{className:"rounded-xl border border-dashed border-line-strong px-5 py-9 text-center",children:[(0,i.jsx)("span",{className:"material-symbols-outlined mx-auto text-[24px] text-muted","aria-hidden":"true",children:"memory"}),(0,i.jsx)("p",{className:"mt-3 text-sm font-semibold",children:eT.trim()||"all"!==eP?"No matching models":"No models discovered"}),(0,i.jsx)("p",{className:"muted mt-1 text-xs",children:eT.trim()||"all"!==eP?"Try a different search or filter.":"Connect the provider or add a custom model ID below."})]}),m.map(e=>(0,i.jsx)(I,{model:{id:e.id,name:e.name},fullModel:`${tB}/${e.id}`,alias:e.alias,copied:tv,onCopy:tj,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?se(e.id,"llm",tH):t8(e.alias)},testStatus:ek[e.id],onTest:b.length>0||tP?()=>sy(e.id):void 0,isTesting:eA.has(e.id),isCustom:"fetch"!==e.origin,isFree:!1,caps:y(`${g}/${e.id}`),thinkingSuffix:tJ(e.id)},`${e.source}-${e.fullModel}`)),d.map(e=>{let t=`${tH}/${e.id}`,s=`${g}/${e.id}`,a=Object.entries(eg).find(([,e])=>e===t||e===s)?.[0];return(0,i.jsx)(I,{model:e,fullModel:`${tB}/${e.id}`,alias:a,copied:tv,onCopy:tj,onSetAlias:t=>t9(e.id,t,tH),onDeleteAlias:()=>t8(a),testStatus:ek[e.id],onTest:b.length>0||tP?()=>sy(e.id):void 0,isTesting:eA.has(e.id),isFree:e.isFree,onDisable:()=>tZ(e.id),caps:y(`${g}/${e.id}`),thinkingSuffix:tJ(e.id)},e.id)}),(0,i.jsxs)("button",{onClick:()=>eD(!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,i.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,i.jsxs)("button",{onClick:st,disabled:tf,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,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:tf?{animation:"spin 1s linear infinite"}:void 0,children:tf?"progress_activity":"download"}),tf?(0,$.Tl)("Fetching..."):(0,$.Tl)("Fetch Qoder Models")]}),("cline"===g||"clinepass"===g)&&b.some(e=>!1!==e.isActive)&&(0,i.jsxs)("button",{onClick:ss,disabled:ty,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,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:ty?{animation:"spin 1s linear infinite"}:void 0,children:ty?"progress_activity":"download"}),ty?(0,$.Tl)("Fetching..."):(0,$.Tl)("Import from /models")]}),eV.length>0&&(e=new Set([...Object.values(eg),...m.map(e=>e.fullModel)]),t=new Set(tR.map(e=>e.id)),0===(s=eV.filter(s=>!e.has(`${tH}/${s.id}`)&&!t.has(s.id))).length?null:(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested models from the provider API:"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,i.jsxs)("button",{onClick:async()=>{await t7(e.id,"llm",tH)},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,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),c.length>0&&(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",c.length,"):"]}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:c.map(e=>(0,i.jsxs)("button",{onClick:()=>tQ(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,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),sg,"kiro"===g?(0,i.jsx)(p.Mh,{isOpen:R,providerInfo:tA,onSuccess:sl,onClose:()=>z(!1)}):"cursor"===g?(0,i.jsx)(p.G9,{isOpen:R,onSuccess:sl,onClose:()=>z(!1)}):"zed"===g?(0,i.jsx)(p.TE,{isOpen:R,providerInfo:tA,onSuccess:sl,onClose:()=>z(!1)}):"gitlab"===g?(0,i.jsx)(p.vj,{isOpen:R,providerInfo:tA,onSuccess:sl,onClose:()=>z(!1)}):"tokenharbor"===g?(0,i.jsx)(p.O1,{isOpen:R,providerInfo:tA,onSuccess:sl,onClose:()=>z(!1)}):(0,i.jsx)(p.LF,{isOpen:R,provider:g,providerInfo:tA,onSuccess:sl,onClose:()=>z(!1)}),(0,i.jsx)(p.LH,{isOpen:q,onSuccess:sl,onClose:()=>M(!1)}),"iflow"===g&&(0,i.jsx)(p.vE,{isOpen:F,onSuccess:()=>{t1(),J(!1)},onClose:()=>J(!1)}),tU&&(0,i.jsx)(p.Sg,{isOpen:W,providerId:g,onSuccess:sl,onClose:()=>B(!1)}),(0,i.jsx)(U,{isOpen:Z,provider:g,providerName:tA.name,isCompatible:tM,isAnthropic:t_,authType:tA?.authType,authHint:tA?.authHint,website:tA?.website,proxyPools:T,error:V,existingNames:b.map(e=>e.name).filter(Boolean),onSave:sr,onBulkDone:t1,onClose:()=>{ea(""),Q(!1)}}),(0,i.jsx)(p.wI,{isOpen:ed,connection:eh,proxyPools:T,onSave:sn,onClose:()=>ec(!1)}),tM&&(0,i.jsx)(K,{isOpen:em,node:k,onSave:t2,onClose:()=>ep(!1),isAnthropic:t_}),!tM&&(0,i.jsx)(L,{isOpen:eE,providerAlias:tH,providerDisplayAlias:tB,onSave:async(e,t,s)=>{await t7(e,t?.stt?"stt":"llm",tH,t,s),eD(!1)},onClose:()=>eD(!1)}),"codex"===g&&(0,i.jsx)(H,{isOpen:el,onClose:()=>er(!1),onSuccess:t1}),"grok-cli"===g&&(0,i.jsx)(G,{isOpen:en,onClose:()=>eo(!1),onSuccess:t1}),eZ&&(0,i.jsx)(Y.A,{isOpen:!!eZ,onClose:()=>eQ(null),connection:eZ,reactive:!0===eB.connections[eZ.id],schedule:eB.schedules?.[eZ.id]||null,onSave:e=>((e,{reactive:t,schedule:s})=>{t4({...eB,connections:{...eB.connections,[e]:t},schedules:{...eB.schedules,[e]:s}})})(eZ.id,e)}),(0,i.jsx)(p.uo,{isOpen:ti,onClose:()=>ta(!1),onConfirm:()=>{(window.localStorage.setItem(tw,"true"),ta(!1),tT)?tk():tC()},title:"Risk Notice",message:tA?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,i.jsx)(p.uo,{isOpen:!!tt,onClose:()=>ts(null),onConfirm:tt?.onConfirm,title:tt?.title||"Confirm",message:tt?.message,variant:"danger"})]})}ei.propTypes={label:r().string.isRequired,value:r().string.isRequired,icon:r().string.isRequired,tone:r().string}},93195:(e,t,s)=>{"use strict";function i(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}s.d(t,{JW:()=>o,Vm:()=>i,fB:()=>l,gy:()=>a,nz:()=>r});let a={anchor:"09:30",timezone:i(),windowHours:5,slotsPerDay:3};function l(e){let t=/^(\d{1,2}):(\d{2})$/.exec(String(e||"").trim());if(!t)return null;let s=Number(t[1]),i=Number(t[2]);return s>23||i>59?null:{hour:s,minute:i}}function r(e){return Math.max(1,Math.floor(24/e))}function n(e,t,s,i){let a="number"==typeof e?e:Number(e);return Number.isFinite(a)?Math.min(i,Math.max(s,a)):t}function o(e){let t=function(e){if(!e||!0!==e.enabled)return null;let t=l(e.anchor)||l(a.anchor),s=`${String(t.hour).padStart(2,"0")}:${String(t.minute).padStart(2,"0")}`,i=!function(e){if(!e||"string"!=typeof e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}(e.timezone)?a.timezone:e.timezone,o=n(e.windowHours,a.windowHours,.5,24),d=Math.round(n(e.slotsPerDay,a.slotsPerDay,1,r(o)));return{enabled:!0,anchor:s,timezone:i,windowHours:o,slotsPerDay:d}}(e);if(!t)return[];let{hour:s,minute:i}=l(t.anchor),o=60*s+i;return Array.from({length:t.slotsPerDay},(e,s)=>{let i=Math.round(o+s*t.windowHours*60)%1440;return`${String(Math.floor(i/60)).padStart(2,"0")}:${String(i%60).padStart(2,"0")}`})}},97132:(e,t,s)=>{"use strict";s.d(t,{A:()=>m});var i=s(95155),a=s(12115),l=s(14051),r=s.n(l),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:l,reactive:r=!1,schedule:p=null}){let[u,x]=(0,a.useState)(()=>({mode:p?.enabled===!0?"schedule":!0===r?"reset":"off",anchor:p?.anchor||d.gy.anchor,timezone:(0,d.Vm)(),windowHours:String(p?.windowHours??d.gy.windowHours),slotsPerDay:String(p?.slotsPerDay??d.gy.slotsPerDay)})),h=Number(u.windowHours),f=Number(u.slotsPerDay),g=!!(0,d.fB)(u.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"!==u.mode||j,k=j?(0,d.JW)({enabled:!0,...u,windowHours:h,slotsPerDay:f}):[],N=k.length&&y?(()=>{let{hour:e,minute:t}=(0,d.fB)(u.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,i.jsx)(n.aF,{isOpen:e,onClose:t,title:"Auto-ping settings",size:"lg",footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.$n,{variant:"secondary",onClick:t,children:"Cancel"}),(0,i.jsx)(n.$n,{onClick:()=>{w&&(s({reactive:"reset"===u.mode,schedule:"schedule"===u.mode?{enabled:!0,anchor:u.anchor,timezone:u.timezone,windowHours:h,slotsPerDay:f}:{enabled:!1}}),t())},disabled:!w,children:"Save"})]}),children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:["Configure automated quota pings",l?.name?` for ${l.name}`:""," — pick one mode."]}),(0,i.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-[10px] bg-surface-2 p-1",children:c.map(e=>{let t=u.mode===e.value;return(0,i.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,i.jsx)("span",{className:"material-symbols-outlined text-[15px] leading-none",children:e.icon}),(0,i.jsx)("span",{children:e.label})]},e.value)})}),"reset"===u.mode&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Pings right after the 5h quota window resets, so a new window starts immediately."}),"schedule"===u.mode&&(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Pings at fixed local times so the 5h windows align with your workday."}),(0,i.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[(0,i.jsx)(n.pd,{label:"Anchor time",type:"time",value:u.anchor,onChange:e=>C({anchor:e.target.value}),error:g?"":"Use HH:MM",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,i.jsx)(n.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:u.windowHours,onChange:e=>C({windowHours:e.target.value}),error:y?"":"0.5 – 24",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,i.jsx)(n.pd,{label:"Pings per day",type:"number",min:"1",max:String(b),step:"1",value:u.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"})]}),k.length>0&&(0,i.jsxs)("div",{className:"rounded-[10px] bg-surface-2 px-3 py-2.5",children:[(0,i.jsxs)("p",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:["Daily slots (",u.timezone,")"]}),(0,i.jsx)("p",{className:"mt-1 text-sm font-medium text-text-main",children:k.join(" → ")}),(0,i.jsxs)("p",{className:"mt-1 text-xs text-text-muted",children:["Covers ",k[0]," – ",N,", then pauses until ",k[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,85,705,5497,8441,3794,7358],()=>e(e.s=30840)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (()=>{"use strict";var e,t,r,a,o,n,i,s,c,l={},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var r=u[e]={exports:{}},a=!0;try{l[e].call(r.exports,r,r.exports,d),a=!1}finally{a&&delete u[e]}return r.exports}d.m=l,e=[],d.O=(t,r,a,o)=>{if(r){o=o||0;for(var n=e.length;n>0&&e[n-1][2]>o;n--)e[n]=e[n-1];e[n]=[r,a,o];return}for(var i=1/0,n=0;n<e.length;n++){for(var[r,a,o]=e[n],s=!0,c=0;c<r.length;c++)(!1&o||i>=o)&&Object.keys(d.O).every(e=>d.O[e](r[c]))?r.splice(c--,1):(s=!1,o<i&&(i=o));if(s){e.splice(n--,1);var l=a();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,a){if(1&a&&(e=this(e)),8&a||"object"==typeof e&&e&&(4&a&&e.__esModule||16&a&&"function"==typeof e.then))return e;var o=Object.create(null);d.r(o);var n={};t=t||[null,r({}),r([]),r(r)];for(var i=2&a&&e;"object"==typeof i&&!~t.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(t=>n[t]=()=>e[t]);return n.default=()=>e,d.d(o,n),o},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=>85===e?"static/chunks/85-324ccdbb00ecb8c6.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:"a39be827fd6d332c",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),a={},d.l=(e,t,r,o)=>{if(a[e])return void a[e].push(t);if(void 0!==r)for(var n,i,s=document.getElementsByTagName("script"),c=0;c<s.length;c++){var l=s[c];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="_N_E:"+r){n=l;break}}n||(i=!0,(n=document.createElement("script")).charset="utf-8",n.timeout=120,d.nc&&n.setAttribute("nonce",d.nc),n.setAttribute("data-webpack","_N_E:"+r),n.src=d.tu(e)),a[e]=[t];var u=(t,r)=>{n.onerror=n.onload=null,clearTimeout(f);var o=a[e];if(delete a[e],n.parentNode&&n.parentNode.removeChild(n),o&&o.forEach(e=>e(r)),t)return t(r)},f=setTimeout(u.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=u.bind(null,n.onerror),n.onload=u.bind(null,n.onload),i&&document.head.appendChild(n)},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===o&&(o={createScriptURL:e=>e},"u">typeof trustedTypes&&trustedTypes.createPolicy&&(o=trustedTypes.createPolicy("nextjs#bundler",o))),o),d.tu=e=>d.tt().createScriptURL(e),d.p="/_next/",n={8068:0},d.f.miniCss=(e,t)=>{if(n[e])t.push(n[e]);else 0!==n[e]&&({2574:1})[e]&&t.push(n[e]=new Promise((t,r)=>{var a=d.miniCssF(e),o=d.p+a;if(((e,t)=>{for(var r=document.getElementsByTagName("link"),a=0;a<r.length;a++){var o=r[a],n=o.getAttribute("data-href")||o.getAttribute("href");if("stylesheet"===o.rel&&(n===e||n===t))return o}for(var i=document.getElementsByTagName("style"),a=0;a<i.length;a++){var o=i[a],n=o.getAttribute("data-href");if(n===e||n===t)return o}})(a,o))return t();((e,t,r,a)=>{var o=document.createElement("link");o.rel="stylesheet",o.type="text/css",o.onerror=o.onload=n=>{if(o.onerror=o.onload=null,"load"===n.type)r();else{var i=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.href||t,c=Error("Loading CSS chunk "+e+" failed.\n("+s+")");c.code="CSS_CHUNK_LOAD_FAILED",c.type=i,c.request=s,o.parentNode.removeChild(o),a(c)}},o.href=t;if("function"==typeof _N_E_STYLE_LOAD){var n=o.href,i=o.onload,s=o.onerror;_N_E_STYLE_LOAD(0===n.indexOf(window.location.origin)?new URL(n).pathname:n).then(function(){i&&i.call(o,{type:"load"})},function(){s&&s.call(o,{})})}else document.head.appendChild(o)})(e,o,t,r)}).then(()=>{n[e]=0},t=>{throw delete n[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 a=new Promise((t,a)=>r=i[e]=[t,a]);t.push(r[2]=a);var o=d.p+d.u(e),n=Error();d.l(o,t=>{if(d.o(i,e)&&(0!==(r=i[e])&&(i[e]=void 0),r)){var a=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;n.message="Loading chunk "+e+" failed.\n("+a+": "+o+")",n.name="ChunkLoadError",n.type=a,n.request=o,r[1](n)}},"chunk-"+e,e)}},d.O.j=e=>0===i[e],s=(e,t)=>{var r,a,[o,n,s]=t,c=0;if(o.some(e=>0!==i[e])){for(r in n)d.o(n,r)&&(d.m[r]=n[r]);if(s)var l=s(d)}for(e&&e(t);c<o.length;c++)a=o[c],d.o(i,a)&&i[a]&&i[a][0](),i[a]=0;return d.O(l)},(c=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(s.bind(null,0)),c.push=s.bind(null,c.push.bind(c))})();
package/app/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnihilbras-app",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "description": "OmniHilbras web dashboard",
5
5
  "private": true,
6
6
  "scripts": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hilbras/omnihilbras",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "description": "OmniHilbras CLI - Start and manage OmniHilbras server",
5
5
  "bin": {
6
6
  "omnihilbras": "./cli.js"
@@ -1 +0,0 @@
1
- (()=>{"use strict";var e,t,r,o,n,a,i,c,s,l={},d={};function u(e){var t=d[e];if(void 0!==t)return t.exports;var r=d[e]={exports:{}},o=!0;try{l[e].call(r.exports,r,r.exports,u),o=!1}finally{o&&delete d[e]}return r.exports}u.m=l,e=[],u.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(u.O).every(e=>u.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},u.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return u.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,u.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);u.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,u.d(n,a),n},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.f={},u.e=e=>Promise.all(Object.keys(u.f).reduce((t,r)=>(u.f[r](e,t),t),[])),u.u=e=>85===e?"static/chunks/85-c9d2b6e00b6ee6eb.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:"a39be827fd6d332c",124:"c092990b4bdb9713",2435:"8a5a02e626c780d0",3521:"3af5cf89706546d6",3862:"290297ea7c7f28c0",5462:"c82c64c26a864ec0",6357:"99dc54a064c984c0",8202:"69dace5daa86686d",8569:"df0d706176dc1f57",9233:"b5ad25d75f88baa7"})[e]+".js",u.miniCssF=e=>"static/css/e07f2bf4fa519943.css",u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o={},u.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,u.nc&&a.setAttribute("nonce",u.nc),a.setAttribute("data-webpack","_N_E:"+r),a.src=u.tu(e)),o[e]=[t];var d=(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(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),i&&document.head.appendChild(a)},u.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.tt=()=>(void 0===n&&(n={createScriptURL:e=>e},"u">typeof trustedTypes&&trustedTypes.createPolicy&&(n=trustedTypes.createPolicy("nextjs#bundler",n))),n),u.tu=e=>u.tt().createScriptURL(e),u.p="/_next/",a={8068:0},u.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=u.miniCssF(e),n=u.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},u.f.j=(e,t)=>{var r=u.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=u.p+u.u(e),a=Error();u.l(n,t=>{if(u.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)}},u.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)u.o(a,r)&&(u.m[r]=a[r]);if(c)var l=c(u)}for(e&&e(t);s<n.length;s++)o=n[s],u.o(i,o)&&i[o]&&i[o][0](),i[o]=0;return u.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))})();