@xopcai/xopc 0.0.484 → 0.0.486

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 (206) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/inbound-processor.js +4 -6
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/extensions/weixin/src/messaging/process-message.js +2 -1
  5. package/dist/gateway/server/chunks.bin +1166 -1121
  6. package/dist/gateway/server/chunks.json +1 -1
  7. package/dist/gateway/static/root/assets/agent-run-error-parser-DsXmcKt-.js +1 -0
  8. package/dist/gateway/static/root/assets/{api-CGs641OT.js → api-CGrHK9ij.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-CH9wENBj.js → apps-page-6xeWvMpF.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-page-B1Ri4sh8.js → automations-page-BLFBqaPX.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-workspace-CNSza6ir.js → automations-workspace-DiO3Iyuj.js} +2 -2
  12. package/dist/gateway/static/root/assets/{capabilities-abgigXV1.js → capabilities-CW-vdkz6.js} +1 -1
  13. package/dist/gateway/static/root/assets/{capabilities-BaKHutgZ.js → capabilities-DZrjA95P.js} +1 -1
  14. package/dist/gateway/static/root/assets/capabilities-page-DQrfkrBA.js +2 -0
  15. package/dist/gateway/static/root/assets/{capabilities-settings-panel-BOwbZn9X.js → capabilities-settings-panel-DIT2dvtc.js} +1 -1
  16. package/dist/gateway/static/root/assets/{channels-DlnXbcOj.js → channels-Dcr5dgqw.js} +1 -1
  17. package/dist/gateway/static/root/assets/{chat-page-LOR5JxDh.js → chat-page-DWZCzxY7.js} +31 -31
  18. package/dist/gateway/static/root/assets/{chat-terminal-dock-DE8j-K9d.js → chat-terminal-dock-DCUuwiTt.js} +1 -1
  19. package/dist/gateway/static/root/assets/command-palette-api-UrqPvWR1.js +1 -0
  20. package/dist/gateway/static/root/assets/composer-payload-handoff-a0quQ25p.js +1 -0
  21. package/dist/gateway/static/root/assets/connected-providers-grid-BJKEp0SE.js +1 -0
  22. package/dist/gateway/static/root/assets/{connectors-page-BJm1jjct.js → connectors-page-BteRI1XM.js} +1 -1
  23. package/dist/gateway/static/root/assets/{extension-debug-page-D3X7SlzG.js → extension-debug-page-4jJ1uVQJ.js} +1 -1
  24. package/dist/gateway/static/root/assets/{extension-iframe-host-CIAq7PSn.js → extension-iframe-host-CJV5JETm.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-message-router-B2wbucV7.js → extension-message-router-B4I-Y6qs.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-page-qwY7r1_p.js → extension-page-lc7a84nG.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-provider-DFcRbTHI.js → extension-provider-D8_mIBI0.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-settings-page-Cpnh9lcZ.js → extension-settings-page-Uw2lfWRh.js} +1 -1
  29. package/dist/gateway/static/root/assets/{home-page-BusNFHe-.js → home-page-mSRCU81k.js} +4 -4
  30. package/dist/gateway/static/root/assets/{home-task-actions-C8Fi6GBq.js → home-task-actions-_ZAc57Y7.js} +1 -1
  31. package/dist/gateway/static/root/assets/{index-DE6GguFZ.js → index-CJAEAcZV.js} +7 -7
  32. package/dist/gateway/static/root/assets/{local-app-workbench-page-B9uSL1Mi.js → local-app-workbench-page-C3Lqi8E1.js} +1 -1
  33. package/dist/gateway/static/root/assets/{note-detail-panel-DXzfoiyk.js → note-detail-panel-uc-5k3a2.js} +3 -3
  34. package/dist/gateway/static/root/assets/{notes-page-BNTgiHSk.js → notes-page-RPfvHnl6.js} +1 -1
  35. package/dist/gateway/static/root/assets/{page-context-capture-button-BXSBeGms.js → page-context-capture-button-CVHz9b6c.js} +1 -1
  36. package/dist/gateway/static/root/assets/{personal-page-D7zTHQ0K.js → personal-page-Dt1d3tQT.js} +1 -1
  37. package/dist/gateway/static/root/assets/{personal-profile-settings-TcI0Zfwr.js → personal-profile-settings-XiT1MgTK.js} +1 -1
  38. package/dist/gateway/static/root/assets/{personal-settings-panel-BJ46T7ZO.js → personal-settings-panel-bcw04REt.js} +1 -1
  39. package/dist/gateway/static/root/assets/{preview-runtime-C1U57WSM.js → preview-runtime-FtWOW5i4.js} +1 -1
  40. package/dist/gateway/static/root/assets/{product-automation-feedback-GA_YPLkr.js → product-automation-feedback-DdFoCDzG.js} +1 -1
  41. package/dist/gateway/static/root/assets/product-preview-content-B3mzl6-f.js +1 -0
  42. package/dist/gateway/static/root/assets/product-preview-modal-5kTp_7Qk.js +2 -0
  43. package/dist/gateway/static/root/assets/project-detail-page-DGPfKx5M.js +7 -0
  44. package/dist/gateway/static/root/assets/{projects-page-BHQxQGTd.js → projects-page-C-9x23LR.js} +1 -1
  45. package/dist/gateway/static/root/assets/route-preload-CzorjVc9.js +2 -0
  46. package/dist/gateway/static/root/assets/routine-panel-n4IstC8Y.js +2 -0
  47. package/dist/gateway/static/root/assets/session-manager-C2MCS4C5.js +28 -0
  48. package/dist/gateway/static/root/assets/{settings-page-BOzzOS6k.js → settings-page-DsM_f07M.js} +1 -1
  49. package/dist/gateway/static/root/assets/{share-preview-page-Di5_ukH8.js → share-preview-page-C32Mq-BY.js} +1 -1
  50. package/dist/gateway/static/root/assets/{shares-settings-CirGM67m.js → shares-settings-BDGbs8wz.js} +1 -1
  51. package/dist/gateway/static/root/assets/{skills-page-gGU0LZ5e.js → skills-page-kL8E5zgi.js} +1 -1
  52. package/dist/gateway/static/root/assets/space-page-DwyuUvI3.js +2 -0
  53. package/dist/gateway/static/root/assets/task-copy-CtcqCQ78.js +1 -0
  54. package/dist/gateway/static/root/assets/task-detail-page-DdCpNW8K.js +3 -0
  55. package/dist/gateway/static/root/assets/{task-header-title-Cdgp2rCs.js → task-header-title-CLt_lmjb.js} +1 -1
  56. package/dist/gateway/static/root/assets/task-result-presentation-CgvcqEMD.js +1 -0
  57. package/dist/gateway/static/root/assets/task-run-issue-notice-8FX876PP.js +1 -0
  58. package/dist/gateway/static/root/assets/tasks-CvOAtEHv.js +1 -0
  59. package/dist/gateway/static/root/assets/turn-outcome-Dtw6OgwL.js +1 -0
  60. package/dist/gateway/static/root/assets/{use-composer-attachments-DJsIzJ1c.js → use-composer-attachments-BEuyorVm.js} +1 -1
  61. package/dist/gateway/static/root/assets/{use-file-preview-expanded-BFF2vXm5.js → use-file-preview-expanded-Cehu0745.js} +1 -1
  62. package/dist/gateway/static/root/assets/use-personal-work-B25WRGHj.js +1 -0
  63. package/dist/gateway/static/root/assets/{use-realtime-voice-9OvLwHzk.js → use-realtime-voice-CV3GIt_T.js} +1 -1
  64. package/dist/gateway/static/root/assets/{use-workspace-tree-LCIT1H-D.js → use-workspace-tree-C0C861cb.js} +1 -1
  65. package/dist/gateway/static/root/assets/{voice-settings-j8o-hGTm.js → voice-settings-JpPo3BvX.js} +1 -1
  66. package/dist/gateway/static/root/assets/workspace-api-CQOuWbVv.js +2 -0
  67. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-DwVWTehC.js → workspace-file-preview-dialog-CmMueTmW.js} +1 -1
  68. package/dist/gateway/static/root/index.html +30 -28
  69. package/dist/package.js +1 -1
  70. package/dist/packages/gateway-contract/src/index.js +3 -1
  71. package/dist/packages/gateway-contract/src/notifications.js +1 -8
  72. package/dist/packages/gateway-contract/src/task-display.js +9 -2
  73. package/dist/packages/gateway-contract/src/task-lifecycle.js +1 -0
  74. package/dist/packages/gateway-contract/src/task-research-result.js +2 -1
  75. package/dist/packages/gateway-contract/src/tasks.js +6 -1
  76. package/dist/packages/gateway-contract/src/user-message-text.js +64 -0
  77. package/dist/src/agent/embedded/run-for-session.js +27 -28
  78. package/dist/src/agent/embedded/session-runner.js +14 -1
  79. package/dist/src/agent/fallback/candidates.d.ts +1 -0
  80. package/dist/src/agent/fallback/candidates.js +1 -1
  81. package/dist/src/agent/image/generation/provider-registry.js +3 -1
  82. package/dist/src/agent/mcp/connection-drafts.d.ts +3 -1
  83. package/dist/src/agent/mcp/connection-drafts.js +24 -11
  84. package/dist/src/agent/mcp/connection-setup.js +13 -10
  85. package/dist/src/agent/mcp/native-mcp.js +1 -0
  86. package/dist/src/agent/mcp/network-policy.d.ts +6 -0
  87. package/dist/src/agent/mcp/network-policy.js +49 -0
  88. package/dist/src/agent/mcp/transport.js +14 -7
  89. package/dist/src/agent/messaging/message-router.js +2 -2
  90. package/dist/src/agent/models/manager.d.ts +1 -1
  91. package/dist/src/agent/models/manager.js +2 -1
  92. package/dist/src/agent/models/turn-candidates.d.ts +16 -0
  93. package/dist/src/agent/models/turn-candidates.js +55 -0
  94. package/dist/src/agent/service/direct-turn-helpers.js +9 -24
  95. package/dist/src/agent/service.d.ts +1 -0
  96. package/dist/src/agent/service.js +12 -0
  97. package/dist/src/agent/skills/installer.js +2 -2
  98. package/dist/src/auth/credentials.js +3 -1
  99. package/dist/src/auth/oauth/index.d.ts +0 -1
  100. package/dist/src/auth/oauth/index.js +1 -4
  101. package/dist/src/auth/oauth/registry.js +0 -4
  102. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  103. package/dist/src/chat-commands/command-parse.d.ts +1 -0
  104. package/dist/src/chat-commands/command-parse.js +8 -10
  105. package/dist/src/chat-commands/registry.d.ts +5 -0
  106. package/dist/src/chat-commands/registry.js +8 -0
  107. package/dist/src/cli/command-manifest.js +1 -1
  108. package/dist/src/cli/commands/auth.js +4 -2
  109. package/dist/src/cli/commands/models.js +12 -10
  110. package/dist/src/config/models-json.js +1 -2
  111. package/dist/src/config/schema.d.ts +54 -4
  112. package/dist/src/config/schema.js +3 -1
  113. package/dist/src/gateway/agent-reactions/reaction.d.ts +1 -2
  114. package/dist/src/gateway/agent-reactions/reaction.js +10 -21
  115. package/dist/src/gateway/custom-image-providers.js +4 -1
  116. package/dist/src/gateway/hono/oauth.js +3 -0
  117. package/dist/src/gateway/hono/routes/device-push.js +55 -15
  118. package/dist/src/gateway/hono/routes/mobile-capability-panels.d.ts +67 -0
  119. package/dist/src/gateway/hono/routes/mobile-capability-panels.js +16 -131
  120. package/dist/src/gateway/hono/routes/mobile-mcp-setup.d.ts +9 -0
  121. package/dist/src/gateway/hono/routes/mobile-mcp-setup.js +949 -0
  122. package/dist/src/gateway/hono/routes/notifications.js +12 -1
  123. package/dist/src/gateway/hono/routes/session-command-handler.js +1 -4
  124. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -4
  125. package/dist/src/gateway/hono/routes/sessions.js +1 -13
  126. package/dist/src/gateway/next-turn-suggestions/generator.js +16 -2
  127. package/dist/src/gateway/next-turn-suggestions/service.d.ts +2 -1
  128. package/dist/src/gateway/next-turn-suggestions/service.js +17 -5
  129. package/dist/src/gateway/next-turn-suggestions/snapshot.d.ts +11 -0
  130. package/dist/src/gateway/next-turn-suggestions/snapshot.js +31 -2
  131. package/dist/src/gateway/security/gateway-scopes.js +1 -0
  132. package/dist/src/gateway/service/config-coordinator.d.ts +14 -1
  133. package/dist/src/gateway/service/run-gateway-agent.js +2 -13
  134. package/dist/src/gateway/service.js +80 -60
  135. package/dist/src/local-apps/capabilities/projections.d.ts +5 -5
  136. package/dist/src/media/generation-changes.d.ts +4 -0
  137. package/dist/src/media/generation-changes.js +37 -0
  138. package/dist/src/music-generation/repository.js +12 -6
  139. package/dist/src/notifications/device-store.d.ts +3 -0
  140. package/dist/src/notifications/device-store.js +14 -1
  141. package/dist/src/notifications/platform-push.d.ts +17 -0
  142. package/dist/src/notifications/platform-push.js +58 -0
  143. package/dist/src/notifications/service.d.ts +2 -2
  144. package/dist/src/notifications/service.js +26 -12
  145. package/dist/src/notifications/store.d.ts +1 -1
  146. package/dist/src/notifications/store.js +3 -2
  147. package/dist/src/providers/env-keys.js +0 -1
  148. package/dist/src/providers/index.js +1 -7
  149. package/dist/src/providers/model-catalog-sync-service.js +3 -1
  150. package/dist/src/providers/model-registry.js +6 -2
  151. package/dist/src/providers/presentation.js +1 -2
  152. package/dist/src/providers/provider-policy.js +2 -1
  153. package/dist/src/session/client-history.js +3 -3
  154. package/dist/src/session/reset-triggers.js +1 -1
  155. package/dist/src/session/user-message-display.js +3 -2
  156. package/dist/src/storage/sqlite/agent-reaction-repository.d.ts +2 -4
  157. package/dist/src/storage/sqlite/agent-reaction-repository.js +18 -13
  158. package/dist/src/storage/sqlite/device-access-repository.js +2 -1
  159. package/dist/src/tasks/capabilities/write.d.ts +2 -0
  160. package/dist/src/tasks/home-query-service.js +2 -1
  161. package/dist/src/tasks/task-contract-planner.js +1 -0
  162. package/dist/src/tasks/task-conversation-summary.d.ts +1 -1
  163. package/dist/src/tasks/task-delivery-checks.d.ts +12 -0
  164. package/dist/src/tasks/task-delivery-checks.js +91 -0
  165. package/dist/src/tasks/task-final-reply.d.ts +3 -1
  166. package/dist/src/tasks/task-final-reply.js +17 -4
  167. package/dist/src/tasks/task-model-call.js +4 -2
  168. package/dist/src/tasks/task-origin-repository.d.ts +1 -1
  169. package/dist/src/tasks/task-read-model-projector.js +24 -7
  170. package/dist/src/tasks/task-research-result.js +12 -27
  171. package/dist/src/tasks/task-result-delivery-repository.js +3 -2
  172. package/dist/src/tasks/task-retry-service.js +2 -1
  173. package/dist/src/tasks/task-run-coordinator.js +14 -4
  174. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
  175. package/dist/src/tasks/task-run-dispatcher.js +78 -48
  176. package/dist/src/tasks/task-run-repository.js +1 -1
  177. package/dist/src/tui/tui-commands.d.ts +2 -1
  178. package/dist/src/tui/tui-commands.js +3 -3
  179. package/dist/src/tui/tui-submit.d.ts +1 -1
  180. package/dist/src/tui/tui-submit.js +2 -4
  181. package/dist/src/video-generation/drafts.js +2 -0
  182. package/dist/src/video-generation/repository.js +13 -6
  183. package/package.json +1 -1
  184. package/dist/gateway/static/root/assets/capabilities-page-EENl65YY.js +0 -2
  185. package/dist/gateway/static/root/assets/command-palette-api-YP0zV_Ol.js +0 -1
  186. package/dist/gateway/static/root/assets/composer-payload-handoff-ClWsunJ2.js +0 -1
  187. package/dist/gateway/static/root/assets/connected-providers-grid-BgW-ioIt.js +0 -1
  188. package/dist/gateway/static/root/assets/product-preview-content-BOq3gtSJ.js +0 -1
  189. package/dist/gateway/static/root/assets/product-preview-modal-DIh_CsXp.js +0 -2
  190. package/dist/gateway/static/root/assets/project-detail-page-Dgs8ImMC.js +0 -7
  191. package/dist/gateway/static/root/assets/route-preload-7WVrzJca.js +0 -2
  192. package/dist/gateway/static/root/assets/routine-panel-Bfbiz0IN.js +0 -2
  193. package/dist/gateway/static/root/assets/session-manager-DUWeBdeG.js +0 -28
  194. package/dist/gateway/static/root/assets/space-page-CKVuhV2i.js +0 -2
  195. package/dist/gateway/static/root/assets/task-detail-page-DEpYIaok.js +0 -3
  196. package/dist/gateway/static/root/assets/task-run-issue-notice-CGrUMy0s.js +0 -1
  197. package/dist/gateway/static/root/assets/tasks-CwyNaa-j.js +0 -1
  198. package/dist/gateway/static/root/assets/turn-outcome-BSbEJx8h.js +0 -1
  199. package/dist/gateway/static/root/assets/use-personal-work-Dd2jRUpz.js +0 -1
  200. package/dist/gateway/static/root/assets/workspace-api-BuNWyNvA.js +0 -2
  201. package/dist/src/auth/oauth/google-antigravity.d.ts +0 -4
  202. package/dist/src/auth/oauth/google-antigravity.js +0 -9
  203. package/dist/src/auth/oauth/google-oauth/google-antigravity.d.ts +0 -25
  204. package/dist/src/auth/oauth/google-oauth/google-antigravity.js +0 -309
  205. package/dist/src/notifications/harmony-push.d.ts +0 -27
  206. package/dist/src/notifications/harmony-push.js +0 -96
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-CHjsq5NR.js";import{t as i}from"./messages-C7QSnTdg.js";import{t as a}from"./plus-Q2yW6OE7.js";import{t as o}from"./square-terminal-K87bylpZ.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./skeleton-DzdOeGYz.js";import{u as l}from"./session-api-CR3NLqvs.js";import{t as u}from"./session-manager-DUWeBdeG.js";import{t as d}from"./button-C5tRaJxt.js";import{t as f}from"./sliding-tab-list-CmcrqRzN.js";import{n as p,r as m,t as h}from"./terminal-panel-store-Cy90Ix5U.js";var g=2,_=1,ee=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(g,Math.floor(u/e.css.cell.width)),rows:Math.max(_,Math.floor(l/e.css.cell.height))}}},te=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,re=(e,t)=>{for(var n in t)te(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{for(var i=r>1?void 0:r?ne(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&te(t,n,i),i},y=(e,t)=>(n,r)=>t(n,r,e),ie=`Terminal input`,ae={get:()=>ie,set:e=>ie=e},oe=`Too much output to announce, navigate to rows manually to read`,b={get:()=>oe,set:e=>oe=e};function se(e){return e.replace(/\r?\n/g,`\r`)}function x(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ce(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function le(e,t,n,r){e.stopPropagation(),e.clipboardData&&ue(e.clipboardData.getData(`text/plain`),t,n,r)}function ue(e,t,n,r){e=se(e),e=x(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function S(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function de(e,t,n,r,i){S(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function C(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function fe(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var pe=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},me=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},w=``,he=` `,ge=class e{constructor(){this.fg=0,this.bg=0,this.extended=new _e}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},_e=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},T=class e extends ge{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new _e,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?C(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ve=`di$target`,ye=`di$dependencies`,be=new Map;function xe(e){return e[ye]||[]}function E(e){if(be.has(e))return be.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Se(t,e,r)};return t._id=e,be.set(e,t),t}function Se(e,t,n){t[ve]===t?t[ye].push({id:e,index:n}):(t[ye]=[{id:e,index:n}],t[ve]=t)}var D=E(`BufferService`),Ce=E(`CoreMouseService`),we=E(`CoreService`),Te=E(`CharsetService`),Ee=E(`InstantiationService`),De=E(`LogService`),O=E(`OptionsService`),Oe=E(`OscLinkService`),ke=E(`UnicodeService`),Ae=E(`DecorationService`),je=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new T,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Me(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};je=v([y(0,D),y(1,O),y(2,Oe)],je);function Me(e,t){if(confirm(`Do you want to navigate to ${t}?
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-CHjsq5NR.js";import{t as i}from"./messages-C7QSnTdg.js";import{t as a}from"./plus-Q2yW6OE7.js";import{t as o}from"./square-terminal-K87bylpZ.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./skeleton-DzdOeGYz.js";import{u as l}from"./session-api-CR3NLqvs.js";import{t as u}from"./session-manager-C2MCS4C5.js";import{t as d}from"./button-C5tRaJxt.js";import{t as f}from"./sliding-tab-list-CmcrqRzN.js";import{n as p,r as m,t as h}from"./terminal-panel-store-Cy90Ix5U.js";var g=2,_=1,ee=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(g,Math.floor(u/e.css.cell.width)),rows:Math.max(_,Math.floor(l/e.css.cell.height))}}},te=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,re=(e,t)=>{for(var n in t)te(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{for(var i=r>1?void 0:r?ne(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&te(t,n,i),i},y=(e,t)=>(n,r)=>t(n,r,e),ie=`Terminal input`,ae={get:()=>ie,set:e=>ie=e},oe=`Too much output to announce, navigate to rows manually to read`,b={get:()=>oe,set:e=>oe=e};function se(e){return e.replace(/\r?\n/g,`\r`)}function x(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ce(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function le(e,t,n,r){e.stopPropagation(),e.clipboardData&&ue(e.clipboardData.getData(`text/plain`),t,n,r)}function ue(e,t,n,r){e=se(e),e=x(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function S(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function de(e,t,n,r,i){S(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function C(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function fe(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var pe=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},me=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},w=``,he=` `,ge=class e{constructor(){this.fg=0,this.bg=0,this.extended=new _e}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},_e=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},T=class e extends ge{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new _e,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?C(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ve=`di$target`,ye=`di$dependencies`,be=new Map;function xe(e){return e[ye]||[]}function E(e){if(be.has(e))return be.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Se(t,e,r)};return t._id=e,be.set(e,t),t}function Se(e,t,n){t[ve]===t?t[ye].push({id:e,index:n}):(t[ye]=[{id:e,index:n}],t[ve]=t)}var D=E(`BufferService`),Ce=E(`CoreMouseService`),we=E(`CoreService`),Te=E(`CharsetService`),Ee=E(`InstantiationService`),De=E(`LogService`),O=E(`OptionsService`),Oe=E(`OscLinkService`),ke=E(`UnicodeService`),Ae=E(`DecorationService`),je=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new T,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Me(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};je=v([y(0,D),y(1,O),y(2,Oe)],je);function Me(e,t){if(confirm(`Do you want to navigate to ${t}?
2
2
 
3
3
  WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Ne=E(`CharSizeService`),Pe=E(`CoreBrowserService`),Fe=E(`MouseService`),Ie=E(`RenderService`),Le=E(`SelectionService`),Re=E(`CharacterJoinerService`),ze=E(`ThemeService`),Be=E(`LinkProviderService`),Ve=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?qe.isErrorNoTelemetry(e)?new qe(e.message+`
4
4
 
@@ -0,0 +1 @@
1
+ import{a as e,i as t,l as n}from"./locale-store-CHjsq5NR.js";import{o as r}from"./local-session-drafts-CGSV1RQg.js";import{t as i}from"./skill-wire-pattern-BPpeIcCi.js";import{t as a}from"./skill-list-api-B26hHnXq.js";var o=new Set([`new`,`reset`,`restart`]),s=new Set([...o,`clear`,`archive`]);function c(e){let t=e.trim(),n=/^\/([^/\s@]+)(?:@[^/\s]+)?(?:\s+([\s\S]*))?$/.exec(t);return n?{name:n[1].toLowerCase(),args:n[2]?.trim()??``}:null}function l(e){let t=c(e);return!!(t&&o.has(t.name)&&!t.args)}function u(e){let t=c(e);return!!(t&&s.has(t.name))}var d=RegExp(`^\\/skill:(${i})`),f=[],p=new Map;function m(e){let t=new Set;for(let n of e??[]){n?.name&&t.add(n.name);for(let e of n.aliases??[])typeof e==`string`&&e.length>0&&t.add(e)}f=Array.from(t).toSorted((e,t)=>t.length-e.length).map(e=>({key:e})),p.clear()}function h(e){let t=c(e);return t!==null&&f.some(({key:e})=>e===t.name)}function g(e,t){if(t>=e.length)return!0;let n=e[t];return!/[a-zA-Z0-9_-]/.test(n)}function _(e,t){return!(e[t]!==`/`||t>0&&!/\s/.test(e[t-1]))}function v(e,t){if(!_(e,t)||f.length===0)return null;let n=e.slice(t);if(n.startsWith(`/skill:`))return null;for(let{key:e}of f){let t=`/${e}`;if(n.startsWith(t)&&g(n,t.length))return{len:t.length,matchedKey:e}}return null}function y(e){let t=[],n=0;for(;n<e.length;){if(e[n]!==`/`){n+=1;continue}let r=e.slice(n).match(d);if(r?.[0]){n+=r[0].length;continue}let i=v(e,n);i?(t.push({start:n,end:n+i.len}),n+=i.len):n+=1}return t}function b(e){for(let t=e.length-1;t>=0;--t){if(e[t]!==`/`||e.startsWith(`/skill:`,t))continue;let n=v(e,t);if(n&&t+n.len===e.length)return!0}return!1}function x(e){if(!e.startsWith(`/`)||f.length===0||e.startsWith(`/skill:`))return!1;let t=v(e,0);return t?e.length===t.len||!/[a-zA-Z0-9_-]/.test(e[t.len]):!1}function S(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function C(e){let t=p.get(e);return t||(t=RegExp(`(${S(e)})([ \\t\\f\\v]*)$`),p.set(e,t)),t}function w(e){for(let{key:t}of f){let n=`/${t}`;if(!e.endsWith(n))continue;let r=e.length-n.length;if(v(e,r))return{tokenStart:r}}return null}function T(e){for(let{key:t}of f){let n=`/${t}`,r=e.match(C(n));if(!r)continue;let i=e.length-r[0].length;if(v(e,i))return{tokenStart:i}}return null}function E(e,t){let n=t.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`,r=e.localizations?.[n]??e.localizations?.en,i=r?.displayName.trim()||e.name,a=r?.description.trim()||e.description,o=new Set([e.name]),s=new Set([e.description]);for(let t of Object.values(e.localizations??{}))t?.displayName.trim()&&o.add(t.displayName.trim()),t?.description.trim()&&s.add(t.description.trim());return o.delete(i),s.delete(a),{displayName:i,description:a,aliases:[...o],searchTerms:[...s]}}async function D(e){let t=await e.json().catch(()=>({}));if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&`message`in t.error){let e=t.error.message;if(typeof e==`string`)return e}return`HTTP ${e.status}`}async function O(){let n=await e(t(`/api/commands`));if(!n.ok)throw Error(await D(n));return(await n.json()).payload?.commands??[]}var k=6e4,A=null,j=0,M=null,N=null,P=0,F=null,I=0,L=new Map,R=new Map,z=0;function B(e,t){let r=n.getState();return`${e?.trim()||`main`}\u0000${JSON.stringify([r.baseUrl,r.conversationId,t?.trim()||``])}`}async function V(e=!1){return!e&&A&&Date.now()<j?(m(A),A):M||(M=O().then(e=>(A=e,j=Date.now()+k,m(e),e)).catch(e=>{throw m([]),e}).finally(()=>{M=null}),M)}async function H(i,a,o=!1){let s=n.getState().conversationId,c=a?await r(a):void 0;if(s!==n.getState().conversationId)throw Error(`Active Gateway changed`);c&&(i=c.creation.agentId,a=void 0);let l=B(i,a),u=Date.now(),d=L.get(l);if(!o&&d&&u<d.expiry)return d.payload;let f=R.get(l);if(f)return f;let p=z,m=new URLSearchParams({agentId:i?.trim()||`main`});a?.trim()&&m.set(`conversationId`,a.trim());let h=e(t(`/api/chat/skills?${m.toString()}`)).then(async e=>{if(e.status===404&&a)return H(i,void 0,o);if(!e.ok)throw Error(await D(e));let t=await e.json();if(!t.payload||!Array.isArray(t.payload.skills))throw Error(`Invalid /api/chat/skills response`);return p===z&&L.set(l,{payload:t.payload,expiry:Date.now()+k}),t.payload}).finally(()=>{R.delete(l)});return R.set(l,h),h}async function U(n,r,i){let a=n?.trim()||`main`,o=await H(a,i,!0),s=new Set(o.effectiveAllowlist??o.agentAllowlist??[]);s.add(r);let c=await e(t(`/api/agents/${encodeURIComponent(a)}`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skills:[...s].sort((e,t)=>e.localeCompare(t))})});if(!c.ok)throw Error(await D(c));W(a)}function W(e){if(z+=1,e){let t=`${e.trim()}\u0000`;for(let e of L.keys())e.startsWith(t)&&L.delete(e);for(let e of R.keys())e.startsWith(t)&&R.delete(e);return}L.clear(),R.clear()}async function G(n){let r=await e(t(`/api/chat/workspace-trust?${new URLSearchParams({conversationId:n}).toString()}`));if(!r.ok)throw Error(await D(r));let i=await r.json();if(!i.payload)throw Error(`Invalid /api/chat/workspace-trust response`);return i.payload}async function K(n,r){let i=await e(t(`/api/chat/workspace-trust`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({conversationId:n,trusted:r})});if(!i.ok)throw Error(await D(i));let a=await i.json();if(!a.payload)throw Error(`Invalid /api/chat/workspace-trust response`);return q(),a.payload}function q(e){W(e),e||(I+=1,N=null,P=0,F=null)}async function J(e=!1){if(!e&&N&&Date.now()<P)return N;if(F)return F;let t=I;return F=a().then(e=>(t===I&&(N=e,P=Date.now()+k),e)).finally(()=>{F=null}),F}export{l as _,H as a,K as c,x as d,T as f,b as g,v as h,V as i,E as l,h as m,W as n,J as o,w as p,q as r,G as s,U as t,y as u,u as v};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./circle-alert-BEjgurr2.js";import{t as o}from"./mic-CuUb7zc-.js";import{t as s}from"./rotate-ccw-JM1TBLpp.js";import{t as c}from"./settings-2-D-csvaET.js";import{t as l}from"./x-B_N4OPjy.js";import{t as u}from"./cn-0WouolD0.js";import{t as d}from"./skeleton-DzdOeGYz.js";import{n as f}from"./open-capability-settings-DQsmJxI7.js";import{n as p}from"./interaction-BdhHBbYa.js";import{l as m,p as h}from"./voice-input-shortcut-events-DN-_rY5a.js";function g(e){return`${e.name}\0${e.size}`}function _(e){if(!e)return[];let t=new Set,n=[],r=e=>{if(!e||e.size===0)return;let r=g(e);t.has(r)||(t.add(r),n.push(e))},{files:i}=e;if(i?.length)for(let e=0;e<i.length;e++)r(i.item(e));for(let t of Array.from(e.items??[]))t.kind===`file`&&r(t.getAsFile());return n}var v=n(),y=r();function b(e){let t=(0,v.c)(10),{disabled:n,chat:r,onStart:i}=e,a=m(x),s=r.voiceInput,c;t[0]===a?c=t[1]:(c=h(a).join(`+`),t[0]=a,t[1]=c);let l=`${s} (${c})`,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=u(`relative inline-flex size-11 sm:size-8 shrink-0 items-center justify-center rounded-lg border border-transparent text-fg-subtle hover:bg-surface-hover hover:text-fg`,p.transition,p.press,p.focusRingPanel,`disabled:cursor-not-allowed disabled:opacity-50`),t[2]=d):d=t[2];let f;t[3]===i?f=t[4]:(f=()=>void i(),t[3]=i,t[4]=f);let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,y.jsx)(o,{className:`size-4 stroke-[1.75]`}),t[5]=g):g=t[5];let _;return t[6]!==n||t[7]!==f||t[8]!==l?(_=(0,y.jsx)(`button`,{type:`button`,className:d,disabled:n,title:l,"aria-label":l,onClick:f,children:g}),t[6]=n,t[7]=f,t[8]=l,t[9]=_):_=t[9],_}function x(e){return e.shortcut}function S(e){if(e.scrollHeight<=e.clientHeight)return!1;let t=window.getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`}function C(e,t,n){let r=[],i=e instanceof Element?e:t;for(;i&&i!==t;)i instanceof HTMLElement&&S(i)&&r.push(i),i=i.parentElement;return t.scrollHeight>t.clientHeight&&r.push(t),n!==t&&r.push(n),r}function w(e,t){let n=e;for(let e of t){let t=Math.max(0,e.scrollHeight-e.clientHeight),r=Math.min(t,Math.max(0,e.scrollTop+n)),i=r-e.scrollTop;if(i!==0&&(e.scrollTop=r),n-=i,Math.abs(n)<.01)break}}function T(e,t,n,{handoffOnly:r=!1}={}){if(!n||!e.cancelable||e.defaultPrevented||e.ctrlKey||e.shiftKey||e.deltaY===0||Math.abs(e.deltaY)<=Math.abs(e.deltaX))return;let i=t.clientHeight||n.clientHeight,a=e.deltaMode===WheelEvent.DOM_DELTA_LINE?16:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?i:1,o=C(e.target,t,n),s=e.deltaY*a;if(r){let e=o[0];if(!e||e===n)return;let t=s>0?e.scrollHeight-e.clientHeight-e.scrollTop:e.scrollTop;if(Math.abs(s)<=t)return}e.preventDefault(),w(s,o)}function E(e,t){let n=t.trim();if(!n)return e;let r=e.trim();return r?`${r} ${n}`:n}var D=e(t(),1),O=u(`inline-flex min-h-11 min-w-11 shrink-0 gap-2 px-3 items-center justify-center rounded-lg text-fg-muted`,`hover:bg-surface-hover hover:text-fg`,p.transition,p.press,p.focusRingPanel,`disabled:cursor-not-allowed disabled:opacity-50`),k=(0,D.memo)(function(e){let t=(0,v.c)(47),{phase:n,elapsedLabel:r,recordedDictation:o,audioLevel:f,partialTranscript:p,finalTranscript:m,error:h,settingsRequired:g,disabled:_,chat:b,onCancel:x,onConfirm:S,onRetry:C}=e,w=n===`transcribing`,T=n===`requesting`,E=n===`connecting`,D=n===`starting`,k=n===`error`,j=k?h||b.voiceTranscribeFailed:T?b.voiceRequestingMicrophone:E?b.voiceConnectingService:D?b.voiceStartingMicrophone:w?b.voiceTranscribing:o?b.voiceRecordedDictationStatus:b.voiceRecordingStatus,M;t[0]!==m||t[1]!==p?(M=[m,p].filter(Boolean),t[0]=m,t[1]=p,t[2]=M):M=t[2];let N=M.join(` `),P=T||E||D||w,F;t[3]!==f||t[4]!==k||t[5]!==n?(F=n===`recording`?(0,y.jsx)(`div`,{className:`flex h-5 shrink-0 items-center gap-0.5`,"aria-hidden":!0,children:Array.from({length:9},(e,t)=>{let n=.35+(t%4+1)*.16;return(0,y.jsx)(`span`,{className:`w-0.5 rounded-full bg-fg-muted motion-safe:transition-[height] motion-safe:duration-75`,style:{height:Math.max(3,Math.round(18*Math.min(1,f*n+.08)))}},t)})}):k?(0,y.jsx)(a,{className:`size-4 shrink-0 text-danger`,"aria-hidden":!0}):(0,y.jsx)(d,{className:`h-4 w-8`}),t[3]=f,t[4]=k,t[5]=n,t[6]=F):F=t[6];let I=k?`alert`:`status`,L;t[7]!==j||t[8]!==I?(L=(0,y.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm text-fg-muted`,role:I,children:j}),t[7]=j,t[8]=I,t[9]=L):L=t[9];let R;t[10]!==r||t[11]!==n?(R=n===`recording`?(0,y.jsx)(`span`,{className:`shrink-0 text-sm tabular-nums text-fg-muted`,children:r}):null,t[10]=r,t[11]=n,t[12]=R):R=t[12];let z;t[13]!==F||t[14]!==L||t[15]!==R?(z=(0,y.jsxs)(`div`,{className:`flex items-center gap-3 px-1`,children:[F,L,R]}),t[13]=F,t[14]=L,t[15]=R,t[16]=z):z=t[16];let B;t[17]===N?B=t[18]:(B=N?(0,y.jsx)(`p`,{className:`max-h-28 overflow-y-auto overscroll-contain whitespace-pre-wrap break-words px-1 text-base text-fg`,children:N}):null,t[17]=N,t[18]=B);let V;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,y.jsx)(l,{className:`size-4`,"aria-hidden":!0}),t[19]=V):V=t[19];let H;t[20]!==b.voiceInputCancel||t[21]!==x?(H=(0,y.jsxs)(`button`,{type:`button`,className:O,title:b.voiceInputCancel,"aria-label":b.voiceInputCancel,onClick:x,children:[V,b.voiceInputCancel]}),t[20]=b.voiceInputCancel,t[21]=x,t[22]=H):H=t[22];let U;t[23]!==_||t[24]!==k||t[25]!==b.voiceOpenSettings||t[26]!==b.voiceRetry||t[27]!==C||t[28]!==g?(U=k&&g?(0,y.jsxs)(`a`,{onClick:A,href:`#/settings/capabilities/models?configure=transcription`,className:u(O,`text-accent-fg`),children:[(0,y.jsx)(c,{className:`size-4`,"aria-hidden":!0}),b.voiceOpenSettings]}):k?(0,y.jsxs)(`button`,{type:`button`,className:O,disabled:_,"aria-label":b.voiceRetry,onClick:C,children:[(0,y.jsx)(s,{className:`size-4`,"aria-hidden":!0}),b.voiceRetry]}):null,t[23]=_,t[24]=k,t[25]=b.voiceOpenSettings,t[26]=b.voiceRetry,t[27]=C,t[28]=g,t[29]=U):U=t[29];let W;t[30]!==_||t[31]!==k||t[32]!==m||t[33]!==b.voiceInputConfirm||t[34]!==S||t[35]!==n?(W=n===`recording`||k&&m?(0,y.jsxs)(`button`,{type:`button`,className:u(O,`rounded-full bg-accent text-on-accent hover:bg-accent-hover hover:text-on-accent`),disabled:_,"aria-label":b.voiceInputConfirm,onClick:S,children:[(0,y.jsx)(i,{className:`size-4`,"aria-hidden":!0}),b.voiceInputConfirm]}):null,t[30]=_,t[31]=k,t[32]=m,t[33]=b.voiceInputConfirm,t[34]=S,t[35]=n,t[36]=W):W=t[36];let G;t[37]!==H||t[38]!==U||t[39]!==W?(G=(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[H,U,W]}),t[37]=H,t[38]=U,t[39]=W,t[40]=G):G=t[40];let K;return t[41]!==b.voiceInput||t[42]!==G||t[43]!==P||t[44]!==z||t[45]!==B?(K=(0,y.jsxs)(`section`,{className:`w-full space-y-3 py-3`,"aria-label":b.voiceInput,"aria-busy":P,children:[z,B,G]}),t[41]=b.voiceInput,t[42]=G,t[43]=P,t[44]=z,t[45]=B,t[46]=K):K=t[46],K});function A(e){!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&e.button===0&&(e.preventDefault(),f(`transcription`))}var j=120*1e3,M=new Map;function N(){return typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function P(e){for(let[t,n]of M)n.expiresAt<=e&&M.delete(t)}function F(e,t=Date.now()){P(t);let n=N();return M.set(n,{attachments:e.map(e=>({...e})),expiresAt:t+j}),n}function I(e,t=Date.now()){let n=M.get(e);if(!n)return null;if(n.expiresAt<=t)return M.delete(e),null;if(!n.attachments)return null;let r=n.attachments;return n.attachments=null,r}export{T as a,E as i,I as n,b as o,k as r,_ as s,F as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,o as s}from"./locale-store-CHjsq5NR.js";import{t as c}from"./messages-C7QSnTdg.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-DlirbHVs.js";import{t as g}from"./createLucideIcon-DPHK1VkS.js";import{t as _}from"./chevron-left-DqFhpbvK.js";import{t as v}from"./chevron-right-BweFrslA.js";import{n as y,r as b}from"./popover-select-hRG1EzAY.js";import{t as x}from"./circle-check-C23XjkUj.js";import{t as S}from"./secret-input-DsjfQmDn.js";import{t as C}from"./globe-DSSGFWFn.js";import{t as w}from"./loader-circle-CifKLtgG.js";import{t as T}from"./plus-Q2yW6OE7.js";import{t as E}from"./search-DA7gz22f.js";import{t as D}from"./settings-2-D-csvaET.js";import{t as O}from"./x-B_N4OPjy.js";import{t as k}from"./cn-0WouolD0.js";import{t as A}from"./skeleton-DzdOeGYz.js";import{i as j}from"./vendor-swr-CdRzEUwF.js";import{r as M}from"./gateway-config-swr-BD-ams0X.js";import{n as N,t as P}from"./registry-api-CDpUAb2R.js";import{t as F}from"./button-C5tRaJxt.js";import{i as ee,o as te}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as I}from"./interaction-BdhHBbYa.js";import{a as L,o as ne,s as R}from"./form-field-width-DJw_jULe.js";import{n as re}from"./secret-input-labels-B5Jl5HqK.js";import{t as ie}from"./sliding-tab-list-CmcrqRzN.js";import{n as ae}from"./model-sort-_Tz8s_4N.js";import{n as oe}from"./capability-navigation-CZbCI5C2.js";import{i as se,n as ce}from"./models-hub-cache-BrD6r5Qs.js";import{a as le,i as z,o as ue}from"./providers-api-D9NuB7w3.js";import{t as de}from"./oauth-provider-connect-DGYky6ut.js";import{n as fe}from"./capability-presentation-DlJQUUlM.js";var B=g(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),pe=g(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),V=e(t(),1),H=n(),U=r();async function W(e){return(await s(a(`/api/models/setup/${encodeURIComponent(e)}`))).payload}async function me(e,t={}){return(await s(a(`/api/models/setup/${encodeURIComponent(e)}/preview`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})).payload}async function he(e,t,n){await s(a(`/api/models/setup/${encodeURIComponent(e)}/apply`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,revision:n})}),await se()}function G(e,t){return e===`single`?t.getApiKey:e===`intl`?t.getApiKeyIntl:t.getApiKeyCn}var ge={"qwen-token-plan-cn":{apiKeyUrl:`https://bailian.console.aliyun.com/cn-beijing/subscription/overview`,docsUrl:`https://help.aliyun.cn/zh/model-studio/token-plan-personal-quick-start`,description:`Alibaba Bailian subscription. Configure chat, vision and image generation with one key.`,descriptionZh:`阿里云百炼订阅,一份 Key 配置对话、视觉和图片生成。`,bestFor:[`general`,`coding`,`vision`],aliases:[`阿里云订阅`,`百炼订阅`,`aliyun`,`bailian`,`qwen`,`token plan`,`通义`,`千问`],envVars:[`QWEN_TOKEN_PLAN_CN_API_KEY`]},openai:{apiKeyUrl:`https://platform.openai.com/api-keys`,pricingUrl:`https://openai.com/pricing`,docsUrl:`https://platform.openai.com/docs`,description:`The most widely used LLM provider. Powers ChatGPT.`,descriptionZh:`最广泛使用的 LLM 服务商,ChatGPT 背后的技术。`,bestFor:[`general`,`coding`,`vision`],freeTier:!1,freeTierNote:`Pay-as-you-go; new accounts may receive trial credits.`,aliases:[`chatgpt`,`gpt`,`gpt-4`,`gpt4`,`gpt-4o`,`gpt4o`],envVars:[`OPENAI_API_KEY`]},anthropic:{apiKeyUrl:`https://console.anthropic.com/settings/keys`,pricingUrl:`https://www.anthropic.com/pricing`,docsUrl:`https://docs.anthropic.com`,description:`Anthropic model access. Available models are loaded from the gateway catalog.`,descriptionZh:`Anthropic 模型服务。可用模型由网关目录动态加载。`,bestFor:[`long context`,`coding`,`reasoning`],freeTier:!1,aliases:[`claude`,`claude 3`,`claude sonnet`,`claude opus`,`claude haiku`],envVars:[`ANTHROPIC_OAUTH_TOKEN`,`ANTHROPIC_API_KEY`]},google:{apiKeyUrl:`https://aistudio.google.com/app/apikey`,pricingUrl:`https://ai.google.dev/pricing`,docsUrl:`https://ai.google.dev/docs`,description:`Google AI model access. Available models are loaded from the gateway catalog.`,descriptionZh:`Google AI 模型服务。可用模型由网关目录动态加载。`,bestFor:[`multimodal`,`long context`,`general`],freeTier:!0,freeTierNote:`Free tier available via Google AI Studio.`,aliases:[`gemini`,`google gemini`,`bard`,`google ai`],envVars:[`GEMINI_API_KEY`,`GOOGLE_API_KEY`]},"google-vertex":{apiKeyUrl:`https://console.cloud.google.com/apis/credentials`,pricingUrl:`https://cloud.google.com/vertex-ai/pricing`,docsUrl:`https://cloud.google.com/vertex-ai/docs`,description:`Google Vertex AI — enterprise-grade model hosting on GCP.`,descriptionZh:`Google Vertex AI,企业级 GCP 托管模型服务。`,bestFor:[`enterprise`,`multimodal`,`compliance`],freeTier:!1,aliases:[`vertex`,`vertex ai`,`gcp`,`google cloud`],envVars:[`GOOGLE_CLOUD_API_KEY`,`GOOGLE_CLOUD_PROJECT`,`GOOGLE_CLOUD_LOCATION`]},"google-gemini-cli":{apiKeyUrl:`https://aistudio.google.com/app/apikey`,pricingUrl:`https://ai.google.dev/pricing`,docsUrl:`https://ai.google.dev/docs`,description:`Gemini via CLI token — for users authenticated with the Gemini CLI tool.`,descriptionZh:`通过 Gemini CLI 令牌访问 Gemini,适合已安装 CLI 工具的用户。`,bestFor:[`general`,`multimodal`],freeTier:!0,freeTierNote:`Uses your existing Gemini CLI authentication.`,aliases:[`gemini cli`,`gemini-cli`],envVars:[`GEMINI_CLI_TOKEN`,`GOOGLE_TOKEN`]},groq:{apiKeyUrl:`https://console.groq.com/keys`,pricingUrl:`https://groq.com/pricing/`,docsUrl:`https://console.groq.com/docs`,description:`Extremely fast inference — ideal for latency-sensitive applications.`,descriptionZh:`推理速度极快,适合对延迟敏感的场景。`,bestFor:[`speed`,`cheap`],freeTier:!0,freeTierNote:`Generous free tier with rate limits.`,aliases:[`groq`,`llama on groq`,`mixtral on groq`],envVars:[`GROQ_API_KEY`]},deepseek:{apiKeyUrl:`https://platform.deepseek.com/api_keys`,pricingUrl:`https://api-docs.deepseek.com/quick_start/pricing/`,docsUrl:`https://platform.deepseek.com/api-docs/`,description:`DeepSeek model access through an OpenAI-compatible API.`,descriptionZh:`通过 OpenAI 兼容 API 访问 DeepSeek 模型。`,bestFor:[`reasoning`,`cheap`,`coding`],freeTier:!0,freeTierNote:`Free credits may be available for new accounts.`,aliases:[`deepseek`,`deep seek`,`deepseek v4`,`deepseek-v4`,`r1`],envVars:[`DEEPSEEK_API_KEY`]},"volcengine-ark":{apiKeyUrl:`https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey`,pricingUrl:`https://www.volcengine.com/docs/82379/1099320`,docsUrl:`https://www.volcengine.com/docs/82379/1302008`,description:`Volcengine Ark — OpenAI-compatible access to Doubao and custom Ark endpoints.`,descriptionZh:`火山方舟,通过 OpenAI 兼容接口访问豆包与自定义方舟 endpoint。`,bestFor:[`chinese`,`general`,`enterprise`],aliases:[`volcengine`,`ark`,`doubao`,`volces`,`火山方舟`,`豆包`],envVars:[`ARK_API_KEY`,`VOLCENGINE_API_KEY`]},"volcengine-plan":{apiKeyUrl:`https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey`,pricingUrl:`https://www.volcengine.com/docs/82379/1099320`,docsUrl:`https://www.volcengine.com/docs/82379/1302008`,description:`Volcengine Doubao Coding Plan — Ark coding endpoint.`,descriptionZh:`火山方舟豆包 Coding Plan,使用 Ark coding endpoint。`,bestFor:[`coding`,`chinese`],aliases:[`volcengine plan`,`ark coding`,`doubao coding`,`火山方舟 coding`],envVars:[`ARK_API_KEY`,`VOLCENGINE_API_KEY`]},"byteplus-plan":{apiKeyUrl:`https://console.byteplus.com/ark/region:ark+ap-southeast-1/apiKey`,pricingUrl:`https://docs.byteplus.com/en/docs/ModelArk`,docsUrl:`https://docs.byteplus.com/en/docs/ModelArk/OpenAI`,description:`BytePlus Doubao Coding Plan — international Ark coding endpoint.`,descriptionZh:`BytePlus 豆包 Coding Plan,国际区 Ark coding endpoint。`,bestFor:[`coding`,`chinese`],aliases:[`byteplus`,`byteplus plan`,`doubao coding international`],envVars:[`BYTEPLUS_API_KEY`,`ARK_API_KEY`]},xai:{apiKeyUrl:`https://console.x.ai/`,pricingUrl:`https://x.ai/api`,docsUrl:`https://docs.x.ai/`,description:`xAI model access. Available models are loaded from the gateway catalog.`,descriptionZh:`xAI 模型服务。可用模型由网关目录动态加载。`,bestFor:[`reasoning`,`real-time`],freeTier:!1,aliases:[`grok`,`xai`,`x.ai`],envVars:[`XAI_API_KEY`]},cerebras:{apiKeyUrl:`https://cloud.cerebras.ai/platform/`,pricingUrl:`https://cloud.cerebras.ai/platform/`,docsUrl:`https://inference-docs.cerebras.ai/`,description:`Ultra-fast inference on custom AI chips. Fastest Llama inference available.`,descriptionZh:`基于专用 AI 芯片的超快推理,Llama 推理速度业界最快。`,bestFor:[`speed`],freeTier:!0,freeTierNote:`Free tier available.`,aliases:[`cerebras`],envVars:[`CEREBRAS_API_KEY`]},mistral:{apiKeyUrl:`https://console.mistral.ai/api-keys/`,pricingUrl:`https://mistral.ai/technology/#pricing`,docsUrl:`https://docs.mistral.ai/`,description:`European open-weight models. Good balance of quality and cost.`,descriptionZh:`欧洲开源模型,质量与成本平衡好。`,bestFor:[`general`,`cheap`,`coding`],freeTier:!1,aliases:[`mistral`,`mixtral`,`codestral`],envVars:[`MISTRAL_API_KEY`]},openrouter:{apiKeyUrl:`https://openrouter.ai/keys`,pricingUrl:`https://openrouter.ai/models`,docsUrl:`https://openrouter.ai/docs`,description:`API gateway to 100+ models from many providers with a single key.`,descriptionZh:`统一 API 网关,一个 Key 访问 100+ 模型。`,bestFor:[`general`,`flexibility`],freeTier:!0,freeTierNote:`Some models are free; pay-per-use for others.`,aliases:[`openrouter`,`open router`],envVars:[`OPENROUTER_API_KEY`]},azure:{apiKeyUrl:`https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/OpenAI`,pricingUrl:`https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/`,docsUrl:`https://learn.microsoft.com/en-us/azure/ai-services/openai/`,description:`OpenAI models hosted on Azure. Enterprise SLA and data residency.`,descriptionZh:`Azure 托管的 OpenAI 模型,企业级 SLA 和数据合规。`,bestFor:[`enterprise`,`compliance`,`coding`],freeTier:!1,aliases:[`azure`,`azure openai`,`aoai`],envVars:[`AZURE_OPENAI_API_KEY`,`AZURE_OPENAI_BASE_URL`]},"amazon-bedrock":{apiKeyUrl:`https://console.aws.amazon.com/iam/home#/security_credentials`,pricingUrl:`https://aws.amazon.com/bedrock/pricing/`,docsUrl:`https://docs.aws.amazon.com/bedrock/`,description:`AWS Bedrock hosted model access with enterprise controls.`,descriptionZh:`AWS Bedrock 托管模型服务,提供企业级控制能力。`,bestFor:[`enterprise`,`compliance`],freeTier:!1,aliases:[`bedrock`,`aws`,`amazon`],envVars:[`AWS_ACCESS_KEY_ID`,`AWS_SECRET_ACCESS_KEY`,`AWS_REGION`]},minimax:{apiKeyUrl:`https://platform.minimax.io/user-center/basic-information/interface-key`,pricingUrl:`https://platform.minimax.io/docs/guides/models-intro`,docsUrl:`https://platform.minimax.io/docs/guides/quickstart-preparation`,description:`MiniMax — Chinese multimodal model with strong text and audio capabilities.`,descriptionZh:`MiniMax,国产多模态模型,文本和音频能力强。`,bestFor:[`multimodal`,`chinese`],freeTier:!0,freeTierNote:`注册赠送免费额度。`,aliases:[`minimax`,`mini max`,`abab`],envVars:[`MINIMAX_API_KEY`]},"minimax-cn":{apiKeyUrl:`https://platform.minimaxi.com/user-center/basic-information/interface-key`,pricingUrl:`https://platform.minimaxi.com/document/Price`,docsUrl:`https://platform.minimaxi.com/document/Announcement`,description:`MiniMax (China endpoint) — domestic access for Chinese users.`,descriptionZh:`MiniMax 国内端点,国内用户直连访问。`,bestFor:[`multimodal`,`chinese`],freeTier:!0,freeTierNote:`注册赠送免费额度。`,aliases:[`minimax cn`,`minimax china`,`abab`],envVars:[`MINIMAX_CN_API_KEY`,`MINIMAX_API_KEY`]},stepfun:{apiKeyUrl:`https://platform.stepfun.com/interface-key`,pricingUrl:`https://platform.stepfun.com/docs/pricing`,docsUrl:`https://platform.stepfun.com/docs`,description:`StepFun OpenAI-compatible endpoint.`,descriptionZh:`阶跃星辰 StepFun OpenAI 兼容端点。`,bestFor:[`chinese`,`reasoning`,`general`],aliases:[`stepfun`,`step`,`阶跃星辰`],envVars:[`STEPFUN_API_KEY`]},"stepfun-cn":{apiKeyUrl:`https://platform.stepfun.com/interface-key`,pricingUrl:`https://platform.stepfun.com/docs/pricing`,docsUrl:`https://platform.stepfun.com/docs`,description:`StepFun China — OpenAI-compatible chat endpoint.`,descriptionZh:`阶跃星辰 StepFun 中国区 OpenAI 兼容对话端点。`,bestFor:[`chinese`,`reasoning`,`general`],aliases:[`stepfun cn`,`step cn`,`阶跃星辰`],envVars:[`STEPFUN_API_KEY`]},"stepfun-intl":{apiKeyUrl:`https://platform.stepfun.com/interface-key`,pricingUrl:`https://platform.stepfun.com/docs/pricing`,docsUrl:`https://platform.stepfun.com/docs`,description:`StepFun International — OpenAI-compatible chat endpoint.`,descriptionZh:`阶跃星辰 StepFun 国际区 OpenAI 兼容对话端点。`,bestFor:[`chinese`,`reasoning`,`general`],aliases:[`stepfun intl`,`step international`],envVars:[`STEPFUN_API_KEY`]},"stepfun-plan":{apiKeyUrl:`https://platform.stepfun.com/interface-key`,pricingUrl:`https://platform.stepfun.com/docs/pricing`,docsUrl:`https://platform.stepfun.com/docs`,description:`StepFun Step Plan coding/planning endpoint.`,descriptionZh:`阶跃星辰 Step Plan coding/planning 专用端点。`,bestFor:[`coding`,`reasoning`,`chinese`],aliases:[`stepfun plan`,`step plan`,`阶跃 plan`],envVars:[`STEPFUN_API_KEY`]},"stepfun-plan-cn":{apiKeyUrl:`https://platform.stepfun.com/interface-key`,pricingUrl:`https://platform.stepfun.com/docs/pricing`,docsUrl:`https://platform.stepfun.com/docs`,description:`StepFun Step Plan China — coding/planning endpoint.`,descriptionZh:`阶跃星辰 Step Plan 中国区 coding/planning 专用端点。`,bestFor:[`coding`,`reasoning`,`chinese`],aliases:[`stepfun plan cn`,`step plan cn`,`阶跃 plan`],envVars:[`STEPFUN_API_KEY`]},"stepfun-plan-intl":{apiKeyUrl:`https://platform.stepfun.com/interface-key`,pricingUrl:`https://platform.stepfun.com/docs/pricing`,docsUrl:`https://platform.stepfun.com/docs`,description:`StepFun Step Plan International — coding/planning endpoint.`,descriptionZh:`阶跃星辰 Step Plan 国际区 coding/planning 专用端点。`,bestFor:[`coding`,`reasoning`,`chinese`],aliases:[`stepfun plan intl`,`step plan international`],envVars:[`STEPFUN_API_KEY`]},"kimi-coding":{apiKeyUrl:`https://platform.kimi.com/console/api-keys`,pricingUrl:`https://platform.kimi.com/docs/pricing/chat`,docsUrl:`https://platform.kimi.com/docs`,description:`Kimi Coding — dedicated Anthropic-compatible coding endpoint.`,descriptionZh:`Kimi Coding,Anthropic 兼容的专用 coding 端点。`,bestFor:[`coding`,`chinese`,`vision`],freeTier:!0,freeTierNote:`注册赠送免费额度。`,aliases:[`kimi coding`,`moonshot coding`,`kimi code`],envVars:[`KIMI_API_KEY`,`MOONSHOT_API_KEY`]},moonshotai:{apiKeyUrl:`https://platform.moonshot.ai/console/api-keys`,pricingUrl:`https://platform.moonshot.ai/docs/pricing`,docsUrl:`https://platform.moonshot.ai/docs`,description:`Moonshot Kimi — international API (api.moonshot.ai).`,descriptionZh:`月之暗面 Kimi 国际版 API(api.moonshot.ai)。`,bestFor:[`coding`,`chinese`,`long context`],freeTier:!0,aliases:[`moonshot`,`kimi`,`moonshot ai`],envVars:[`MOONSHOT_API_KEY`]},"moonshotai-cn":{apiKeyUrl:`https://platform.moonshot.cn/console/api-keys`,pricingUrl:`https://platform.moonshot.cn/docs/pricing/chat`,docsUrl:`https://platform.moonshot.cn/docs`,description:`Moonshot Kimi — China region endpoint.`,descriptionZh:`月之暗面 Kimi 中国区域端点。`,bestFor:[`coding`,`chinese`,`long context`],freeTier:!0,aliases:[`moonshot cn`,`kimi cn`],envVars:[`MOONSHOT_API_KEY`]},fal:{apiKeyUrl:`https://fal.ai/dashboard/keys`,pricingUrl:`https://fal.ai/pricing`,docsUrl:`https://fal.ai/docs`,description:`fal — serverless image and media generation APIs.`,descriptionZh:`fal:无服务器图像与媒体生成 API。`,bestFor:[`image`,`video`],freeTier:!0,aliases:[`fal ai`,`fal.ai`],envVars:[`FAL_KEY`,`FAL_API_KEY`]},fireworks:{apiKeyUrl:`https://fireworks.ai/account/api-keys`,pricingUrl:`https://fireworks.ai/pricing`,docsUrl:`https://docs.fireworks.ai`,description:`Fireworks AI — fast inference for open and proprietary models.`,descriptionZh:`Fireworks AI,多种开源与商业模型的高速推理服务。`,bestFor:[`speed`,`coding`,`open weights`],freeTier:!0,aliases:[`fireworks ai`,`fireworks`],envVars:[`FIREWORKS_API_KEY`]},together:{apiKeyUrl:`https://api.together.xyz/settings/api-keys`,pricingUrl:`https://www.together.ai/pricing`,docsUrl:`https://docs.together.ai`,description:`Together AI — hosted Llama, Qwen, DeepSeek, and more.`,descriptionZh:`Together AI,托管 Llama、Qwen、DeepSeek 等模型。`,bestFor:[`open source`,`flexibility`],freeTier:!0,aliases:[`together ai`,`together.xyz`],envVars:[`TOGETHER_API_KEY`]},"cloudflare-workers-ai":{apiKeyUrl:`https://dash.cloudflare.com/?to=/:account/ai/workers-ai`,pricingUrl:`https://developers.cloudflare.com/workers-ai/platform/pricing/`,docsUrl:`https://developers.cloudflare.com/workers-ai/`,description:`Cloudflare Workers AI — models at the edge via Cloudflare API.`,descriptionZh:`Cloudflare Workers AI,通过 Cloudflare API 在边缘运行模型。`,bestFor:[`edge`,`latency`],freeTier:!0,aliases:[`workers ai`,`cf workers ai`],envVars:[`CLOUDFLARE_API_KEY`]},"cloudflare-ai-gateway":{apiKeyUrl:`https://dash.cloudflare.com/?to=/:account/ai/ai-gateway`,pricingUrl:`https://developers.cloudflare.com/ai-gateway/pricing/`,docsUrl:`https://developers.cloudflare.com/ai-gateway/`,description:`Cloudflare AI Gateway — unified OpenAI/Anthropic-compatible routing.`,descriptionZh:`Cloudflare AI Gateway,统一 OpenAI/Anthropic 兼容路由。`,bestFor:[`routing`,`observability`,`enterprise`],freeTier:!0,aliases:[`cf ai gateway`,`cloudflare gateway`],envVars:[`CLOUDFLARE_API_KEY`]},xiaomi:{apiKeyUrl:`https://platform.xiaomimimo.com/#/console/api-keys`,pricingUrl:`https://mimo.mi.com/`,docsUrl:`https://platform.xiaomimimo.com/`,description:`Xiaomi MiMo — API billing through the MiMo open platform; endpoint api.xiaomimimo.com.`,descriptionZh:`小米 MiMo 按量计费线路,在开放平台创建密钥;接口域名为 api.xiaomimimo.com。`,bestFor:[`general`,`coding`],freeTier:!1,aliases:[`xiaomi`,`mimo`,`小米`,`xiaomimimo`],envVars:[`XIAOMI_API_KEY`]},"xiaomi-token-plan-cn":{apiKeyUrl:`https://platform.xiaomimimo.com/#/console/api-keys`,pricingUrl:`https://mimo.mi.com/`,docsUrl:`https://platform.xiaomimimo.com/`,description:`Xiaomi MiMo Token Plan — China region (token-plan-cn.xiaomimimo.com).`,descriptionZh:`小米 MiMo Token 套餐 · 中国区(token-plan-cn.xiaomimimo.com)。`,bestFor:[`general`,`coding`],freeTier:!1,aliases:[`xiaomi token cn`,`mimo token cn`],envVars:[`XIAOMI_TOKEN_PLAN_CN_API_KEY`,`XIAOMI_TOKEN_PLAN_API_KEY`]},"xiaomi-token-plan-ams":{apiKeyUrl:`https://platform.xiaomimimo.com/#/console/api-keys`,pricingUrl:`https://mimo.mi.com/`,docsUrl:`https://platform.xiaomimimo.com/`,description:`Xiaomi MiMo Token Plan — Amsterdam region (token-plan-ams.xiaomimimo.com).`,descriptionZh:`小米 MiMo Token 套餐 · 阿姆斯特丹(token-plan-ams.xiaomimimo.com)。`,bestFor:[`general`,`coding`],freeTier:!1,aliases:[`xiaomi token ams`,`mimo token ams`],envVars:[`XIAOMI_TOKEN_PLAN_AMS_API_KEY`,`XIAOMI_TOKEN_PLAN_API_KEY`]},"xiaomi-token-plan-sgp":{apiKeyUrl:`https://platform.xiaomimimo.com/#/console/api-keys`,pricingUrl:`https://mimo.mi.com/`,docsUrl:`https://platform.xiaomimimo.com/`,description:`Xiaomi MiMo Token Plan — Singapore region (token-plan-sgp.xiaomimimo.com).`,descriptionZh:`小米 MiMo Token 套餐 · 新加坡(token-plan-sgp.xiaomimimo.com)。`,bestFor:[`general`,`coding`],freeTier:!1,aliases:[`xiaomi token sgp`,`mimo token sgp`],envVars:[`XIAOMI_TOKEN_PLAN_SGP_API_KEY`,`XIAOMI_TOKEN_PLAN_API_KEY`]},"ant-ling":{apiKeyUrl:`https://ling.tbox.cn/`,docsUrl:`https://ling.tbox.cn/`,description:`Ant Ling — domestic OpenAI-compatible access to Ling and Ring models.`,descriptionZh:`蚂蚁 Ling,国内 OpenAI 兼容服务,提供 Ling 与 Ring 系列模型。`,bestFor:[`chinese`,`reasoning`,`coding`],aliases:[`ant ling`,`ling`,`ring`,`蚂蚁 ling`,`蚂蚁灵`],envVars:[`ANT_LING_API_KEY`,`LING_API_KEY`]},"zai-coding-cn":{apiKeyUrl:`https://bigmodel.cn/usercenter/proj-mgmt/apikeys`,pricingUrl:`https://bigmodel.cn/pricing`,docsUrl:`https://docs.bigmodel.cn/cn/guide/start/model-overview`,description:`Zhipu GLM Coding Plan — China endpoint from the pi-ai provider catalog.`,descriptionZh:`智谱 GLM Coding Plan 中国区,来自 pi-ai 内置 provider 目录。`,bestFor:[`coding`,`reasoning`,`chinese`],aliases:[`zai coding cn`,`zhipu coding cn`,`glm coding cn`,`智谱 coding`],envVars:[`ZAI_CODING_CN_API_KEY`,`ZHIPU_API_KEY`,`BIGMODEL_API_KEY`,`ZAI_API_KEY`]},"zhipu-cn":{apiKeyUrl:`https://bigmodel.cn/usercenter/proj-mgmt/apikeys`,pricingUrl:`https://bigmodel.cn/pricing`,docsUrl:`https://docs.bigmodel.cn/cn/guide/start/model-overview`,description:`Zhipu GLM China — BigModel OpenAI-compatible endpoint.`,descriptionZh:`智谱 GLM 中国区,通过 BigModel OpenAI 兼容接口访问。`,bestFor:[`chinese`,`reasoning`,`general`],freeTier:!0,aliases:[`zhipu`,`glm`,`bigmodel`,`智谱`,`z.ai cn`],envVars:[`ZHIPU_API_KEY`,`BIGMODEL_API_KEY`]},huggingface:{apiKeyUrl:`https://huggingface.co/settings/tokens`,pricingUrl:`https://huggingface.co/pricing`,docsUrl:`https://huggingface.co/docs/api-inference/`,description:`Access thousands of open-source models via Hugging Face Inference API.`,descriptionZh:`通过 Hugging Face 访问数千个开源模型。`,bestFor:[`open source`,`flexibility`],freeTier:!0,freeTierNote:`Free tier with rate limits.`,aliases:[`huggingface`,`hugging face`,`hf`],envVars:[`HF_TOKEN`,`HUGGINGFACE_TOKEN`]},opencode:{apiKeyUrl:`https://opencode.ai/auth`,pricingUrl:`https://opencode.ai/docs`,docsUrl:`https://opencode.ai/docs/providers/`,description:`OpenCode — AI coding assistant provider.`,descriptionZh:`OpenCode,AI 代码助手服务商。`,bestFor:[`coding`],freeTier:!1,aliases:[`opencode`,`open code`],envVars:[`OPENCODE_API_KEY`]},"opencode-go":{apiKeyUrl:`https://opencode.ai/auth`,pricingUrl:`https://opencode.ai/docs`,docsUrl:`https://opencode.ai/docs/providers/`,description:`OpenCode Go — AI coding assistant provider (Go variant).`,descriptionZh:`OpenCode Go,AI 代码助手服务商(Go 版本)。`,bestFor:[`coding`],freeTier:!1,aliases:[`opencode go`,`opencode-go`],envVars:[`OPENCODE_API_KEY`]},zai:{apiKeyUrl:`https://z.ai/manage-apikey/apikey-list`,pricingUrl:`https://z.ai/manage-apikey/billing`,docsUrl:`https://docs.z.ai/guides/overview/quick-start`,description:`Zhipu GLM Coding Plan — international z.ai endpoint.`,descriptionZh:`智谱 GLM Coding Plan 国际区 z.ai 端点。`,bestFor:[`coding`,`reasoning`,`chinese`],aliases:[`zai coding`,`zhipu coding global`,`glm coding global`],envVars:[`ZAI_API_KEY`,`Z_AI_API_KEY`]},"zai-api":{apiKeyUrl:`https://z.ai/manage-apikey/apikey-list`,pricingUrl:`https://z.ai/manage-apikey/billing`,docsUrl:`https://docs.z.ai/guides/overview/quick-start`,description:`Zhipu GLM International — z.ai OpenAI-compatible endpoint.`,descriptionZh:`智谱 GLM 国际区,通过 z.ai OpenAI 兼容接口访问。`,bestFor:[`general`,`reasoning`,`chinese`],freeTier:!1,aliases:[`zai`,`z.ai`,`zhipu global`,`glm global`,`智谱`],envVars:[`ZAI_API_KEY`,`Z_AI_API_KEY`]},dashscope:{apiKeyUrl:`https://dashscope.console.aliyun.com/apiKey`,pricingUrl:`https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-thousand-questions-metering-and-billing`,docsUrl:`https://help.aliyun.com/zh/model-studio/developer-reference/compatibility-of-openai-with-dashscope`,description:`Alibaba Bailian / DashScope service provider.`,descriptionZh:`阿里百炼 / DashScope 服务 provider。`,bestFor:[`chinese`,`coding`,`image`,`speech`],freeTier:!0,aliases:[`dash scope`,`alibaba dashscope`,`qwen`,`tongyi`,`阿里百炼`,`通义千问`],envVars:[`DASHSCOPE_API_KEY`,`QWEN_API_KEY`]},"dashscope-cn":{apiKeyUrl:`https://dashscope.console.aliyun.com/apiKey`,pricingUrl:`https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-thousand-questions-metering-and-billing`,docsUrl:`https://help.aliyun.com/zh/model-studio/developer-reference/compatibility-of-openai-with-dashscope`,description:`Alibaba Bailian / DashScope China — Qwen LLMs through the China endpoint.`,descriptionZh:`阿里百炼 / DashScope 中国区:通过国内端点访问通义千问 LLM。`,bestFor:[`chinese`,`coding`,`image`],freeTier:!0,aliases:[`dash scope cn`,`alibaba dashscope cn`,`qwen cn`,`tongyi cn`,`阿里百炼`,`通义千问`],envVars:[`DASHSCOPE_API_KEY`,`QWEN_API_KEY`]},"dashscope-intl":{apiKeyUrl:`https://modelstudio.console.alibabacloud.com/`,pricingUrl:`https://www.alibabacloud.com/help/en/model-studio/billing-for-tongyi-qianwen`,docsUrl:`https://www.alibabacloud.com/help/en/model-studio/compatibility-of-openai-with-dashscope`,description:`Alibaba Bailian / DashScope International — Qwen LLMs through the international endpoint.`,descriptionZh:`阿里百炼 / DashScope 国际区:通过国际端点访问通义千问 LLM。`,bestFor:[`chinese`,`coding`,`image`],freeTier:!0,aliases:[`dash scope intl`,`alibaba cloud dashscope`,`qwen intl`,`tongyi intl`],envVars:[`DASHSCOPE_API_KEY`,`QWEN_API_KEY`]},"vercel-ai-gateway":{apiKeyUrl:`https://vercel.com/account/tokens`,pricingUrl:`https://vercel.com/pricing`,docsUrl:`https://vercel.com/docs/ai/ai-gateway`,description:`Vercel AI Gateway — route requests to multiple LLM providers via Vercel.`,descriptionZh:`Vercel AI Gateway,通过 Vercel 路由请求到多个 LLM 服务商。`,bestFor:[`flexibility`,`enterprise`],freeTier:!1,aliases:[`vercel gateway`,`vercel ai gateway`],envVars:[`AI_GATEWAY_API_KEY`,`VERCEL_AI_GATEWAY_API_KEY`]},"github-copilot":{apiKeyUrl:`https://github.com/settings/tokens`,pricingUrl:`https://github.com/features/copilot#pricing`,docsUrl:`https://docs.github.com/en/copilot`,description:`GitHub Copilot — use your GitHub token to access Copilot models.`,descriptionZh:`使用 GitHub 令牌访问 Copilot 模型。`,bestFor:[`coding`],freeTier:!0,freeTierNote:`Free for verified students and open-source maintainers.`,aliases:[`github copilot`,`copilot`,`github`],envVars:[`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`GITHUB_COPILOT_TOKEN`]}};function K(e,t){let n=ge[e];return n&&n.apiKeyUrl?[{href:n.apiKeyUrl,kind:`single`}]:[]}var _e=[`common`,`domestic`,`specialty`,`enterprise`,`oauth`,`extension`];function ve(e){let t=new Map;for(let e of _e)t.set(e,[]);for(let n of e){let e=n.category||`specialty`,r=t.get(e)??[];r.push(n),t.set(e,r)}return t}function q(e,t){switch(t){case`agent`:return e.sourceAgent;case`gateway`:return e.sourceGateway;case`oauth`:return e.sourceOauth;case`env`:return e.sourceEnv;case`models_json`:return e.sourceModelsJson;case`extension`:return e.sourceExtension;default:return e.sourceNone}}var ye=[{value:`openai-completions`,label:`OpenAI Completions`},{value:`openai-responses`,label:`OpenAI Responses`},{value:`anthropic-messages`,label:`Anthropic Messages`},{value:`google-generative-ai`,label:`Google Generative AI`},{value:`azure-openai-responses`,label:`Azure OpenAI`},{value:`bedrock-converse-stream`,label:`AWS Bedrock`},{value:`google-gemini-cli`,label:`Google Gemini CLI`},{value:`google-vertex`,label:`Google Vertex AI`}];function J(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&`message`in t.error){let e=t.error.message;return typeof e==`string`?e:void 0}}function Y(e){if(!e||typeof e!=`object`)return{providers:{}};let t=e,n=t.providers;return n&&typeof n==`object`&&!Array.isArray(n)?e:{...t,providers:{}}}async function be(){let e=await i(a(`/api/models-json`)),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok||!t.payload)throw Error(J(t)||`HTTP ${e.status}`);return{...t.payload,config:Y(t.payload.config)}}async function xe(e){let t=await i(a(`/api/models-json`),{method:`PATCH`,body:JSON.stringify({config:e})}),n=await t.json().catch(()=>({}));if(!t.ok||!n.ok||!n.payload)throw Error(J(n)||`HTTP ${t.status}`);return await se(),n.payload}async function X(e){let t=await i(a(`/api/models-json/discover-models`),{method:`POST`,body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));if(!t.ok||!n.ok||!n.payload)throw Error(J(n)||`HTTP ${t.status}`);return n.payload.models}function Se(e,t,n){return{id:e,name:t||e,input:[`text`],contextWindow:128e3,maxTokens:16384,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},...n}}var Z={ollama:{label:`Ollama`,providerId:`ollama`,config:{baseUrl:`http://localhost:11434/v1`,api:`openai-completions`,apiKey:`ollama`}},lmstudio:{label:`LM Studio`,providerId:`lmstudio`,config:{baseUrl:`http://localhost:1234/v1`,api:`openai-completions`,apiKey:`lmstudio`}},zhipuCn:{label:`Zhipu GLM China`,providerId:`zhipu-cn`,config:{baseUrl:`https://open.bigmodel.cn/api/paas/v4`,api:`openai-completions`,apiKey:`ZHIPU_API_KEY`,models:[{id:`glm-5.2`,name:`GLM 5.2`,contextWindow:1e6,maxTokens:65536,reasoning:!0,input:[`text`]}]}},zaiGeneral:{label:`Zhipu GLM API (International)`,providerId:`zai-api`,config:{baseUrl:`https://api.z.ai/api/paas/v4`,api:`openai-completions`,apiKey:`ZAI_API_KEY`,models:[{id:`glm-5.2`,name:`GLM 5.2`,contextWindow:1e6,maxTokens:65536,reasoning:!0,input:[`text`]}]}},dashscopeCn:{label:`Alibaba Bailian / DashScope China`,providerId:`dashscope-cn`,description:`China OpenAI-compatible Qwen endpoint`,config:{baseUrl:`https://dashscope.aliyuncs.com/compatible-mode/v1`,api:`openai-completions`,apiKey:`DASHSCOPE_API_KEY`,models:[{id:`qwen3.7-max`,name:`Qwen3.7 Max`,contextWindow:1e6,input:[`text`,`image`]},{id:`qwen3.7-plus`,name:`Qwen3.7 Plus`,contextWindow:1e6,input:[`text`,`image`]},{id:`qwen3.6-flash`,name:`Qwen3.6 Flash`,contextWindow:1e6,input:[`text`]}]}},dashscopeIntl:{label:`Alibaba Bailian / DashScope International`,providerId:`dashscope-intl`,description:`International OpenAI-compatible Qwen endpoint`,config:{baseUrl:`https://dashscope-intl.aliyuncs.com/compatible-mode/v1`,api:`openai-completions`,apiKey:`DASHSCOPE_API_KEY`,models:[{id:`qwen3.7-max`,name:`Qwen3.7 Max`,contextWindow:1e6,input:[`text`,`image`]},{id:`qwen3.7-plus`,name:`Qwen3.7 Plus`,contextWindow:1e6,input:[`text`,`image`]},{id:`qwen3.6-flash`,name:`Qwen3.6 Flash`,contextWindow:1e6,input:[`text`]}]}},dashscopePhone:{label:`Alibaba Bailian · Phone Use`,providerId:`dashscope-phone`,description:`Beijing GUI-Plus API, the official GUI-Owl hosted entry; requires a Beijing Bailian key`,config:{baseUrl:`https://dashscope.aliyuncs.com/compatible-mode/v1`,api:`openai-completions`,apiKey:`DASHSCOPE_API_KEY`,models:[{id:`gui-plus-2026-02-26`,name:`Bailian GUI-Plus · Phone`,input:[`text`,`image`],contextWindow:262144,maxTokens:4096,phoneUse:{profile:`gui-owl-phone-v1`}}]}},modelscope:{label:`ModelScope`,providerId:`modelscope`,description:`General inference; select a model currently offered by ModelScope`,config:{baseUrl:`https://api-inference.modelscope.cn/v1`,api:`openai-completions`,apiKey:`MODELSCOPE_TOKEN`,models:[{id:`Qwen/Qwen3.5-35B-A3B`,name:`Qwen3.5 35B A3B`,input:[`text`],maxTokens:4096}]}},volcengineArk:{label:`Volcengine Ark`,providerId:`volcengine-ark`,description:`Doubao Seed GUI; use the activated model ID or your Ark endpoint ID`,config:{baseUrl:`https://ark.cn-beijing.volces.com/api/v3`,api:`openai-completions`,apiKey:`ARK_API_KEY`,models:[{id:`doubao-seed-2-1-pro-260915`,name:`Doubao Seed 2.1 Pro`,contextWindow:1024e3,maxTokens:4096,input:[`text`,`image`],phoneUse:{profile:`doubao-seed-phone-v1`}}]}},volcenginePlan:{label:`Volcengine Doubao Coding Plan`,providerId:`volcengine-plan`,description:`Doubao coding-plan endpoint on Volcengine Ark`,config:{baseUrl:`https://ark.cn-beijing.volces.com/api/coding/v3`,api:`openai-completions`,apiKey:`ARK_API_KEY`,models:[{id:`ark-code-latest`,name:`Ark Coding Plan`,contextWindow:256e3,maxTokens:4096,input:[`text`]},{id:`doubao-seed-2.0-code`,name:`Doubao Seed 2.0 Code`,contextWindow:256e3,maxTokens:4096,input:[`text`]},{id:`doubao-seed-2.0-pro`,name:`Doubao Seed 2.0 Pro`,contextWindow:256e3,maxTokens:4096,input:[`text`]},{id:`doubao-seed-2.0-lite`,name:`Doubao Seed 2.0 Lite`,contextWindow:256e3,maxTokens:4096,input:[`text`]}]}},byteplusPlan:{label:`BytePlus Doubao Coding Plan`,providerId:`byteplus-plan`,description:`Doubao coding-plan endpoint on BytePlus`,config:{baseUrl:`https://ark.ap-southeast.bytepluses.com/api/coding/v3`,api:`openai-completions`,apiKey:`BYTEPLUS_API_KEY`,models:[{id:`ark-code-latest`,name:`Ark Coding Plan`,contextWindow:256e3,maxTokens:4096,input:[`text`]},{id:`doubao-seed-2.0-code`,name:`Doubao Seed 2.0 Code`,contextWindow:256e3,maxTokens:4096,input:[`text`]},{id:`doubao-seed-2.0-pro`,name:`Doubao Seed 2.0 Pro`,contextWindow:256e3,maxTokens:4096,input:[`text`]},{id:`doubao-seed-2.0-lite`,name:`Doubao Seed 2.0 Lite`,contextWindow:256e3,maxTokens:4096,input:[`text`]}]}},stepfunIntl:{label:`StepFun International`,providerId:`stepfun-intl`,config:{baseUrl:`https://api.stepfun.ai/v1`,api:`openai-completions`,apiKey:`STEPFUN_API_KEY`,models:[{id:`step-3.7-flash`,name:`Step 3.7 Flash`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]},{id:`step-3.5-flash-2603`,name:`Step 3.5 Flash 2603`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]},{id:`step-3.5-flash`,name:`Step 3.5 Flash`,contextWindow:1e6,reasoning:!0,input:[`text`]}]}},stepfunCn:{label:`StepFun China`,providerId:`stepfun-cn`,config:{baseUrl:`https://api.stepfun.com/v1`,api:`openai-completions`,apiKey:`STEPFUN_API_KEY`,models:[{id:`step-3.7-flash`,name:`Step 3.7 Flash`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]},{id:`step-3.5-flash-2603`,name:`Step 3.5 Flash 2603`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]},{id:`step-3.5-flash`,name:`Step 3.5 Flash`,contextWindow:1e6,reasoning:!0,input:[`text`]}]}},stepfunPlanIntl:{label:`StepFun Step Plan International`,providerId:`stepfun-plan-intl`,config:{baseUrl:`https://api.stepfun.ai/step_plan/v1`,api:`openai-completions`,apiKey:`STEPFUN_API_KEY`,models:[{id:`step-3.7-flash`,name:`Step 3.7 Flash`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]},{id:`step-3.5-flash-2603`,name:`Step 3.5 Flash 2603`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]},{id:`step-3.5-flash`,name:`Step 3.5 Flash`,contextWindow:1e6,reasoning:!0,input:[`text`]}]}},stepfunPlanCn:{label:`StepFun Step Plan China`,providerId:`stepfun-plan-cn`,config:{baseUrl:`https://api.stepfun.com/step_plan/v1`,api:`openai-completions`,apiKey:`STEPFUN_API_KEY`,models:[{id:`step-3.7-flash`,name:`Step 3.7 Flash`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]},{id:`step-3.5-flash-2603`,name:`Step 3.5 Flash 2603`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]},{id:`step-3.5-flash`,name:`Step 3.5 Flash`,contextWindow:1e6,reasoning:!0,input:[`text`]}]}}},Ce=Object.entries(Z).map(([e,t])=>({key:e,...t}));function Q(e){return Z[e]?.providerId??e}function we(e){return Ce.find(t=>t.providerId===e)?.key}var Te=new Set([`modelscope`,`dashscope-phone`,`dashscope-cn`,`dashscope-intl`,`volcengine-ark`,`volcengine-plan`,`byteplus-plan`,`stepfun-cn`,`stepfun-intl`,`stepfun-plan-cn`,`stepfun-plan-intl`,`zhipu-cn`,`zai-api`]);function $(e){if(Te.has(e))return we(e)}var Ee=[{value:`text`,labelKey:`inputTextOnly`},{value:`text,image`,labelKey:`inputTextVision`}];function De(){return k(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,R,`dark:border-edge`)}function Oe(){return k(ne,L)}function ke(e){return(e.input||[`text`]).includes(`image`)?`text,image`:`text`}function Ae(e){return e===`text,image`?[`text`,`image`]:[`text`]}function je(e){let t=(0,H.c)(16),{value:n,onChange:r,language:i,disabled:a}=e,o=a!==void 0&&a,s=i===`zh`,c=(0,V.useId)(),l=s?`配置接入方式`:`Configure access method`,u;t[0]===l?u=t[1]:(u=(0,U.jsx)(`legend`,{className:`mb-2 text-sm font-medium text-fg`,children:l}),t[0]=l,t[1]=u);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=[`api-key`,`oauth`],t[2]=d):d=t[2];let f;t[3]!==o||t[4]!==c||t[5]!==r||t[6]!==n||t[7]!==s?(f=(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:d.map(e=>(0,U.jsxs)(`label`,{className:k(`relative flex min-h-11 cursor-pointer items-center justify-center gap-2 rounded-lg border px-3 text-sm text-fg has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-accent`,n===e?`border-accent bg-surface-active`:`border-edge bg-surface-panel`,o&&`cursor-default opacity-60`),children:[(0,U.jsx)(`input`,{className:`sr-only`,type:`radio`,name:c,value:e,checked:n===e,onChange:()=>r(e)}),e===`api-key`?`API Key`:s?`账号登录(OAuth)`:`Account (OAuth)`]},e))}),t[3]=o,t[4]=c,t[5]=r,t[6]=n,t[7]=s,t[8]=f):f=t[8];let p=s?`选择要配置的方式;保存密钥或完成授权后,按凭据优先级生效。已保存的 API Key 优先于 OAuth。`:`Choose which credentials to configure. Saved API keys take priority over OAuth; selecting a form does not switch the active connection.`,m;t[9]===p?m=t[10]:(m=(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:p}),t[9]=p,t[10]=m);let h;return t[11]!==o||t[12]!==u||t[13]!==f||t[14]!==m?(h=(0,U.jsxs)(`fieldset`,{disabled:o,className:`space-y-2`,children:[u,f,m]}),t[11]=o,t[12]=u,t[13]=f,t[14]=m,t[15]=h):h=t[15],h}function Me(e){let t=(0,H.c)(17),{row:n,language:r}=e,i=r===`zh`,a=n?.authMode??n?.activeKeySource,o=n?.authStatus,s=o===`connected`,l=o===`expired`?i?`授权已过期`:`Authorization expired`:s?i?`凭据已配置`:`Credentials configured`:i?`未连接`:`Not connected`,u;t[0]===l?u=t[1]:(u=(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:l}),t[0]=l,t[1]=u);let d;t[2]!==r||t[3]!==a||t[4]!==i?(d=a&&a!==`none`?(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[i?`当前认证来源:`:`Current credential source: `,q(c(r).providersSettings,a)]}):null,t[2]=r,t[3]=a,t[4]=i,t[5]=d):d=t[5];let f;t[6]!==a||t[7]!==i?(f=a===`env`?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`正在使用环境变量中的凭据,无需重复填写。`:`Using credentials from the environment. No need to enter them again.`}):null,t[6]=a,t[7]=i,t[8]=f):f=t[8];let p;t[9]!==s||t[10]!==i?(p=s?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`凭据状态不代表模型调用已验证。`:`Credential status does not verify model access.`}):null,t[9]=s,t[10]=i,t[11]=p):p=t[11];let m;return t[12]!==u||t[13]!==d||t[14]!==f||t[15]!==p?(m=(0,U.jsxs)(`div`,{role:`status`,className:`space-y-1 rounded-lg border border-edge-subtle bg-surface-panel/60 p-3`,children:[u,d,f,p]}),t[12]=u,t[13]=d,t[14]=f,t[15]=p,t[16]=m):m=t[16],m}var Ne={chat:[`对话与任务`,`Chat and tasks`],vision:[`看图`,`Image understanding`],image:[`画图`,`Image generation`],background:[`后台任务`,`Background tasks`],speech:[`语音合成`,`Speech synthesis`],transcription:[`录音识别`,`Recorded audio recognition`],conversation:[`实时语音对话`,`Realtime conversation`]};function Pe({providerId:e,row:t,modelIds:n,existingConnection:r=!1,targetUse:i,connectOnly:a=!1,language:o,alternatives:s=[],onChooseProvider:l,onBack:d,onDone:f,onApplied:p,inline:h=!1,onPendingChange:g}){let v=o===`zh`,C=(0,V.useRef)(!1),[T,E]=(0,V.useState)(null),[D,k]=(0,V.useState)({mode:i?`replace`:`fill`,modelIds:n}),[j,M]=(0,V.useState)(null),[N,P]=(0,V.useState)(!1),[ee,te]=(0,V.useState)(!1),[I,L]=(0,V.useState)(``),[ne,R]=(0,V.useState)(!1),[se,ce]=(0,V.useState)(!1),[z,ue]=(0,V.useState)(r||!!t?.configured),[B,pe]=(0,V.useState)(!1),H=(0,V.useRef)(!1),[W,G]=(0,V.useState)(``),[K,_e]=(0,V.useState)(!1),[ve,q]=(0,V.useState)(0);(0,V.useEffect)(()=>{let t=!0;return me(e,{modelIds:n,...a?{selected:[]}:{},...i&&!a?{mode:`replace`,selected:[i]}:{}}).then(e=>{t&&(E(e),ue(e.configured),C.current||(C.current=!0,k({mode:i?`replace`:`fill`,modelIds:n,selected:a?[]:e.uses.filter(e=>e.selected).map(e=>e.id)})),G(``))}).catch(e=>{t&&G(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[e,n,i,a,ve]),(0,V.useEffect)(()=>(g?.(B||N),()=>g?.(!1)),[B,N,g]);let ye=t?.supportsOAuth??T?.profile.credential===`oauth`,J=t?.supportsApiKey??T?.profile.credential===`api-key`,Y=j??(t?.authMode===`oauth`||!J?`oauth`:`api-key`),be=J&&Y===`api-key`,xe=ye&&Y===`oauth`,X=ee||z&&(t?t.authMode===`oauth`&&t.authStatus===`connected`:T?.profile.credential===`oauth`),Se=t?!!t.apiKey:T?.profile.credential===`api-key`,Z=J&&ye&&!r&&!K?(0,U.jsx)(je,{value:Y,language:o,disabled:B||N,onChange:e=>{M(e),L(``),R(!1)}}):null,Ce=()=>{ue(!0),te(!0),L(``),R(!1),a?(_e(!0),p?.()):q(e=>e+1)},Q=D.selected??[],we=e=>{k({...D,mode:e,selected:T?.uses.filter(t=>t.recommended&&t.choices.length&&(e===`replace`||t.selected)).map(e=>e.id)??[]})},Te=async()=>{if(!T||H.current)return;H.current=!0,pe(!0),G(``),ce(!1);let t=!1;try{I.trim()&&(await le({[e]:I.trim()}),t=!0,ce(!0),ue(!0),R(!1),L(``));let n=await me(e,D);if(ue(n.configured),a){if(!n.configured)throw Error(v?`请先连接此服务。`:`Connect this service first.`);E(n),_e(!0),p?.();return}let r=T.uses.filter(e=>Q.includes(e.id)).map(e=>D.overrides?.[e.id]??e.recommended),i=n.uses.filter(e=>Q.includes(e.id)).map(e=>D.overrides?.[e.id]??e.recommended);if(T.revision!==n.revision||JSON.stringify(r)!==JSON.stringify(i))throw E(n),k({...D,selected:n.uses.filter(e=>e.selected).map(e=>e.id)}),Error(v?`目录或当前配置已更新,请核对后再次应用。`:`The catalog or settings changed. Review the updated choices and apply again.`);if(!n.configured)throw Error(v?`请先连接此服务。`:`Connect this service first.`);await he(e,D,n.revision),E(n),_e(!0),p?.()}catch(e){let n=e instanceof Error?e.message:String(e);G((!h&&t?v?`服务已保存,用途配置未完成。`:`Connection saved; model setup is incomplete. `:``)+n)}finally{H.current=!1,pe(!1)}},$=T?.profile.name??t?.name??e,Ee=T?.profile.apiKeyUrl??ge[e]?.apiKeyUrl;if(h){let t=T?.uses.find(e=>e.id===i),n=i?D.overrides?.[i]??t?.recommended:void 0,r=fe(e,$,v);return(0,U.jsxs)(`div`,{className:`space-y-6 p-4 sm:p-5`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:r}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i?`${v?`用于`:`For `}${oe[i][+!v]}`:``})]}),(0,U.jsx)(F,{variant:`ghost`,disabled:B||N,onClick:f,children:v?`更换服务`:`Change service`})]}),!T&&!W?(0,U.jsx)(A,{className:`h-48 w-full rounded-xl`}):null,T?(0,U.jsxs)(U.Fragment,{children:[Z,xe&&!X?(0,U.jsx)(de,{providerId:e,displayName:r,connected:X,onConnected:Ce,onPendingChange:P}):null,xe&&X?(0,U.jsxs)(`p`,{className:`flex items-center gap-2 rounded-xl bg-surface-inset px-4 py-3 text-sm text-fg`,children:[(0,U.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),v?`使用已有连接`:`Using the existing connection`]}):null,be?(0,U.jsx)(`div`,{className:`space-y-3`,children:z&&!ne?(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-inset px-4 py-3`,children:[(0,U.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),v?`使用已有连接`:`Using the existing connection`]}),(0,U.jsx)(F,{variant:`ghost`,disabled:B,onClick:()=>R(!0),children:Se?v?`更换`:`Change`:v?`添加 API Key`:`Add API key`})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`label`,{htmlFor:`provider-setup-key`,className:`text-sm font-medium text-fg`,children:T.profile.access===`subscription`?v?`订阅 API Key`:`Subscription API key`:`API Key`}),z?(0,U.jsx)(F,{variant:`ghost`,disabled:B,onClick:()=>{R(!1),L(``)},children:Se?v?`保留原 Key`:`Keep saved key`:v?`保留当前连接`:`Keep current connection`}):null]}),(0,U.jsx)(S,{id:`provider-setup-key`,disabled:B,value:I,onChange:L,placeholder:z?v?`输入新的 API Key`:`Enter a new API key`:v?`粘贴 API Key`:`Paste your API key`,labels:re(c(o).providersSettings)}),z?(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:v?`此服务的其他已配置模型也会使用新的 Key。`:`Other models configured with this service will also use the new key.`}):null,Ee?(0,U.jsx)(`a`,{className:`inline-flex min-h-10 items-center text-sm text-accent-fg hover:underline`,href:Ee,target:`_blank`,rel:`noopener noreferrer`,children:v?`获取 API Key`:`Get an API key`}):null]})}):null,t?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`label`,{className:`block text-sm font-medium text-fg`,children:v?`选择模型`:`Model`}),(0,U.jsx)(y,{value:n??``,disabled:B||!t.choices.length,"aria-label":v?`选择模型`:`Model`,onChange:e=>k({...D,selected:[t.id],overrides:{...D.overrides,[t.id]:e.target.value}}),children:[...t.choices].sort(ae).map(e=>(0,U.jsx)(b,{value:e.id,children:e.name},e.id))})]}):null,(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:[v?`只更改当前能力使用的模型。`:`Changes the model for this capability only.`,T.profile.interactiveOnly?v?` 后台任务继续使用原服务。`:` Background tasks keep their current service.`:``]})]}):null,W?(0,U.jsxs)(`div`,{role:`alert`,className:`space-y-2 rounded-xl border border-edge p-3`,children:[(0,U.jsx)(`p`,{className:`text-sm text-danger`,children:se?v?`连接信息已保存,模型尚未切换。请重试。`:`Connection saved. The model has not switched; please retry.`:v?`未能应用配置,请重试。`:`Could not apply settings. Please retry.`}),(0,U.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer`,children:v?`查看详情`:`Show details`}),(0,U.jsx)(`p`,{className:`mt-2 break-words`,children:W})]})]}):null,(0,U.jsx)(`div`,{className:`flex items-center justify-end gap-3 border-t border-edge-subtle pt-4`,children:(0,U.jsxs)(F,{variant:`primary`,disabled:B||!T&&!W||!!T&&(!z&&!I.trim()||!n||!t?.choices.some(e=>e.id===n)),onClick:()=>{T?Te():q(e=>e+1)},children:[B?(0,U.jsx)(w,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,B?v?`正在应用…`:`Applying…`:!T&&W?v?`重新加载`:`Reload`:W?v?`重试`:`Retry`:z&&!I.trim()?v?`使用此模型`:`Use this model`:v?`连接并使用`:`Connect and use`]})})]})}let De=h?`h3`:m,Oe=h?`p`:u;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 px-5 py-5`,children:[d&&!B&&!K?(0,U.jsx)(F,{variant:`ghost`,className:`shrink-0 p-1.5`,"aria-label":v?`返回`:`Back`,onClick:d,children:(0,U.jsx)(_,{className:`size-4`})}):null,(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(De,{className:`text-base font-semibold text-fg`,children:i?`${v?`连接服务 · `:`Connect service · `}${Ne[i][+!v]}`:v?`连接模型服务`:`Connect model service`}),(0,U.jsx)(Oe,{className:`mt-2 text-sm text-fg-muted`,children:$})]}),(0,U.jsx)(F,{variant:`ghost`,className:`shrink-0 p-1.5`,disabled:B,"aria-label":v?`关闭`:`Close`,onClick:f,children:(0,U.jsx)(O,{className:`size-4`})})]}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 pb-5`,children:[!T&&!W?(0,U.jsx)(A,{className:`h-64 w-full rounded-xl`}):null,T?(0,U.jsxs)(U.Fragment,{children:[Z,!K&&s.length>1&&l?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{className:`mb-2 block text-xs text-fg-muted`,children:v?`接入方式 / 地域`:`Access method / region`}),(0,U.jsx)(y,{value:e,disabled:B,"aria-label":v?`接入方式 / 地域`:`Access method / region`,onChange:e=>l(e.target.value),children:s.map(e=>(0,U.jsx)(b,{value:e.id,children:e.setupProfile?.name??e.name},e.id))})]}):null,K?(0,U.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-fg`,children:[(0,U.jsx)(x,{className:`size-4`}),a?v?`服务连接已保存`:`Connection saved`:v?`所选用途配置已保存`:`Selected model uses saved`]}):(0,U.jsxs)(U.Fragment,{children:[xe&&!X?(0,U.jsx)(de,{providerId:e,displayName:$,connected:X,onConnected:Ce,onPendingChange:P}):null,z&&!ne?(0,U.jsxs)(`div`,{role:`status`,className:`flex items-center justify-between gap-3 rounded-xl bg-surface-inset px-4 py-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,U.jsx)(x,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v?`服务已连接`:`Service connected`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:v?`可直接选择模型,无需重复填写凭据。`:`Choose a model without entering credentials again.`})]})]}),!r&&be?(0,U.jsx)(F,{variant:`ghost`,disabled:B,onClick:()=>R(!0),children:Se?v?`更换 API Key`:`Change API key`:v?`添加 API Key`:`Add API key`}):null]}):null,be&&!r&&(!z||ne)?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`label`,{htmlFor:`provider-setup-key`,className:`text-sm font-medium text-fg`,children:T.profile.access===`subscription`?v?`套餐 API Key`:`Plan API key`:`API Key`}),z?(0,U.jsx)(F,{variant:`ghost`,disabled:B,onClick:()=>{R(!1),L(``)},children:v?`取消更换`:`Cancel change`}):null]}),(0,U.jsx)(S,{id:`provider-setup-key`,disabled:B,value:I,onChange:L,placeholder:z?v?`输入新的 API Key`:`Enter a new API key`:`API Key`,labels:re(c(o).providersSettings)}),Ee?(0,U.jsx)(`a`,{className:`inline-flex min-h-8 items-center text-sm text-accent-fg hover:underline`,href:Ee,target:`_blank`,rel:`noopener noreferrer`,children:v?`获取对应接入方式的 Key`:`Get a key for this access method`}):null]}):null,!a&&!h?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:v?`模型用途`:`Model uses`}),(0,U.jsx)(ie,{className:`flex gap-2`,indicatorClassName:`rounded-lg bg-surface-active`,children:[`fill`,`replace`].map(e=>(0,U.jsx)(F,{variant:D.mode===e?`secondary`:`ghost`,disabled:B,"aria-pressed":D.mode===e,onClick:()=>we(e),children:e===`fill`?v?`补齐未配置`:`Fill missing`:v?`改用此服务`:`Switch to this service`},e))})]}):(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h?v?`仅更新当前能力,其他模型和参数保持原设置。`:`Only this capability changes; other settings are preserved.`:z?v?`连接已就绪,返回能力设置选择要使用的模型。`:`The connection is ready. Return to capability settings to choose a model.`:v?`保存连接后返回能力设置,再选择要使用的模型。`:`Save the connection, then choose a model in capability settings.`})]}),a?(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[v?`支持用途:`:`Supported uses: `,T.uses.filter(e=>e.choices.length&&(!i||e.id===i)).map(e=>Ne[e.id][+!v]).join(`、`)]}):null,a?null:(0,U.jsx)(`div`,{className:`divide-y divide-edge rounded-xl border border-edge bg-surface-inset px-4`,children:T.uses.filter(e=>!h||!i||e.id===i).map(e=>{let t=D.overrides?.[e.id]??e.recommended,n=e.choices.find(e=>e.id===t);return(0,U.jsxs)(`div`,{className:`space-y-2 py-3`,children:[(0,U.jsxs)(`label`,{className:`flex min-h-10 items-start gap-3`,children:[(0,U.jsx)(`input`,{hidden:h,type:`checkbox`,className:`ui-checkbox mt-1`,checked:Q.includes(e.id),disabled:h||B||K||!t||!e.choices.length,onChange:t=>k({...D,selected:t.target.checked?[...Q,e.id]:Q.filter(t=>t!==e.id)})}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Ne[e.id][+!v]}),(0,U.jsx)(`span`,{className:`mt-1 block break-all text-xs text-fg-muted`,children:Q.includes(e.id)?`${e.current?`${e.current} → `:``}${n?.name??t??``}`:e.current?`${v?`保留:`:`Keep: `}${e.current}`:e.reason===`interactive_only`?v?`此套餐不用于后台任务`:`This plan is not used for background tasks`:n?.name??(v?`暂无可自动配置的模型`:`No automatic model selection available`)})]})]}),!K&&e.choices.length>1?(0,U.jsxs)(`details`,{open:h||void 0,className:`pl-7`,children:[(0,U.jsx)(`summary`,{className:`text-xs text-accent-fg`,children:v?`选择具体模型`:`Choose a model`}),(0,U.jsx)(y,{value:t??``,disabled:B,"aria-label":Ne[e.id][+!v],onChange:t=>k({...D,selected:[...new Set([...Q,e.id])],overrides:{...D.overrides,[e.id]:t.target.value}}),children:[...e.choices].sort(ae).map(e=>(0,U.jsx)(b,{value:e.id,children:e.name},e.id))})]}):null]},e.id)})}),K?null:(0,U.jsx)(F,{variant:`ghost`,disabled:B,onClick:()=>q(e=>e+1),children:v?`刷新目录`:`Refresh catalog`}),!a&&!h?(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{className:`text-xs text-accent-fg`,children:v?`任务模型与其他用途`:`Task models and other uses`}),(0,U.jsxs)(`div`,{className:`mt-2 space-y-1 text-xs text-fg-muted`,children:[Object.entries(T.taskModels).map(([e,t])=>(0,U.jsxs)(`p`,{children:[e,`: `,t]},e)),(0,U.jsx)(`p`,{children:v?`未选用途与电脑操作保留当前配置;所选用途清除跨服务回退。`:`Unselected uses and Computer Use keep their settings. Selected uses clear cross-service fallbacks.`})]})]}):null,a?null:(0,U.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:T.profile.interactiveOnly?v?`此套餐仅用于交互任务。后台调用会检查使用范围,不会自动切换到其他收费来源。`:`This plan is for interactive tasks. Background calls check usage scope and do not automatically switch billing sources.`:v?`仅更新勾选的全局用途,智能体和会话的独立设置继续生效。`:`Only selected global uses change. Agent and session overrides remain effective.`}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:v?`配置保存与模型真实调用验证分别显示;此操作不会发送测试请求。`:`Saving settings does not perform a model test request.`})]}):null,W?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:W}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:T&&!K&&!a?v?`将配置 ${Q.length} 项`:`${Q.length} uses selected`:``}),K||a&&z&&!I.trim()&&!ne?(0,U.jsx)(F,{disabled:B||N||!T,onClick:()=>{K||p?.(),f()},children:a?v?`返回选择模型`:`Return to model selection`:v?`完成`:`Done`}):!T&&W?(0,U.jsx)(F,{onClick:()=>q(e=>e+1),children:v?`重试`:`Retry`}):(0,U.jsxs)(F,{onClick:()=>void Te(),disabled:B||N||!T||!z&&!I.trim()||h&&!Q.some(e=>D.overrides?.[e]||T.uses.find(t=>t.id===e)?.recommended),children:[B?(0,U.jsx)(w,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):null,B?v?`正在应用…`:`Applying…`:Q.length?h&&i?`${v?`连接并用于`:`Connect and use for `}${Ne[i][+!v]}`:v?`连接并应用`:`Connect and apply`:v?`仅连接`:`Connect only`]})]})]})}function Fe(e){let t=(0,H.c)(7),{target:n,targetUse:r,zh:i,onDone:a,onApplied:o}=e,s=i?`zh`:`en`,c;return t[0]!==o||t[1]!==a||t[2]!==s||t[3]!==n.modelIds||t[4]!==n.providerId||t[5]!==r?(c=(0,U.jsx)(Pe,{providerId:n.providerId,modelIds:n.modelIds,targetUse:r,language:s,existingConnection:!0,onDone:a,onApplied:o},n.providerId),t[0]=o,t[1]=a,t[2]=s,t[3]=n.modelIds,t[4]=n.providerId,t[5]=r,t[6]=c):c=t[6],c}function Ie(e){let t=(0,H.c)(38),{open:n,initialProviderId:r,initialUse:i,connectOnly:a,onOpenChange:o,builtinRows:s,customConfig:c,labels:u,language:d,onSaved:m}=e,g=a!==void 0&&a,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_={type:`pick`},t[0]=_):_=t[0];let[v,y]=(0,V.useState)(_),[b,x]=(0,V.useState)(``),S;t[1]!==r||t[2]!==v?(S=v.type===`pick`&&r?{type:`builtin`,providerId:r}:v,t[1]=r,t[2]=v,t[3]=S):S=t[3];let C=S,w=(0,V.useRef)(0),T;t[4]!==C.providerId||t[5]!==C.type||t[6]!==s?(T=C.type===`builtin`?s.find(e=>e.id===C.providerId)?.setupProfile?.brand:void 0,t[4]=C.providerId,t[5]=C.type,t[6]=s,t[7]=T):T=t[7];let E=T,D;t[8]===o?D=t[9]:(D=e=>{e||window.setTimeout(()=>{y({type:`pick`}),x(``),w.current=0},200),o(e)},t[8]=o,t[9]=D);let O=D,A;t[10]!==s||t[11]!==g||t[12]!==O||t[13]!==m?(A=(e,t)=>{let n=s.some(t=>t.id===e&&t.configured);g||t?.length===0||t===void 0&&n?(m(e),O(!1)):y({type:`success`,target:{providerId:e,modelIds:t}})},t[10]=s,t[11]=g,t[12]=O,t[13]=m,t[14]=A):A=t[14];let j=A,M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,U.jsx)(l,{className:k(`xopc-dialog-overlay fixed inset-0 bg-scrim`,te)}),t[15]=M):M=t[15];let N;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(N=k(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(40rem,calc(100vh-3rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay`,ee),t[16]=N):N=t[16];let P;t[17]!==C.presetKey||t[18]!==C.providerId||t[19]!==C.target||t[20]!==C.type||t[21]!==s||t[22]!==g||t[23]!==c||t[24]!==O||t[25]!==j||t[26]!==r||t[27]!==i||t[28]!==u||t[29]!==d||t[30]!==m||t[31]!==b||t[32]!==E?(P=(0,U.jsxs)(f,{children:[M,(0,U.jsx)(p,{className:N,children:C.type===`success`?(0,U.jsx)(Fe,{target:C.target,targetUse:i,zh:d===`zh`,onApplied:()=>m(C.target.providerId),onDone:()=>O(!1)}):C.type===`pick`?(0,U.jsx)(Re,{builtinRows:s,searchQuery:b,onSearchChange:x,labels:u,language:d,scrollTopRef:w,onPickBuiltin:e=>{let t=$(e);y(t?{type:`custom`,presetKey:t}:{type:`builtin`,providerId:e})},onPickCustom:()=>y({type:`custom`})}):C.type===`builtin`?(0,U.jsx)(Pe,{providerId:C.providerId,targetUse:i,connectOnly:g,row:s.find(e=>e.id===C.providerId),language:d,alternatives:E?s.filter(e=>e.setupProfile?.brand===E):[],onChooseProvider:e=>{let t=$(e);y(t?{type:`custom`,presetKey:t}:{type:`builtin`,providerId:e})},onBack:r?void 0:()=>y({type:`pick`}),onApplied:()=>{m(C.providerId),g&&O(!1)},onDone:()=>O(!1)},C.providerId):(0,U.jsx)(We,{initialPresetKey:C.presetKey,customConfig:c,labels:u,language:d,onBack:()=>y({type:`pick`}),onSaved:j})})]}),t[17]=C.presetKey,t[18]=C.providerId,t[19]=C.target,t[20]=C.type,t[21]=s,t[22]=g,t[23]=c,t[24]=O,t[25]=j,t[26]=r,t[27]=i,t[28]=u,t[29]=d,t[30]=m,t[31]=b,t[32]=E,t[33]=P):P=t[33];let F;return t[34]!==O||t[35]!==n||t[36]!==P?(F=(0,U.jsx)(h,{open:n,onOpenChange:O,children:P}),t[34]=O,t[35]=n,t[36]=P,t[37]=F):F=t[37],F}function Le(e){let t=(0,H.c)(4),{label:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=k(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,I.press),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,U.jsx)(O,{className:`size-4`,"aria-hidden":!0}),t[1]=i):i=t[1];let a;return t[2]===n?a=t[3]:(a=(0,U.jsx)(d,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:r,"aria-label":n,children:i})}),t[2]=n,t[3]=a),a}function Re({builtinRows:e,searchQuery:t,onSearchChange:n,labels:r,language:i,scrollTopRef:a,onPickBuiltin:o,onPickCustom:s}){let c=t.trim().toLowerCase(),l=(0,V.useRef)(null);(0,V.useLayoutEffect)(()=>{let e=l.current;e&&a.current>0&&(e.scrollTop=a.current)},[a]);let d=(0,V.useMemo)(()=>c?e.filter(e=>{let t=ge[e.id]?.aliases??[];return e.id.toLowerCase().includes(c)||e.name.toLowerCase().includes(c)||t.some(e=>e.toLowerCase().includes(c))}):e,[e,c]),f=(0,V.useMemo)(()=>{let e=new Set;return d.filter(t=>{let n=t.setupProfile?.brand??t.id;return e.has(n)?!1:(e.add(n),!0)})},[d]),p=f.filter(e=>e.id===`xopc-cloud`),h=p.map(e=>e.id),g=f.filter(e=>e.configured&&!h.includes(e.id)),_=(0,V.useMemo)(()=>ve(f.filter(e=>!h.includes(e.id)&&!e.configured)),[f,h]),y=e=>{let t=ge[e.id];return i===`zh`?t?.descriptionZh??t?.description:t?.description};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-5 pb-3 pt-5`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(m,{className:`text-base font-semibold text-fg`,children:r.step1Title}),(0,U.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:r.step1Subtitle})]}),(0,U.jsx)(Le,{label:r.close})]}),(0,U.jsx)(`div`,{className:`px-5 pb-3`,children:(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(E,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),(0,U.jsx)(`input`,{type:`search`,value:t,onChange:e=>n(e.target.value),placeholder:r.searchPlaceholder,autoComplete:`off`,className:k(`h-10 w-full rounded-xl border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg placeholder:text-fg-subtle`,R)})]})}),(0,U.jsx)(`div`,{ref:l,onScroll:e=>{a.current=e.currentTarget.scrollTop},className:`min-h-0 flex-1 overscroll-contain overflow-y-auto px-5 pb-5`,children:c&&f.length===0?(0,U.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:r.noResults}):c?(0,U.jsx)(ze,{title:r.searchResults,children:f.map(e=>(0,U.jsx)(Be,{row:e,description:y(e),labels:r,onPick:o},e.id))}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[p.length>0?(0,U.jsx)(ze,{title:r.quickStart,children:p.map(e=>(0,U.jsx)(Be,{row:e,description:y(e),labels:r,prominent:!0,onPick:o},e.id))}):null,g.length>0?(0,U.jsx)(ze,{title:r.connectedSection,children:g.map(e=>(0,U.jsx)(Be,{row:e,description:y(e),labels:r,onPick:o},e.id))}):null,_e.map(e=>{let t=_.get(e)??[];return t.length===0?null:(0,U.jsx)(ze,{title:r.categories[e]??e,children:t.map(e=>(0,U.jsx)(Be,{row:e,description:y(e),labels:r,onPick:o},e.id))},e)}),(0,U.jsxs)(`button`,{type:`button`,onClick:s,className:k(`flex w-full items-center gap-3 rounded-xl bg-surface-hover/25 px-4 py-3 text-left transition-colors`,`hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,U.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base/60 text-fg-muted`,children:(0,U.jsx)(C,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.addCustom}),(0,U.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-muted`,children:r.customDescription})]}),(0,U.jsx)(v,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})]})})]})}function ze(e){let t=(0,H.c)(7),{title:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,U.jsx)(`h3`,{className:`mb-1.5 px-1 text-xs font-semibold text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,U.jsx)(`div`,{className:`flex flex-col gap-1 rounded-xl bg-surface-hover/20 p-1`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,U.jsxs)(`section`,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Be(e){let t=(0,H.c)(27),{row:n,description:r,labels:i,prominent:a,onPick:o}=e,s=a!==void 0&&a,c;t[0]!==o||t[1]!==n.id?(c=()=>o(n.id),t[0]=o,t[1]=n.id,t[2]=c):c=t[2];let l=s&&`bg-surface-base/80`,u;t[3]===l?u=t[4]:(u=k(`flex min-h-12 w-full items-center gap-3 rounded-lg bg-surface-base/55 px-3 py-2.5 text-left transition-colors`,`hover:bg-surface-base focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,l),t[3]=l,t[4]=u);let d;t[5]===n.name?d=t[6]:(d=(0,U.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:n.name}),t[5]=n.name,t[6]=d);let f;t[7]!==i||t[8]!==s?(f=s?(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:i.recommended}):null,t[7]=i,t[8]=s,t[9]=f):f=t[9];let p;t[10]!==d||t[11]!==f?(p=(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[d,f]}),t[10]=d,t[11]=f,t[12]=p):p=t[12];let m;t[13]===r?m=t[14]:(m=r?(0,U.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:r}):null,t[13]=r,t[14]=m);let h;t[15]!==p||t[16]!==m?(h=(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17];let g;t[18]!==i||t[19]!==n.configured?(g=n.configured?(0,U.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-1 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,U.jsx)(x,{className:`size-3.5`,"aria-hidden":!0}),i.connected]}):null,t[18]=i,t[19]=n.configured,t[20]=g):g=t[20];let _;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,U.jsx)(v,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=_):_=t[21];let y;return t[22]!==g||t[23]!==c||t[24]!==u||t[25]!==h?(y=(0,U.jsxs)(`button`,{type:`button`,onClick:c,className:u,children:[h,g,_]}),t[22]=g,t[23]=c,t[24]=u,t[25]=h,t[26]=y):y=t[26],y}function Ve(e){return{clientKey:crypto.randomUUID(),value:e}}function He(e=`custom`){if(e!==`custom`&&Z[e]){let t=Z[e].config;return{preset:e,providerId:Q(e),baseUrl:t.baseUrl??``,api:t.api??`openai-completions`,apiKey:t.apiKey??``,modelSlots:(t.models?.map(e=>e.id)??[``]).map(Ve),error:null}}return{preset:`custom`,providerId:``,baseUrl:``,api:`openai-completions`,apiKey:``,modelSlots:[Ve(``)],error:null}}function Ue(e,t){switch(t.type){case`applyPreset`:return t.key===`custom`?{...e,preset:`custom`,error:null}:Z[t.key]?He(t.key):e;case`setProviderId`:return{...e,providerId:t.value};case`setBaseUrl`:return{...e,baseUrl:t.value};case`setApi`:return{...e,api:t.value};case`setApiKey`:return{...e,apiKey:t.value};case`addModelSlot`:return{...e,modelSlots:[...e.modelSlots,Ve(``)]};case`updateModelId`:return{...e,modelSlots:e.modelSlots.map((e,n)=>n===t.index?{...e,value:t.value}:e)};case`setModelIds`:return{...e,modelSlots:(t.values.length>0?t.values:[``]).map(Ve)};case`removeModelSlot`:return{...e,modelSlots:e.modelSlots.filter((e,n)=>n!==t.index)};case`setError`:return{...e,error:t.value}}}function We({initialPresetKey:e,customConfig:t,labels:n,language:r,onBack:i,onSaved:a}){let[o,s]=(0,V.useReducer)(Ue,void 0,()=>He(e)),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(!1),p=re(c(r).providersSettings),{preset:h,providerId:g,baseUrl:_,api:x,apiKey:C,modelSlots:D,error:A}=o,j=D.map(e=>e.value),M=async()=>{let e=g.trim(),r=_.trim();if(!e){s({type:`setError`,value:n.providerIdRequired});return}if(!r){s({type:`setError`,value:n.baseUrlRequired});return}let i=j.map(e=>e.trim()).filter(Boolean);u(!0),s({type:`setError`,value:null});try{let n=t?.providers??{},o=h===`custom`?void 0:Z[h]?.config,s={...o??{},baseUrl:r,api:x,apiKey:C.trim()||void 0,models:i.map(e=>o?.models?.find(t=>t.id===e)??{id:e})};await xe({providers:{...n,[e]:s}});let c=new Set(n[e]?.models?.map(e=>e.id)??[]);a(e,s.models?.filter(e=>!c.has(e.id)&&!e.computerUse).map(e=>e.id)??[])}catch(e){s({type:`setError`,value:e instanceof Error?e.message:n.saveError})}finally{u(!1)}},N=async()=>{let e=g.trim()||Q(h)||`custom`,t=_.trim();if(!t){s({type:`setError`,value:n.baseUrlRequired});return}f(!0),s({type:`setError`,value:null});try{let r=h===`custom`?void 0:Z[h]?.config,i=(await X({providerId:e,baseUrl:t,apiKey:C.trim()||void 0,api:x,headers:r?.headers})).map(e=>e.id).filter(e=>e&&!e.includes(`/`));s({type:`setModelIds`,values:i}),i.length===0&&s({type:`setError`,value:n.discoverModelsHint})}catch(e){s({type:`setError`,value:e instanceof Error?e.message:n.discoverModelsHint})}finally{f(!1)}},P=g.trim()&&_.trim(),ee=(x===`openai-completions`||x===`openai-responses`)&&_.trim();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-3 pt-5`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:i,className:k(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,I.press),"aria-label":n.back,children:(0,U.jsx)(v,{className:`size-4 rotate-180`,"aria-hidden":!0})}),(0,U.jsx)(m,{className:`min-w-0 flex-1 text-base font-semibold text-fg`,children:n.step2CustomTitle}),(0,U.jsx)(Le,{label:n.close})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 pb-4`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-hover/20 p-4`,children:[(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.customDescription}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`label`,{htmlFor:`custom-preset`,className:`text-sm font-medium text-fg`,children:n.presetLabel}),(0,U.jsxs)(y,{id:`custom-preset`,value:h,onChange:e=>s({type:`applyPreset`,key:e.target.value}),className:Oe(),children:[(0,U.jsx)(b,{value:`custom`,children:n.presetCustom}),Ce.map(e=>(0,U.jsx)(b,{value:e.key,children:e.label},e.key))]})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`label`,{htmlFor:`custom-provider-id`,className:`text-sm font-medium text-fg`,children:n.providerIdLabel}),(0,U.jsx)(`input`,{id:`custom-provider-id`,type:`text`,autoComplete:`off`,value:g,onChange:e=>s({type:`setProviderId`,value:e.target.value}),placeholder:n.providerIdPlaceholder,className:k(`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle`,R)})]}),(0,U.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`label`,{htmlFor:`custom-base-url`,className:`text-sm font-medium text-fg`,children:n.baseUrlLabel}),(0,U.jsx)(`input`,{id:`custom-base-url`,type:`url`,autoComplete:`off`,value:_,onChange:e=>s({type:`setBaseUrl`,value:e.target.value}),placeholder:n.baseUrlPlaceholder,className:k(`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle`,R)})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`label`,{htmlFor:`custom-api-type`,className:`text-sm font-medium text-fg`,children:n.apiTypeLabel}),(0,U.jsx)(y,{id:`custom-api-type`,value:x,onChange:e=>s({type:`setApi`,value:e.target.value}),className:Oe(),children:ye.map(e=>(0,U.jsx)(b,{value:e.value,children:e.label},e.value))})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`label`,{htmlFor:`custom-api-key`,className:`text-sm font-medium text-fg`,children:n.apiKeyLabel}),(0,U.jsx)(S,{id:`custom-api-key`,value:C,onChange:e=>s({type:`setApiKey`,value:e}),placeholder:n.apiKeyPlaceholder,labels:p})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.modelIdLabel}),(0,U.jsxs)(F,{type:`button`,variant:`secondary`,className:`gap-1.5`,disabled:!ee||d,onClick:()=>void N(),children:[d?(0,U.jsx)(w,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,U.jsx)(E,{className:`size-3.5`,"aria-hidden":!0}),d?n.discoveringModels:n.discoverModels]})]}),j.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`text`,autoComplete:`off`,value:e,onChange:e=>s({type:`updateModelId`,index:t,value:e.target.value}),placeholder:n.modelIdPlaceholder,className:k(`flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle`,R)}),j.length>1?(0,U.jsx)(`button`,{type:`button`,onClick:()=>s({type:`removeModelSlot`,index:t}),className:k(`rounded-lg p-1.5 text-fg-subtle hover:bg-surface-hover hover:text-fg`,I.press),children:(0,U.jsx)(O,{className:`size-3.5`,"aria-hidden":!0})}):null]},D[t].clientKey)),(0,U.jsxs)(F,{type:`button`,variant:`ghost`,className:`w-fit gap-1.5 text-fg-muted`,onClick:()=>s({type:`addModelSlot`}),children:[(0,U.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),n.addModel]})]}),A?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:A}):null]})}),(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-2 bg-surface-hover/15 px-5 py-3`,children:[(0,U.jsx)(F,{type:`button`,variant:`secondary`,onClick:i,children:n.cancel}),(0,U.jsx)(F,{type:`button`,variant:`primary`,disabled:!P||l,onClick:()=>void M(),children:l?(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(w,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),n.saving]}):n.save})]})]})}function Ge(){let e=(0,H.c)(29),t=!!o(Ze),{data:n,isLoading:r}=M(t),i;e[0]===t?i=e[1]:(i=t?a(`/api/providers/meta`):null,e[0]=t,e[1]=i);let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},e[2]=s):s=e[2];let{data:c,isLoading:l}=j(i,Xe,s),u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u={revalidateOnFocus:!1},e[3]=u):u=e[3];let{data:d,isLoading:f}=j(t?P:null,Ye,u),p;e[4]===d?p=e[5]:(p=d===void 0?[]:d,e[4]=d,e[5]=p);let m=p,h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1},e[6]=h):h=e[6];let{data:g}=j(t?ce:null,Je,h),_;bb0:{if(!c||n===void 0){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[7]=t):t=e[7],_=t;break bb0}let t;e[8]!==n?.payload?.config||e[9]!==c||e[10]!==m?(t=z(c,ue(n?.payload?.config),m),e[8]=n?.payload?.config,e[9]=c,e[10]=m,e[11]=t):t=e[11],_=t}let v=_,y;bb1:{if(!g){y=null;break bb1}let t;e[12]===g.config?t=e[13]:(t=Y(g.config),e[12]=g.config,e[13]=t),y=t}let b=y,x;if(e[14]!==v||e[15]!==b||e[16]!==c||e[17]!==m){x=[];let t=new Set((c??[]).filter(qe).map(Ke)),n;e[19]===b?n=e[20]:(n=new Set(b?Object.keys(b.providers):[]),e[19]=b,e[20]=n);let r=n;for(let e of v){if(!t.has(e.id))continue;let n=r.has(e.id),i=n?b.providers[e.id]?.models?.length??0:m.filter(t=>t.provider===e.id).length;x.push({id:e.id,name:e.name,configured:!0,isCustom:n,modelCount:i})}if(b){let t;e[21]===b.providers?t=e[22]:(t=Object.entries(b.providers),e[21]=b.providers,e[22]=t);for(let[e,n]of t)x.some(t=>t.id===e)||x.push({id:e,name:e,configured:!0,isCustom:!0,modelCount:n.models?.length??0})}e[14]=v,e[15]=b,e[16]=c,e[17]=m,e[18]=x}else x=e[18];let S=x,C=r||l||f,w;return e[23]!==v||e[24]!==S||e[25]!==b||e[26]!==C||e[27]!==m?(w={cards:S,loading:C,builtinRows:v,customConfig:b,allModels:m},e[23]=v,e[24]=S,e[25]=b,e[26]=C,e[27]=m,e[28]=w):w=e[28],w}function Ke(e){return e.id}function qe(e){return e.configured}function Je(){return be()}function Ye(){return N()}async function Xe(e){let{payload:t}=await(await fetch(e,{credentials:`same-origin`,redirect:`error`})).json();return t?.providers??[]}function Ze(e){return e.conversationId}function Qe(e){let t=(0,H.c)(12),{labels:n,data:r,onAdd:i,onManage:a}=e,{cards:o,loading:s}=r;if(s){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(A,{className:`h-6 w-48 max-w-full`}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,children:[e,(0,U.jsx)(`div`,{className:`flex flex-col gap-1`,children:[1,2,3].map(et)})]}),t[1]=n):n=t[1],n}let c;if(t[2]!==o||t[3]!==n||t[4]!==i||t[5]!==a){let e=o.filter($e),r=e.length>0?n.titleCount.replace(`{{count}}`,String(e.length)):n.title,s;t[7]===r?s=t[8]:(s=(0,U.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:r}),t[7]=r,t[8]=s);let l=e.length>0?(0,U.jsxs)(F,{type:`button`,variant:`primary`,className:`gap-1.5`,onClick:i,children:[(0,U.jsx)(T,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),n.addProvider]}):null,u;t[9]!==s||t[10]!==l?(u=(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[s,l]}),t[9]=s,t[10]=l,t[11]=u):u=t[11],c=(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u,e.length===0?(0,U.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/25 px-6 py-10 text-center`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.empty}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint}),(0,U.jsxs)(F,{type:`button`,variant:`primary`,className:`mt-4 gap-1.5`,onClick:i,children:[(0,U.jsx)(T,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),n.addProvider]})]}):(0,U.jsx)(`div`,{className:`flex flex-col gap-1 rounded-xl bg-surface-hover/20 p-1`,children:e.map(e=>(0,U.jsx)(tt,{card:e,labels:n,onManage:()=>a(e.id,e.isCustom)},e.id))})]}),t[2]=o,t[3]=n,t[4]=i,t[5]=a,t[6]=c}else c=t[6];return c}function $e(e){return e.configured}function et(e){return(0,U.jsx)(A,{className:`h-16 rounded-lg`},e)}function tt(e){let t=(0,H.c)(26),{card:n,labels:r,onManage:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(`group relative flex min-h-16 w-full flex-col justify-center gap-2 rounded-lg bg-surface-base/45 px-3 py-3 text-left transition-colors sm:flex-row sm:items-center sm:gap-4`,`hover:bg-surface-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,I.pressCard),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(x,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),t[1]=o):o=t[1];let s;t[2]===n.name?s=t[3]:(s=(0,U.jsx)(`span`,{className:`min-w-0 text-sm font-semibold leading-snug text-fg`,children:n.name}),t[2]=n.name,t[3]=s);let c;t[4]!==n.isCustom||t[5]!==r.custom?(c=n.isCustom?(0,U.jsx)(`span`,{className:`shrink-0 rounded bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium text-fg-subtle`,children:r.custom}):null,t[4]=n.isCustom,t[5]=r.custom,t[6]=c):c=t[6];let l;t[7]!==s||t[8]!==c?(l=(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[o,s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]!==n.modelCount||t[11]!==r.modelsCount||t[12]!==r.noModels?(u=n.modelCount>0?r.modelsCount.replace(`{{count}}`,String(n.modelCount)):r.noModels,t[10]=n.modelCount,t[11]=r.modelsCount,t[12]=r.noModels,t[13]=u):u=t[13];let d;t[14]===u?d=t[15]:(d=(0,U.jsx)(`span`,{className:`whitespace-nowrap text-xs text-fg-subtle`,children:u}),t[14]=u,t[15]=d);let f;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,U.jsx)(D,{className:`size-3`,"aria-hidden":!0}),t[16]=f):f=t[16];let p;t[17]===r.manage?p=t[18]:(p=(0,U.jsxs)(`span`,{className:`flex items-center gap-1 text-xs font-medium text-accent-fg`,children:[f,r.manage]}),t[17]=r.manage,t[18]=p);let m;t[19]!==d||t[20]!==p?(m=(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-4 pl-6 sm:justify-end sm:pl-0`,children:[d,p]}),t[19]=d,t[20]=p,t[21]=m):m=t[21];let h;return t[22]!==i||t[23]!==m||t[24]!==l?(h=(0,U.jsxs)(`button`,{type:`button`,onClick:i,className:a,children:[l,m]}),t[22]=i,t[23]=m,t[24]=l,t[25]=h):h=t[25],h}export{B as C,pe as S,K as _,Pe as a,W as b,Ee as c,$ as d,ke as f,ge as g,xe as h,Fe as i,De as l,Se as m,Ge as n,je as o,Oe as p,Ie as r,Me as s,Qe as t,Ae as u,G as v,me as x,he as y};