@xopcai/xopc 0.0.432 → 0.0.434

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 (659) hide show
  1. package/README.md +5 -5
  2. package/README.zh-CN.md +5 -5
  3. package/dist/browser-ext/dist/sidepanel.js +11 -0
  4. package/dist/browser-ext/manifest.json +1 -1
  5. package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
  6. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  7. package/dist/extensions/telegram/src/inbound-processor.js +2 -2
  8. package/dist/extensions/telegram/src/outbound-sender.js +1 -1
  9. package/dist/extensions/telegram/src/plugin.js +2 -2
  10. package/dist/extensions/telegram/xopc.extension.json +1 -1
  11. package/dist/extensions/weixin/src/api/api.js +2 -2
  12. package/dist/extensions/weixin/src/auth/accounts.js +12 -12
  13. package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
  14. package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
  15. package/dist/gateway/static/root/assets/{activity-store-iTw0JzOx.js → activity-store-Cwn_CNwl.js} +1 -1
  16. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CXuMwQ4y.js → agent-avatar-dicebear-Cd23LnJJ.js} +1 -1
  17. package/dist/gateway/static/root/assets/{agent-avatar-display-hRyDKdPJ.js → agent-avatar-display-ByzM7u9S.js} +2 -2
  18. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BBRKBHLB.js → agent-defaults-settings-panel-B0i37diS.js} +1 -1
  19. package/dist/gateway/static/root/assets/{agent-plugin-dialog-PoKk6j20.js → agent-plugin-dialog-XN-tZ-Ox.js} +1 -1
  20. package/dist/gateway/static/root/assets/{agents--P5-QEHR.js → agents-ZDA1OaLv.js} +3 -3
  21. package/dist/gateway/static/root/assets/{agents-admin-api-DuYzWKP8.js → agents-admin-api-B5lKH_ps.js} +1 -1
  22. package/dist/gateway/static/root/assets/{api-DT_Aly4B.js → api-B9fZL-V8.js} +1 -1
  23. package/dist/gateway/static/root/assets/{api-BeNB3MkI.js → api-Djju8qIR.js} +1 -1
  24. package/dist/gateway/static/root/assets/{app-management-settings-panel-C4JhA-Kz.js → app-management-settings-panel-IlyzDPJu.js} +1 -1
  25. package/dist/gateway/static/root/assets/{appearance-settings-YM311zxY.js → appearance-settings-BxdFGob3.js} +1 -1
  26. package/dist/gateway/static/root/assets/apps-page-CxEKiOTA.js +1 -0
  27. package/dist/gateway/static/root/assets/{archive-plugin-DoYjGZv1.js → archive-plugin-4gEvotPr.js} +1 -1
  28. package/dist/gateway/static/root/assets/{automation-api-ZD1VY9jO.js → automation-api-4fVKv9PJ.js} +1 -1
  29. package/dist/gateway/static/root/assets/{automation-result-state-BO5N3gMt.js → automation-result-state-m7PeK2kl.js} +1 -1
  30. package/dist/gateway/static/root/assets/automation-run-list-CJOdy_R2.js +1 -0
  31. package/dist/gateway/static/root/assets/{automation-task-card--K7uiKHL.js → automation-task-card-DZWhCWJa.js} +3 -3
  32. package/dist/gateway/static/root/assets/{automations-page-Clcl5MI7.js → automations-page-CmxICTM4.js} +1 -1
  33. package/dist/gateway/static/root/assets/automations-workspace-R6YNDdAO.js +9 -0
  34. package/dist/gateway/static/root/assets/{binary-plugins-B-dkI6-B.js → binary-plugins-69WyJLNW.js} +1 -1
  35. package/dist/gateway/static/root/assets/{block-editor-CB6KruU-.js → block-editor-DUONDIZR.js} +1 -1
  36. package/dist/gateway/static/root/assets/{browser-automation-inputs-Bk_QFbzb.js → browser-automation-inputs-DL4YPCuN.js} +1 -1
  37. package/dist/gateway/static/root/assets/{browser-automations-page-54eckhYq.js → browser-automations-page-1Aq6XmRs.js} +1 -1
  38. package/dist/gateway/static/root/assets/{browser-control-api-B4T1KPPz.js → browser-control-api-yjru8E7R.js} +1 -1
  39. package/dist/gateway/static/root/assets/{browser-settings-page-rOmS1-T8.js → browser-settings-page-CvwpT8Um.js} +1 -1
  40. package/dist/gateway/static/root/assets/{capabilities-D_Uqx5il.js → capabilities-C7lnwKKm.js} +1 -1
  41. package/dist/gateway/static/root/assets/{capabilities-DBDeifNA.js → capabilities-DaeQXJT4.js} +1 -1
  42. package/dist/gateway/static/root/assets/capabilities-page-B5avAOUM.js +2 -0
  43. package/dist/gateway/static/root/assets/{capabilities-settings-panel-iQPbNO4A.js → capabilities-settings-panel-_9yCS78i.js} +1 -1
  44. package/dist/gateway/static/root/assets/capability-links-DeO34GIF.js +1 -0
  45. package/dist/gateway/static/root/assets/{channels-DsEP_hFB.js → channels-CoQb4HOF.js} +1 -1
  46. package/dist/gateway/static/root/assets/{chat-agents-api-D5-xZdAt.js → chat-agents-api-BUi_7GRo.js} +1 -1
  47. package/dist/gateway/static/root/assets/{chat-chart-block-B-ri4wfk.js → chat-chart-block-CcVcKsDZ.js} +1 -1
  48. package/dist/gateway/static/root/assets/chat-page-BJ8PlDjZ.js +72 -0
  49. package/dist/gateway/static/root/assets/{chat-terminal-dock-RcrdmYe8.js → chat-terminal-dock-BMXJpPuH.js} +1 -1
  50. package/dist/gateway/static/root/assets/{command-palette-api-DFd-zOz_.js → command-palette-api-luUjQPsh.js} +1 -1
  51. package/dist/gateway/static/root/assets/{composer-payload-handoff-hccuv1Lk.js → composer-payload-handoff-B5XNxNCb.js} +1 -1
  52. package/dist/gateway/static/root/assets/computer-settings-page-CWtdyEJH.js +1 -0
  53. package/dist/gateway/static/root/assets/connected-providers-grid-2idMtk65.js +1 -0
  54. package/dist/gateway/static/root/assets/connection-usage-Cm_McddI.js +1 -0
  55. package/dist/gateway/static/root/assets/connection-usage-guide-Ddh0bfkj.js +1 -0
  56. package/dist/gateway/static/root/assets/{connector-service-page-C3ZhlR8V.js → connector-service-page-C3msXaBk.js} +1 -1
  57. package/dist/gateway/static/root/assets/{connectors-api-D6CPY0Nu.js → connectors-api-NcWECWKg.js} +1 -1
  58. package/dist/gateway/static/root/assets/connectors-page-Crb6DILX.js +1 -0
  59. package/dist/gateway/static/root/assets/{date-picker-D3bxeryy.js → date-picker-Cfjq1hD_.js} +1 -1
  60. package/dist/gateway/static/root/assets/{desktop-pet-B7kSoCSo.js → desktop-pet-ChFn9v-3.js} +1 -1
  61. package/dist/gateway/static/root/assets/{desktop-pet-settings-3dEeKSHA.js → desktop-pet-settings-DvnVIv25.js} +1 -1
  62. package/dist/gateway/static/root/assets/{dev-view-store-Dk7ylv5S.js → dev-view-store-DQJ61P5L.js} +1 -1
  63. package/dist/gateway/static/root/assets/{device-pairing-wizard-CstPAnnj.js → device-pairing-wizard-KxaIL-OX.js} +1 -1
  64. package/dist/gateway/static/root/assets/{directory-picker-path-field-BUGqS-lm.js → directory-picker-path-field-Drv864uE.js} +1 -1
  65. package/dist/gateway/static/root/assets/{discussion-annotation-sync-D9-wFJDS.js → discussion-annotation-sync-DfBRkWtw.js} +1 -1
  66. package/dist/gateway/static/root/assets/{extension-debug-page-BDTA9XDE.js → extension-debug-page-DAlBIt_R.js} +1 -1
  67. package/dist/gateway/static/root/assets/{extension-iframe-host-CPEaw2ZG.js → extension-iframe-host-Bds-5kY_.js} +1 -1
  68. package/dist/gateway/static/root/assets/{extension-marketplace-api-edmEFM6F.js → extension-marketplace-api-CZg8nBwW.js} +1 -1
  69. package/dist/gateway/static/root/assets/{extension-page-Biz-65E8.js → extension-page-ZTw-oucT.js} +1 -1
  70. package/dist/gateway/static/root/assets/{extension-provider-DCur0Xcb.js → extension-provider-NKWfjpdP.js} +1 -1
  71. package/dist/gateway/static/root/assets/{extension-settings-page-CvPK63oz.js → extension-settings-page-CT7PPt_q.js} +1 -1
  72. package/dist/gateway/static/root/assets/{file-preview-surface-BFs1sAID.js → file-preview-surface-BcLeaSNe.js} +1 -1
  73. package/dist/gateway/static/root/assets/{gateway-config-swr-C-fPl1hP.js → gateway-config-swr-Cq-ByXL4.js} +1 -1
  74. package/dist/gateway/static/root/assets/{gateway-realtime-xZpX_HCq.js → gateway-realtime-DwMd2PCt.js} +1 -1
  75. package/dist/gateway/static/root/assets/gateway-realtime-store-CHrf6-nR.js +1 -0
  76. package/dist/gateway/static/root/assets/{gateway-restart-BfozBI8f.js → gateway-restart-DdiVzbkL.js} +1 -1
  77. package/dist/gateway/static/root/assets/{gateway-settings-A8BUKcfx.js → gateway-settings-1QUdNwrZ.js} +1 -1
  78. package/dist/gateway/static/root/assets/{gateway-startup-retry-BRrkiv67.js → gateway-startup-retry-PMJi5mX4.js} +1 -1
  79. package/dist/gateway/static/root/assets/{global-defaults-api-C9O_X0pj.js → global-defaults-api-DgzZh3wX.js} +1 -1
  80. package/dist/gateway/static/root/assets/{home-page-CzS-ROXe.js → home-page-Chn7YTiD.js} +2 -2
  81. package/dist/gateway/static/root/assets/{image-generation-api-ohquPPls.js → image-generation-api-CjVpsckq.js} +1 -1
  82. package/dist/gateway/static/root/assets/{imports-page-DAebChWv.js → imports-page-CJCvZFaQ.js} +1 -1
  83. package/dist/gateway/static/root/assets/index-DWQ4LbBn.js +11 -0
  84. package/dist/gateway/static/root/assets/index-iukJWzxG.css +1 -0
  85. package/dist/gateway/static/root/assets/install-connector-dialog-Bo06Ry3H.js +1 -0
  86. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Bv4YJpTl.js → keyboard-shortcuts-settings-BylFJeGu.js} +1 -1
  87. package/dist/gateway/static/root/assets/{local-app-workbench-page-OhV8UnzK.js → local-app-workbench-page-B3MSSFsr.js} +1 -1
  88. package/dist/gateway/static/root/assets/{local-apps-page-ADzWmh3T.js → local-apps-page-BeV86rMJ.js} +1 -1
  89. package/dist/gateway/static/root/assets/{local-session-drafts-DgtYzPiy.js → local-session-drafts-jgw8UGsO.js} +2 -2
  90. package/dist/gateway/static/root/assets/{locale-store-fGFrr4_4.js → locale-store-CAZaC05J.js} +1 -1
  91. package/dist/gateway/static/root/assets/{logs-page-i0eD_bSC.js → logs-page-BMmSsUP5.js} +1 -1
  92. package/dist/gateway/static/root/assets/{management-settings-C-JTxRjw.js → management-settings-Bu7T8ewk.js} +1 -1
  93. package/dist/gateway/static/root/assets/{markdown-view-Cnt8oxNg.js → markdown-view-BatP4qeK.js} +1 -1
  94. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-BQ_US_jP.js → mcp-conversation-setup-page-rROtr0UN.js} +1 -1
  95. package/dist/gateway/static/root/assets/{media-plugins-cphVSfva.js → media-plugins-88OV72YE.js} +1 -1
  96. package/dist/gateway/static/root/assets/messages-C7fckbyG.js +3 -0
  97. package/dist/gateway/static/root/assets/{model-selector-Bv-anQ6O.js → model-selector-raBRBkN_.js} +1 -1
  98. package/dist/gateway/static/root/assets/{models-hub-cache-BLYpN4bJ.js → models-hub-cache-CzC9y3D0.js} +1 -1
  99. package/dist/gateway/static/root/assets/{note-detail-panel-B-pk3LYN.js → note-detail-panel-BvA8Vkbm.js} +3 -3
  100. package/dist/gateway/static/root/assets/note-image-lightbox-D6kUDDd5.js +1 -0
  101. package/dist/gateway/static/root/assets/{notes-api-IIQgxlMj.js → notes-api-zXpV6UXu.js} +1 -1
  102. package/dist/gateway/static/root/assets/{notes-page-C6l9zI17.js → notes-page-CjYH9Kle.js} +1 -1
  103. package/dist/gateway/static/root/assets/{oauth-api-BojfhqmL.js → oauth-api-DmxSaxM1.js} +1 -1
  104. package/dist/gateway/static/root/assets/{oauth-provider-connect-D_p1ez-o.js → oauth-provider-connect-D4Gfs-Ba.js} +1 -1
  105. package/dist/gateway/static/root/assets/{page-context-capture-button-CiEaCz7v.js → page-context-capture-button-Mig3d0UX.js} +1 -1
  106. package/dist/gateway/static/root/assets/{page-context-draft-BbGvUKjF.js → page-context-draft-C4IIZaKd.js} +1 -1
  107. package/dist/gateway/static/root/assets/page-header-store-D7G5utVi.js +1 -0
  108. package/dist/gateway/static/root/assets/{personal-avatar-Cq0y6LEK.js → personal-avatar-DLa-CpaK.js} +1 -1
  109. package/dist/gateway/static/root/assets/{personal-page-CDad-FDO.js → personal-page-l9_vYfdJ.js} +1 -1
  110. package/dist/gateway/static/root/assets/{personal-settings-panel-yVUzcKoo.js → personal-settings-panel-XSUkgcr2.js} +1 -1
  111. package/dist/gateway/static/root/assets/phone-dependencies-card-DYwnuVh3.js +1 -0
  112. package/dist/gateway/static/root/assets/phone-model-connection-2F32QTHA.js +1 -0
  113. package/dist/gateway/static/root/assets/phone-model-picker-DCVzIr0s.js +1 -0
  114. package/dist/gateway/static/root/assets/phone-settings-page-DJttE4id.js +1 -0
  115. package/dist/gateway/static/root/assets/{phone-workspace-store-DoTZvoDh.js → phone-workspace-store-Dxp-KhFP.js} +1 -1
  116. package/dist/gateway/static/root/assets/plugin-details-dialog-tyjAjFjA.js +1 -0
  117. package/dist/gateway/static/root/assets/{preference-select-fields-oZm_6PvN.js → preference-select-fields-BVP3MhGK.js} +1 -1
  118. package/dist/gateway/static/root/assets/{product-automation-feedback-Ddj5cmmF.js → product-automation-feedback-DbJvv92z.js} +1 -1
  119. package/dist/gateway/static/root/assets/{product-open-page-CTuqeUDh.js → product-open-page-RImqlhCD.js} +1 -1
  120. package/dist/gateway/static/root/assets/{product-preview-content-Ci8eDZ2h.js → product-preview-content-DxSqrKsg.js} +1 -1
  121. package/dist/gateway/static/root/assets/{product-preview-modal-J-9O-eQ2.js → product-preview-modal-Cw8Q8Uom.js} +2 -2
  122. package/dist/gateway/static/root/assets/{project-detail-page-D8QlmMQp.js → project-detail-page-BbyV8EiG.js} +1 -1
  123. package/dist/gateway/static/root/assets/{project-understanding-8DBS77KV.js → project-understanding-BMKcoUW5.js} +1 -1
  124. package/dist/gateway/static/root/assets/{projects-page-CEyyFqca.js → projects-page-CFsABLvs.js} +1 -1
  125. package/dist/gateway/static/root/assets/{providers-api-DyX07mht.js → providers-api-CAeXbJNF.js} +1 -1
  126. package/dist/gateway/static/root/assets/{recording-upload-DOhMs_aU.js → recording-upload-CfpllTe5.js} +1 -1
  127. package/dist/gateway/static/root/assets/{registry-api-Bm7kut54.js → registry-api-fLOqFyrz.js} +1 -1
  128. package/dist/gateway/static/root/assets/{remote-access-hub-DfCkv8XR.js → remote-access-hub-BvKOxy0L.js} +1 -1
  129. package/dist/gateway/static/root/assets/{resource-unavailable-jg8QV_tO.js → resource-unavailable-D15jzjV_.js} +1 -1
  130. package/dist/gateway/static/root/assets/route-preload-BWpw9qxc.js +2 -0
  131. package/dist/gateway/static/root/assets/{runtime-tools-api-BpaZgv-a.js → runtime-tools-api-D0Nrvuqv.js} +1 -1
  132. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CGnX0DY1.js → runtime-tools-settings-panel-CA27XgL2.js} +1 -1
  133. package/dist/gateway/static/root/assets/{service-recommendation-list-NdwoBa_O.js → service-recommendation-list-B0RoYLVT.js} +1 -1
  134. package/dist/gateway/static/root/assets/session-api-CHRP5Lwf.js +1 -0
  135. package/dist/gateway/static/root/assets/session-channel-icon-D1ktvt1P.js +1 -0
  136. package/dist/gateway/static/root/assets/session-identity-label-BP7OIYth.js +1 -0
  137. package/dist/gateway/static/root/assets/session-manager-DRRWwKE4.js +25 -0
  138. package/dist/gateway/static/root/assets/{sessions-page-CAutHonI.js → sessions-page-uJHS3-6F.js} +1 -1
  139. package/dist/gateway/static/root/assets/settings-advanced-gate-CZ4J3Kuy.js +1 -0
  140. package/dist/gateway/static/root/assets/{settings-advanced-section-CICMnCwv.js → settings-advanced-section-D-llwfSj.js} +1 -1
  141. package/dist/gateway/static/root/assets/{settings-mode-store-DCnYgG87.js → settings-mode-store-BspMKc9N.js} +1 -1
  142. package/dist/gateway/static/root/assets/{settings-page-CZXi8Jro.js → settings-page-XJXcnE1_.js} +1 -1
  143. package/dist/gateway/static/root/assets/{settings-page-header-DH1qb4vP.js → settings-page-header-LuOJvqNa.js} +1 -1
  144. package/dist/gateway/static/root/assets/{settings-page-layout-B2G042F2.js → settings-page-layout-CduQ8w4a.js} +1 -1
  145. package/dist/gateway/static/root/assets/{setup-interaction-page-B-tpfd3l.js → setup-interaction-page-ujpPGl84.js} +1 -1
  146. package/dist/gateway/static/root/assets/{setup-status-panel-DtA2Lb-A.js → setup-status-panel-BN2aCJUN.js} +1 -1
  147. package/dist/gateway/static/root/assets/{share-link-dialog-BjjkGRWn.js → share-link-dialog-CTATUaa4.js} +1 -1
  148. package/dist/gateway/static/root/assets/{share-preview-page-BBaJCO3w.js → share-preview-page-Dq0J3VgS.js} +1 -1
  149. package/dist/gateway/static/root/assets/{shares-api-C1rliVTe.js → shares-api-zegE8pSE.js} +1 -1
  150. package/dist/gateway/static/root/assets/{shares-settings-BMctLz4y.js → shares-settings-DXpvsRXq.js} +1 -1
  151. package/dist/gateway/static/root/assets/{skill-api-fWp7oUet.js → skill-api-DCL1EN7f.js} +1 -1
  152. package/dist/gateway/static/root/assets/{skill-list-api-B-2Dod7G.js → skill-list-api-Bv0mmHbu.js} +1 -1
  153. package/dist/gateway/static/root/assets/{skill-reload-api-Cejk-tbD.js → skill-reload-api-DPZbadiO.js} +1 -1
  154. package/dist/gateway/static/root/assets/{skills-page-D-dxO0Vc.js → skills-page-DMC7Gaku.js} +1 -1
  155. package/dist/gateway/static/root/assets/{system-settings-panel-D-gdBXlK.js → system-settings-panel-BYFUhlqG.js} +1 -1
  156. package/dist/gateway/static/root/assets/{task-detail-page-CIX4EckU.js → task-detail-page-DvX9JoEd.js} +3 -3
  157. package/dist/gateway/static/root/assets/{task-result-evidence-Dp6gk3xn.js → task-result-evidence-Bxm8-H0B.js} +1 -1
  158. package/dist/gateway/static/root/assets/{terminal-panel-store-BDrza-7c.js → terminal-panel-store-Djf9l2qZ.js} +1 -1
  159. package/dist/gateway/static/root/assets/{theme-store-De43hGnm.js → theme-store-8GFVtotZ.js} +1 -1
  160. package/dist/gateway/static/root/assets/{tracing-settings-page-DlQJAutq.js → tracing-settings-page-oWW3SBZ4.js} +1 -1
  161. package/dist/gateway/static/root/assets/{tunnel-api-BSeDyRBI.js → tunnel-api-D-mEsSGF.js} +1 -1
  162. package/dist/gateway/static/root/assets/{understanding-activity-store-CABSRtdN.js → understanding-activity-store-CvDjsd0I.js} +1 -1
  163. package/dist/gateway/static/root/assets/{understanding-refresh-store-C5pXQtC9.js → understanding-refresh-store-DzOZJm7A.js} +1 -1
  164. package/dist/gateway/static/root/assets/{usage-page-Dd6gyHlm.js → usage-page-z-o6Uuev.js} +1 -1
  165. package/dist/gateway/static/root/assets/{use-autosave-BhdMHxgz.js → use-autosave-BVYS8UoK.js} +1 -1
  166. package/dist/gateway/static/root/assets/{use-composer-attachments-Baw8AHhn.js → use-composer-attachments-lecOV2q5.js} +1 -1
  167. package/dist/gateway/static/root/assets/{use-file-preview-expanded-B_cRX1Ih.js → use-file-preview-expanded-nd_CuFsd.js} +2 -2
  168. package/dist/gateway/static/root/assets/{use-personal-profile-DL5rDvwX.js → use-personal-profile-CQi2ZCxV.js} +1 -1
  169. package/dist/gateway/static/root/assets/{use-workspace-tree-DONQqfmT.js → use-workspace-tree-BiaddkzX.js} +1 -1
  170. package/dist/gateway/static/root/assets/{user-model-page-u2vtyxcX.js → user-model-page-Bks1n0Nj.js} +1 -1
  171. package/dist/gateway/static/root/assets/{voice-api-key-field-OChN73N1.js → voice-api-key-field-BbW8NFeZ.js} +1 -1
  172. package/dist/gateway/static/root/assets/{voice-config-api-CziHHWRu.js → voice-config-api-jSMzZWWy.js} +1 -1
  173. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-CWSb-oJe.js → voice-input-shortcut-events-_SgYmx7X.js} +1 -1
  174. package/dist/gateway/static/root/assets/{voice-transcribe-api-CqEwxj11.js → voice-transcribe-api-BJCfiRFU.js} +1 -1
  175. package/dist/gateway/static/root/assets/{work-discovery-overlay-BJT2mARb.js → work-discovery-overlay-DSTSNyU7.js} +1 -1
  176. package/dist/gateway/static/root/assets/{work-discovery-page-CkHMAnBc.js → work-discovery-page-Dd_QJJvb.js} +1 -1
  177. package/dist/gateway/static/root/assets/{working-directory-picker-modal-CpZEiO2a.js → working-directory-picker-modal-q39BUcJ6.js} +1 -1
  178. package/dist/gateway/static/root/assets/{workspace-api-Yi28Sl0C.js → workspace-api-Di2OmCvz.js} +2 -2
  179. package/dist/gateway/static/root/assets/workspace-editor-agent-store-B2r9wlix.js +1 -0
  180. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-MLLldcHQ.js → workspace-file-preview-dialog-BUGNT765.js} +1 -1
  181. package/dist/gateway/static/root/assets/{workspace-open-location-menu-CjfDtW9T.js → workspace-open-location-menu-bMSvmQW7.js} +1 -1
  182. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-FioKsLPf.js → xopc-cloud-account-card-Bbe19Del.js} +1 -1
  183. package/dist/gateway/static/root/index.html +87 -85
  184. package/dist/package.js +1 -1
  185. package/dist/packages/computer-control-contract/src/index.js +33 -3
  186. package/dist/packages/gateway-contract/src/session-identity.js +2 -1
  187. package/dist/packages/gateway-contract/src/session-input-command.js +19 -2
  188. package/dist/packages/gateway-contract/src/specialists.js +1 -0
  189. package/dist/src/agent/agent-manager.js +17 -17
  190. package/dist/src/agent/agent-scope.js +2 -2
  191. package/dist/src/agent/background-review/prompts.js +1 -1
  192. package/dist/src/agent/background-review/run-background-review.js +11 -11
  193. package/dist/src/agent/child-agent-factory.js +2 -2
  194. package/dist/src/agent/context/coordinator.js +2 -2
  195. package/dist/src/agent/context/execution-context.js +4 -4
  196. package/dist/src/agent/context/project-context.js +3 -3
  197. package/dist/src/agent/data-acquisition/service.js +1 -1
  198. package/dist/src/agent/embedded/codemode-extension.js +1 -1
  199. package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -1
  200. package/dist/src/agent/embedded/execution-tool-policy.js +3 -3
  201. package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
  202. package/dist/src/agent/embedded/run-for-session.js +29 -14
  203. package/dist/src/agent/embedded/run-turn.js +48 -25
  204. package/dist/src/agent/embedded/runs.d.ts +2 -2
  205. package/dist/src/agent/embedded/runs.js +4 -4
  206. package/dist/src/agent/embedded/session-runner.js +30 -15
  207. package/dist/src/agent/embedded/session-tool-result-guard.js +1 -1
  208. package/dist/src/agent/embedded/tool-search-extension.d.ts +8 -2
  209. package/dist/src/agent/embedded/tool-search-extension.js +122 -30
  210. package/dist/src/agent/embedded/xopc-tools-bridge.js +1 -1
  211. package/dist/src/agent/external-tools/cliProvider.d.ts +10 -9
  212. package/dist/src/agent/external-tools/cliProvider.js +27 -7
  213. package/dist/src/agent/external-tools/composio-provider.d.ts +3 -3
  214. package/dist/src/agent/external-tools/composio-provider.js +8 -5
  215. package/dist/src/agent/external-tools/discovery.d.ts +47 -0
  216. package/dist/src/agent/external-tools/discovery.js +56 -0
  217. package/dist/src/agent/external-tools/endpoint-provider.js +4 -4
  218. package/dist/src/agent/external-tools/extension-provider.js +1 -1
  219. package/dist/src/agent/external-tools/gateway-tools.js +27 -47
  220. package/dist/src/agent/external-tools/index.d.ts +1 -0
  221. package/dist/src/agent/external-tools/index.js +7 -0
  222. package/dist/src/agent/external-tools/memory-provider.js +1 -1
  223. package/dist/src/agent/external-tools/personal-request-scope.d.ts +7 -0
  224. package/dist/src/agent/external-tools/personal-request-scope.js +83 -0
  225. package/dist/src/agent/external-tools/read-policy.js +5 -4
  226. package/dist/src/agent/external-tools/service.d.ts +2 -0
  227. package/dist/src/agent/external-tools/service.js +22 -3
  228. package/dist/src/agent/external-tools/tool-registry.d.ts +6 -0
  229. package/dist/src/agent/external-tools/types.d.ts +7 -2
  230. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  231. package/dist/src/agent/image/generation/runtime.js +1 -1
  232. package/dist/src/agent/image/index.js +1 -1
  233. package/dist/src/agent/inbound/attachment-pipeline.js +2 -2
  234. package/dist/src/agent/inbound/inbound-loop.js +2 -2
  235. package/dist/src/agent/inbound/turn-dispatcher.d.ts +1 -1
  236. package/dist/src/agent/inbound/turn-dispatcher.js +3 -2
  237. package/dist/src/agent/independent-execution.js +2 -2
  238. package/dist/src/agent/index.js +3 -3
  239. package/dist/src/agent/mcp/connection-drafts.js +1 -1
  240. package/dist/src/agent/mcp/connection-setup.js +1 -1
  241. package/dist/src/agent/mcp/conversation-setup.js +1 -1
  242. package/dist/src/agent/mcp/discovery.js +2 -2
  243. package/dist/src/agent/mcp/transport.js +1 -1
  244. package/dist/src/agent/memory/index.js +1 -1
  245. package/dist/src/agent/orchestration/llm-turn-retry.d.ts +1 -1
  246. package/dist/src/agent/orchestration/llm-turn-retry.js +14 -9
  247. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +1 -0
  248. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +3 -1
  249. package/dist/src/agent/prompt/response-language.js +1 -1
  250. package/dist/src/agent/prompt/sections/tooling.js +1 -1
  251. package/dist/src/agent/prompt/service-prompt-builder.js +3 -3
  252. package/dist/src/agent/prompt/system-prompt-params.js +1 -1
  253. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  254. package/dist/src/agent/service/direct-turn-helpers.js +6 -6
  255. package/dist/src/agent/service/process-direct-streaming.js +6 -6
  256. package/dist/src/agent/service/webchat-tts.js +2 -2
  257. package/dist/src/agent/service.js +21 -21
  258. package/dist/src/agent/session/session-config-service.js +2 -2
  259. package/dist/src/agent/session/session-hydrator.js +1 -1
  260. package/dist/src/agent/session/session-inspector.js +1 -1
  261. package/dist/src/agent/skills/filesystem-watcher.js +1 -1
  262. package/dist/src/agent/skills/hub-lock.js +1 -1
  263. package/dist/src/agent/skills/hub-pull.js +2 -2
  264. package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
  265. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
  266. package/dist/src/agent/skills/skill-manager.js +1 -1
  267. package/dist/src/agent/skills/skill-sources.js +1 -1
  268. package/dist/src/agent/source-context/index.js +1 -1
  269. package/dist/src/agent/tasks/task-judge-service.js +8 -8
  270. package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
  271. package/dist/src/agent/tool-manuals/computer.js +6 -4
  272. package/dist/src/agent/tool-manuals/phone.d.ts +1 -1
  273. package/dist/src/agent/tool-manuals/phone.js +4 -4
  274. package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +1 -1
  275. package/dist/src/agent/tool-manuals/xopc-configuration.js +4 -2
  276. package/dist/src/agent/tools/computer-use-tool.js +7 -6
  277. package/dist/src/agent/tools/create-share-tool.js +2 -2
  278. package/dist/src/agent/tools/delegate-tool.js +3 -3
  279. package/dist/src/agent/tools/delegation-policy.js +1 -0
  280. package/dist/src/agent/tools/exec-command.js +1 -1
  281. package/dist/src/agent/tools/executor.js +1 -1
  282. package/dist/src/agent/tools/factory.js +23 -21
  283. package/dist/src/agent/tools/fetch-text.js +1 -1
  284. package/dist/src/agent/tools/image-generate-tool.js +2 -2
  285. package/dist/src/agent/tools/index.js +4 -4
  286. package/dist/src/agent/tools/list-dir.js +1 -1
  287. package/dist/src/agent/tools/personal-attention-tool.js +2 -2
  288. package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
  289. package/dist/src/agent/tools/personal-request-tool.js +4 -4
  290. package/dist/src/agent/tools/personal-result-tool.js +1 -1
  291. package/dist/src/agent/tools/personal-task-tool.js +5 -5
  292. package/dist/src/agent/tools/phone-use-tool.js +3 -3
  293. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  294. package/dist/src/agent/tools/read.js +1 -1
  295. package/dist/src/agent/tools/review-workspace.js +1 -1
  296. package/dist/src/agent/tools/send-media.js +1 -1
  297. package/dist/src/agent/tools/skill-manage-tool.js +1 -1
  298. package/dist/src/agent/tools/task-collaboration-tool.js +2 -2
  299. package/dist/src/agent/tools/tts-tool.js +1 -1
  300. package/dist/src/agent/tools/user-context-tool.js +2 -2
  301. package/dist/src/agent/tools/web.js +23 -4
  302. package/dist/src/agent/tools/write.js +1 -1
  303. package/dist/src/agent/tools/xopc-use-tool.js +10 -10
  304. package/dist/src/agent/transcript/index.js +2 -2
  305. package/dist/src/agent/transcript/transcript-hygiene.js +2 -2
  306. package/dist/src/agent-matching/delegation-service.js +1 -1
  307. package/dist/src/agent-matching/service.js +2 -2
  308. package/dist/src/ai-assist/text-assist.js +1 -1
  309. package/dist/src/auth/credentials.js +1 -1
  310. package/dist/src/auth/oauth/openai.js +1 -1
  311. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  312. package/dist/src/auth/profiles/store.js +1 -1
  313. package/dist/src/automations/delivery/delivery-router.js +1 -1
  314. package/dist/src/automations/domain/index.js +1 -1
  315. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  316. package/dist/src/automations/index.js +2 -2
  317. package/dist/src/automations/service/action-executor.js +2 -2
  318. package/dist/src/automations/service/automation-service.js +2 -2
  319. package/dist/src/browser/native-messaging-host.js +1 -1
  320. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  321. package/dist/src/capabilities/store-connector.js +2 -2
  322. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
  323. package/dist/src/channels/index.js +1 -1
  324. package/dist/src/channels/outbound-sender.js +1 -1
  325. package/dist/src/channels/pairing/allow-from-file.js +9 -9
  326. package/dist/src/channels/pairing/pairing-store.js +6 -6
  327. package/dist/src/chat-commands/agent-edit.js +1 -1
  328. package/dist/src/chat-commands/builtins/config.js +2 -2
  329. package/dist/src/chat-commands/builtins/session.js +1 -1
  330. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  331. package/dist/src/chat-commands/builtins/tts.js +1 -1
  332. package/dist/src/chat-commands/context.js +1 -1
  333. package/dist/src/chat-commands/index.js +3 -3
  334. package/dist/src/cli/commands/agent.js +7 -7
  335. package/dist/src/cli/commands/config.js +1 -1
  336. package/dist/src/cli/commands/connectors.js +1 -1
  337. package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
  338. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  339. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  340. package/dist/src/cli/commands/extension-agent-plugin.js +1 -1
  341. package/dist/src/cli/commands/extension-dev.js +1 -1
  342. package/dist/src/cli/commands/extension.js +2 -2
  343. package/dist/src/cli/commands/image.js +1 -1
  344. package/dist/src/cli/commands/init.js +1 -1
  345. package/dist/src/cli/commands/models.js +2 -2
  346. package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
  347. package/dist/src/cli/commands/onboard.js +1 -1
  348. package/dist/src/cli/commands/project.js +1 -1
  349. package/dist/src/cli/commands/skills.js +2 -2
  350. package/dist/src/cli/commands/tunnel.js +4 -4
  351. package/dist/src/cli/extension-cli-register.js +5 -5
  352. package/dist/src/cli/utils/gateway-client.js +1 -1
  353. package/dist/src/cli/utils/init-workspace-core.js +2 -2
  354. package/dist/src/cli/utils/session.js +1 -1
  355. package/dist/src/computer/batch.d.ts +108 -0
  356. package/dist/src/computer/batch.js +125 -0
  357. package/dist/src/computer/broker.d.ts +28 -2
  358. package/dist/src/computer/broker.js +95 -17
  359. package/dist/src/computer/diagnostics.d.ts +5 -1
  360. package/dist/src/computer/diagnostics.js +22 -3
  361. package/dist/src/computer/errors.d.ts +15 -0
  362. package/dist/src/computer/errors.js +59 -3
  363. package/dist/src/computer/flows.js +1 -1
  364. package/dist/src/computer/model-adapter.d.ts +58 -0
  365. package/dist/src/computer/model-adapter.js +113 -67
  366. package/dist/src/computer/native-errors.d.ts +2 -0
  367. package/dist/src/computer/native-errors.js +13 -0
  368. package/dist/src/computer/program-runtime.d.ts +1 -1
  369. package/dist/src/computer/program-runtime.js +1 -0
  370. package/dist/src/computer/runtime.d.ts +11 -0
  371. package/dist/src/computer/runtime.js +106 -38
  372. package/dist/src/computer/semantic-actions.js +4 -0
  373. package/dist/src/config/index.js +3 -3
  374. package/dist/src/config/loader.js +1 -1
  375. package/dist/src/config/models-json.js +1 -1
  376. package/dist/src/config/schema.d.ts +6 -0
  377. package/dist/src/connectors/cli/authorization.js +1 -1
  378. package/dist/src/connectors/composio-sessions.js +1 -1
  379. package/dist/src/connectors/composio.js +1 -1
  380. package/dist/src/connectors/connected-source-ingestion.js +2 -2
  381. package/dist/src/connectors/connected-source-understanding.js +5 -5
  382. package/dist/src/connectors/connection-recovery-service.js +4 -4
  383. package/dist/src/connectors/content-enrichment.js +1 -1
  384. package/dist/src/connectors/health.js +1 -1
  385. package/dist/src/connectors/instances.js +1 -1
  386. package/dist/src/connectors/runtime-adapter-registry.js +2 -2
  387. package/dist/src/discussions/live-worker.js +1 -1
  388. package/dist/src/discussions/sealer.js +1 -1
  389. package/dist/src/endpoint-tools/index.js +1 -1
  390. package/dist/src/endpoint-tools/runtime.js +2 -2
  391. package/dist/src/extensions/activation-context.js +3 -3
  392. package/dist/src/extensions/agent-plugins/auth.js +1 -1
  393. package/dist/src/extensions/agent-plugins/formats.js +2 -1
  394. package/dist/src/extensions/agent-plugins/inventory.d.ts +2 -0
  395. package/dist/src/extensions/agent-plugins/inventory.js +4 -1
  396. package/dist/src/extensions/agent-plugins/skill-catalog.js +2 -2
  397. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  398. package/dist/src/extensions/agent-plugins/validation.d.ts +1 -0
  399. package/dist/src/extensions/agent-plugins/validation.js +2 -1
  400. package/dist/src/extensions/api.js +3 -3
  401. package/dist/src/extensions/bundled-extension-activation.js +1 -1
  402. package/dist/src/extensions/index.js +3 -3
  403. package/dist/src/extensions/loader.js +2 -2
  404. package/dist/src/extensions/lockfile.js +1 -1
  405. package/dist/src/extensions/sdk/index.js +1 -1
  406. package/dist/src/extensions/sdk/media.js +1 -1
  407. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  408. package/dist/src/gateway/agents-admin.js +1 -1
  409. package/dist/src/gateway/device-routes.js +1 -1
  410. package/dist/src/gateway/file-path-classifier.js +1 -1
  411. package/dist/src/gateway/global-defaults-admin.js +1 -1
  412. package/dist/src/gateway/hono/app.js +2 -2
  413. package/dist/src/gateway/hono/lib/config-payload.js +2 -2
  414. package/dist/src/gateway/hono/oauth-async.js +1 -1
  415. package/dist/src/gateway/hono/routes/agent-plugins.js +1 -1
  416. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  417. package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
  418. package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
  419. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  420. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  421. package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -1
  422. package/dist/src/gateway/hono/routes/home.js +1 -1
  423. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  424. package/dist/src/gateway/hono/routes/location-sharing.js +1 -1
  425. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  426. package/dist/src/gateway/hono/routes/memory-learning.js +3 -3
  427. package/dist/src/gateway/hono/routes/models.js +4 -4
  428. package/dist/src/gateway/hono/routes/notes.js +1 -1
  429. package/dist/src/gateway/hono/routes/phone-dependencies.js +27 -6
  430. package/dist/src/gateway/hono/routes/phone-setup.js +43 -17
  431. package/dist/src/gateway/hono/routes/phone.js +24 -9
  432. package/dist/src/gateway/hono/routes/projects.js +4 -4
  433. package/dist/src/gateway/hono/routes/runtime-tools.js +1 -1
  434. package/dist/src/gateway/hono/routes/session-command-handler.js +11 -2
  435. package/dist/src/gateway/hono/routes/session-input-control.d.ts +3 -0
  436. package/dist/src/gateway/hono/routes/session-input-control.js +37 -0
  437. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +12 -0
  438. package/dist/src/gateway/hono/routes/session-input-handler.js +27 -5
  439. package/dist/src/gateway/hono/routes/sessions.js +7 -3
  440. package/dist/src/gateway/hono/routes/shares.js +1 -1
  441. package/dist/src/gateway/hono/routes/side-chats.js +1 -1
  442. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  443. package/dist/src/gateway/hono/routes/user-model.js +7 -7
  444. package/dist/src/gateway/hono/routes/voice.js +7 -7
  445. package/dist/src/gateway/lock.js +11 -11
  446. package/dist/src/gateway/media-access.js +1 -1
  447. package/dist/src/gateway/mobile-privacy.js +2 -2
  448. package/dist/src/gateway/ports.js +6 -6
  449. package/dist/src/gateway/provider-model-setup.js +1 -1
  450. package/dist/src/gateway/server.js +1 -1
  451. package/dist/src/gateway/service/agent-runner.js +7 -6
  452. package/dist/src/gateway/service/config-coordinator.d.ts +6 -0
  453. package/dist/src/gateway/service/config-coordinator.js +2 -2
  454. package/dist/src/gateway/service/marketplace-service.js +2 -2
  455. package/dist/src/gateway/service/run-gateway-agent.js +5 -5
  456. package/dist/src/gateway/service/session-command-service.js +2 -2
  457. package/dist/src/gateway/service/session-input-coordinator.d.ts +6 -3
  458. package/dist/src/gateway/service/session-input-coordinator.js +48 -7
  459. package/dist/src/gateway/service.d.ts +1 -0
  460. package/dist/src/gateway/service.js +45 -42
  461. package/dist/src/gateway/session-context-summary.js +4 -4
  462. package/dist/src/gateway/session-reset-service.js +1 -1
  463. package/dist/src/gateway/workspace-editor-path.js +2 -2
  464. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  465. package/dist/src/home-intelligence/generator.js +2 -2
  466. package/dist/src/imports/inventory.js +2 -2
  467. package/dist/src/imports/productImport.js +1 -1
  468. package/dist/src/imports/runtime.js +1 -1
  469. package/dist/src/infra/gateway-processes.js +2 -2
  470. package/dist/src/infra/path-env.js +3 -3
  471. package/dist/src/infra/update-global.js +9 -9
  472. package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
  473. package/dist/src/knowledge/index.js +1 -1
  474. package/dist/src/knowledge-memory/repository.js +1 -1
  475. package/dist/src/knowledge-memory/usage-policy.js +1 -1
  476. package/dist/src/local-apps/service.js +2 -2
  477. package/dist/src/mcp/gateway-http-client.js +1 -1
  478. package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
  479. package/dist/src/memory-learning/source-learning.js +5 -5
  480. package/dist/src/memory-learning/task-receipts.js +1 -1
  481. package/dist/src/notes/agent-context.js +4 -4
  482. package/dist/src/notes/index.js +1 -1
  483. package/dist/src/notes/service.js +3 -3
  484. package/dist/src/personal-agent/capability-service.js +3 -3
  485. package/dist/src/personal-agent/proactivity/routes.js +1 -1
  486. package/dist/src/personal-agent/proactivity/service.js +7 -7
  487. package/dist/src/personal-agent/prompt-context.js +7 -7
  488. package/dist/src/personal-agent/prompts.js +2 -2
  489. package/dist/src/personal-agent/reply-composer.js +9 -9
  490. package/dist/src/personal-agent/request-access.d.ts +2 -0
  491. package/dist/src/personal-agent/request-access.js +22 -2
  492. package/dist/src/personal-agent/request-delivery.js +2 -2
  493. package/dist/src/personal-agent/request-service.js +9 -9
  494. package/dist/src/personal-agent/result-reader.js +1 -1
  495. package/dist/src/personal-agent/service.js +1 -1
  496. package/dist/src/personal-agent/specialist-capabilities.d.ts +2 -0
  497. package/dist/src/personal-agent/specialist-capabilities.js +9 -3
  498. package/dist/src/phone/adb-driver.d.ts +3 -0
  499. package/dist/src/phone/adb-driver.js +29 -0
  500. package/dist/src/phone/contracts.d.ts +14 -2
  501. package/dist/src/phone/contracts.js +8 -1
  502. package/dist/src/phone/gui-protocol.js +1 -1
  503. package/dist/src/phone/hdc-driver.d.ts +30 -0
  504. package/dist/src/phone/hdc-driver.js +331 -0
  505. package/dist/src/phone/hdc-video-bridge.d.ts +2 -0
  506. package/dist/src/phone/hdc-video-bridge.js +91 -0
  507. package/dist/src/phone/hdc-video-tools.d.ts +15 -0
  508. package/dist/src/phone/hdc-video-tools.js +123 -0
  509. package/dist/src/phone/hdc-video.d.ts +69 -0
  510. package/dist/src/phone/hdc-video.js +350 -0
  511. package/dist/src/phone/interactive-session.js +1 -1
  512. package/dist/src/phone/live-provider.d.ts +6 -0
  513. package/dist/src/phone/live-provider.js +1 -0
  514. package/dist/src/phone/model-adapter.d.ts +3 -0
  515. package/dist/src/phone/model-adapter.js +6 -4
  516. package/dist/src/phone/repository.js +3 -2
  517. package/dist/src/phone/runtime.d.ts +10 -4
  518. package/dist/src/phone/runtime.js +154 -88
  519. package/dist/src/phone/setup/service.d.ts +8 -6
  520. package/dist/src/phone/setup/service.js +33 -16
  521. package/dist/src/platform/client.d.ts +1 -1
  522. package/dist/src/platform/contracts.d.ts +1 -1
  523. package/dist/src/process/phone-process.d.ts +1 -1
  524. package/dist/src/process/phone-process.js +2 -2
  525. package/dist/src/projects/index.js +2 -2
  526. package/dist/src/projects/project-agent-suggestion.js +1 -1
  527. package/dist/src/projects/project-service.js +2 -2
  528. package/dist/src/projects/project-skill-service.js +2 -2
  529. package/dist/src/projects/workspace.js +1 -1
  530. package/dist/src/providers/model-reference-auditor.js +1 -1
  531. package/dist/src/realtime/runtime.js +1 -1
  532. package/dist/src/remote-access/exposure-manager.js +1 -1
  533. package/dist/src/runtime-tools/downloader.d.ts +1 -0
  534. package/dist/src/runtime-tools/downloader.js +8 -4
  535. package/dist/src/runtime-tools/harmony-dependencies.d.ts +24 -0
  536. package/dist/src/runtime-tools/harmony-dependencies.js +272 -0
  537. package/dist/src/runtime-tools/harmony-dependency-catalog.d.ts +4 -0
  538. package/dist/src/runtime-tools/harmony-dependency-catalog.js +54 -0
  539. package/dist/src/runtime-tools/harmony-paths.d.ts +9 -0
  540. package/dist/src/runtime-tools/harmony-paths.js +15 -0
  541. package/dist/src/runtime-tools/hdc-dependency-catalog.d.ts +8 -0
  542. package/dist/src/runtime-tools/hdc-dependency-catalog.js +83 -0
  543. package/dist/src/runtime-tools/hdc-files.d.ts +14 -0
  544. package/dist/src/runtime-tools/hdc-files.js +87 -0
  545. package/dist/src/runtime-tools/phone-dependencies.d.ts +6 -1
  546. package/dist/src/runtime-tools/phone-dependencies.js +22 -4
  547. package/dist/src/runtime-tools/phone-dependency-catalog.d.ts +10 -1
  548. package/dist/src/runtime-tools/phone-dependency-catalog.js +2 -0
  549. package/dist/src/runtime-tools/types.d.ts +1 -1
  550. package/dist/src/session/client-history.d.ts +2 -0
  551. package/dist/src/session/client-history.js +3 -0
  552. package/dist/src/session/compact-history.js +1 -0
  553. package/dist/src/session/index.js +2 -2
  554. package/dist/src/session/init-session-turn.js +1 -1
  555. package/dist/src/session/resolve-session.js +1 -1
  556. package/dist/src/session/store.js +5 -5
  557. package/dist/src/session/thinking-resolve.js +1 -1
  558. package/dist/src/share/hosted-session-share.js +2 -2
  559. package/dist/src/share/session-share-service.js +1 -1
  560. package/dist/src/share/share-store.js +1 -1
  561. package/dist/src/share/share-thumbnail.js +1 -1
  562. package/dist/src/share/site-proxy.js +1 -1
  563. package/dist/src/share/site-share-store.js +1 -1
  564. package/dist/src/storage/sqlite/connection.js +9 -9
  565. package/dist/src/storage/sqlite/schema.d.ts +2 -2
  566. package/dist/src/storage/sqlite/schema.js +7 -7
  567. package/dist/src/storage/sqlite/schema.sql +16 -0
  568. package/dist/src/storage/sqlite/session-creation-repository.js +3 -0
  569. package/dist/src/storage/sqlite/session-input-control-repository.d.ts +12 -0
  570. package/dist/src/storage/sqlite/session-input-control-repository.js +83 -0
  571. package/dist/src/storage/sqlite/session-input-repository.d.ts +2 -0
  572. package/dist/src/storage/sqlite/session-input-repository.js +17 -5
  573. package/dist/src/storage/sqlite/session-repository.js +1 -0
  574. package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +2 -0
  575. package/dist/src/storage/sqlite/session-turn-replace-repository.js +14 -2
  576. package/dist/src/storage/sqlite/upgrades/262_session_input_control.sql +15 -0
  577. package/dist/src/tasks/capabilities/read.js +2 -2
  578. package/dist/src/tasks/capabilities/write.js +1 -1
  579. package/dist/src/tasks/home-query-service.js +1 -1
  580. package/dist/src/tasks/index.js +5 -5
  581. package/dist/src/tasks/task-allocation-service.js +5 -5
  582. package/dist/src/tasks/task-application-service.js +5 -5
  583. package/dist/src/tasks/task-collaboration-delivery.js +1 -1
  584. package/dist/src/tasks/task-context-assembler.js +2 -2
  585. package/dist/src/tasks/task-contract-planner.js +2 -2
  586. package/dist/src/tasks/task-handoff-service.js +1 -1
  587. package/dist/src/tasks/task-handoff.js +4 -4
  588. package/dist/src/tasks/task-main-update-decision-service.js +3 -3
  589. package/dist/src/tasks/task-model-call.js +1 -1
  590. package/dist/src/tasks/task-research-result.js +4 -4
  591. package/dist/src/tasks/task-result-delivery-repository.js +1 -1
  592. package/dist/src/tasks/task-result-delivery-service.js +2 -2
  593. package/dist/src/tasks/task-run-coordinator.js +3 -3
  594. package/dist/src/tasks/task-run-dispatcher.js +1 -1
  595. package/dist/src/tui/backends/embedded-backend.js +11 -11
  596. package/dist/src/tui/backends/gateway-realtime-backend.js +2 -2
  597. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  598. package/dist/src/tui/tui-commands.js +5 -5
  599. package/dist/src/tui/tui-picker-overlay.js +1 -1
  600. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  601. package/dist/src/tui/tui-startup-resources.js +3 -3
  602. package/dist/src/tui/tui.js +4 -4
  603. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  604. package/dist/src/user-context/access-policy.js +2 -2
  605. package/dist/src/user-model/bootstrap.js +1 -1
  606. package/dist/src/user-model/capture/executor.js +1 -1
  607. package/dist/src/user-model/index.js +2 -2
  608. package/dist/src/user-model/usage-policy.js +1 -1
  609. package/dist/src/voice/realtime/memory-context.js +5 -5
  610. package/dist/src/voice/realtime/omniRoute.js +1 -1
  611. package/dist/src/voice/realtime/runtime.js +4 -4
  612. package/dist/src/voice/stt/index.js +2 -2
  613. package/dist/src/voice/stt/preflight.js +1 -1
  614. package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
  615. package/dist/src/voice/stt/providers/bailian-plan-transcription.js +1 -1
  616. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
  617. package/dist/src/voice/stt/transcribe-core.js +1 -1
  618. package/dist/src/voice/tts/index.js +3 -3
  619. package/dist/src/voice/tts/merge-config.js +1 -1
  620. package/dist/src/voice/tts/payload.js +1 -1
  621. package/dist/src/voice/tts/providers/bailian-plan-speech.js +1 -1
  622. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
  623. package/dist/src/voice/tts/speak-core.js +1 -1
  624. package/dist/src/work-discovery/service.js +7 -7
  625. package/package.json +2 -2
  626. package/skills/tools/configure-xopc/SKILL.md +2 -2
  627. package/skills/tools/configure-xopc/references/phone/acceptance.md +3 -2
  628. package/skills/tools/configure-xopc/references/phone/dependencies.md +18 -2
  629. package/skills/tools/configure-xopc/references/phone/harmonyos.md +16 -0
  630. package/skills/tools/configure-xopc/references/phone/overview.md +2 -2
  631. package/skills/tools/configure-xopc/references/scene-index.md +2 -2
  632. package/dist/gateway/static/root/assets/apps-page-BrnAMjXr.js +0 -1
  633. package/dist/gateway/static/root/assets/automations-workspace-DM67xMcR.js +0 -9
  634. package/dist/gateway/static/root/assets/capabilities-page-DOMoAom0.js +0 -2
  635. package/dist/gateway/static/root/assets/capability-links-DzQWK1Fh.js +0 -1
  636. package/dist/gateway/static/root/assets/chat-page-DQNLsOad.js +0 -72
  637. package/dist/gateway/static/root/assets/computer-settings-page-C-7YLU9l.js +0 -1
  638. package/dist/gateway/static/root/assets/connected-providers-grid-DziNfbFz.js +0 -1
  639. package/dist/gateway/static/root/assets/connectors-page-CcG3V3OB.js +0 -1
  640. package/dist/gateway/static/root/assets/gateway-realtime-store-eEZgUEdH.js +0 -1
  641. package/dist/gateway/static/root/assets/index-BinHjymm.js +0 -11
  642. package/dist/gateway/static/root/assets/index-Cz-VjTNd.css +0 -1
  643. package/dist/gateway/static/root/assets/install-connector-dialog-xHNBuSj0.js +0 -1
  644. package/dist/gateway/static/root/assets/list-tree-B0OMswgM.js +0 -1
  645. package/dist/gateway/static/root/assets/messages-9OwWjlww.js +0 -3
  646. package/dist/gateway/static/root/assets/note-image-lightbox-DOG9mCzE.js +0 -1
  647. package/dist/gateway/static/root/assets/page-header-store-DBeD_mAA.js +0 -1
  648. package/dist/gateway/static/root/assets/phone-dependencies-card-CM2Mj4rH.js +0 -1
  649. package/dist/gateway/static/root/assets/phone-model-connection-kJYAiCgI.js +0 -1
  650. package/dist/gateway/static/root/assets/phone-model-picker-sXs8PpFk.js +0 -1
  651. package/dist/gateway/static/root/assets/phone-settings-page-ayCImqUb.js +0 -1
  652. package/dist/gateway/static/root/assets/plugin-details-dialog-B4qZ0obG.js +0 -1
  653. package/dist/gateway/static/root/assets/route-preload-Uhpfz1Jz.js +0 -2
  654. package/dist/gateway/static/root/assets/session-api-BwcBcvzv.js +0 -1
  655. package/dist/gateway/static/root/assets/session-channel-icon-SsY70Z6t.js +0 -1
  656. package/dist/gateway/static/root/assets/session-identity-label-B7sgG1PE.js +0 -1
  657. package/dist/gateway/static/root/assets/session-manager-SASXxhrN.js +0 -23
  658. package/dist/gateway/static/root/assets/settings-advanced-gate-iUlbBMZI.js +0 -1
  659. package/dist/gateway/static/root/assets/workspace-editor-agent-store-Bz_M_rk3.js +0 -1
@@ -1 +0,0 @@
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"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,n as o,o as s}from"./locale-store-fGFrr4_4.js";import{t as c}from"./messages-9OwWjlww.js";import{t as l}from"./check-DUBLcKHA.js";import{t as u}from"./globe-DSSGFWFn.js";import{t as d}from"./monitor-Af5eAvF7.js";import{t as f}from"./mouse-pointer-2-DZ51Onvj.js";import{t as p}from"./plus-Q2yW6OE7.js";import{t as m}from"./shield-check-BU58siTV.js";import{t as h}from"./square-DMK_fB-3.js";import{t as g}from"./skeleton-BI5TyibZ.js";import{i as _}from"./vendor-swr-CdRzEUwF.js";import{r as v}from"./gateway-config-swr-C-fPl1hP.js";import{n as y,t as b}from"./registry-api-Bm7kut54.js";import{t as x}from"./button-Cc4hUNTt.js";import{t as S}from"./electron-env-DHOGevH3.js";import{n as C}from"./model-selector-Bv-anQ6O.js";import{n as w,t as T}from"./global-defaults-api-C9O_X0pj.js";import{n as ee,t as te}from"./settings-page-header-DH1qb4vP.js";import"./settings-page-layout-B2G042F2.js";var E=n(),D=e(t(),1),O=r();function ne({zh:e}){let t=c(e?`zh`:`en`).computerSettings,n=_(`settings-agent-defaults`,T),r=_(b,y),a=n.data?.defaults.models.computerUse?.primary??``,[o,s]=(0,D.useState)(a),[l,u]=(0,D.useState)(!1),[d,f]=(0,D.useState)(``),[p,m]=(0,D.useState)(!1);(0,D.useEffect)(()=>{s(a)},[a]);let h=!o||r.data?.some(e=>e.id===o&&e.computerUse),v=async()=>{u(!0),f(``),m(!1);try{if(!h)throw Error(t.modelUnavailable);let e=await T(),r={...e.defaults.models};o?r.computerUse={primary:o,fallbacks:[]}:delete r.computerUse;let i=await w({...e.defaults,models:r});await n.mutate(i,!1),m(!0)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,O.jsxs)(`section`,{"aria-label":t.model,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.model}),!n.data&&!n.error?(0,O.jsx)(g,{className:`h-52 w-full rounded-xl`}):n.error?(0,O.jsxs)(`div`,{role:`alert`,className:`text-sm text-danger`,children:[String(n.error),(0,O.jsx)(x,{onClick:()=>{n.mutate().catch(()=>{})},children:t.retry})]}):(0,O.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,O.jsx)(`div`,{className:`min-w-0 flex-1`,children:r.isLoading?(0,O.jsx)(g,{className:`h-11 w-full rounded-lg`}):(0,O.jsx)(C,{value:o,onChange:e=>{s(e),m(!1)},disabled:l,capabilitiesFilter:`computer-use`,models:r.data??[],modelsError:r.error,placeholder:t.selectModel,searchPlaceholder:t.searchModel,noMatches:t.noModels,registryEmptyHint:t.noModels,allowEmpty:!0,emptyLabel:t.noModel,ariaLabel:t.modelLabel,className:`w-full`,contentAlign:`start`})}),(0,O.jsx)(x,{variant:`primary`,disabled:l||o===a||!h||!!r.error||r.isLoading,onClick:()=>{v()},children:t.saveModel})]}),(0,O.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[(0,O.jsx)(`span`,{children:t.modelDataUse}),(0,O.jsx)(x,{asChild:!0,variant:`ghost`,className:`h-auto p-0 text-xs`,children:(0,O.jsx)(i,{to:`/settings/capabilities/models?add=1`,children:t.manageModels})}),p&&(0,O.jsx)(`span`,{role:`status`,children:t.modelSaved})]}),!h&&!r.isLoading&&!r.error&&(0,O.jsx)(`p`,{role:`status`,className:`mt-3 text-sm text-warning`,children:t.modelUnavailable}),r.error&&(0,O.jsxs)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:[String(r.error),(0,O.jsx)(x,{onClick:()=>{r.mutate().catch(()=>{})},children:t.retry})]}),d&&(0,O.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:d})]})]})}function k(e){let t=(0,E.c)(15),{icon:n,title:r,description:i,children:a}=e,o;t[0]===n?o=t[1]:(o=n&&(0,O.jsx)(`div`,{className:`flex size-6 shrink-0 items-center justify-center text-fg-muted`,"aria-hidden":!0,children:n}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,O.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=i&&(0,O.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===a?u=t[10]:(u=a&&(0,O.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:a}),t[9]=a,t[10]=u);let d;return t[11]!==o||t[12]!==l||t[13]!==u?(d=(0,O.jsxs)(`div`,{className:`flex min-h-16 flex-wrap items-center gap-3 px-4 py-3 sm:flex-nowrap sm:px-5`,children:[o,l,u]}),t[11]=o,t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function A(){let e=(0,E.c)(2),t=o(j)===`zh`,n;return e[0]===t?n=e[1]:(n=(0,O.jsx)(M,{zh:t}),e[0]=t,e[1]=n),n}function j(e){return e.language}function M({zh:e}){let t=c(e?`zh`:`en`).computerSettings,{data:n,mutate:r,error:o}=v(!0),_=n?.payload?.config,[y,b]=(0,D.useState)(!1),[C,w]=(0,D.useState)(``),[T,E]=(0,D.useState)(!1),[A,j]=(0,D.useState)(null),[M,N]=(0,D.useState)(!1),[P,F]=(0,D.useState)(null),[re,I]=(0,D.useState)(!1),[L,R]=(0,D.useState)(``),[z,B]=(0,D.useState)(!1),[ie,V]=(0,D.useState)(!1),H=window.electronAPI?.platform===`win32`,U=S()?window.electronAPI?.computer:void 0,W=window.electronAPI?.platform===`darwin`?window.electronAPI.system:void 0;(0,D.useEffect)(()=>{if(!U)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await U.status();e||(j(t),N(!1))}catch{e||(j(null),N(!0))}finally{t=!1}}};n();let r=window.setInterval(()=>{n()},2e3);return()=>{e=!0,window.clearInterval(r)}},[U]),(0,D.useEffect)(()=>{if(!U?.access)return;let e=!1;return U.access().then(t=>{e||(F(t),I(!1))}).catch(()=>{e||I(!0)}),()=>{e=!0}},[U]);let G=async e=>{b(!0),w(``);try{await e()}catch(e){w(e instanceof Error?e.message:String(e))}finally{b(!1)}},ae=e=>G(async()=>{S()&&(await s(a(`/api/config`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({computer:{enabled:e}})}),await r())}),oe=async()=>{w(``),E(!1);try{await U?.stop(),E(!0),U&&j(await U.status())}catch(e){w(e instanceof Error?e.message:String(e))}},K=A?.session?.status??`idle`,q=t.states[K]??K,J=S()&&_?.computer?.enabled===!0,se=A?.controlPaused?t.pausedNotice:J?A?.connected?`${t.connected} · ${q}`:A?t.disconnected:t.checking:t.disabled,Y=!U||M||A?.reenrollmentRequired===!0||!!(A?.error||A?.session?.errorCode)||A!=null&&!H&&(!A.permissions.accessibility||A.permissions.screenRecording!==`granted`),X=(H?A?.connected===!0:A?.permissions.accessibility===!0&&A.permissions.screenRecording===`granted`)&&!A?.reenrollmentRequired,Z=P?.apps.filter(e=>P.authorizedAppIds.includes(e.appId))??[],Q=P?.apps.filter(e=>!P.authorizedAppIds.includes(e.appId)&&`${e.name} ${e.appId}`.toLocaleLowerCase().includes(L.toLocaleLowerCase()))??[],$=(0,O.jsxs)(`section`,{"aria-labelledby":`computer-permissions-title`,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{id:`computer-permissions-title`,className:`text-sm font-semibold text-fg`,children:t.permissions}),U?M?(0,O.jsx)(`p`,{role:`alert`,className:`rounded-xl bg-danger-soft p-5 text-sm text-danger`,children:t.nativeError}):A?X&&!ie?(0,O.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:(0,O.jsx)(k,{icon:(0,O.jsx)(m,{className:`size-5`}),title:H?t.windowsAccess:t.systemPermissions,description:H?t.windowsAccessDescription:t.granted,children:(0,O.jsx)(x,{onClick:()=>V(!0),children:t.viewDetails})})}):(0,O.jsxs)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[(0,O.jsx)(k,{icon:(0,O.jsx)(d,{className:`size-5`}),title:t.device,description:(0,O.jsxs)(`span`,{"aria-live":`polite`,children:[A.connected?t.connected:t.disconnected,` · `,q]}),children:A.reenrollmentRequired&&(0,O.jsx)(x,{disabled:y,onClick:()=>{G(async()=>{j(await U.reenroll())})},children:t.reenroll})}),H&&(0,O.jsx)(k,{icon:(0,O.jsx)(m,{className:`size-5`}),title:t.windowsAccess,description:t.windowsAccessDescription}),W&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(k,{icon:(0,O.jsx)(m,{className:`size-5`}),title:t.accessibility,children:[(0,O.jsx)(`span`,{className:`text-xs text-fg-muted`,children:A.permissions.accessibility?t.granted:t.notGranted}),!A.permissions.accessibility&&(0,O.jsx)(x,{disabled:y,"aria-label":`${t.openSettings}: ${t.accessibility}`,onClick:()=>{G(()=>W.requestAccessibility())},children:t.openSettings})]}),(0,O.jsxs)(k,{icon:(0,O.jsx)(d,{className:`size-5`}),title:t.screen,children:[(0,O.jsx)(`span`,{className:`text-xs text-fg-muted`,children:A.permissions.screenRecording===`granted`?t.granted:t.notGranted}),A.permissions.screenRecording!==`granted`&&(0,O.jsx)(x,{disabled:y,"aria-label":`${t.openSettings}: ${t.screen}`,onClick:()=>{G(()=>W.requestScreen())},children:t.openSettings})]})]}),X&&(0,O.jsx)(`div`,{className:`flex justify-end px-4 py-2 sm:px-5`,children:(0,O.jsx)(x,{variant:`ghost`,onClick:()=>V(!1),children:t.hideDetails})})]}):(0,O.jsx)(`div`,{"aria-label":t.checking,children:(0,O.jsx)(g,{className:`h-20 w-full rounded-xl`})}):(0,O.jsx)(`p`,{className:`rounded-xl bg-surface-hover/20 p-5 text-sm leading-relaxed text-fg-muted`,children:window.electronAPI?t.unsupportedPlatform:t.desktopRequired}),(A?.error||A?.session?.errorCode)&&(0,O.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-red-600`,children:A.error||A.session?.errorCode})]});return(0,O.jsxs)(ee,{gap:`gap-7`,children:[(0,O.jsx)(te,{title:t.title,subtitle:t.subtitle,meta:(0,O.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:t.preview}),actions:U&&(0,O.jsxs)(x,{onClick:()=>{oe()},children:[(0,O.jsx)(h,{className:`size-3.5`}),t.stop]})}),H&&(0,O.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:t.windowsAccessDescription}),C&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:C}),T&&(0,O.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:t.stoppedNotice}),(0,O.jsxs)(`section`,{"aria-labelledby":`computer-control-title`,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{id:`computer-control-title`,className:`text-sm font-semibold text-fg`,children:t.control}),!_&&!o?(0,O.jsx)(g,{className:`h-32 w-full rounded-xl`}):o?(0,O.jsxs)(`div`,{role:`alert`,className:`text-sm text-fg-muted`,children:[String(o),` `,(0,O.jsx)(x,{onClick:()=>{G(()=>r())},children:t.retry})]}):(0,O.jsxs)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[(0,O.jsx)(k,{icon:(0,O.jsx)(f,{className:`size-5`}),title:t.desktop,description:(0,O.jsx)(`span`,{"aria-live":`polite`,children:se}),children:(0,O.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":t.desktop,"aria-checked":J,disabled:y||!S()||A?.capabilities?.supported===!1,onClick:()=>{ae(_?.computer?.enabled!==!0)},className:`touch-target flex items-center rounded-lg px-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,O.jsx)(`span`,{className:`flex h-6 w-11 items-center rounded-full p-0.5 transition-colors ${J?`bg-accent`:`bg-fg-muted/30`}`,children:(0,O.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform ${J?`translate-x-5`:`translate-x-0`}`})})})}),A?.controlPaused&&(0,O.jsx)(`div`,{className:`flex justify-end border-t border-edge-subtle px-4 py-3 sm:px-5`,children:(0,O.jsx)(x,{disabled:y,onClick:()=>{G(async()=>{U&&j(await U.resume()),E(!1)})},children:t.resume})})]})]}),Y&&$,U?.access&&(0,O.jsxs)(`section`,{"aria-labelledby":`computer-app-access-title`,className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsx)(`h2`,{id:`computer-app-access-title`,className:`text-sm font-semibold text-fg`,children:t.appAccess}),!P?.allowAllApps&&(0,O.jsxs)(x,{disabled:y,"aria-expanded":z,"aria-controls":z?`computer-app-picker`:void 0,onClick:()=>{B(e=>!e),R(``)},children:[z?(0,O.jsx)(l,{className:`size-4`,"aria-hidden":!0}):(0,O.jsx)(p,{className:`size-4`,"aria-hidden":!0}),z?t.doneAdding:t.addApp]})]}),P?(0,O.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[(0,O.jsx)(k,{icon:(0,O.jsx)(f,{className:`size-5`}),title:t.anyApp,description:t.anyAppDescription,children:(0,O.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":t.anyApp,"aria-checked":P.allowAllApps===!0,disabled:y,onClick:()=>{G(async()=>{F(await U.setAllAppAccess(!P.allowAllApps)),B(!1)})},className:`touch-target flex items-center rounded-lg px-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,O.jsx)(`span`,{className:`flex h-6 w-11 items-center rounded-full p-0.5 transition-colors ${P.allowAllApps?`bg-accent`:`bg-fg-muted/30`}`,children:(0,O.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform ${P.allowAllApps?`translate-x-5`:`translate-x-0`}`})})})}),!P.allowAllApps&&(0,O.jsx)(`div`,{className:`border-t border-edge-subtle`,children:Z.length?Z.map(e=>(0,O.jsxs)(`div`,{className:`flex min-h-16 items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3 last:border-b-0 sm:px-5`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),(0,O.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:e.appId})]}),(0,O.jsx)(x,{disabled:y,variant:`ghost`,onClick:()=>{G(async()=>{let t=await U.setAppAccess(e.appId,!1);F(e=>e&&{...e,authorizedAppIds:t.authorizedAppIds})})},children:t.revokeApp})]},e.appId)):(0,O.jsx)(`p`,{className:`px-5 py-6 text-center text-sm text-fg-muted`,children:t.noAuthorizedApps})})]}):re?(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t.appListError}):(0,O.jsx)(g,{className:`h-20 w-full rounded-xl`}),z&&!P?.allowAllApps&&(0,O.jsxs)(`div`,{id:`computer-app-picker`,className:`space-y-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`input`,{"aria-label":t.searchApps,value:L,onChange:e=>R(e.target.value),placeholder:t.searchApps,className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,O.jsx)(x,{disabled:y,onClick:()=>{G(async()=>{F(await U.access()),I(!1)})},children:t.refreshApps})]}),P&&(0,O.jsx)(`div`,{className:`max-h-64 overflow-y-auto rounded-xl border border-edge`,children:Q.length?Q.map(e=>(0,O.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-3 border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),(0,O.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:e.appId})]}),(0,O.jsx)(x,{disabled:y,variant:`secondary`,onClick:()=>{G(async()=>{let t=await U.setAppAccess(e.appId,!0);F(e=>e&&{...e,authorizedAppIds:t.authorizedAppIds})})},children:t.authorizeApp})]},e.appId)):(0,O.jsx)(`p`,{className:`px-3 py-5 text-center text-sm text-fg-muted`,children:P.appsBusy?t.appsBusy:P.appsUnavailable?t.appListError:t.noMatchingApps})})]})]}),(0,O.jsx)(ne,{zh:e}),!Y&&$,(0,O.jsxs)(`section`,{"aria-labelledby":`computer-browser-title`,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{id:`computer-browser-title`,className:`text-sm font-semibold text-fg`,children:t.otherControl}),(0,O.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:(0,O.jsx)(k,{icon:(0,O.jsx)(u,{className:`size-5`}),title:t.browser,description:_?_.browser?.enabled?t.browserEnabled:t.browserDisabled:t.checking,children:(0,O.jsx)(x,{asChild:!0,children:(0,O.jsx)(i,{to:`/settings/agent-browser`,children:t.manage})})})})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.previewFootnote})]})}export{A as ComputerSettingsPage,M as ComputerSettingsPanel};
@@ -1 +0,0 @@
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-fGFrr4_4.js";import{t as c}from"./messages-9OwWjlww.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-BGTk37IG.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-CEMWIrtY.js";import{t as x}from"./circle-check-C23XjkUj.js";import{t as S}from"./secret-input-Dryrns2s.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-BI5TyibZ.js";import{i as j}from"./vendor-swr-CdRzEUwF.js";import{r as M}from"./gateway-config-swr-C-fPl1hP.js";import{n as N,t as P}from"./registry-api-Bm7kut54.js";import{t as F}from"./button-Cc4hUNTt.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 R,s as z}from"./form-field-width-DJw_jULe.js";import{n as ne}from"./secret-input-labels-B5Jl5HqK.js";import{t as re}from"./sliding-tab-list-DuQyViqe.js";import{i as B,n as V}from"./models-hub-cache-BLYpN4bJ.js";import{a as ie,i as H,o as U}from"./providers-api-DyX07mht.js";import{t as ae}from"./oauth-provider-connect-D_p1ez-o.js";var oe=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`}]]),se=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`}]]),W=e(t(),1),G=n(),K=[{label:[`文本`,`Text`],uses:[`chat`]},{label:[`图片`,`Images`],uses:[`vision`,`image`]},{label:[`语音`,`Voice`],uses:[`transcription`,`speech`,`conversation`]},{label:[`后台`,`Background`],uses:[`background`]}],ce={chat:[`对话与任务`,`Chat and tasks`],vision:[`看图`,`Image understanding`],image:[`生成图片`,`Image generation`],transcription:[`录音与听写`,`Recording and dictation`],speech:[`文字转语音`,`Text to speech`],conversation:[`实时语音对话`,`Realtime conversation`],background:[`自动与后台任务`,`Background tasks`]};function le(e){return e&&Object.hasOwn(ce,e)?e:void 0}function q(e){return e&&!/[\\\r\n]/.test(e)&&(e.startsWith(`/chat/`)||e===`/personal`||e===`/settings/phone-use`||e.startsWith(`/automations`))?e:void 0}function J(e,t){let[n,r]=e.split(`?`),i=new URLSearchParams(r),a=q(t.get(`returnTo`));return a&&i.set(`returnTo`,a),`${n}${i.size?`?${i}`:``}`}async function Y(e){return(await s(a(`/api/models/setup/${encodeURIComponent(e)}`))).payload}async function ue(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 de(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 B()}function fe(e,t){return e===`single`?t.getApiKey:e===`intl`?t.getApiKeyIntl:t.getApiKeyCn}var X={"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`]},"google-antigravity":{apiKeyUrl:`https://console.cloud.google.com/apis/credentials`,pricingUrl:`https://cloud.google.com/pricing`,docsUrl:`https://cloud.google.com/docs`,description:`Google Antigravity — internal/experimental Google AI endpoint.`,descriptionZh:`Google Antigravity,Google 内部/实验性 AI 端点。`,bestFor:[`experimental`],freeTier:!1,aliases:[`antigravity`,`google antigravity`],envVars:[`ANTIGRAVITY_API_KEY`]},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-global":{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-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:[`ZHIPU_API_KEY`,`BIGMODEL_API_KEY`,`ZAI_API_KEY`]},"zhipu-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 BigModel endpoint.`,descriptionZh:`智谱 GLM Coding Plan 中国区 BigModel 端点。`,bestFor:[`coding`,`reasoning`,`chinese`],aliases:[`zhipu coding`,`glm coding cn`,`智谱 coding`],envVars:[`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 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 pe(e,t){let n=X[e];return n&&n.apiKeyUrl?[{href:n.apiKeyUrl,kind:`single`}]:[]}var me=[`common`,`domestic`,`specialty`,`enterprise`,`oauth`,`extension`];function he(e){let t=new Map;for(let e of me)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}var ge=[{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 _e(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 ve(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 ye(){let e=await i(a(`/api/models-json`)),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok||!t.payload)throw Error(_e(t)||`HTTP ${e.status}`);return{...t.payload,config:ve(t.payload.config)}}async function be(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(_e(n)||`HTTP ${t.status}`);return await B(),n.payload}async function xe(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(_e(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`}},openrouter:{label:`OpenRouter`,providerId:`openrouter`,config:{baseUrl:`https://openrouter.ai/api/v1`,api:`openai-completions`,apiKey:``}},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 International`,providerId:`zai`,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`]}]}},deepseek:{label:`DeepSeek`,providerId:`deepseek`,config:{baseUrl:`https://api.deepseek.com`,api:`openai-completions`,apiKey:`DEEPSEEK_API_KEY`,models:[{id:`deepseek-v4-pro`,name:`DeepSeek V4 Pro`,contextWindow:1e6,maxTokens:393216,reasoning:!0,input:[`text`]},{id:`deepseek-v4-flash`,name:`DeepSeek V4 Flash`,contextWindow:1e6,maxTokens:393216,reasoning:!0,input:[`text`]}]}},moonshotCn:{label:`Kimi / Moonshot China`,providerId:`moonshotai-cn`,config:{baseUrl:`https://api.moonshot.cn/v1`,api:`openai-completions`,apiKey:`MOONSHOT_API_KEY`,models:[{id:`kimi-k2.7-code`,name:`Kimi K2.7 Code`,contextWindow:262144,maxTokens:32768,reasoning:!0,input:[`text`,`image`]},{id:`kimi-k2.6`,name:`Kimi K2.6`,contextWindow:128e3,input:[`text`]}]}},moonshotIntl:{label:`Kimi / Moonshot International`,providerId:`moonshotai`,config:{baseUrl:`https://api.moonshot.ai/v1`,api:`openai-completions`,apiKey:`MOONSHOT_API_KEY`,models:[{id:`kimi-k2.7-code`,name:`Kimi K2.7 Code`,contextWindow:262144,maxTokens:32768,reasoning:!0,input:[`text`,`image`]},{id:`kimi-k2.6`,name:`Kimi K2.6`,contextWindow:128e3,input:[`text`]}]}},kimiCoding:{label:`Kimi Coding`,providerId:`kimi-coding`,description:`Dedicated Kimi coding endpoint`,config:{baseUrl:`https://api.kimi.com/coding`,api:`anthropic-messages`,apiKey:`KIMI_API_KEY`,headers:{"User-Agent":`KimiCLI/1.5`},models:[{id:`k2p7`,name:`Kimi K2.7 Code`,contextWindow:262144,maxTokens:32768,reasoning:!0,input:[`text`,`image`]},{id:`kimi-for-coding`,name:`Kimi For Coding`,contextWindow:262144,maxTokens:32768,reasoning:!0,input:[`text`,`image`]}]}},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`]}]}},xiaomi:{label:`Xiaomi MiMo`,providerId:`xiaomi`,config:{baseUrl:`https://api.xiaomimimo.com/v1`,api:`openai-completions`,apiKey:`XIAOMI_API_KEY`,models:[{id:`mimo-v2.5-pro`,name:`MiMo V2.5 Pro`,contextWindow:1e6,reasoning:!0,input:[`text`]},{id:`mimo-v2.5-pro-ultraspeed`,name:`MiMo V2.5 Pro UltraSpeed`,contextWindow:1e6,reasoning:!0,input:[`text`]},{id:`mimo-v2.5`,name:`MiMo V2.5`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]}]}},xiaomiTokenPlanCn:{label:`Xiaomi MiMo Token Plan China`,providerId:`xiaomi-token-plan-cn`,config:{baseUrl:`https://token-plan-cn.xiaomimimo.com/v1`,api:`openai-completions`,apiKey:`XIAOMI_TOKEN_PLAN_CN_API_KEY`,models:[{id:`mimo-v2.5-pro`,name:`MiMo V2.5 Pro`,contextWindow:1e6,reasoning:!0,input:[`text`]},{id:`mimo-v2.5-pro-ultraspeed`,name:`MiMo V2.5 Pro UltraSpeed`,contextWindow:1e6,reasoning:!0,input:[`text`]},{id:`mimo-v2.5`,name:`MiMo V2.5`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]}]}},xiaomiTokenPlanAms:{label:`Xiaomi MiMo Token Plan Amsterdam`,providerId:`xiaomi-token-plan-ams`,config:{baseUrl:`https://token-plan-ams.xiaomimimo.com/v1`,api:`openai-completions`,apiKey:`XIAOMI_TOKEN_PLAN_AMS_API_KEY`,models:[{id:`mimo-v2.5-pro`,name:`MiMo V2.5 Pro`,contextWindow:1e6,reasoning:!0,input:[`text`]},{id:`mimo-v2.5-pro-ultraspeed`,name:`MiMo V2.5 Pro UltraSpeed`,contextWindow:1e6,reasoning:!0,input:[`text`]},{id:`mimo-v2.5`,name:`MiMo V2.5`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]}]}},xiaomiTokenPlanSgp:{label:`Xiaomi MiMo Token Plan Singapore`,providerId:`xiaomi-token-plan-sgp`,config:{baseUrl:`https://token-plan-sgp.xiaomimimo.com/v1`,api:`openai-completions`,apiKey:`XIAOMI_TOKEN_PLAN_SGP_API_KEY`,models:[{id:`mimo-v2.5-pro`,name:`MiMo V2.5 Pro`,contextWindow:1e6,reasoning:!0,input:[`text`]},{id:`mimo-v2.5-pro-ultraspeed`,name:`MiMo V2.5 Pro UltraSpeed`,contextWindow:1e6,reasoning:!0,input:[`text`]},{id:`mimo-v2.5`,name:`MiMo V2.5`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]}]}},minimax:{label:`MiniMax`,providerId:`minimax`,description:`Anthropic-compatible endpoint preferred for agent workflows`,config:{baseUrl:`https://api.minimax.io/anthropic`,api:`anthropic-messages`,apiKey:`MINIMAX_API_KEY`,authHeader:!0,models:[{id:`MiniMax-M3`,name:`MiniMax M3`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]},{id:`MiniMax-M2.7-highspeed`,name:`MiniMax M2.7 Highspeed`,contextWindow:204800,input:[`text`]},{id:`MiniMax-M2.7`,name:`MiniMax M2.7`,contextWindow:204800,input:[`text`]}]}},zhipuCodingCn:{label:`Zhipu GLM Coding Plan China`,providerId:`zhipu-coding-cn`,config:{baseUrl:`https://open.bigmodel.cn/api/coding/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`]}]}},zaiCodingGlobal:{label:`Zhipu GLM Coding Plan International`,providerId:`zai-coding-global`,config:{baseUrl:`https://api.z.ai/api/coding/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`]}]}},minimaxCn:{label:`MiniMax China`,providerId:`minimax-cn`,config:{baseUrl:`https://api.minimaxi.com/anthropic`,api:`anthropic-messages`,apiKey:`MINIMAX_CN_API_KEY`,authHeader:!0,models:[{id:`MiniMax-M3`,name:`MiniMax M3`,contextWindow:1e6,reasoning:!0,input:[`text`,`image`]},{id:`MiniMax-M2.7-highspeed`,name:`MiniMax M2.7 Highspeed`,contextWindow:204800,input:[`text`]},{id:`MiniMax-M2.7`,name:`MiniMax M2.7`,contextWindow:204800,input:[`text`]}]}}},Ce=Object.entries(Z).map(([e,t])=>({key:e,...t}));function we(e){return Z[e]?.providerId??e}function Te(e){return Ce.find(t=>t.providerId===e)?.key}var Ee=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-coding-global`,`zhipu-coding-cn`]);function De(e){if(Ee.has(e))return Te(e)}var Oe=[{value:`text`,labelKey:`inputTextOnly`},{value:`text,image`,labelKey:`inputTextVision`}];function ke(){return k(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,z,`dark:border-edge`)}function Ae(){return k(R,L)}function je(e){return(e.input||[`text`]).includes(`image`)?`text,image`:`text`}function Me(e){return e===`text,image`?[`text`,`image`]:[`text`]}var Ne={chat:[`日常对话与交办任务`,`Everyday conversations and tasks`],vision:[`理解照片、截图和图片内容`,`Understand photos, screenshots and images`],image:[`根据描述生成图片`,`Create images from a description`],transcription:[`聊天听写与笔记录音转文字`,`Dictate messages and transcribe recorded notes`],speech:[`朗读消息,选择喜欢的音色`,`Read messages aloud in your preferred voice`],conversation:[`实时通话、音色与音频设备`,`Live calls, voices and audio devices`],background:[`自动化、定时和无人值守任务`,`Automations, schedules and unattended tasks`]};function Pe(e,t,n){return n?{"qwen-token-plan-cn":`阿里云百炼订阅 · 北京`,"qwen-token-plan":`阿里云百炼订阅 · 国际`,"dashscope-cn":`阿里云百炼 · 中国区`,"dashscope-intl":`阿里云百炼 · 国际区`,"xiaomi-token-plan-cn":`小米 MiMo 订阅 · 中国区`}[e]??t:t}var Q=r(),$={chat:[`对话与任务`,`Chat and tasks`],vision:[`看图`,`Image understanding`],image:[`画图`,`Image generation`],background:[`后台任务`,`Background tasks`],speech:[`语音合成`,`Speech synthesis`],transcription:[`录音识别`,`Recorded audio recognition`],conversation:[`实时语音对话`,`Realtime conversation`]};function Fe({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,W.useRef)(!1),[T,E]=(0,W.useState)(null),[D,k]=(0,W.useState)({mode:i?`replace`:`fill`,modelIds:n}),[j,M]=(0,W.useState)(``),[N,P]=(0,W.useState)(!1),[ee,te]=(0,W.useState)(!1),[I,L]=(0,W.useState)(r||!!t?.configured),[R,z]=(0,W.useState)(!1),B=(0,W.useRef)(!1),[V,H]=(0,W.useState)(``),[U,oe]=(0,W.useState)(!1),[se,G]=(0,W.useState)(0);(0,W.useEffect)(()=>{let t=!0;return ue(e,{modelIds:n,...a?{selected:[]}:{},...i&&!a?{mode:`replace`,selected:[i]}:{}}).then(e=>{t&&(E(e),L(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)})),H(``))}).catch(e=>{t&&H(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[e,n,i,a,se]),(0,W.useEffect)(()=>(g?.(R),()=>g?.(!1)),[R,g]);let K=D.selected??[],le=e=>{k({...D,mode:e,selected:T?.uses.filter(t=>t.recommended&&t.choices.length&&(e===`replace`||t.selected)).map(e=>e.id)??[]})},q=async()=>{if(!T||B.current)return;B.current=!0,z(!0),H(``),te(!1);let t=!1;try{j.trim()&&(await ie({[e]:j.trim()}),t=!0,te(!0),L(!0),P(!1),M(``));let n=await ue(e,D);if(L(n.configured),a){if(!n.configured)throw Error(v?`请先连接此服务。`:`Connect this service first.`);E(n),oe(!0),p?.();return}let r=T.uses.filter(e=>K.includes(e.id)).map(e=>D.overrides?.[e.id]??e.recommended),i=n.uses.filter(e=>K.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 de(e,D,n.revision),E(n),oe(!0),p?.()}catch(e){let n=e instanceof Error?e.message:String(e);H((!h&&t?v?`服务已保存,用途配置未完成。`:`Connection saved; model setup is incomplete. `:``)+n)}finally{B.current=!1,z(!1)}},J=T?.profile.name??t?.name??e,Y=T?.profile.apiKeyUrl??X[e]?.apiKeyUrl;if(h){let n=T?.uses.find(e=>e.id===i),r=i?D.overrides?.[i]??n?.recommended:void 0,a=Pe(e,J,v);return(0,Q.jsxs)(`div`,{className:`space-y-6 p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:a}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i?`${v?`用于`:`For `}${ce[i][+!v]}`:``})]}),(0,Q.jsx)(F,{variant:`ghost`,disabled:R,onClick:f,children:v?`更换服务`:`Change service`})]}),!T&&!V?(0,Q.jsx)(A,{className:`h-48 w-full rounded-xl`}):null,T?(0,Q.jsxs)(Q.Fragment,{children:[T.profile.credential===`oauth`&&!I?(0,Q.jsx)(ae,{providerId:e,displayName:a,connected:I,onConnected:()=>{L(!0),G(e=>e+1)}}):null,T.profile.credential===`oauth`&&I&&!t?.supportsApiKey?(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 rounded-xl bg-surface-inset px-4 py-3 text-sm text-fg`,children:[(0,Q.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),v?`使用已有连接`:`Using the existing connection`]}):null,T.profile.credential===`api-key`||T.profile.credential===`oauth`&&t?.supportsApiKey?(0,Q.jsx)(`div`,{className:`space-y-3`,children:I&&!N?(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-inset px-4 py-3`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,Q.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),v?`使用已有连接`:`Using the existing connection`]}),(0,Q.jsx)(F,{variant:`ghost`,disabled:R,onClick:()=>P(!0),children:v?`更换`:`Change`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.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`}),I?(0,Q.jsx)(F,{variant:`ghost`,disabled:R,onClick:()=>{P(!1),M(``)},children:v?`保留原 Key`:`Keep saved key`}):null]}),(0,Q.jsx)(S,{id:`provider-setup-key`,disabled:R,value:j,onChange:M,placeholder:I?v?`输入新的 API Key`:`Enter a new API key`:v?`粘贴 API Key`:`Paste your API key`,labels:ne(c(o).providersSettings)}),I?(0,Q.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,Y?(0,Q.jsx)(`a`,{className:`inline-flex min-h-10 items-center text-sm text-accent-fg hover:underline`,href:Y,target:`_blank`,rel:`noopener noreferrer`,children:v?`获取 API Key`:`Get an API key`}):null]})}):null,n?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`label`,{className:`block text-sm font-medium text-fg`,children:v?`选择模型`:`Model`}),(0,Q.jsx)(y,{value:r??``,disabled:R||!n.choices.length,"aria-label":v?`选择模型`:`Model`,onChange:e=>k({...D,selected:[n.id],overrides:{...D.overrides,[n.id]:e.target.value}}),children:n.choices.map(e=>(0,Q.jsx)(b,{value:e.id,children:e.name},e.id))})]}):null,(0,Q.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,V?(0,Q.jsxs)(`div`,{role:`alert`,className:`space-y-2 rounded-xl border border-edge p-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:ee?v?`连接信息已保存,模型尚未切换。请重试。`:`Connection saved. The model has not switched; please retry.`:v?`未能应用配置,请重试。`:`Could not apply settings. Please retry.`}),(0,Q.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:v?`查看详情`:`Show details`}),(0,Q.jsx)(`p`,{className:`mt-2 break-words`,children:V})]})]}):null,(0,Q.jsx)(`div`,{className:`flex items-center justify-end gap-3 border-t border-edge-subtle pt-4`,children:(0,Q.jsxs)(F,{variant:`primary`,disabled:R||!T&&!V||!!T&&(!I&&!j.trim()||!r||!n?.choices.some(e=>e.id===r)),onClick:()=>{T?q():G(e=>e+1)},children:[R?(0,Q.jsx)(w,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,R?v?`正在应用…`:`Applying…`:!T&&V?v?`重新加载`:`Reload`:V?v?`重试`:`Retry`:I&&!j.trim()?v?`使用此模型`:`Use this model`:v?`连接并使用`:`Connect and use`]})})]})}let fe=h?`h3`:m,pe=h?`p`:u;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 px-5 py-5`,children:[d&&!R&&!U?(0,Q.jsx)(F,{variant:`ghost`,className:`shrink-0 p-1.5`,"aria-label":v?`返回`:`Back`,onClick:d,children:(0,Q.jsx)(_,{className:`size-4`})}):null,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(fe,{className:`text-base font-semibold text-fg`,children:i?`${v?`连接服务 · `:`Connect service · `}${$[i][+!v]}`:v?`连接模型服务`:`Connect model service`}),(0,Q.jsx)(pe,{className:`mt-2 text-sm text-fg-muted`,children:J})]}),(0,Q.jsx)(F,{variant:`ghost`,className:`shrink-0 p-1.5`,disabled:R,"aria-label":v?`关闭`:`Close`,onClick:f,children:(0,Q.jsx)(O,{className:`size-4`})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 pb-5`,children:[!T&&!V?(0,Q.jsx)(A,{className:`h-64 w-full rounded-xl`}):null,T?(0,Q.jsxs)(Q.Fragment,{children:[!U&&s.length>1&&l?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-xs text-fg-muted`,children:v?`接入方式 / 地域`:`Access method / region`}),(0,Q.jsx)(y,{value:e,disabled:R,"aria-label":v?`接入方式 / 地域`:`Access method / region`,onChange:e=>l(e.target.value),children:s.map(e=>(0,Q.jsx)(b,{value:e.id,children:e.setupProfile?.name??e.name},e.id))})]}):null,U?(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-fg`,children:[(0,Q.jsx)(x,{className:`size-4`}),a?v?`服务连接已保存`:`Connection saved`:v?`所选用途配置已保存`:`Selected model uses saved`]}):(0,Q.jsxs)(Q.Fragment,{children:[T.profile.credential===`oauth`&&!I?(0,Q.jsx)(ae,{providerId:e,displayName:J,connected:I,onConnected:()=>{L(!0),G(e=>e+1)}}):null,(T.profile.credential===`api-key`||T.profile.credential===`oauth`&&t?.supportsApiKey)&&!r?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.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`}),(0,Q.jsx)(S,{id:`provider-setup-key`,disabled:R,value:j,onChange:M,placeholder:I?v?`留空使用已保存的凭据`:`Leave empty to use saved credentials`:`API Key`,labels:ne(c(o).providersSettings)}),Y?(0,Q.jsx)(`a`,{className:`inline-flex min-h-8 items-center text-sm text-accent-fg hover:underline`,href:Y,target:`_blank`,rel:`noopener noreferrer`,children:v?`获取对应接入方式的 Key`:`Get a key for this access method`}):null]}):null,!a&&!h?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:v?`模型用途`:`Model uses`}),(0,Q.jsx)(re,{className:`flex gap-2`,indicatorClassName:`rounded-lg bg-surface-active`,children:[`fill`,`replace`].map(e=>(0,Q.jsx)(F,{variant:D.mode===e?`secondary`:`ghost`,disabled:R,"aria-pressed":D.mode===e,onClick:()=>le(e),children:e===`fill`?v?`补齐未配置`:`Fill missing`:v?`改用此服务`:`Switch to this service`},e))})]}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h?v?`仅更新当前能力,其他模型和参数保持原设置。`:`Only this capability changes; other settings are preserved.`:v?`保存连接后返回能力设置,再选择要使用的模型。`:`Save the connection, then choose a model in capability settings.`})]}),a?(0,Q.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=>$[e.id][+!v]).join(`、`)]}):null,a?null:(0,Q.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,Q.jsxs)(`div`,{className:`space-y-2 py-3`,children:[(0,Q.jsxs)(`label`,{className:`flex min-h-10 items-start gap-3`,children:[(0,Q.jsx)(`input`,{hidden:h,type:`checkbox`,className:`ui-checkbox mt-1`,checked:K.includes(e.id),disabled:h||R||U||!t||!e.choices.length,onChange:t=>k({...D,selected:t.target.checked?[...K,e.id]:K.filter(t=>t!==e.id)})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:$[e.id][+!v]}),(0,Q.jsx)(`span`,{className:`mt-1 block break-all text-xs text-fg-muted`,children:K.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`)})]})]}),!U&&e.choices.length>1?(0,Q.jsxs)(`details`,{open:h||void 0,className:`pl-7`,children:[(0,Q.jsx)(`summary`,{className:`text-xs text-accent-fg`,children:v?`选择具体模型`:`Choose a model`}),(0,Q.jsx)(y,{value:t??``,disabled:R,"aria-label":$[e.id][+!v],onChange:t=>k({...D,selected:[...new Set([...K,e.id])],overrides:{...D.overrides,[e.id]:t.target.value}}),children:e.choices.map(e=>(0,Q.jsx)(b,{value:e.id,children:e.name},e.id))})]}):null]},e.id)})}),U?null:(0,Q.jsx)(F,{variant:`ghost`,disabled:R,onClick:()=>G(e=>e+1),children:v?`刷新目录`:`Refresh catalog`}),!a&&!h?(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`text-xs text-accent-fg`,children:v?`任务模型与其他用途`:`Task models and other uses`}),(0,Q.jsxs)(`div`,{className:`mt-2 space-y-1 text-xs text-fg-muted`,children:[Object.entries(T.taskModels).map(([e,t])=>(0,Q.jsxs)(`p`,{children:[e,`: `,t]},e)),(0,Q.jsx)(`p`,{children:v?`未选用途与电脑操作保留当前配置;所选用途清除跨服务回退。`:`Unselected uses and Computer Use keep their settings. Selected uses clear cross-service fallbacks.`})]})]}):null,(0,Q.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,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:v?`配置保存与模型真实调用验证分别显示;此操作不会发送测试请求。`:`Saving settings does not perform a model test request.`})]}):null,V?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:V}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:T&&!U&&!a?v?`将配置 ${K.length} 项`:`${K.length} uses selected`:``}),U?(0,Q.jsx)(F,{onClick:f,children:v?`完成`:`Done`}):!T&&V?(0,Q.jsx)(F,{onClick:()=>G(e=>e+1),children:v?`重试`:`Retry`}):(0,Q.jsxs)(F,{onClick:()=>void q(),disabled:R||!T||!I&&!j.trim()||h&&!K.some(e=>D.overrides?.[e]||T.uses.find(t=>t.id===e)?.recommended),children:[R?(0,Q.jsx)(w,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}):null,R?v?`正在应用…`:`Applying…`:K.length?h&&i?`${v?`连接并用于`:`Connect and use for `}${$[i][+!v]}`:v?`连接并应用`:`Connect and apply`:v?`仅连接`:`Connect only`]})]})]})}function Ie(e){let t=(0,G.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,Q.jsx)(Fe,{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 Le(e){let t=(0,G.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,W.useState)(_),[b,x]=(0,W.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,W.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,Q.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,Q.jsxs)(f,{children:[M,(0,Q.jsx)(p,{className:N,children:C.type===`success`?(0,Q.jsx)(Ie,{target:C.target,targetUse:i,zh:d===`zh`,onApplied:()=>m(C.target.providerId),onDone:()=>O(!1)}):C.type===`pick`?(0,Q.jsx)(ze,{builtinRows:s,searchQuery:b,onSearchChange:x,labels:u,language:d,scrollTopRef:w,onPickBuiltin:e=>{let t=De(e);y(t?{type:`custom`,presetKey:t}:{type:`builtin`,providerId:e})},onPickCustom:()=>y({type:`custom`})}):C.type===`builtin`?(0,Q.jsx)(Fe,{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=De(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,Q.jsx)(Ge,{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,Q.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 Re(e){let t=(0,G.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,Q.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,Q.jsx)(d,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:r,"aria-label":n,children:i})}),t[2]=n,t[3]=a),a}function ze({builtinRows:e,searchQuery:t,onSearchChange:n,labels:r,language:i,scrollTopRef:a,onPickBuiltin:o,onPickCustom:s}){let c=t.trim().toLowerCase(),l=(0,W.useRef)(null);(0,W.useLayoutEffect)(()=>{let e=l.current;e&&a.current>0&&(e.scrollTop=a.current)},[a]);let d=(0,W.useMemo)(()=>c?e.filter(e=>{let t=X[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,W.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.onboardingFeatured&&[`subscription`,`account`].includes(e.setupProfile?.access??``)).slice(0,6),h=p.map(e=>e.id),g=f.filter(e=>e.configured&&!h.includes(e.id)),_=(0,W.useMemo)(()=>he(f.filter(e=>!h.includes(e.id)&&!e.configured)),[f,h]),y=e=>{let t=X[e.id];return i===`zh`?t?.descriptionZh??t?.description:t?.description};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-5 pb-3 pt-5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(m,{className:`text-base font-semibold text-fg`,children:r.step1Title}),(0,Q.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:r.step1Subtitle})]}),(0,Q.jsx)(Re,{label:r.close})]}),(0,Q.jsx)(`div`,{className:`px-5 pb-3`,children:(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.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,Q.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`,z)})]})}),(0,Q.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,Q.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:r.noResults}):c?(0,Q.jsx)(Be,{title:r.searchResults,children:f.map(e=>(0,Q.jsx)(Ve,{row:e,description:y(e),labels:r,onPick:o},e.id))}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[p.length>0?(0,Q.jsx)(Be,{title:r.quickStart,children:p.map(e=>(0,Q.jsx)(Ve,{row:e,description:y(e),labels:r,prominent:!0,onPick:o},e.id))}):null,g.length>0?(0,Q.jsx)(Be,{title:r.connectedSection,children:g.map(e=>(0,Q.jsx)(Ve,{row:e,description:y(e),labels:r,onPick:o},e.id))}):null,me.map(e=>{let t=_.get(e)??[];return t.length===0?null:(0,Q.jsx)(Be,{title:r.categories[e]??e,children:t.map(e=>(0,Q.jsx)(Ve,{row:e,description:y(e),labels:r,onPick:o},e.id))},e)}),(0,Q.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,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base/60 text-fg-muted`,children:(0,Q.jsx)(C,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.addCustom}),(0,Q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-muted`,children:r.customDescription})]}),(0,Q.jsx)(v,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})]})})]})}function Be(e){let t=(0,G.c)(7),{title:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.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,Q.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,Q.jsxs)(`section`,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ve(e){let t=(0,G.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,Q.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,Q.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,Q.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,Q.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,Q.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,Q.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,Q.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,Q.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,Q.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 He(e){return{clientKey:crypto.randomUUID(),value:e}}function Ue(e=`custom`){if(e!==`custom`&&Z[e]){let t=Z[e].config;return{preset:e,providerId:we(e),baseUrl:t.baseUrl??``,api:t.api??`openai-completions`,apiKey:t.apiKey??``,modelSlots:(t.models?.map(e=>e.id)??[``]).map(He),error:null}}return{preset:`custom`,providerId:``,baseUrl:``,api:`openai-completions`,apiKey:``,modelSlots:[He(``)],error:null}}function We(e,t){switch(t.type){case`applyPreset`:return t.key===`custom`?{...e,preset:`custom`,error:null}:Z[t.key]?Ue(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,He(``)]};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(He)};case`removeModelSlot`:return{...e,modelSlots:e.modelSlots.filter((e,n)=>n!==t.index)};case`setError`:return{...e,error:t.value}}}function Ge({initialPresetKey:e,customConfig:t,labels:n,language:r,onBack:i,onSaved:a}){let[o,s]=(0,W.useReducer)(We,void 0,()=>Ue(e)),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(!1),p=ne(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 be({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()||we(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 xe({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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-3 pt-5`,children:[(0,Q.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,Q.jsx)(v,{className:`size-4 rotate-180`,"aria-hidden":!0})}),(0,Q.jsx)(m,{className:`min-w-0 flex-1 text-base font-semibold text-fg`,children:n.step2CustomTitle}),(0,Q.jsx)(Re,{label:n.close})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 pb-4`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-hover/20 p-4`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.customDescription}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:`custom-preset`,className:`text-sm font-medium text-fg`,children:n.presetLabel}),(0,Q.jsxs)(y,{id:`custom-preset`,value:h,onChange:e=>s({type:`applyPreset`,key:e.target.value}),className:Ae(),children:[(0,Q.jsx)(b,{value:`custom`,children:n.presetCustom}),Ce.map(e=>(0,Q.jsx)(b,{value:e.key,children:e.label},e.key))]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:`custom-provider-id`,className:`text-sm font-medium text-fg`,children:n.providerIdLabel}),(0,Q.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`,z)})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:`custom-base-url`,className:`text-sm font-medium text-fg`,children:n.baseUrlLabel}),(0,Q.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`,z)})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:`custom-api-type`,className:`text-sm font-medium text-fg`,children:n.apiTypeLabel}),(0,Q.jsx)(y,{id:`custom-api-type`,value:x,onChange:e=>s({type:`setApi`,value:e.target.value}),className:Ae(),children:ge.map(e=>(0,Q.jsx)(b,{value:e.value,children:e.label},e.value))})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:`custom-api-key`,className:`text-sm font-medium text-fg`,children:n.apiKeyLabel}),(0,Q.jsx)(S,{id:`custom-api-key`,value:C,onChange:e=>s({type:`setApiKey`,value:e}),placeholder:n.apiKeyPlaceholder,labels:p})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.modelIdLabel}),(0,Q.jsxs)(F,{type:`button`,variant:`secondary`,className:`gap-1.5`,disabled:!ee||d,onClick:()=>void N(),children:[d?(0,Q.jsx)(w,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(E,{className:`size-3.5`,"aria-hidden":!0}),d?n.discoveringModels:n.discoverModels]})]}),j.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.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`,z)}),j.length>1?(0,Q.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,Q.jsx)(O,{className:`size-3.5`,"aria-hidden":!0})}):null]},D[t].clientKey)),(0,Q.jsxs)(F,{type:`button`,variant:`ghost`,className:`w-fit gap-1.5 text-fg-muted`,onClick:()=>s({type:`addModelSlot`}),children:[(0,Q.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),n.addModel]})]}),A?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:A}):null]})}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-2 bg-surface-hover/15 px-5 py-3`,children:[(0,Q.jsx)(F,{type:`button`,variant:`secondary`,onClick:i,children:n.cancel}),(0,Q.jsx)(F,{type:`button`,variant:`primary`,disabled:!P||l,onClick:()=>void M(),children:l?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(w,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),n.saving]}):n.save})]})]})}function Ke(){let e=(0,G.c)(29),t=!!o(Qe),{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,Ze,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,Xe,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?V:null,Ye,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=H(c,U(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=ve(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(Je).map(qe)),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 qe(e){return e.id}function Je(e){return e.configured}function Ye(){return ye()}function Xe(){return N()}async function Ze(e){let{payload:t}=await(await fetch(e,{credentials:`same-origin`,redirect:`error`})).json();return t?.providers??[]}function Qe(e){return e.conversationId}function $e(e){let t=(0,G.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,Q.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,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,children:[e,(0,Q.jsx)(`div`,{className:`flex flex-col gap-1`,children:[1,2,3].map(tt)})]}),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(et),r=e.length>0?n.titleCount.replace(`{{count}}`,String(e.length)):n.title,s;t[7]===r?s=t[8]:(s=(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:r}),t[7]=r,t[8]=s);let l=e.length>0?(0,Q.jsxs)(F,{type:`button`,variant:`primary`,className:`gap-1.5`,onClick:i,children:[(0,Q.jsx)(T,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),n.addProvider]}):null,u;t[9]!==s||t[10]!==l?(u=(0,Q.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,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u,e.length===0?(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/25 px-6 py-10 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.empty}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint}),(0,Q.jsxs)(F,{type:`button`,variant:`primary`,className:`mt-4 gap-1.5`,onClick:i,children:[(0,Q.jsx)(T,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),n.addProvider]})]}):(0,Q.jsx)(`div`,{className:`flex flex-col gap-1 rounded-xl bg-surface-hover/20 p-1`,children:e.map(e=>(0,Q.jsx)(nt,{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 et(e){return e.configured}function tt(e){return(0,Q.jsx)(A,{className:`h-16 rounded-lg`},e)}function nt(e){let t=(0,G.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,Q.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,Q.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,Q.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,Q.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,Q.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,Q.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,Q.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,Q.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,Q.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{ce as C,se as D,J as E,oe as O,K as S,le as T,pe as _,Fe as a,Y as b,Oe as c,De as d,je as f,X as g,be as h,Ie as i,ke as l,Se as m,Ke as n,Ne as o,Ae as p,Le as r,Pe as s,$e as t,Me as u,fe as v,q as w,ue as x,de as y};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i,u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as o,l as s,n as c,o as l}from"./locale-store-fGFrr4_4.js";import{t as u}from"./messages-9OwWjlww.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{i as v,n as y,r as b,t as x}from"./service-recommendation-list-NdwoBa_O.js";import{t as S}from"./chevron-down-ccbiQQz_.js";import{t as C}from"./chevron-right-BweFrslA.js";import{n as w,r as T,t as E}from"./popover-select-CEMWIrtY.js";import{t as D}from"./circle-alert-BEjgurr2.js";import{t as O}from"./circle-check-C23XjkUj.js";import{t as k}from"./circle-pause-CN9jYH2s.js";import{a as A,i as j,n as M,r as N,t as P}from"./connector-filters-Cfcx9EA2.js";import{t as F}from"./clock-3-DnrAnuyZ.js";import{t as I}from"./database-CjjeZfRG.js";import{t as L}from"./ellipsis-0k4rZLoy.js";import{t as R}from"./external-link-DjqjBmc3.js";import{n as z}from"./secret-input-Dryrns2s.js";import{t as B}from"./eye-CABVeTq0.js";import{t as V}from"./key-round-DWbpyU2U.js";import{t as H}from"./loader-circle-CifKLtgG.js";import{a as U,c as ee,i as W,n as te,o as G,r as ne,s as re,t as ie}from"./install-connector-dialog-xHNBuSj0.js";import{t as K}from"./plug-DKYPEgkR.js";import{t as ae}from"./plus-Q2yW6OE7.js";import{t as oe}from"./refresh-cw-BRlGaq2w.js";import{t as se}from"./save-DRDABU--.js";import{t as q}from"./server-BlHCBjiE.js";import{t as J}from"./settings-uiTATseT.js";import{t as ce}from"./store-SzD1Jvgm.js";import{t as le}from"./terminal-oKqqZdiG.js";import{t as ue}from"./trash-2-DusmjVPV.js";import{t as de}from"./wrench-DFb4r8bH.js";import{t as fe}from"./x-B_N4OPjy.js";import{t as Y}from"./cn-0WouolD0.js";import{t as pe}from"./skeleton-BI5TyibZ.js";import{r as me}from"./extension-provider-DCur0Xcb.js";import{i as he}from"./vendor-swr-CdRzEUwF.js";import{n as X,r as ge}from"./gateway-config-swr-C-fPl1hP.js";import{t as Z}from"./button-Cc4hUNTt.js";import{n as _e}from"./copy-to-clipboard-HOJ79TWv.js";import{n as ve}from"./interaction-BdhHBbYa.js";import{A as ye,E as be,F as xe,I as Se,L as Ce,M as we,N as Te,O as Ee,P as De,R as Oe,S as ke,_ as Ae,a as je,c as Me,d as Ne,i as Pe,j as Fe,l as Ie,m as Le,n as Re,o as ze,p as Be,r as Ve,s as He,u as Ue,v as We,w as Ge,x as Ke,y as qe,z as Je}from"./connectors-api-D6CPY0Nu.js";import{s as Ye}from"./form-field-width-DJw_jULe.js";import{n as Xe}from"./electron-env-DHOGevH3.js";import{t as Ze}from"./page-tabs-oeTY7z3_.js";import{t as Qe}from"./page-header-store-DBeD_mAA.js";import{t as $e}from"./sliding-tab-list-DuQyViqe.js";import{t as et}from"./confirm-dialog-D7dQJytv.js";import{l as tt,m as nt,o as rt,r as it,t as at}from"./dist-ZrL34Ps4.js";import{t as ot}from"./capability-links-DzQWK1Fh.js";import{t as st}from"./capability-icon-DVoZxEgW.js";import{n as ct,t as lt}from"./capability-header-actions-BxMYfQ8y.js";import{t as ut}from"./connector-service-page-C3ZhlR8V.js";import{t as dt}from"./number-input-El7Szeln.js";var Q=e(t(),1),ft=n(),$=r();function pt(e){let t=(0,ft.c)(57),{connector:n,installed:r,onInstall:i,onOpenDetails:a,t:o}=e,s,c,l,u,d,f;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o){let e=n.capabilities.filter(mt),p=e.slice(0,2),m=Math.max(0,e.length-p.length),h=o.connect,g;t[11]!==n||t[12]!==o?(g=W(n,o),t[11]=n,t[12]=o,t[13]=g):g=t[13];let _=g,v=n.verificationLevel===`verified`?o.connectorVerified:n.verificationLevel===`beta`?o.connectorBeta:n.verificationLevel===`experimental`?o.connectorExperimental:null,y;t[14]!==h||t[15]!==n||t[16]!==i?(y=e=>(0,$.jsxs)(Z,{type:`button`,variant:`secondary`,className:Y(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:()=>i(n),children:[(0,$.jsx)(ee,{className:`size-4`}),h]}),t[14]=h,t[15]=n,t[16]=i,t[17]=y):y=t[17],s=y,f=`group flex min-h-[8.75rem] flex-col rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`,c=`flex min-w-0 flex-1 flex-col`;let b;t[18]===n?b=t[19]:(b=(0,$.jsx)(te,{connector:n}),t[18]=n,t[19]=b);let x;t[20]!==n||t[21]!==a?(x=a?(0,$.jsx)(`button`,{type:`button`,className:`block max-w-full truncate text-left text-sm font-semibold text-fg hover:underline`,onClick:()=>a(n),children:n.displayName}):(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.displayName}),t[20]=n,t[21]=a,t[22]=x):x=t[22];let S;t[23]===v?S=t[24]:(S=v?(0,$.jsx)(`span`,{className:`mt-1 inline-flex rounded-full border border-edge px-1.5 py-0.5 text-[10px] font-medium text-fg-subtle`,children:v}):null,t[23]=v,t[24]=S);let C;t[25]!==S||t[26]!==x?(C=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[25]=S,t[26]=x,t[27]=C):C=t[27];let w;t[28]!==C||t[29]!==b?(w=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[b,C]}),t[28]=C,t[29]=b,t[30]=w):w=t[30];let T;t[31]!==r||t[32]!==s?(T=r?null:(0,$.jsx)(`div`,{className:`hidden shrink-0 items-center gap-1 sm:flex`,children:s()}),t[31]=r,t[32]=s,t[33]=T):T=t[33];let E;t[34]!==r||t[35]!==o.connectedBadge?(E=r?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,$.jsx)(O,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}):null,t[34]=r,t[35]=o.connectedBadge,t[36]=E):E=t[36];let D;t[37]!==T||t[38]!==E?(D=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[T,E]}),t[37]=T,t[38]=E,t[39]=D):D=t[39],t[40]!==w||t[41]!==D?(l=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[w,D]}),t[40]=w,t[41]=D,t[42]=l):l=t[42],t[43]===_?u=t[44]:(u=(0,$.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-6 text-fg-muted`,title:_,children:_}),t[43]=_,t[44]=u),d=p.length>0?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[p.map(e=>(0,$.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:o.connectorCapabilityLabels[e]??e},e)),m>0?(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-subtle`,children:[`+`,m]}):null]}):null,t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f}else s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10];let p;t[45]!==c||t[46]!==l||t[47]!==u||t[48]!==d?(p=(0,$.jsxs)(`div`,{className:c,children:[l,u,d]}),t[45]=c,t[46]=l,t[47]=u,t[48]=d,t[49]=p):p=t[49];let m;t[50]!==r||t[51]!==s?(m=r?null:(0,$.jsx)(`div`,{className:`mt-4 flex flex-col gap-2 border-t border-edge pt-3 sm:hidden`,children:s(`w-full`)}),t[50]=r,t[51]=s,t[52]=m):m=t[52];let h;return t[53]!==f||t[54]!==p||t[55]!==m?(h=(0,$.jsxs)(`div`,{className:f,children:[p,m]}),t[53]=f,t[54]=p,t[55]=m,t[56]=h):h=t[56],h}function mt(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}var ht=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function gt(e,t){return t.some(t=>t.connectorId===e.id)}var _t=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function vt(){let e=(0,ft.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:Y(`size-10 shrink-0 rounded-xl`,_t)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`div`,{className:`flex h-full min-h-[9.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:Y(`h-4 min-w-0 flex-1`,_t)}),(0,$.jsx)(`div`,{className:Y(`h-8 w-[4.5rem] shrink-0 rounded-lg`,_t)})]}),(0,$.jsx)(`div`,{className:Y(`h-3 w-full`,_t)}),(0,$.jsx)(`div`,{className:Y(`h-3 w-[88%]`,_t)})]})]})}),e[1]=n):n=e[1],n}function yt(){let e=(0,ft.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(pe,{className:`size-9 shrink-0 rounded-lg`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex min-h-[8.75rem] min-w-0 flex-col rounded-xl border border-edge bg-surface-panel p-4`,"aria-hidden":!0,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,$.jsx)(pe,{className:`h-4 w-28 max-w-full`}),(0,$.jsx)(pe,{className:`h-3 w-20 max-w-full`})]})]}),(0,$.jsx)(pe,{className:`mt-2 h-3 w-48 max-w-full`}),(0,$.jsx)(pe,{className:`ml-auto mt-auto h-3 w-16`})]}),e[1]=n):n=e[1],n}var bt=[`understand`,`act`,`reach`];function xt(e){if(e.benefits?.length)return[...new Set(e.benefits)];let t=new Set(e.capabilities),n=[e.id,e.displayName,...e.tags??[]].join(` `).toLowerCase(),r=[];return(t.has(`context`)||t.has(`memory_source`)||t.has(`resources`)||e.category===`docs`||e.category===`data`||/notion|drive|document|confluence|airtable|database|knowledge|wiki/.test(n))&&r.push(`understand`),t.has(`tools`)&&r.push(`act`),(t.has(`channel`)||/slack|telegram|discord|teams|mail|message|wechat|weixin/.test(n))&&r.push(`reach`),r.length?[...new Set(r)]:[`act`]}function St(e){return xt(e)[0]??`act`}function Ct(e,t){let n=t?St(t):`act`,r=e.connectionStatus===`connected`||e.status===`connected`||e.usage.lastHealthStatus===`ok`,i=e.status===`not_configured`||e.status===`failed`||e.status===`degraded`||e.status===`unauthorized`||e.connectionStatus===`unauthorized`||e.connectionStatus===`error`,a=n===`understand`?e.usage.lastResourceCount:n===`act`?e.usage.lastToolCount:void 0;return{benefit:n,state:r?`ready`:i?`needs_setup`:`checking`,availableCount:a}}function wt(e,t){return t.connectorCapabilityLabels[e]??e}function Tt(e,t){if(e.runtime.type===`mcp`)return U(t.connectorRuntimeMcp,{serverId:e.runtime.serverId});let n=e.runtime.type===`composio`?e.runtime.toolkit:e.runtime.type===`cli`?e.runtime.adapterId:e.runtime.sourceKind;return U(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function Et(e,t){return e.auth.mode===`cli`?t.connectorAuthCli:e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function Dt(e){let t=(0,ft.c)(133),{connector:n,installed:r,onClose:i,onInstall:a,t:o}=e,s;t[0]!==n||t[1]!==o?(s=W(n,o),t[0]=n,t[1]=o,t[2]=s):s=t[2];let c=s,l,u,v,y,b,x,S,C,w,T,E,D,k,A,j,M;if(t[3]!==n||t[4]!==c||t[5]!==r||t[6]!==i||t[7]!==o){let e=xt(n),a;t[24]!==n.setup.config||t[25]!==n.setup.secrets?(a=[...(n.setup.secrets??[]).filter(At),...(n.setup.config??[]).filter(kt)],t[24]=n.setup.config,t[25]=n.setup.secrets,t[26]=a):a=t[26];let s=a,N=n.capabilities.filter(Ot);v=_,S=!0,t[27]===i?C=t[28]:(C=e=>{e||i()},t[27]=i,t[28]=C),u=m,t[29]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[29]=x):x=t[29],l=h,t[30]===Symbol.for(`react.memo_cache_sentinel`)?(y=Y(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,42rem)] w-[min(100%-2rem,min(92vw,44rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-overlay shadow-float outline-none dark:border-edge`),t[30]=y):y=t[30];let P;t[31]===n?P=t[32]:(P=(0,$.jsx)(te,{connector:n,size:`lg`}),t[31]=n,t[32]=P);let F;t[33]===n.displayName?F=t[34]:(F=(0,$.jsx)(g,{className:`text-base font-semibold text-fg`,children:n.displayName}),t[33]=n.displayName,t[34]=F);let I;t[35]!==r||t[36]!==o.connectedBadge?(I=r?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,$.jsx)(O,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}):null,t[35]=r,t[36]=o.connectedBadge,t[37]=I):I=t[37];let L;t[38]!==F||t[39]!==I?(L=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[F,I]}),t[38]=F,t[39]=I,t[40]=L):L=t[40];let R;t[41]===c?R=t[42]:(R=(0,$.jsx)(f,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:c}),t[41]=c,t[42]=R);let z;t[43]!==L||t[44]!==R?(z=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[L,R]}),t[43]=L,t[44]=R,t[45]=z):z=t[45];let B;t[46]!==P||t[47]!==z?(B=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[P,z]}),t[46]=P,t[47]=z,t[48]=B):B=t[48];let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=Y(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ve.focusRingPanel),t[49]=H):H=t[49];let ee;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(fe,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[50]=ee):ee=t[50];let W;t[51]===o.modalClose?W=t[52]:(W=(0,$.jsx)(p,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:H,"aria-label":o.modalClose,children:ee})}),t[51]=o.modalClose,t[52]=W),t[53]!==B||t[54]!==W?(b=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-5 sm:px-6`,children:[B,W]}),t[53]=B,t[54]=W,t[55]=b):b=t[55],A=`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-5 sm:px-6`,j=e.length?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:o.connectorWhyConnect}),(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.connectorBenefitHeadings[e]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.connectorBenefitHints[e]})]},e))})]}):null;let G;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[56]=G):G=t[56];let ne;t[57]===o.detailPermissions?ne=t[58]:(ne=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.detailPermissions}),t[57]=o.detailPermissions,t[58]=ne);let re;t[59]!==n||t[60]!==o?(re=Et(n,o),t[59]=n,t[60]=o,t[61]=re):re=t[61];let ie;t[62]===re?ie=t[63]:(ie=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:re}),t[62]=re,t[63]=ie);let K;t[64]!==ne||t[65]!==ie?(K=(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3`,children:[G,(0,$.jsxs)(`div`,{children:[ne,ie]})]}),t[64]=ne,t[65]=ie,t[66]=K):K=t[66];let ae;t[67]===o.connectorSetupTitle?ae=t[68]:(ae=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.connectorSetupTitle}),t[67]=o.connectorSetupTitle,t[68]=ae);let oe;t[69]!==s.length||t[70]!==o.connectorRequiredInputsCount||t[71]!==o.connectorSetupNone?(oe=s.length?U(o.connectorRequiredInputsCount,{count:String(s.length)}):o.connectorSetupNone,t[69]=s.length,t[70]=o.connectorRequiredInputsCount,t[71]=o.connectorSetupNone,t[72]=oe):oe=t[72];let se;t[73]===oe?se=t[74]:(se=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:oe}),t[73]=oe,t[74]=se);let J;t[75]!==ae||t[76]!==se?(J=(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[ae,se]}),t[75]=ae,t[76]=se,t[77]=J):J=t[77],t[78]!==K||t[79]!==J?(M=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[K,J]}),t[78]=K,t[79]=J,t[80]=M):M=t[80],D=`rounded-xl border border-edge bg-surface-base`,t[81]===o.connectorTechnicalDetails?k=t[82]:(k=(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-fg`,children:o.connectorTechnicalDetails}),t[81]=o.connectorTechnicalDetails,t[82]=k),w=`space-y-5 border-t border-edge-subtle px-4 py-4`;let ce;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(q,{className:`size-3.5`,"aria-hidden":!0}),t[83]=ce):ce=t[83];let le;t[84]===o.connectorRuntimeTitle?le=t[85]:(le=(0,$.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[ce,o.connectorRuntimeTitle]}),t[84]=o.connectorRuntimeTitle,t[85]=le);let ue;t[86]!==n||t[87]!==o?(ue=Tt(n,o),t[86]=n,t[87]=o,t[88]=ue):ue=t[88];let de;t[89]===ue?de=t[90]:(de=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-subtle`,children:ue}),t[89]=ue,t[90]=de),t[91]!==le||t[92]!==de?(T=(0,$.jsxs)(`div`,{children:[le,de]}),t[91]=le,t[92]=de,t[93]=T):T=t[93],E=N.length?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:N.map(e=>(0,$.jsx)(`span`,{className:`rounded-md bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:wt(e,o)},e))}):null,t[3]=n,t[4]=c,t[5]=r,t[6]=i,t[7]=o,t[8]=l,t[9]=u,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D,t[20]=k,t[21]=A,t[22]=j,t[23]=M}else l=t[8],u=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19],k=t[20],A=t[21],j=t[22],M=t[23];let N;t[94]!==w||t[95]!==T||t[96]!==E?(N=(0,$.jsxs)(`div`,{className:w,children:[T,E]}),t[94]=w,t[95]=T,t[96]=E,t[97]=N):N=t[97];let P;t[98]!==N||t[99]!==D||t[100]!==k?(P=(0,$.jsxs)(`details`,{className:D,children:[k,N]}),t[98]=N,t[99]=D,t[100]=k,t[101]=P):P=t[101];let F;t[102]!==P||t[103]!==A||t[104]!==j||t[105]!==M?(F=(0,$.jsxs)(`div`,{className:A,children:[j,M,P]}),t[102]=P,t[103]=A,t[104]=j,t[105]=M,t[106]=F):F=t[106];let I;t[107]===o.modalClose?I=t[108]:(I=(0,$.jsx)(p,{asChild:!0,children:(0,$.jsx)(Z,{variant:`secondary`,children:o.modalClose})}),t[107]=o.modalClose,t[108]=I);let L;t[109]!==n||t[110]!==r||t[111]!==i||t[112]!==a||t[113]!==o.connect?(L=r?null:(0,$.jsxs)(Z,{variant:`primary`,onClick:()=>{a(n),i()},children:[(0,$.jsx)(ee,{className:`size-4`}),o.connect]}),t[109]=n,t[110]=r,t[111]=i,t[112]=a,t[113]=o.connect,t[114]=L):L=t[114];let R;t[115]!==I||t[116]!==L?(R=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[I,L]}),t[115]=I,t[116]=L,t[117]=R):R=t[117];let z;t[118]!==l||t[119]!==y||t[120]!==b||t[121]!==F||t[122]!==R?(z=(0,$.jsxs)(l,{className:y,children:[b,F,R]}),t[118]=l,t[119]=y,t[120]=b,t[121]=F,t[122]=R,t[123]=z):z=t[123];let B;t[124]!==u||t[125]!==x||t[126]!==z?(B=(0,$.jsxs)(u,{children:[x,z]}),t[124]=u,t[125]=x,t[126]=z,t[127]=B):B=t[127];let H;return t[128]!==v||t[129]!==S||t[130]!==C||t[131]!==B?(H=(0,$.jsx)(v,{open:S,onOpenChange:C,children:B}),t[128]=v,t[129]=S,t[130]=C,t[131]=B,t[132]=H):H=t[132],H}function Ot(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}function kt(e){return e.required}function At(e){return e.required}var jt=(0,Q.memo)(function(e){let t=(0,ft.c)(45),{onRefresh:n,refreshing:r,refreshLabel:i,onBrowseCatalog:a,onAddCustomServer:o,addLabel:s,browseLabel:c,customLabel:l,serviceLabel:u,moreActionsLabel:d}=e,[f,p]=(0,Q.useState)(!1),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=Y(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[highlighted]:bg-surface-hover`,ve.transition),t[0]=m):m=t[0];let h=m,g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(ae,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[1]=g):g=t[1];let _;t[2]===s?_=t[3]:(_=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:s}),t[2]=s,t[3]=_);let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(S,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[4]=v):v=t[4];let y;t[5]!==s||t[6]!==_?(y=(0,$.jsx)(nt,{asChild:!0,children:(0,$.jsxs)(Z,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":s,children:[g,_,v]})}),t[5]=s,t[6]=_,t[7]=y):y=t[7];let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(ce,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[8]=b):b=t[8];let x;t[9]!==c||t[10]!==a?(x=(0,$.jsxs)(it,{className:h,onSelect:a,children:[b,c]}),t[9]=c,t[10]=a,t[11]=x):x=t[11];let C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(de,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[12]=C):C=t[12];let w;t[13]!==l||t[14]!==o?(w=(0,$.jsxs)(it,{className:h,onSelect:o,children:[C,l]}),t[13]=l,t[14]=o,t[15]=w):w=t[15];let T;t[16]!==x||t[17]!==w?(T=(0,$.jsx)(rt,{children:(0,$.jsxs)(at,{className:`z-50 min-w-[14rem] rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[x,w]})}),t[16]=x,t[17]=w,t[18]=T):T=t[18];let E;t[19]!==T||t[20]!==y?(E=(0,$.jsxs)(tt,{children:[y,T]}),t[19]=T,t[20]=y,t[21]=E):E=t[21];let D;t[22]===f?D=t[23]:(D=(0,$.jsx)(ut,{open:f,onOpenChange:p,hideTrigger:!0}),t[22]=f,t[23]=D);let O;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(L,{className:`size-4`,"aria-hidden":!0}),t[24]=O):O=t[24];let k;t[25]===d?k=t[26]:(k=(0,$.jsx)(nt,{asChild:!0,children:(0,$.jsx)(Z,{type:`button`,variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":d,title:d,children:O})}),t[25]=d,t[26]=k);let A;t[27]!==n||t[28]!==i||t[29]!==r?(A=n?(0,$.jsxs)(it,{className:h,disabled:r,onSelect:n,children:[r?(0,$.jsx)(H,{className:`size-4 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,$.jsx)(oe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,t[27]=n,t[28]=i,t[29]=r,t[30]=A):A=t[30];let j,M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>p(!0),M=(0,$.jsx)(J,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t[31]=j,t[32]=M):(j=t[31],M=t[32]);let N;t[33]===u?N=t[34]:(N=(0,$.jsxs)(it,{className:h,onSelect:j,children:[M,u]}),t[33]=u,t[34]=N);let P;t[35]!==A||t[36]!==N?(P=(0,$.jsx)(rt,{children:(0,$.jsxs)(at,{className:`z-50 min-w-[14rem] rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[A,N]})}),t[35]=A,t[36]=N,t[37]=P):P=t[37];let F;t[38]!==k||t[39]!==P?(F=(0,$.jsxs)(tt,{children:[k,P]}),t[38]=k,t[39]=P,t[40]=F):F=t[40];let I;return t[41]!==E||t[42]!==D||t[43]!==F?(I=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2`,children:[E,D,F]}),t[41]=E,t[42]=D,t[43]=F,t[44]=I):I=t[44],I});function Mt(e=``,t=``){return{clientKey:crypto.randomUUID(),key:e,value:t}}var Nt=/^([^:=]+)[:=](.*)$/;function Pt(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return It(e)}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=Nt.exec(t);r&&n.push(Mt(r[1].trim(),r[2].trim()))}return n.length>0?n:null}function Ft(e){let t=Object.create(null);for(let n of e){let e=n.key.trim();e&&(t[e]=n.reference??n.value)}return Object.keys(t).length>0?t:void 0}function It(e){if(!e||typeof e!=`object`)return[Mt()];let t=Object.entries(e).map(([e,t])=>typeof t==`object`&&t&&!Array.isArray(t)?{...Mt(e),reference:t}:Mt(e,t==null?``:String(t)));return t.length>0?t:[Mt()]}function Lt(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.xopcConnector;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.managed===!0)}function Rt(e){let t=e.trim();if(!t)return;if(t.startsWith(`[`)){let e=JSON.parse(t);if(!Array.isArray(e)||e.some(e=>typeof e!=`string`))throw Error(`Command arguments must be a JSON array of strings.`);return e}let n=[],r=``,i=``,a=!1;for(let e=0;e<t.length;e++){let o=t[e];o===`\\`&&t[e+1]&&i!==`'`&&/[\s"'\\]/.test(t[e+1])?(r+=t[++e],a=!0):i?o===i?i=``:r+=o:o===`"`||o===`'`?(i=o,a=!0):/\s/.test(o)?a&&=(n.push(r),r=``,!1):(r+=o,a=!0)}if(i)throw Error(`Command arguments contain an unclosed quote.`);return a&&n.push(r),n}function zt(e){let t=e.trim();if(!t)return;let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Expected a JSON object`);return n}function Bt(e){let t={...e.extra,exposure:e.exposure};if(e.displayName?.trim()?t.displayName=e.displayName.trim():delete t.displayName,delete t.command,delete t.args,delete t.env,delete t.cwd,delete t.url,delete t.headers,delete t.type,e.transport===`stdio`){t.type=`stdio`,t.command=e.command.trim();let n=Rt(e.argsText);if(n&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envEntries){let n=new Set;for(let t of e.envEntries)if(!(!t.key.trim()&&!t.value&&!t.reference)){if(!t.key.trim()||n.has(t.key.trim()))throw Error(`Environment variable names must be non-empty and unique.`);n.add(t.key.trim())}let r=Ft(e.envEntries);r&&(t.env=r)}else e.envJson.trim()&&(t.env=zt(e.envJson));delete t.oauth,delete t.auth}else{t.type=e.transport===`sse`?`sse`:`http`,t.url=e.url.trim();let n=Ft(e.headers);n&&(t.headers=n);let r={...t.oauth??{}};e.oauthClientId.trim()?r.clientId=e.oauthClientId.trim():delete r.clientId,Object.keys(r).length?t.oauth=r:delete t.oauth}return e.timeout===void 0?delete t.timeout:t.timeout=e.timeout,t}function Vt(e,t){let n=t.oauth;return{clientKey:e,id:e,displayName:typeof t.displayName==`string`?t.displayName:``,transport:typeof t.url==`string`?t.type===`sse`?`sse`:`streamable-http`:`stdio`,command:typeof t.command==`string`?t.command:``,argsText:Array.isArray(t.args)?JSON.stringify(t.args):``,envJson:t.env?JSON.stringify(t.env,null,2):``,cwd:typeof t.cwd==`string`?t.cwd:``,url:typeof t.url==`string`?t.url:``,headers:It(t.headers),oauthClientId:typeof n?.clientId==`string`?n.clientId:``,timeout:typeof t.timeout==`number`?t.timeout:void 0,exposure:t.exposure??`codemode`,extra:t}}function Ht(e,t){let n=`mcp`;try{n=e.transport===`stdio`?e.command.split(/[\\/]/).pop()||n:new URL(e.url).hostname}catch{}let r=n.replace(/[^a-zA-Z0-9_-]+/g,`_`).replace(/^_+|_+$/g,``)||`mcp`,i=new Set([...t].map(e=>e.replace(/-/g,`_`))),a=r;for(let e=2;i.has(a.replace(/-/g,`_`));e++)a=`${r}_${e}`;return a}function Ut(e){let t=e.trim(),n=new URL(/^[a-z][a-z\d+.-]*:/i.test(t)&&!/^[^/]+:\d+(?:[/?#]|$)/.test(t)?t:`${/^(localhost|127\.0\.0\.1)(:|\/|$)/i.test(t)?`http`:`https`}://${t}`);if(![`http:`,`https:`].includes(n.protocol)||n.username||n.password)throw Error(`Use an HTTP or HTTPS MCP address without embedded credentials.`);return n.href}function Wt(e){let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Expected a JSON object.`);let n=t.mcpServers??t.mcp?.servers??t.servers;if(n!==void 0&&(!n||typeof n!=`object`||Array.isArray(n)))throw Error(`Expected a server configuration object.`);let r=n?Object.entries(n):[[``,t]];if(!r.length)throw Error(`No MCP servers found.`);return r.map(([e,t])=>{if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Invalid MCP server configuration.`);let n=t;if(typeof n.url!=`string`&&typeof n.command!=`string`)throw Error(`The configuration needs an MCP URL or command.`);if(n.args!==void 0&&(!Array.isArray(n.args)||n.args.some(e=>typeof e!=`string`)))throw Error(`Command arguments must be strings.`);let r=Vt(e,n);return r.clientKey=crypto.randomUUID(),r.url&&=Ut(r.url),r})}function Gt(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`streamable-http`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[],oauthClientId:``,timeout:void 0,exposure:`codemode`,extra:{}}}function Kt(e){let t=e?.mcp?.servers??{};return{servers:Object.entries(t).filter(([,e])=>!Lt(e)).map(([e,t])=>Vt(e,t)).sort((e,t)=>e.id.localeCompare(t.id))}}function qt(e){return Bt(e)}async function Jt(e,t){return(await l(o(`/api/mcp/servers/${encodeURIComponent(e)}/tools`),{method:`POST`,signal:AbortSignal.any([t,AbortSignal.timeout(95e3)])})).payload.tools}async function Yt(e,t,n,r){return(await l(o(`/api/mcp/drafts`),{method:`POST`,signal:r,body:JSON.stringify({serverId:e.id,sourceServerId:t,expectedServer:n,server:Bt(e)})})).payload}async function Xt(e,t){return(await l(o(`/api/mcp/drafts/${encodeURIComponent(e)}/probe`),{method:`POST`,signal:AbortSignal.any([t,AbortSignal.timeout(95e3)])})).payload}async function Zt(e){await l(o(`/api/mcp/drafts/${encodeURIComponent(e)}`),{method:`DELETE`})}async function Qt(e,t=!1){let n=await l(o(`/api/mcp/drafts/${encodeURIComponent(e)}/commit`),{method:`POST`,body:JSON.stringify({enable:t})});return X(),n.payload}async function $t(e){return(await l(o(`/api/mcp/drafts/${encodeURIComponent(e)}/auth`),{method:`POST`})).payload}async function en(e,t){return(await l(o(`/api/mcp/drafts/${encodeURIComponent(e)}/auth`),{signal:t})).payload}async function tn(e){await l(o(`/api/mcp/drafts/${encodeURIComponent(e)}/auth`),{method:`DELETE`})}async function nn(e,t){await l(o(`/api/mcp/drafts/${encodeURIComponent(e)}/auth/redirect`),{method:`POST`,body:JSON.stringify({url:t})})}async function rn(e,t){return(await l(o(`/api/mcp/drafts/${encodeURIComponent(e)}/tools`),{signal:t})).payload.tools}async function an(e){let t=await l(o(`/api/mcp/servers`),{signal:e});return Object.fromEntries(t.payload.servers.filter(e=>e.lastCheck&&Number.isFinite(Date.parse(e.lastCheck.checkedAt))).map(e=>[e.id,e.lastCheck]))}async function on(e){let t=await l(o(`/api/mcp/servers/${encodeURIComponent(e.id)}`),{method:`DELETE`,body:JSON.stringify({expectedServer:e.extra})});return X(),t.payload}function sn(e){let t=(0,ft.c)(111),{serverId:n,displayName:r,returnFocusTo:i,draftId:a,t:o,onClose:s,onConfigure:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],t[0]=l):l=t[0];let[u,v]=(0,Q.useState)(l),[y,b]=(0,Q.useState)(!0),[x,S]=(0,Q.useState)(``),[C,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(0),D=(0,Q.useRef)(!1),O;t[1]!==a||t[2]!==n||t[3]!==o.setupAccessDenied||t[4]!==o.setupConflict||t[5]!==o.setupGatewayUnauthorized||t[6]!==o.setupRateLimited||t[7]!==o.toolsLoadFailed?(O=()=>{let e=new AbortController,t=!0;return b(!0),S(``),v([]),(a?rn(a,e.signal):Jt(n,e.signal)).then(e=>{t&&v(e)}).catch(e=>{let n=e?.status;t&&S(n===401?o.setupGatewayUnauthorized:n===403?o.setupAccessDenied:n===429?o.setupRateLimited:n===404||n===409?o.setupConflict:o.toolsLoadFailed)}).finally(()=>{t&&b(!1)}),()=>{t=!1,e.abort()}},t[1]=a,t[2]=n,t[3]=o.setupAccessDenied,t[4]=o.setupConflict,t[5]=o.setupGatewayUnauthorized,t[6]=o.setupRateLimited,t[7]=o.toolsLoadFailed,t[8]=O):O=t[8];let k;t[9]!==a||t[10]!==T||t[11]!==n||t[12]!==o?(k=[n,a,T,o],t[9]=a,t[10]=T,t[11]=n,t[12]=o,t[13]=k):k=t[13],(0,Q.useEffect)(O,k);let A,j,M,N,P,F,I,L,R,z,B,V,H;if(t[14]!==r||t[15]!==x||t[16]!==y||t[17]!==s||t[18]!==c||t[19]!==C||t[20]!==i||t[21]!==n||t[22]!==o.exposureLabels||t[23]!==o.setupConfigure||t[24]!==o.toolDetails||t[25]!==o.toolsClearSearch||t[26]!==o.toolsDialogSearchEmpty||t[27]!==o.toolsDialogSearchPlaceholder||t[28]!==o.toolsDialogSubtitle||t[29]!==o.toolsDialogTitle||t[30]!==o.toolsEmpty||t[31]!==o.toolsLoading||t[32]!==o.toolsRetryHint||t[33]!==o.toolsSearchSummary||t[34]!==o.toolsTitle||t[35]!==u){let e=C.trim().toLowerCase(),a;if(t[49]!==n){let e;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(e=/-/g,t[51]=e):e=t[51],a=n.replace(e,`_`),t[49]=n,t[50]=a}else a=t[50];let l=`mcp__${a}__`,p=u.filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e));M=_,F=!0,t[52]===s?I=t[53]:(I=e=>{e||s()},t[52]=s,t[53]=I),j=m,t[54]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(d,{className:`fixed inset-0 z-[60] bg-scrim`}),t[54]=P):P=t[54],A=h,t[55]===i?V=t[56]:(V=e=>{(D.current||i)&&e.preventDefault(),!D.current&&i?.isConnected&&i.focus()},t[55]=i,t[56]=V),H=`fixed left-1/2 top-1/2 z-[60] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay`;let v;t[57]===o.toolsDialogTitle?v=t[58]:(v=(0,$.jsx)(g,{className:`font-semibold`,children:o.toolsDialogTitle}),t[57]=o.toolsDialogTitle,t[58]=v);let b;t[59]!==r||t[60]!==x||t[61]!==y||t[62]!==n||t[63]!==o.toolsDialogSubtitle||t[64]!==u.length?(b=y||x?r||n:o.toolsDialogSubtitle.replace(`{{serverId}}`,r||n).replace(`{{count}}`,String(u.length)),t[59]=r,t[60]=x,t[61]=y,t[62]=n,t[63]=o.toolsDialogSubtitle,t[64]=u.length,t[65]=b):b=t[65];let S;t[66]===b?S=t[67]:(S=(0,$.jsx)(f,{className:`mt-1 break-words text-sm text-fg-muted`,children:b}),t[66]=b,t[67]=S);let T;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>w(e.target.value),t[68]=T):T=t[68];let E;t[69]!==C||t[70]!==o.toolsDialogSearchPlaceholder?(E=(0,$.jsx)(`input`,{className:`mt-4 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,value:C,onChange:T,placeholder:o.toolsDialogSearchPlaceholder,"aria-label":o.toolsDialogSearchPlaceholder}),t[69]=C,t[70]=o.toolsDialogSearchPlaceholder,t[71]=E):E=t[71];let O=e&&!y&&!x?(0,$.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-fg-muted`,children:o.toolsSearchSummary.replace(`{{visible}}`,String(p.length)).replace(`{{count}}`,String(u.length))}):null;t[72]!==v||t[73]!==S||t[74]!==E||t[75]!==O?(N=(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge p-5`,children:[v,S,E,O]}),t[72]=v,t[73]=S,t[74]=E,t[75]=O,t[76]=N):N=t[76],L=`min-h-0 flex-1 overflow-y-auto p-5`,R=y,t[77]!==o.toolsTitle||t[78]!==u.length?(z=o.toolsTitle.replace(`{{count}}`,String(u.length)),t[77]=o.toolsTitle,t[78]=u.length,t[79]=z):z=t[79],B=y?(0,$.jsx)(`div`,{role:`status`,"aria-label":o.toolsLoading,className:`space-y-3`,children:[0,1,2].map(ln)}):x?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm text-danger`,children:x}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.toolsRetryHint}),c?(0,$.jsx)(Z,{variant:`secondary`,onClick:()=>{D.current=!0,c()},children:o.setupConfigure}):null]}):p.length?(0,$.jsx)(`div`,{className:`space-y-3`,children:p.map(e=>(0,$.jsxs)(`article`,{className:`rounded-lg border border-edge p-4`,children:[(0,$.jsx)(`h3`,{className:`break-all font-mono text-sm font-semibold text-fg`,children:e.name.startsWith(l)?e.name.slice(l.length):e.name}),e.exposure&&Object.hasOwn(o.exposureLabels,e.exposure)?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:o.exposureLabels[e.exposure]}):null,e.description?(0,$.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-fg-muted`,children:e.description}):null,(0,$.jsxs)(`details`,{className:`mt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm text-accent-fg`,children:o.toolDetails}),(0,$.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-fg-muted`,children:e.name}),(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded-md bg-surface-panel p-3 text-xs text-fg`,children:JSON.stringify(e.inputSchema,null,2)})]})]},e.name))}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.length?o.toolsDialogSearchEmpty:o.toolsEmpty}),e?(0,$.jsx)(Z,{variant:`secondary`,onClick:()=>w(``),children:o.toolsClearSearch}):null]}),t[14]=r,t[15]=x,t[16]=y,t[17]=s,t[18]=c,t[19]=C,t[20]=i,t[21]=n,t[22]=o.exposureLabels,t[23]=o.setupConfigure,t[24]=o.toolDetails,t[25]=o.toolsClearSearch,t[26]=o.toolsDialogSearchEmpty,t[27]=o.toolsDialogSearchPlaceholder,t[28]=o.toolsDialogSubtitle,t[29]=o.toolsDialogTitle,t[30]=o.toolsEmpty,t[31]=o.toolsLoading,t[32]=o.toolsRetryHint,t[33]=o.toolsSearchSummary,t[34]=o.toolsTitle,t[35]=u,t[36]=A,t[37]=j,t[38]=M,t[39]=N,t[40]=P,t[41]=F,t[42]=I,t[43]=L,t[44]=R,t[45]=z,t[46]=B,t[47]=V,t[48]=H}else A=t[36],j=t[37],M=t[38],N=t[39],P=t[40],F=t[41],I=t[42],L=t[43],R=t[44],z=t[45],B=t[46],V=t[47],H=t[48];let U;t[80]!==L||t[81]!==R||t[82]!==z||t[83]!==B?(U=(0,$.jsx)(`div`,{className:L,"aria-busy":R,"aria-label":z,children:B}),t[80]=L,t[81]=R,t[82]=z,t[83]=B,t[84]=U):U=t[84];let ee;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>E(cn),t[85]=ee):ee=t[85];let W;t[86]!==y||t[87]!==o.refreshTools?(W=(0,$.jsx)(Z,{variant:`secondary`,disabled:y,onClick:ee,children:o.refreshTools}),t[86]=y,t[87]=o.refreshTools,t[88]=W):W=t[88];let te;t[89]!==s||t[90]!==o.toolsDialogClose?(te=(0,$.jsx)(p,{asChild:!0,children:(0,$.jsx)(Z,{onClick:s,children:o.toolsDialogClose})}),t[89]=s,t[90]=o.toolsDialogClose,t[91]=te):te=t[91];let G;t[92]!==W||t[93]!==te?(G=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge p-4`,children:[W,te]}),t[92]=W,t[93]=te,t[94]=G):G=t[94];let ne;t[95]!==A||t[96]!==N||t[97]!==U||t[98]!==G||t[99]!==V||t[100]!==H?(ne=(0,$.jsxs)(A,{onCloseAutoFocus:V,className:H,children:[N,U,G]}),t[95]=A,t[96]=N,t[97]=U,t[98]=G,t[99]=V,t[100]=H,t[101]=ne):ne=t[101];let re;t[102]!==j||t[103]!==P||t[104]!==ne?(re=(0,$.jsxs)(j,{children:[P,ne]}),t[102]=j,t[103]=P,t[104]=ne,t[105]=re):re=t[105];let ie;return t[106]!==M||t[107]!==F||t[108]!==I||t[109]!==re?(ie=(0,$.jsx)(M,{open:F,onOpenChange:I,children:re}),t[106]=M,t[107]=F,t[108]=I,t[109]=re,t[110]=ie):ie=t[110],ie}function cn(e){return e+1}function ln(e){return(0,$.jsx)(pe,{className:`h-24 w-full`},e)}function un(e){if(e.transport===`stdio`)return e.command.trim();try{let t=new URL(e.url);return`${t.protocol}//${t.host}${t.pathname}`}catch{return e.url.trim().split(/[?#]/,1)[0].replace(/\/\/[^/]*@/,`//`)}}function dn({row:e,lastCheck:t,t:n,cs:r,onEdit:i,onRemove:a}){let o=c(e=>e.language),[s,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(``),h=e.displayName||e.id,g=un(e),_=e.extra.enabled===!1,v=_?k:t?O:F,y=e.transport===`stdio`?le:q,b=_?n.setupDisabled:t?r.customCheckSucceeded:r.customUnchecked,x=t?new Intl.DateTimeFormat(o,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(t.checkedAt)):null;return(0,$.jsxs)(`li`,{className:`flex min-h-[8.75rem] min-w-0 flex-col rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(`div`,{title:n.transportLabels[e.transport],className:`flex size-9 shrink-0 items-center justify-center rounded-xl border border-edge-subtle bg-surface-inset text-fg-muted`,children:(0,$.jsx)(y,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,$.jsx)(`h3`,{className:`min-w-0 max-w-full text-sm font-semibold text-fg`,children:(0,$.jsx)(`button`,{type:`button`,onClick:i,title:h,className:`block max-w-full truncate rounded text-left hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:h})}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px]`,children:[(0,$.jsxs)(`span`,{title:x?r.customLastChecked.replace(`{{time}}`,x):void 0,"aria-label":x?`${b} · ${r.customLastChecked.replace(`{{time}}`,x)}`:b,className:Y(`inline-flex shrink-0 items-center gap-1`,!_&&t?`text-emerald-700 dark:text-emerald-300`:`text-fg-muted`),children:[(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),b]}),t?(0,$.jsx)(`span`,{className:`text-fg-muted`,children:r.customToolCount.replace(`{{count}}`,String(t.toolCount))}):null]})]})})]}),(0,$.jsx)(`p`,{title:g,className:`mt-2 truncate font-mono text-xs leading-5 text-fg-muted`,children:g})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`mr-auto text-[11px] text-fg-subtle`,children:n.transportLabels[e.transport]}),(0,$.jsx)(Z,{variant:`ghost`,className:`h-8 px-2 py-1 text-xs`,onClick:i,children:n.setupConfigure}),(0,$.jsx)(Z,{ref:u,variant:`secondary`,className:`h-8 px-2 py-1 text-xs shadow-none sm:shadow-none`,disabled:_,onClick:()=>l(!0),children:n.viewTools}),(0,$.jsxs)(tt,{children:[(0,$.jsx)(nt,{asChild:!0,children:(0,$.jsx)(Z,{variant:`ghost`,className:`size-8 p-0`,"aria-label":r.customManage.replace(`{{name}}`,h),title:r.customManage.replace(`{{name}}`,h),children:(0,$.jsx)(L,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(rt,{children:(0,$.jsx)(at,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:(0,$.jsxs)(it,{onSelect:()=>f(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none data-[highlighted]:bg-surface-hover`,children:[(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),n.removeServer]})})})]})]}),p?(0,$.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:p}):null,s?(0,$.jsx)(sn,{serverId:e.id,displayName:e.displayName,returnFocusTo:u.current,t:n,onClose:()=>l(!1),onConfigure:()=>{l(!1),i()}}):null,(0,$.jsx)(et,{open:d,title:r.removeConfirmTitle.replace(`{{name}}`,h),description:r.removeConfirmDescription,confirmLabel:n.removeServer,cancelLabel:r.modalCancel,destructive:!0,onCancel:()=>f(!1),onConfirm:()=>{f(!1),m(``),a().catch(()=>m(n.setupRemoveFailed))}})]})}function fn(e){let t=(0,ft.c)(30),{servers:n,lastChecks:r,t:i,cs:a,onAdd:o,onEdit:s,onRemove:c}=e,l;t[0]===a.customIntegrationsTitle?l=t[1]:(l=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a.customIntegrationsTitle}),t[0]=a.customIntegrationsTitle,t[1]=l);let u;t[2]===n.length?u=t[3]:(u=(0,$.jsx)(`span`,{className:`rounded-md bg-surface-inset px-1.5 py-0.5 text-xs tabular-nums text-fg-muted`,children:n.length}),t[2]=n.length,t[3]=u);let d;t[4]!==l||t[5]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,u]}),t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===a.customIntegrationsHint?f=t[8]:(f=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.customIntegrationsHint}),t[7]=a.customIntegrationsHint,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),t[12]=m):m=t[12];let h;t[13]!==a.customAdd||t[14]!==o?(h=(0,$.jsxs)(Z,{variant:`secondary`,className:`shrink-0 text-xs shadow-none sm:shadow-none`,onClick:o,children:[m,a.customAdd]}),t[13]=a.customAdd,t[14]=o,t[15]=h):h=t[15];let g;t[16]!==p||t[17]!==h?(g=(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[p,h]}),t[16]=p,t[17]=h,t[18]=g):g=t[18];let _;t[19]!==a||t[20]!==r||t[21]!==s||t[22]!==c||t[23]!==n||t[24]!==i?(_=n.length?(0,$.jsx)(`ul`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:n.map(e=>(0,$.jsx)(dn,{row:e,lastCheck:r[e.id],t:i,cs:a,onEdit:()=>s(e),onRemove:()=>c(e)},e.clientKey))}):(0,$.jsx)(`p`,{className:`rounded-xl border border-dashed border-edge px-5 py-8 text-center text-sm text-fg-muted`,children:a.customEmpty}),t[19]=a,t[20]=r,t[21]=s,t[22]=c,t[23]=n,t[24]=i,t[25]=_):_=t[25];let v;return t[26]!==a.customIntegrationsTitle||t[27]!==g||t[28]!==_?(v=(0,$.jsxs)(`section`,{"aria-label":a.customIntegrationsTitle,children:[g,_]}),t[26]=a.customIntegrationsTitle,t[27]=g,t[28]=_,t[29]=v):v=t[29],v}function pn(e){return e.format===`agent-plugin`&&!!e.pluginId&&(!!e.setup?.authorizations?.length||e.authorizationStatus===`required`||!!e.components?.mcp.some(e=>e.type!==`stdio`))}function mn(e){let t=(0,ft.c)(54),{extension:n,language:r,onOpen:i}=e,a;t[0]===r?a=t[1]:(a=r.startsWith(`zh`),t[0]=r,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(e,t)=>o?e:t,t[2]=o,t[3]=s);let c=s,l=n.installationState===`preparing`,u=n.activationEligible===!1,d=n.authorizationStatus===`required`,f;t[4]!==u||t[5]!==n.readiness||t[6]!==d||t[7]!==l||t[8]!==c?(f=l?c(`准备未完成`,`Setup incomplete`):u?c(`已停用`,`Disabled`):d?c(`需要授权`,`Authorization required`):n.readiness===`blocked`||n.readiness===`degraded`?c(`需要处理`,`Needs attention`):c(`已连接`,`Connected`),t[4]=u,t[5]=n.readiness,t[6]=d,t[7]=l,t[8]=c,t[9]=f):f=t[9];let p=f,m;t[10]!==u||t[11]!==d||t[12]!==l||t[13]!==c?(m=l?c(`继续安装`,`Continue setup`):!u&&d?c(`去授权`,`Connect account`):c(`查看详情`,`View details`),t[10]=u,t[11]=d,t[12]=l,t[13]=c,t[14]=m):m=t[14];let h=m,g;t[15]===n.setup?.authorizations?g=t[16]:(g=n.setup?.authorizations??[],t[15]=n.setup?.authorizations,t[16]=g);let _=g,v=_.length===1?_[0].title:n.name,y=l||!u&&(d||n.readiness===`blocked`||n.readiness===`degraded`),b=l?F:u?k:y?D:O,x=y&&`border-amber-500/25`,S;t[17]===x?S=t[18]:(S=Y(`flex min-h-[8.75rem] w-full min-w-0 flex-col rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,x),t[17]=x,t[18]=S);let w=n.branding?.iconUrl,T;t[19]===w?T=t[20]:(T=(0,$.jsx)(st,{iconUrl:w,fallback:K,className:`size-9`}),t[19]=w,t[20]=T);let E;t[21]===v?E=t[22]:(E=(0,$.jsx)(`span`,{className:`block truncate text-sm font-semibold text-fg`,title:v,children:v}),t[21]=v,t[22]=E);let A=y?`text-amber-700 dark:text-amber-300`:u?`text-fg-muted`:`text-emerald-700 dark:text-emerald-300`,j;t[23]===A?j=t[24]:(j=Y(`mt-1 inline-flex items-center gap-1 text-[11px]`,A),t[23]=A,t[24]=j);let M;t[25]===b?M=t[26]:(M=(0,$.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),t[25]=b,t[26]=M);let N;t[27]!==p||t[28]!==j||t[29]!==M?(N=(0,$.jsxs)(`span`,{className:j,children:[M,p]}),t[27]=p,t[28]=j,t[29]=M,t[30]=N):N=t[30];let P;t[31]!==E||t[32]!==N?(P=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[E,N]}),t[31]=E,t[32]=N,t[33]=P):P=t[33];let I;t[34]!==P||t[35]!==T?(I=(0,$.jsxs)(`span`,{className:`flex w-full min-w-0 items-start gap-3`,children:[T,P]}),t[34]=P,t[35]=T,t[36]=I):I=t[36];let L=n.name,R;t[37]===c?R=t[38]:(R=c(`由插件提供`,`Provided by plugin`),t[37]=c,t[38]=R);let z;t[39]!==n.name||t[40]!==R?(z=(0,$.jsxs)(`span`,{className:`mt-2 block w-full truncate text-xs leading-5 text-fg-muted`,title:L,children:[R,` · `,n.name]}),t[39]=n.name,t[40]=R,t[41]=z):z=t[41];let B=y?`text-accent-fg`:`text-fg-muted`,V;t[42]===B?V=t[43]:(V=Y(`mt-auto flex w-full items-center justify-end gap-1 pt-2 text-xs`,B),t[42]=B,t[43]=V);let H;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(C,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[44]=H):H=t[44];let U;t[45]!==h||t[46]!==V?(U=(0,$.jsxs)(`span`,{className:V,children:[h,H]}),t[45]=h,t[46]=V,t[47]=U):U=t[47];let ee;return t[48]!==i||t[49]!==I||t[50]!==z||t[51]!==U||t[52]!==S?(ee=(0,$.jsxs)(`button`,{type:`button`,onClick:i,className:S,children:[I,z,U]}),t[48]=i,t[49]=I,t[50]=z,t[51]=U,t[52]=S,t[53]=ee):ee=t[53],ee}function hn(e){let t=e.connectedAt?Date.parse(e.connectedAt):0;return Number.isFinite(t)?t:0}function gn(e,t){return e.status===`active`&&t.status!==`active`?-1:e.status!==`active`&&t.status===`active`?1:e.isCurrentAuthorization===t.isCurrentAuthorization?hn(t)-hn(e):e.isCurrentAuthorization?-1:1}function _n(e){let t=new Map;for(let n of e){let e=n.accountId??n.identityKey??`authorization:${n.id}`;t.set(e,[...t.get(e)??[],n])}return[...t.entries()].map(([e,t])=>{let n=[...t].sort(gn);return{key:e,primary:n[0],authorizations:n}}).sort((e,t)=>gn(e.primary,t.primary))}var vn=Y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,Ye);function yn(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function bn(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function xn(e,t,n){return e.status===`connected`?U(n.composioHealthConnected,{count:String(t)}):e.status===`reauthorization_required`?n.composioHealthReconnect:e.status===`disconnected`?n.composioHealthDisconnected:e.errorCode===`missing_credential`?n.composioHealthMissingCredential:e.errorCode===`unauthorized`?n.composioHealthUnauthorized:e.errorCode===`forbidden`?n.composioHealthForbidden:e.errorCode===`network`?n.composioHealthNetwork:e.errorCode===`timeout`?n.composioHealthTimeout:n.composioHealthDegraded}function Sn(e,t){return e===`active`?t.composioConnectionHealthy:e===`pending`?t.composioConnectionPending:e===`expired`?t.composioConnectionExpired:e===`failed`?t.composioConnectionFailed:e===`revoked`||e===`disabled`?t.composioConnectionRevoked:t.composioConnectionUnknown}function Cn(e,t,n){return e.status===`paused`?t?.scanEnabled===!1?n.connectorLearningPausedByPolicy:n.connectorLearningPausedByFailure:e.status===`queued`?n.connectorLearningQueued:e.status===`running`?n.connectorLearningRunning:e.status===`completed`?n.connectorLearningCompleted:n.connectorLearningFailed}function wn({instance:e,t,onChanged:n}){let r=yn(e),i=c(e=>e.language)===`zh`,[a,o]=(0,Q.useState)([]),[s,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)([]),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)([]),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)([]),[S,C]=(0,Q.useState)({}),[E,k]=(0,Q.useState)(`read`),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(null),[B,ee]=(0,Q.useState)(!1),[W,te]=(0,Q.useState)(!1),[G,re]=(0,Q.useState)(!1),ie=(0,Q.useRef)(0),K=(0,Q.useRef)(0),ae=(0,Q.useMemo)(()=>_n(a),[a]),se=(0,Q.useCallback)(e=>new Promise((t,n)=>{let r=window.setTimeout(()=>n(Error(i?`连接服务响应超时,请重试。`:`The connection service timed out. Please retry.`)),15e3);e.then(t,n).finally(()=>window.clearTimeout(r))}),[i]),q=(0,Q.useCallback)(async()=>{if(!r||e.materialized.type!==`composio`||e.materialized.role===`credential`)return;j(!0),N(null);let t=++ie.current;try{let e=(await Promise.allSettled([se(Ae()).then(e=>{t===ie.current&&(o(e.filter(e=>e.toolkit.toLowerCase()===r.toLowerCase())),ee(!0))}),se(Ne(r)).then(e=>{t===ie.current&&k(e)}),se(Ue(r)).then(e=>{t===ie.current&&(p(e.policy),h(e.agents))})])).find(e=>e.status===`rejected`);t===ie.current&&e?.status===`rejected`&&N(String(e.reason instanceof Error?e.reason.message:e.reason))}finally{t===ie.current&&j(!1)}},[e.materialized,r,se]);(0,Q.useEffect)(()=>(q(),()=>{ie.current++}),[q]);let J=(0,Q.useCallback)(async()=>{if(!r)return;let e=++K.current;re(!0),F(!1);let t=t=>n=>{e===K.current&&t(n)},n=await Promise.allSettled([se(We(r)).then(t(l)),se(qe(20)).then(t(e=>d(e.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===r.toLowerCase())))),se(Be(r)).then(t(y)),se(Ie(r)).then(t(_))]);e===K.current&&(F(n.some(e=>e.status===`rejected`)),re(!1))},[r,se]);(0,Q.useEffect)(()=>(W&&J(),()=>{K.current++}),[W,J]),(0,Q.useEffect)(()=>{let e=!1,t=_n(a).map(e=>e.primary).filter(e=>e.supportsLearning&&e.accountId);if(t.length)return se(Ke()).then(t=>{e||x(t)}).catch(()=>{}),Promise.allSettled(t.map(async e=>[e.accountId,await se(Le(e.accountId))])).then(t=>{e||C(Object.fromEntries(t.flatMap(e=>e.status===`fulfilled`?[e.value]:[])))}),()=>{e=!0}},[a,se]);let ce=(0,Q.useCallback)(async i=>{if(!r)return;let a=Xe()?null:window.open(`about:blank`,`_blank`);a&&(a.opener=null),j(!0),N(null);try{if(!Xe()&&!a)throw Error(`Allow popups to open the authorization page.`);let t=await Fe(e.connectorId,i);if(!t.authorizationUrl)throw Error(`The authorization provider did not return an authorization URL.`);if(Xe()){let e=await window.electronAPI?.shell?.openExternalUrl(t.authorizationUrl);if(!e?.ok)throw Error(e?.error??`Could not open the system browser.`)}else a.location.href=t.authorizationUrl;let o=await Je(r,t.connectionId,12e4,t.attemptId);if(i&&o.accountId!==i)throw Error(`A different account was authorized. The original account and its task bindings were not changed.`);await Promise.all([n?.(),q()])}catch(e){N(ne(e,t))}finally{a?.close(),j(!1)}},[e.connectorId,q,n,t,r]),le=(0,Q.useCallback)(async t=>{j(!0),N(null);try{await Ce(e.instanceId,{config:{...e.config??{},authConfigId:t||void 0}}),await Promise.all([n?.(),q()])}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(!1)}},[e.config,e.instanceId,q,n]),de=async e=>{let t=Xe()?null:window.open(`about:blank`,`_blank`);t&&(t.opener=null),N(null);try{let n=await Me(e.id);if(n.authorizationUrl)if(Xe())await window.electronAPI?.shell?.openExternalUrl(n.authorizationUrl);else if(t)t.location.href=n.authorizationUrl;else throw Error(`Allow popups to reopen authorization.`);else t?.close(),await q()}catch(e){t?.close(),N(e instanceof Error?e.message:String(e))}},fe=(0,Q.useCallback)(async e=>{if(r){k(e),N(null);try{await Ee(r,e)}catch(e){N(e instanceof Error?e.message:String(e)),await q()}}},[q,r]),me=(0,Q.useCallback)(async e=>{if(r){N(null);try{p(await Se(r,e))}catch(e){N(e instanceof Error?e.message:String(e))}}},[r]),he=(0,Q.useCallback)(e=>{if(!f)return;let t=f.allowedAgentIds.includes(e);if(t&&f.allowedAgentIds.length===1)return;let n=t?f.allowedAgentIds.filter(t=>t!==e):[...f.allowedAgentIds,e];me({allowedAgentIds:n})},[me,f]),X=(0,Q.useCallback)(async e=>{j(!0),N(null);try{await e(),await q()}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(!1)}},[q]);if(!r)return null;if(e.materialized.type===`composio`&&e.materialized.role===`credential`)return(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.composioApiKeyStored});let ge=ae.filter(e=>e.primary.status===`active`).length,_e=ge>0?t.composioAddAccount:t.composioConnectAccount,ve=B&&ge>0,we=v?.requiresCustomAuthConfig===!0,Te=v?.authConfigs.filter(e=>e.status===`ENABLED`&&e.isEnabledForToolRouter)??[];return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`section`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:Y(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,ve?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:[ve?(0,$.jsx)(O,{className:`size-3.5`}):(0,$.jsx)(D,{className:`size-3.5`}),ve?t.connectionReady:B||M?t.connectionNeedsSetup:t.connectionChecking]}),B&&(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:U(t.composioAccountCount,{count:String(ae.length)})})]}),(0,$.jsxs)(Z,{variant:`primary`,className:`shrink-0`,disabled:A,onClick:()=>void ce(),children:[A?(0,$.jsx)(H,{className:`size-4 animate-spin`}):(0,$.jsx)(V,{className:`size-4`}),_e]})]}),M?(0,$.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center justify-between gap-2 rounded-xl border border-danger/20 bg-danger/5 px-3 py-2 text-sm text-danger`,children:[(0,$.jsx)(`p`,{children:M}),(0,$.jsx)(Z,{variant:`secondary`,disabled:A,onClick:()=>void q(),children:t.composioRetry})]}):null,g&&!ve?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-amber-500/25 bg-amber-500/5 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:xn(g,ge,t)}),g.recovery===`none`?null:(0,$.jsx)(Z,{variant:`secondary`,disabled:A,onClick:()=>void(g.recovery===`retry`?q():ce()),children:g.recovery===`retry`?t.composioRetry:t.composioReconnectAccount})]}):null,we&&Te.length===0?(0,$.jsx)(`p`,{className:`rounded-xl border border-amber-500/25 bg-amber-500/5 px-4 py-3 text-sm text-amber-800 dark:text-amber-200`,children:t.composioAuthConfigEmpty}):null,f?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle px-4 py-4 sm:grid-cols-[minmax(0,1fr)_15rem] sm:items-start`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioAccessTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:E===`read`?t.composioAccessReadHint:E===`admin`?t.composioAccessAdminHint:t.composioAccessWriteHint})]}),(0,$.jsxs)(w,{value:E,onChange:e=>void fe(e.currentTarget.value),children:[(0,$.jsx)(T,{value:`read`,children:t.composioAccessReadOnly}),(0,$.jsx)(T,{value:`write`,children:t.composioAccessReadWrite}),E===`admin`?(0,$.jsx)(T,{value:`admin`,children:t.composioAccessAdminCurrent}):null]})]}),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm text-fg-muted`,children:t.composioAdvancedSettings}),(0,$.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle px-4 py-4 sm:grid-cols-[minmax(0,1fr)_15rem] sm:items-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioConfirmationPolicy}),(0,$.jsxs)(w,{value:f.confirmationPolicy,onChange:e=>void me({confirmationPolicy:e.currentTarget.value}),children:[(0,$.jsx)(T,{value:`writes`,children:t.composioConfirmWrites}),(0,$.jsx)(T,{value:`always`,children:t.composioConfirmAlways}),f.confirmationPolicy===`never`?(0,$.jsx)(T,{value:`never`,children:t.composioConfirmNever}):null]})]}),(0,$.jsxs)(`div`,{className:`px-4 py-4`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioAllowedAgents}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.allowedAgentIds.length?t.composioAllowedAgentsSelected:t.composioAllowedAgentsAll}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,className:Y(`rounded-full border px-2.5 py-1 text-xs transition-colors`,f.allowedAgentIds.length===0?`border-accent bg-accent/10 text-accent`:`border-edge bg-surface-panel text-fg-muted hover:text-fg`),onClick:()=>void me({allowedAgentIds:[]}),children:t.composioAllowedAgentsAllOption}),m.map(e=>(0,$.jsx)(`button`,{type:`button`,className:Y(`rounded-full border px-2.5 py-1 text-xs transition-colors`,f.allowedAgentIds.includes(e.id)?`border-accent bg-accent/10 text-accent`:`border-edge bg-surface-panel text-fg-muted hover:text-fg`),onClick:()=>he(e.id),children:e.name},e.id))]})]}),(0,$.jsxs)(`fieldset`,{className:`space-y-2 border-t border-edge-subtle p-4 text-xs text-fg-muted`,children:[(0,$.jsx)(`legend`,{children:i?`可用账号范围`:`Available accounts`}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:f.selectedAccountIds===null,disabled:A,onChange:e=>void me({selectedAccountIds:e.currentTarget.checked?null:[]})}),i?`所有账号(包括以后新增)`:`All accounts, including new ones`]}),f.selectedAccountIds!==null&&ae.map(({primary:e})=>e.accountId&&(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:A,checked:f.selectedAccountIds.includes(e.accountId),onChange:t=>void me({selectedAccountIds:t.currentTarget.checked?[...f.selectedAccountIds,e.accountId]:f.selectedAccountIds.filter(t=>t!==e.accountId)})}),e.alias??e.accountEmail??e.accountId]},e.accountId)),f.selectedAccountIds?.length===0&&(0,$.jsx)(`p`,{children:i?`未选择账号,Agent 无法使用此应用。`:`No accounts selected. Agents cannot use this app.`})]})]})]}):null,(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.composioConnectedAccounts}),B&&(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:U(t.composioAccountCount,{count:String(ae.length)})})]}),(0,$.jsxs)(Z,{variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:A,onClick:()=>void q(),children:[(0,$.jsx)(oe,{className:Y(`size-3.5`,A&&`animate-spin`)}),t.refresh]})]}),ae.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:ae.map(e=>{let r=e.primary,a=b.find(e=>r.accountId?e.accountId===r.accountId:e.connectionId===r.id),o=r.accountId?S[r.accountId]:void 0;return(0,$.jsxs)(`article`,{className:`px-4 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col items-start justify-between gap-3 sm:flex-row`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:r.alias??r.workspace??r.accountEmail??r.username??t.composioUnnamedAuthorization})}),(0,$.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:r.accountEmail??r.username??r.workspace??r.accountId}),r.backendLabel&&(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:r.backendLabel}),(0,$.jsx)(`p`,{className:Y(`mt-1 text-xs`,r.status===`active`?`text-emerald-700 dark:text-emerald-300`:`text-amber-700 dark:text-amber-300`),children:r.accountEnabled===!1?i?`已暂停`:`Paused`:Sn(r.status,t)}),a?(0,$.jsx)(`p`,{className:Y(`mt-1 text-xs`,a.status===`failed`?`text-red-600`:`text-fg-subtle`),children:U(t.connectorLearningStatus,{status:Cn(a,o,t),count:String(a.candidatesCreated)})}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[r.status===`pending`&&(0,$.jsx)(Z,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,onClick:()=>void de(r),children:i?`继续授权`:`Continue authorization`}),r.accountId&&(0,$.jsx)(Z,{variant:`ghost`,className:`h-8 px-2.5 text-xs text-danger`,disabled:A,onClick:()=>z(r.accountId),children:i?`断开`:`Disconnect`}),r.accountId&&r.status!==`active`&&(0,$.jsx)(Z,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,disabled:A,onClick:()=>void ce(r.accountId),children:t.composioReconnectAccount}),r.accountId&&(0,$.jsx)(Z,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,disabled:A,onClick:()=>void X(()=>De(r.accountId,{enabled:r.accountEnabled===!1})),children:r.accountEnabled===!1?i?`启用`:`Enable`:i?`暂停`:`Pause`}),r.supportsLearning&&r.status===`active`&&r.accountEnabled!==!1?(0,$.jsxs)(Z,{variant:`secondary`,className:`h-8 shrink-0 px-2.5 text-xs`,disabled:A,onClick:()=>void X(async()=>{if(!r.accountId)throw Error(`Connector account is unavailable.`);await ye(r.accountId),await n?.()}),children:[(0,$.jsx)(oe,{className:`size-3.5`}),t.composioSyncNow]}):null]})]}),(0,$.jsxs)(`details`,{className:`mt-3 text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`w-fit cursor-pointer font-medium hover:text-fg`,children:t.composioAccountSettings}),(0,$.jsxs)(`div`,{className:`mt-3 space-y-4 rounded-lg bg-surface-panel p-3`,children:[r.accountId&&(0,$.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,$.jsx)(`legend`,{className:`mb-2 font-medium`,children:t.composioAllowedAgents}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:A,checked:r.allowedAgentIds==null,onChange:e=>void X(()=>De(r.accountId,{allowedAgentIds:e.currentTarget.checked?null:[]}))}),t.composioAllowedAgentsAllOption]}),r.allowedAgentIds!=null&&m.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:A,checked:r.allowedAgentIds.includes(e.id),onChange:t=>{let n=t.currentTarget.checked;X(()=>De(r.accountId,{allowedAgentIds:n?[...r.allowedAgentIds,e.id]:r.allowedAgentIds.filter(t=>t!==e.id)}))}}),e.name]},e.id)),r.allowedAgentIds?.length===0&&(0,$.jsx)(`p`,{children:i?`未选择 Agent:任何 Agent 都不能使用此账号。`:`No agents selected: this account is unavailable to all agents.`})]}),r.supportsLearning&&o?(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:o.scanEnabled,disabled:A,onChange:e=>void X(()=>Oe(r.accountId,{scanEnabled:e.currentTarget.checked}))}),t.connectorScheduledScan]}),o.scanEnabled?(0,$.jsxs)(`label`,{className:`sm:col-span-2`,children:[t.connectorScanInterval,(0,$.jsxs)(w,{className:`mt-1`,value:String(o.intervalMinutes??30),disabled:A,onChange:e=>void X(()=>Oe(r.accountId,{intervalMinutes:Number(e.currentTarget.value)})),children:[(0,$.jsxs)(T,{value:`5`,children:[`5 `,t.connectorMinutes]}),(0,$.jsxs)(T,{value:`15`,children:[`15 `,t.connectorMinutes]}),(0,$.jsxs)(T,{value:`30`,children:[`30 `,t.connectorMinutes]}),(0,$.jsxs)(T,{value:`60`,children:[`60 `,t.connectorMinutes]})]})]}):null]}):null,(0,$.jsxs)(`label`,{className:`block`,children:[t.composioAccountAlias,(0,$.jsx)(`input`,{className:Y(vn,`mt-1 h-8 py-1 text-xs`),defaultValue:r.alias??``,onBlur:e=>{e.currentTarget.value!==(r.alias??``)&&X(()=>xe(r.id,{alias:e.currentTarget.value}))}})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:e.authorizations.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`p`,{className:`min-w-0 break-all font-mono text-fg-subtle`,children:[t.composioAuthorizationId,`: `,e.providerConnectionId]}),(0,$.jsx)(Z,{variant:`ghost`,className:`size-7 shrink-0 p-0 text-danger`,title:t.composioRevoke,disabled:A,onClick:()=>L(e.id),children:(0,$.jsx)(ue,{className:`size-3.5`})})]},e.id))}),(0,$.jsx)(`div`,{className:`flex justify-end gap-1`,children:(0,$.jsx)(Z,{variant:`ghost`,className:`size-8 p-0`,title:t.refresh,disabled:A,onClick:()=>void X(()=>ke(r.id)),children:(0,$.jsx)(oe,{className:`size-4`})})})]})]})]},e.key)})}):A&&!B?(0,$.jsxs)(`div`,{"aria-busy":`true`,"aria-label":t.connectionChecking,className:`space-y-3`,children:[(0,$.jsx)(pe,{className:`h-16 w-full`}),(0,$.jsx)(pe,{className:`h-16 w-full`})]}):B?(0,$.jsx)(`div`,{className:`rounded-xl border border-dashed border-edge px-4 py-8 text-center`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.composioConnectionsEmpty})}):null]}),(0,$.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-base`,onToggle:e=>te(e.currentTarget.open),children:[(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-fg`,children:t.composioAdvancedSettings}),(0,$.jsxs)(`div`,{className:`space-y-5 border-t border-edge-subtle px-4 py-4`,children:[G?(0,$.jsx)(pe,{"aria-label":t.connectionChecking,className:`h-16 w-full`}):null,P?(0,$.jsxs)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:[t.composioDiagnosticsUnavailable,(0,$.jsx)(Z,{variant:`ghost`,disabled:G,onClick:()=>void J(),children:t.composioRetry})]}):null,v?.mode===`byok`?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioAuthConfigTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:we?t.composioAuthConfigRequiredHint:t.composioAuthConfigOptionalHint})]}),(0,$.jsx)(`a`,{className:`text-xs font-medium text-accent-fg hover:underline`,href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,children:t.composioAuthConfigManage})]}),(0,$.jsxs)(w,{className:`mt-3`,value:typeof e.config?.authConfigId==`string`?e.config.authConfigId:``,disabled:A,onChange:e=>void le(e.currentTarget.value),children:[we?null:(0,$.jsx)(T,{value:``,children:t.composioAuthConfigManaged}),we&&typeof e.config?.authConfigId!=`string`?(0,$.jsx)(T,{value:``,disabled:!0,children:t.composioAuthConfigSelect}):null,Te.map(e=>(0,$.jsxs)(T,{value:e.id,children:[e.name,` · `,e.authScheme??`OAuth`]},e.id))]})]}):null,(0,$.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioAgentTools}),(0,$.jsx)(`div`,{className:`space-y-2`,children:s.length?s.slice(0,8).map(e=>(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.slug}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[bn(e.scope,t),e.curated?``:` ${t.composioUncuratedSuffix}`]})]},e.slug)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioToolsEmpty})})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioRecentTriggers}),(0,$.jsx)(`div`,{className:`space-y-2`,children:u.length?u.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`p`,{className:`truncate text-xs text-fg`,children:e.trigger??e.id}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:new Date(e.at).toLocaleString()})]},`${e.id}-${e.at}`)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioTriggersEmpty})})]})]})]})]}),(0,$.jsx)(et,{open:R!==null,title:i?`断开账号`:`Disconnect account`,description:i?`停止此账号的工具使用和学习,并撤销其全部授权。已保存的数据不会删除。`:`Stop tool access and learning for this account and revoke all its authorizations. Saved data will not be deleted.`,confirmLabel:i?`断开`:`Disconnect`,cancelLabel:t.modalCancel,destructive:!0,onConfirm:()=>{let e=R;z(null),e&&X(()=>Re(e))},onCancel:()=>z(null)}),(0,$.jsx)(et,{open:I!==null,title:t.composioRevoke,description:t.composioRevokeConfirm,confirmLabel:t.composioRevoke,cancelLabel:t.modalCancel,destructive:!0,onConfirm:()=>{let e=I;L(null),e&&X(()=>be(e))},onCancel:()=>L(null)})]})}var Tn=Y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,Ye);function En(e,t){let n={};for(let r of e?.setup.config??[]){let e=t.config?.[r.key]??r.defaultValue??``;n[r.key]=typeof e==`string`?e:JSON.stringify(e,null,2)}return n}function Dn(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function On({instance:e,definition:t,onClose:n,onChanged:r,t:i}){let[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(()=>En(t,e)),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),A=t?.setup.config??[],j=(e.materialized.type===`mcp`||e.materialized.type===`memorySource`)&&A.length>0&&(t?.setup.secrets??[]).length===0,M=e.materialized.type===`mcp`,N=e.materialized.type===`composio`,P=e.materialized.type===`memorySource`,F=t?W(t,i):null,L=(0,Q.useCallback)(async()=>{D(!0),T(null);try{let t=await Te(e.instanceId);k(t),t.ok||T(t.error??t.action??i.healthStatusLabels[t.status]),await r()}catch(e){T(e instanceof Error?e.message:String(e))}finally{D(!1)}},[e.instanceId,r,i.healthStatusLabels]),R=(0,Q.useCallback)(async()=>{o(!0),T(null);try{await Ge(e.instanceId),await r(),n()}catch(e){T(e instanceof Error?e.message:String(e)),o(!1)}},[e.instanceId,r,n]),z=(0,Q.useCallback)(async()=>{if(!(!t||!j)){u(!0),T(null);try{let n={};for(let e of t.setup.config??[]){let t=Dn(e.type,S[e.key]??``);t!==void 0&&(n[e.key]=t)}await Ce(e.instanceId,{config:n}),await r()}catch(e){T(e instanceof Error?e.message:String(e))}finally{u(!1)}}},[S,t,e.instanceId,r,j]),B=(0,Q.useCallback)(async()=>{y(!0),x(null),T(null);try{let t=await we(e.connectorId);x(t.recordIds.length),await r()}catch(e){T(e instanceof Error?e.message:String(e))}finally{y(!1)}},[e.connectorId,r]);return(0,$.jsxs)(_,{open:!0,onOpenChange:e=>{e||n()},children:[(0,$.jsxs)(m,{children:[(0,$.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(h,{className:Y(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,N?`h-[min(100dvh-2rem,36rem)] w-[min(100%-2rem,40rem)]`:`h-[min(100dvh-2rem,44rem)] w-[min(100%-2rem,min(92vw,54rem))]`,`rounded-2xl border border-edge bg-surface-overlay shadow-float outline-none dark:border-edge`),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(te,{connector:t,size:`lg`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(g,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,$.jsx)(f,{className:`mt-1 text-sm text-fg-muted`,children:F??(e.materialized.type===`mcp`?U(i.mcpServerRuntime,{serverId:e.materialized.serverId}):U(i.runtimeLabel,{runtime:e.materialized.type}))})]})]}),(0,$.jsx)(p,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:Y(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ve.focusRingPanel),"aria-label":i.modalClose,children:[(0,$.jsx)(fe,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[w?(0,$.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:w}):null,M?(0,$.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsx)(`p`,{className:`text-fg-muted`,role:`status`,children:O?.ok?U(i.toolsAvailable,{count:String(O.toolCount)}):O?i.healthStatusLabels[O.status]:e.usage.lastHealthStatus?i.healthStatusLabels[e.usage.lastHealthStatus]:i.healthNotTested}),(0,$.jsxs)(Z,{variant:`secondary`,"aria-busy":E,disabled:E||!e.enabled,onClick:()=>void L(),children:[E?(0,$.jsx)(H,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),i.test]})]}),j?A.map(e=>(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:e.label}),e.description?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,$.jsx)(`input`,{className:Tn,value:S[e.key]??``,placeholder:e.placeholder,onChange:t=>C(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key)):null]}):null,N?(0,$.jsx)(wn,{instance:e,t:i,onChanged:r}):null,P?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-edge bg-surface-base p-4 text-sm`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.connectedSourceSync}),F?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:F}):null,b===null?null:(0,$.jsx)(`p`,{className:`mt-1 text-xs text-emerald-600`,children:U(i.connectedSourceSynced,{count:String(b)})})]}),(0,$.jsxs)(Z,{disabled:v,onClick:()=>void B(),children:[v?(0,$.jsx)(H,{className:`size-4 animate-spin`}):(0,$.jsx)(I,{className:`size-4`}),i.composioSyncNow]})]}),j?(0,$.jsx)(`div`,{className:`grid gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:A.map(e=>(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,$.jsx)(`input`,{className:Tn,value:S[e.key]??``,placeholder:e.placeholder,onChange:t=>C(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}):null,!M&&!N&&!P?(0,$.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:(0,$.jsx)(`p`,{children:i.connectorPolicyHint})}):null,(0,$.jsxs)(`details`,{className:`mt-5 rounded-xl border border-edge`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-danger`,children:i.dangerZone}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-danger/15 px-4 py-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i.removeConnectorHint}),(0,$.jsxs)(Z,{variant:`secondary`,className:`shrink-0 border-danger/30 text-danger hover:bg-danger/10`,disabled:a,onClick:()=>c(!0),children:[a?(0,$.jsx)(H,{className:`size-4 animate-spin`}):(0,$.jsx)(ue,{className:`size-4`}),i.remove]})]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,$.jsx)(Z,{variant:`secondary`,onClick:n,children:i.modalClose}),(M||P)&&j?(0,$.jsxs)(Z,{variant:`primary`,disabled:l,onClick:()=>void z(),children:[l?(0,$.jsx)(H,{className:`size-4 animate-spin`}):(0,$.jsx)(se,{className:`size-4`}),i.modalSave]}):null]})]})]}),(0,$.jsx)(et,{open:s,title:U(i.removeConfirmTitle,{name:e.displayName}),description:i.removeConfirmDescription,confirmLabel:i.removeConfirmAction,cancelLabel:i.modalCancel,destructive:!0,onConfirm:()=>{c(!1),R()},onCancel:()=>{a||c(!1)}})]})}function kn(e){let t=(0,ft.c)(2),n;return t[0]===e?n=t[1]:(n=e.instance.materialized.type===`cli`&&e.definition?(0,$.jsx)(G,{definition:e.definition,instance:e.instance,onClose:e.onClose,onChanged:e.onChanged}):(0,$.jsx)(On,{...e}),t[0]=e,t[1]=n),n}function An(e){let t=(0,ft.c)(59),{instance:n,definition:r,highlighted:i,onOpenDetails:a,t:o}=e,s=i!==void 0&&i,c;t[0]!==r||t[1]!==n?(c=Ct(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c.state,u;t[3]!==r||t[4]!==o?(u=r?W(r,o):null,t[3]=r,t[4]=o,t[5]=u):u=t[5];let d=u,f,p,m,h,g,_,v,y,b;if(t[6]!==l||t[7]!==r||t[8]!==s||t[9]!==n||t[10]!==a||t[11]!==o.connectionChecking||t[12]!==o.connectionNeedsSetup||t[13]!==o.connectionReady){f=l===`ready`?{label:o.connectionReady,Icon:O,className:`text-emerald-700 dark:text-emerald-300`}:l===`needs_setup`?{label:o.connectionNeedsSetup,Icon:D,className:`text-amber-700 dark:text-amber-300`}:{label:o.connectionChecking,Icon:F,className:`text-fg-muted`},b=`button`;let e=l===`needs_setup`&&`border-amber-500/25`,i=s&&`bg-accent-soft`;t[23]!==e||t[24]!==i?(p=Y(`flex min-h-[8.75rem] w-full min-w-0 flex-col rounded-xl border border-edge bg-surface-panel p-4 text-left hover:bg-surface-hover/45`,ve.transition,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,e,i),t[23]=e,t[24]=i,t[25]=p):p=t[25],t[26]!==n||t[27]!==a?(m=()=>a(n),t[26]=n,t[27]=a,t[28]=m):m=t[28],v=`flex w-full min-w-0 items-start gap-3`,t[29]===r?y=t[30]:(y=(0,$.jsx)(te,{connector:r,size:`sm`}),t[29]=r,t[30]=y),g=`min-w-0 flex-1`,t[31]===n.displayName?_=t[32]:(_=(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,title:n.displayName,children:n.displayName}),t[31]=n.displayName,t[32]=_),h=Y(`mt-1 inline-flex items-center gap-1 text-[11px]`,f.className),t[6]=l,t[7]=r,t[8]=s,t[9]=n,t[10]=a,t[11]=o.connectionChecking,t[12]=o.connectionNeedsSetup,t[13]=o.connectionReady,t[14]=f,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v,t[21]=y,t[22]=b}else f=t[14],p=t[15],m=t[16],h=t[17],g=t[18],_=t[19],v=t[20],y=t[21],b=t[22];let x;t[33]===f.Icon?x=t[34]:(x=(0,$.jsx)(f.Icon,{className:`size-3.5`,"aria-hidden":!0}),t[33]=f.Icon,t[34]=x);let S;t[35]!==f.label||t[36]!==x||t[37]!==h?(S=(0,$.jsxs)(`span`,{className:h,children:[x,f.label]}),t[35]=f.label,t[36]=x,t[37]=h,t[38]=S):S=t[38];let w;t[39]!==S||t[40]!==g||t[41]!==_?(w=(0,$.jsxs)(`div`,{className:g,children:[_,S]}),t[39]=S,t[40]=g,t[41]=_,t[42]=w):w=t[42];let T;t[43]!==w||t[44]!==v||t[45]!==y?(T=(0,$.jsxs)(`div`,{className:v,children:[y,w]}),t[43]=w,t[44]=v,t[45]=y,t[46]=T):T=t[46];let E;t[47]===d?E=t[48]:(E=d?(0,$.jsx)(`p`,{className:`mt-2 w-full line-clamp-2 text-xs leading-5 text-fg-muted`,title:d,children:d}):null,t[47]=d,t[48]=E);let k;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(C,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[49]=k):k=t[49];let A;t[50]===o.installedDetails?A=t[51]:(A=(0,$.jsxs)(`span`,{className:`mt-auto flex w-full items-center justify-end gap-1 pt-2 text-xs text-fg-muted`,children:[o.installedDetails,k]}),t[50]=o.installedDetails,t[51]=A);let j;return t[52]!==p||t[53]!==m||t[54]!==T||t[55]!==E||t[56]!==A||t[57]!==b?(j=(0,$.jsxs)(`button`,{type:b,className:p,onClick:m,children:[T,E,A]}),t[52]=p,t[53]=m,t[54]=T,t[55]=E,t[56]=A,t[57]=b,t[58]=j):j=t[58],j}function jn(e,t){return Gt()}function Mn(e){let t=e.headers.filter(e=>e.key.trim()),n=t.find(e=>e.key.toLowerCase()===`authorization`&&!e.reference&&/^Bearer\s/i.test(e.value)),r=e.extra.auth||t.some(e=>e.reference)||e.extra.oauth&&t.some(e=>e.key.toLowerCase()===`authorization`)?`existing`:e.extra.oauth?`oauth`:n?`bearer`:t.length?`headers`:`auto`;return{mode:r,token:n?.value.replace(/^Bearer\s+/i,``)??``,apiKey:``,headerName:``,customHeaders:t.length?t:[Mt()],additionalHeaders:r===`bearer`?t.filter(e=>e!==n):r===`oauth`?t:[]}}function Nn(e,t){if(e.transport===`stdio`||t.mode===`existing`)return{...e,extra:{...e.extra}};let n={...e.extra};delete n.auth,t.mode!==`oauth`&&delete n.oauth;let r=t.mode===`headers`?t.customHeaders:t.additionalHeaders;if(t.mode===`bearer`){let e=t.token.trim().replace(/^Bearer\s+/i,``);r=[...r,Mt(`Authorization`,`Bearer ${e}`)]}return t.mode===`apiKey`&&(r=[...r,Mt(t.headerName.trim(),t.apiKey.trim())]),{...e,extra:n,headers:r,oauthClientId:t.mode===`oauth`?e.oauthClientId:``}}function Pn(e){let t=new Set;return e.findIndex(e=>{let n=e.key.trim();if(!n&&!e.value&&!e.reference)return!1;if(!/^[!#$%&'*+.^_`|~\da-z-]+$/i.test(n)||/[\r\n]/.test(e.value))return!0;let r=n.toLowerCase();return t.has(r)?!0:(t.add(r),!1)})}function Fn(){return Y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,Ye)}function In({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:i,pasteFailed:a,pasteFailedTitle:o,dismissLabel:s,keyPlaceholder:c,valuePlaceholder:l,headers:u,onChange:d,referenceLabel:f=`Existing credential reference`,showValueLabel:p=`Show value`,hideValueLabel:m=`Hide value`,allowPaste:h=!0}){let[g,_]=(0,Q.useState)(new Set),[v,y]=(0,Q.useState)(!1),b=(e,t)=>{d(u.map((n,r)=>r===e?{...n,...t}:n))},x=()=>{d([...u,Mt()])},S=e=>{let t=u.filter((t,n)=>n!==e);d(t.length>0?t:[Mt()])},C=async()=>{try{let e=await _e();if(!e){y(!0);return}let t=Pt(e);if(!t?.length){y(!0);return}d(t)}catch{y(!0)}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 md:col-span-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:e}),t?(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:t}):null]}),h?(0,$.jsxs)(Z,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void C(),children:[(0,$.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),i]}):null]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>(0,$.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)_auto_auto]`,children:[(0,$.jsx)(`input`,{className:Y(Fn(),`col-span-3 min-w-0 font-mono text-xs sm:col-span-1`),"aria-label":`${c} ${t+1}`,value:e.key,placeholder:c,onChange:e=>b(t,{key:e.target.value})}),(0,$.jsx)(`input`,{className:Y(Fn(),`min-w-0 font-mono text-xs`),type:g.has(e.clientKey)?`text`:`password`,autoComplete:`off`,"aria-label":`${l} ${t+1}`,readOnly:!!e.reference,value:e.reference?f:e.value,placeholder:e.reference?f:l,onChange:e=>b(t,{value:e.target.value})}),(0,$.jsx)(Z,{type:`button`,variant:`ghost`,className:`size-10 shrink-0 px-0`,disabled:!!e.reference,"aria-label":g.has(e.clientKey)?m:p,onClick:()=>_(t=>{let n=new Set(t);return n.has(e.clientKey)?n.delete(e.clientKey):n.add(e.clientKey),n}),children:g.has(e.clientKey)?(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(B,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(Z,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:u.length<=1&&!e.key&&!e.value,onClick:()=>S(t),"aria-label":r,children:(0,$.jsx)(ue,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})}),e.reference?(0,$.jsx)(`p`,{className:`col-span-3 break-words text-xs text-fg-muted sm:col-span-4`,children:f}):null]},e.clientKey))}),(0,$.jsx)(et,{open:v,title:o,description:a,confirmLabel:s,onConfirm:()=>y(!1),onCancel:()=>y(!1)}),(0,$.jsxs)(`button`,{type:`button`,className:Y(`self-start text-sm text-accent hover:underline`,ve.press),onClick:x,children:[`+ `,n]})]})}var Ln=Y(`w-full min-w-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,Ye);function Rn(e){let t=(0,ft.c)(20),{value:n,onChange:r,label:i,t:a,required:o}=e,s=o!==void 0&&o,[c,l]=(0,Q.useState)(!1),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=Y(Ln,`mt-1.5`),t[0]=u):u=t[0];let d=c?`text`:`password`,f;t[1]===r?f=t[2]:(f=e=>r(e.target.value),t[1]=r,t[2]=f);let p;t[3]!==s||t[4]!==d||t[5]!==f||t[6]!==n?(p=(0,$.jsx)(`input`,{className:u,type:d,value:n,required:s,autoComplete:`off`,onChange:f}),t[3]=s,t[4]=d,t[5]=f,t[6]=n,t[7]=p):p=t[7];let m;t[8]!==i||t[9]!==p?(m=(0,$.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[i,p]}),t[8]=i,t[9]=p,t[10]=m):m=t[10];let h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>l(zn),t[11]=h):h=t[11];let g;t[12]===c?g=t[13]:(g=c?(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(B,{className:`size-4`,"aria-hidden":!0}),t[12]=c,t[13]=g);let _=c?a.setupHideValue:a.setupShowValue,v;t[14]!==g||t[15]!==_?(v=(0,$.jsxs)(Z,{type:`button`,variant:`ghost`,className:`gap-1.5 text-xs`,onClick:h,children:[g,_]}),t[14]=g,t[15]=_,t[16]=v):v=t[16];let y;return t[17]!==v||t[18]!==m?(y=(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[m,v]}),t[17]=v,t[18]=m,t[19]=y):y=t[19],y}function zn(e){return!e}function Bn(e){let t=(0,ft.c)(17),{headers:n,onChange:r,t:i,additional:a,environment:o}=e,s=a!==void 0&&a,c=o!==void 0&&o,l=c?i.envLabel:s?i.setupAdditionalHeaders:i.headersLabel,u=c?i.setupAddEnv:i.addHeader,d=c?i.setupRemoveEnv:i.removeHeader,f=c?i.setupEnvName:i.headerKeyPlaceholder,p=c?i.setupEnvValue:i.headerValuePlaceholder,m=!c,h;return t[0]!==n||t[1]!==r||t[2]!==i.optionalSuffix||t[3]!==i.pasteHeaders||t[4]!==i.pasteHeadersDismiss||t[5]!==i.pasteHeadersFailed||t[6]!==i.pasteHeadersFailedTitle||t[7]!==i.setupHideValue||t[8]!==i.setupReference||t[9]!==i.setupShowValue||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==f||t[14]!==p||t[15]!==m?(h=(0,$.jsx)(In,{label:l,optionalLabel:i.optionalSuffix,addLabel:u,removeHeaderAria:d,pasteLabel:i.pasteHeaders,pasteFailed:i.pasteHeadersFailed,pasteFailedTitle:i.pasteHeadersFailedTitle,dismissLabel:i.pasteHeadersDismiss,keyPlaceholder:f,valuePlaceholder:p,headers:n,onChange:r,referenceLabel:i.setupReference,showValueLabel:i.setupShowValue,hideValueLabel:i.setupHideValue,allowPaste:m}),t[0]=n,t[1]=r,t[2]=i.optionalSuffix,t[3]=i.pasteHeaders,t[4]=i.pasteHeadersDismiss,t[5]=i.pasteHeadersFailed,t[6]=i.pasteHeadersFailedTitle,t[7]=i.setupHideValue,t[8]=i.setupReference,t[9]=i.setupShowValue,t[10]=l,t[11]=u,t[12]=d,t[13]=f,t[14]=p,t[15]=m,t[16]=h):h=t[16],h}function Vn(e){let t=(0,ft.c)(52),{draft:n,onChange:r,t:i,allowExisting:a}=e,o=i.setupAuthLabel,s=i.setupAuthLabel,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=Y(Ln,`mt-1.5`),t[0]=c):c=t[0];let l=n.mode,u;t[1]===r?u=t[2]:(u=e=>r({mode:e.target.value}),t[1]=r,t[2]=u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=[`auto`,`oauth`,`bearer`,`apiKey`,`headers`,`none`],t[3]=d):d=t[3];let f;t[4]===i.setupAuthModes?f=t[5]:(f=d.map(e=>(0,$.jsx)(T,{value:e,children:i.setupAuthModes[e]},e)),t[4]=i.setupAuthModes,t[5]=f);let p;t[6]!==a||t[7]!==n.mode||t[8]!==i.setupAuthModes?(p=a||n.mode===`existing`?(0,$.jsx)(T,{value:`existing`,children:i.setupAuthModes.existing}):null,t[6]=a,t[7]=n.mode,t[8]=i.setupAuthModes,t[9]=p):p=t[9];let m;t[10]!==n.mode||t[11]!==i.setupAuthLabel||t[12]!==u||t[13]!==f||t[14]!==p?(m=(0,$.jsxs)(w,{"aria-label":s,className:c,value:l,onChange:u,children:[f,p]}),t[10]=n.mode,t[11]=i.setupAuthLabel,t[12]=u,t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==i.setupAuthLabel||t[17]!==m?(h=(0,$.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[o,m]}),t[16]=i.setupAuthLabel,t[17]=m,t[18]=h):h=t[18];let g;t[19]!==n.mode||t[20]!==i.setupAuthAutoHint?(g=n.mode===`auto`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupAuthAutoHint}):null,t[19]=n.mode,t[20]=i.setupAuthAutoHint,t[21]=g):g=t[21];let _;t[22]!==n.mode||t[23]!==i.setupAuthOAuthHint?(_=n.mode===`oauth`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupAuthOAuthHint}):null,t[22]=n.mode,t[23]=i.setupAuthOAuthHint,t[24]=_):_=t[24];let v;t[25]!==n.mode||t[26]!==i.setupExistingHint?(v=n.mode===`existing`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupExistingHint}):null,t[25]=n.mode,t[26]=i.setupExistingHint,t[27]=v):v=t[27];let y;t[28]!==n.mode||t[29]!==n.token||t[30]!==r||t[31]!==i?(y=n.mode===`bearer`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Rn,{value:n.token,onChange:e=>r({token:e}),label:i.setupTokenLabel,t:i,required:!0}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupTokenHint})]}):null,t[28]=n.mode,t[29]=n.token,t[30]=r,t[31]=i,t[32]=y):y=t[32];let b;t[33]!==n.apiKey||t[34]!==n.headerName||t[35]!==n.mode||t[36]!==r||t[37]!==i?(b=n.mode===`apiKey`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[i.setupApiKeyHeader,(0,$.jsx)(`input`,{className:Y(Ln,`mt-1.5`),placeholder:`x-api-key`,value:n.headerName,required:!0,onChange:e=>r({headerName:e.target.value})})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupApiKeyHint}),(0,$.jsx)(Rn,{value:n.apiKey,onChange:e=>r({apiKey:e}),label:`API Key`,t:i,required:!0})]}):null,t[33]=n.apiKey,t[34]=n.headerName,t[35]=n.mode,t[36]=r,t[37]=i,t[38]=b):b=t[38];let x;t[39]!==n.customHeaders||t[40]!==n.mode||t[41]!==r||t[42]!==i?(x=n.mode===`headers`?(0,$.jsx)(Bn,{headers:n.customHeaders,onChange:e=>r({customHeaders:e}),t:i}):null,t[39]=n.customHeaders,t[40]=n.mode,t[41]=r,t[42]=i,t[43]=x):x=t[43];let S;return t[44]!==h||t[45]!==g||t[46]!==_||t[47]!==v||t[48]!==y||t[49]!==b||t[50]!==x?(S=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[h,g,_,v,y,b,x]}),t[44]=h,t[45]=g,t[46]=_,t[47]=v,t[48]=y,t[49]=b,t[50]=x,t[51]=S):S=t[51],S}function Hn(e){let t=(0,ft.c)(8),{label:n,children:r,hint:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`span`,{children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i?(0,$.jsx)(`span`,{className:`block text-xs font-normal text-fg-muted`,children:i}):null,t[2]=i,t[3]=o);let s;return t[4]!==r||t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm font-medium text-fg`,children:[a,r,o]}),t[4]=r,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Un({row:e,t,onUpdate:n}){let[r,i]=(0,Q.useState)(()=>It(e.envJson?JSON.parse(e.envJson):void 0)),[a,o]=(0,Q.useState)(!1),s=[];try{s=Rt(e.argsText)??[]}catch{}let c=e=>n({argsText:JSON.stringify(e)});return(0,$.jsxs)(`div`,{"data-field":`commandOptions`,className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.argsLabel}),(0,$.jsx)(Z,{type:`button`,variant:`ghost`,onClick:()=>o(e=>!e),children:a?t.setupArgsRows:t.setupArgsPaste})]}),a?(0,$.jsx)(Hn,{label:t.setupArgsPaste,hint:t.argsHint,children:(0,$.jsx)(`input`,{className:Ln,value:e.argsText,onChange:e=>n({argsText:e.target.value})})}):s.map((e,n)=>(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`input`,{className:Ln,"aria-label":`${t.argsLabel} ${n+1}`,value:e,onChange:e=>c(s.map((t,r)=>r===n?e.target.value:t))}),(0,$.jsx)(Z,{type:`button`,variant:`ghost`,"aria-label":t.setupRemoveArg,onClick:()=>c(s.filter((e,t)=>t!==n)),children:(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0})})]},n)),a?null:(0,$.jsxs)(Z,{type:`button`,variant:`ghost`,onClick:()=>c([...s,``]),children:[(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),t.setupAddArg]})]}),(0,$.jsx)(Bn,{environment:!0,headers:r,t,onChange:e=>{i(e),n({envEntries:e,envJson:JSON.stringify(Ft(e)??{})})}})]})}function Wn(e){let t=(0,ft.c)(15),{row:n,t:r,onUpdate:i,variant:a,showOAuth:o,idReadOnly:s}=e,c=a===void 0?`all`:a,l=o!==void 0&&o,u=s!==void 0&&s,d=c!==`advanced`,f=c!==`basic`,p;t[0]!==d||t[1]!==i||t[2]!==n||t[3]!==r?(p=d?(0,$.jsxs)($.Fragment,{children:[n.transport===`stdio`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Hn,{label:`${r.commandLabel} *`,children:(0,$.jsx)(`input`,{"data-field":`command`,className:Ln,value:n.command,required:!0,onChange:e=>i({command:e.target.value})})}),(0,$.jsx)(Un,{row:n,t:r,onUpdate:i})]}):(0,$.jsx)(Hn,{label:`${r.urlLabel} *`,children:(0,$.jsx)(`input`,{"data-field":`url`,className:Ln,value:n.url,placeholder:`https://example.com/mcp`,required:!0,onChange:e=>i({url:e.target.value})})}),(0,$.jsx)(Hn,{label:r.setupNameLabel,hint:r.setupNameHint,children:(0,$.jsx)(`input`,{className:Ln,value:n.displayName??``,placeholder:r.setupNamePlaceholder,onChange:e=>i({displayName:e.target.value})})})]}):null,t[0]=d,t[1]=i,t[2]=n,t[3]=r,t[4]=p):p=t[4];let m;t[5]!==f||t[6]!==u||t[7]!==i||t[8]!==n||t[9]!==l||t[10]!==r?(m=f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Hn,{label:r.serverIdLabel,hint:r.setupIdHint,children:(0,$.jsx)(`input`,{className:Ln,readOnly:u,value:n.id,onChange:e=>i({id:e.target.value}),placeholder:r.serverIdPlaceholder})}),n.transport===`stdio`?(0,$.jsx)(Hn,{label:r.cwdLabel,children:(0,$.jsx)(`input`,{className:Ln,value:n.cwd,onChange:e=>i({cwd:e.target.value})})}):null,n.transport!==`stdio`&&l?(0,$.jsx)(Hn,{label:r.oauthClientIdLabel,hint:r.oauthClientIdHint,children:(0,$.jsx)(`input`,{className:Ln,value:n.oauthClientId,onChange:e=>i({oauthClientId:e.target.value})})}):null,(0,$.jsx)(Hn,{label:r.exposureLabel,hint:r.setupExposureHint,children:(0,$.jsx)(w,{"aria-label":r.exposureLabel,className:Ln,value:n.exposure,onChange:e=>i({exposure:e.target.value}),children:[`codemode`,`deferred`,`direct`,`hidden`].map(e=>(0,$.jsx)(T,{value:e,children:r.exposureLabels[e]},e))})}),(0,$.jsx)(Hn,{label:r.requestTimeoutLabel,children:(0,$.jsx)(dt,{allowEmpty:!0,type:`number`,min:1,className:Ln,value:n.timeout??``,placeholder:r.setupDefaultTimeout,onChange:e=>i({timeout:e.target.value?Number(e.target.value):void 0})})})]}):null,t[5]=f,t[6]=u,t[7]=i,t[8]=n,t[9]=l,t[10]=r,t[11]=m):m=t[11];let h;return t[12]!==p||t[13]!==m?(h=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[p,m]}),t[12]=p,t[13]=m,t[14]=h):h=t[14],h}function Gn(e,t){let n=e;if(n?.status===429)return t.setupRateLimited;if(n?.status===401)return t.setupGatewayUnauthorized;if(n?.status===404||n?.status===409)return t.setupConflict;if(n?.status&&n.status>=500)return t.setupGatewayCheckFailed;let r={command_missing:t.setupCommandMissing,connection_refused:t.setupConnectionRefused,host_not_found:t.setupHostNotFound,timeout:t.setupTimedOut,access_denied:t.setupAccessDenied,network:t.setupServiceNetworkFailed,tls:t.setupTlsFailed,invalid_response:t.setupInvalidResponse,not_found:t.setupEndpointNotFound,rate_limited:t.setupServiceRateLimited,configuration:t.setupInvalidConfig};if(n?.errorCode&&Object.hasOwn(r,n.errorCode))return r[n.errorCode];let i=e instanceof Error?e.message:typeof e==`string`?e:n?.error??``;return/ENOENT|command not found|executable.{0,30}not found/i.test(i)?t.setupCommandMissing:/ECONNREFUSED|connection refused/i.test(i)?t.setupConnectionRefused:/ENOTFOUND|EAI_AGAIN|could not resolve/i.test(i)?t.setupHostNotFound:/timeout|timed out/i.test(i)?t.setupTimedOut:/fetch failed|failed to fetch|network error|NetworkError/i.test(i)?n?.error===void 0?t.setupGatewayNetworkFailed:t.setupServiceNetworkFailed:/\b(?:401|403)\b|unauthorized|forbidden|permission denied/i.test(i)?t.setupAccessDenied:t.setupCheckFailed}function Kn(e,t){return JSON.stringify({id:e.id,config:qt(Nn(e,t))})}function qn(e,t){try{return Kn(e,t)}catch{return JSON.stringify({row:e,auth:t})}}function Jn(e){let{t,cs:n}=e,r=c(e=>e.language),i=(0,Q.useId)(),[a,o]=(0,Q.useState)(e.initialRow),[s,l]=(0,Q.useState)(()=>Mn(e.initialRow)),[u,p]=(0,Q.useState)(`idle`),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(),[E,D]=(0,Q.useState)(),[k,A]=(0,Q.useState)(),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(``),[L,z]=(0,Q.useState)(``),[B,V]=(0,Q.useState)([]),[U,ee]=(0,Q.useState)(`0`),[W,te]=(0,Q.useState)(0),[G,ne]=(0,Q.useState)(``),[re,ie]=(0,Q.useState)(!1),[K,ae]=(0,Q.useState)(!1),oe=e.mode===`edit`,[se,q]=(0,Q.useState)(``),J=(0,Q.useRef)(void 0),[ce]=(0,Q.useState)(()=>qn(e.initialRow,Mn(e.initialRow))),le=(0,Q.useRef)(e.mode===`edit`?e.initialRow.id:``),ue=(0,Q.useRef)(void 0),de=(0,Q.useRef)(void 0),pe=(0,Q.useRef)(void 0),me=(0,Q.useRef)(null),he=(0,Q.useRef)(``),X=(0,Q.useRef)(!0),ge=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),ve=(0,Q.useRef)(null),ye=(0,Q.useRef)(null),be=(0,Q.useRef)(e.onSaved);be.current=e.onSaved;let xe=k?.state===`starting`||k?.state===`authorizing`,Se=u!==`idle`||xe,Ce=ce!==qn(a,s),we=a.extra.enabled===!1,Te=!b&&(Ce||!!F.trim());(0,Q.useEffect)(()=>(X.current=!0,()=>{X.current=!1,ue.current?.abort(),me.current?.close(),J.current&&Zt(J.current).catch(()=>{})}),[]),(0,Q.useEffect)(()=>{if(!Te)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[Te]),(0,Q.useEffect)(()=>{if(!S)return;let e=ve.current?.querySelector(`[data-field="${S.field}"]`),t=e?.closest(`details`);t&&(t.open=!0);let n=e?.querySelector(`input,button,textarea`)??e;return n?.setAttribute(`aria-invalid`,`true`),n?.setAttribute(`aria-describedby`,i),S.focus!==!1&&(n??ye.current)?.focus(),()=>{n?.removeAttribute(`aria-invalid`),n?.removeAttribute(`aria-describedby`)}},[S,i]),(0,Q.useEffect)(()=>{if(!k||!xe)return;let e=new AbortController;de.current=e;let n;async function r(){try{let n=await en(J.current,e.signal);if(e.signal.aborted||(A(n),n.authorizationUrl&&he.current!==n.authorizationUrl&&(he.current=n.authorizationUrl,window.electronAPI?.shell?.openExternalUrl?!(await window.electronAPI.shell.openExternalUrl(n.authorizationUrl)).ok&&!e.signal.aborted&&y(t.oauthOpenFailed):me.current&&!me.current.closed&&me.current.location.replace(n.authorizationUrl)),e.signal.aborted))return;if(n.state===`connected`){pe.current=void 0,me.current?.close(),D({state:`connected`,toolCount:n.toolCount}),y(``);return}if(n.state===`error`||n.state===`cancelled`){pe.current=void 0,me.current?.close(),y(n.state===`cancelled`?t.setupCancelled:t.setupAuthFailed),/client.{0,20}(id|registration)|register|registration/i.test(n.error??``)&&M(!0);return}}catch{if(e.signal.aborted)return;Ee(),me.current?.close(),y(t.setupAuthFailed);return}n=setTimeout(()=>void r(),1200)}return r(),()=>{e.abort(),clearTimeout(n)}},[k?.id,xe,t.oauthOpenFailed,t.setupCancelled,t.setupAuthFailed]);function Ee(){ue.current?.abort(),de.current?.abort(),J.current&&Zt(J.current).catch(()=>{}),J.current=void 0,q(``),ie(!1),D(void 0),A(void 0),y(``),C(void 0)}function De(e){o(t=>({...t,...e})),Ee()}function Oe(e){l(t=>({...t,...e})),Ee()}function ke(){u===`saving`||xe||(u===`checking`&&(Ee(),p(`idle`)),Te?ae(!0):e.onClose())}function Ae(){try{V(Wt(F)),ee(`0`),z(``)}catch{z(t.setupImportError),V([])}}function je(){let t=B[Number(U)];if(!t)return;let n={...t,id:le.current||t.id,clientKey:e.initialRow.clientKey,extra:{...t.extra,...le.current?{enabled:a.extra.enabled}:{}}};o(n),l(Mn(n)),Ee(),te(e=>e+1),P(!1),I(``),V([])}function Me(e){function n(e,t){return C({field:e,message:t}),!1}if(e.transport!==`stdio`){try{e.url=Ut(e.url)}catch{return n(`url`,t.setupAddressInvalid)}if(s.mode===`bearer`&&!s.token.trim().replace(/^Bearer\s*/i,``)||s.mode===`apiKey`&&(!s.apiKey.trim()||!s.headerName.trim()))return n(`auth`,t.setupCredentialRequired);if(Pn(e.headers)>=0)return n(`auth`,t.setupHeaderInvalid);if(s.mode===`oauth`&&e.headers.some(e=>e.key.trim().toLowerCase()===`authorization`))return n(`auth`,t.setupOAuthHeaderConflict);if(s.mode===`headers`&&!e.headers.some(e=>e.key.trim()&&(e.value.trim()||e.reference)))return n(`auth`,t.setupCredentialRequired)}else if(!e.command.trim())return n(`command`,t.setupCommandRequired);if(e.timeout!==void 0&&(!Number.isFinite(e.timeout)||e.timeout<=0))return n(`advanced`,t.setupInvalidConfig);try{qt(e)}catch(r){return n(e.transport===`stdio`?`commandOptions`:`advanced`,r instanceof Error&&r.message.startsWith(`Environment`)?t.setupEnvInvalid:t.setupInvalidConfig)}return!0}async function Ne(){y(``),p(`checking`),he.current=``,window.electronAPI?.shell?.openExternalUrl||(me.current=window.open(`about:blank`,`_blank`),me.current&&(me.current.opener=null));try{let e=await $t(J.current);if(!X.current){me.current?.close(),J.current&&Zt(J.current).catch(()=>{});return}pe.current=e.id,A(e)}catch{me.current?.close(),X.current&&y(t.setupAuthFailed)}finally{X.current&&p(`idle`)}}async function Pe(){let r=Nn(a,s);if(!Me(r))return;let i=e.existingCustomServers.filter(t=>t.clientKey!==e.initialRow.clientKey&&t.id!==le.current),c=new Set([...e.managedServerIds,...i.map(e=>e.id)]);if(r.id=le.current||r.id.trim()||Ht(r,c),!/^[a-zA-Z0-9_-]+$/.test(r.id)||[...c].some(e=>e.replace(/-/g,`_`)===r.id.replace(/-/g,`_`))){C({field:`advanced`,message:n.duplicateServerId});return}Ee(),p(`checking`);let l=new AbortController;ue.current=l;try{let n=await Yt(r,le.current||void 0,e.initialRow.extra,l.signal);if(!X.current||l.signal.aborted){Zt(n.id).catch(()=>{});return}J.current=n.id,o(r),q(qn(r,s));let i=await Xt(n.id,l.signal);if(!X.current||l.signal.aborted)return;D(i),i.state===`error`&&y(Gn(i,t))}catch(e){X.current&&!l.signal.aborted&&y(e.status===409?t.setupConflict:Gn(e,t))}finally{X.current&&ue.current===l&&p(`idle`)}}async function Fe(n=!1){if(!(!J.current||E?.state!==`connected`||se!==qn(a,s))){p(`saving`),y(``);try{let t=await Qt(J.current,n);J.current=void 0,await be.current().catch(()=>{}),t?.reloadRequired?x(!0):e.onClose()}catch(e){let n=e.status;n===404||n===409?(Ee(),y(t.setupConflict)):y(t.setupSaveFailed)}finally{X.current&&p(`idle`)}}}async function Ie(){de.current?.abort();let e=J.current;pe.current=void 0,A(void 0),me.current?.close(),y(t.setupCancelled),p(`checking`);try{e&&await tn(e)}catch{X.current&&(Ee(),y(t.setupCancelled))}finally{X.current&&p(`idle`)}}async function Le(){k?.authorizationUrl&&(window.electronAPI?.shell?.openExternalUrl?(await window.electronAPI.shell.openExternalUrl(k.authorizationUrl)).ok||y(t.oauthOpenFailed):window.open(k.authorizationUrl,`_blank`,`noopener,noreferrer`))}async function Re(){if(k)try{await nn(J.current,G),ne(``),y(``)}catch{y(t.setupRedirectInvalid)}}let ze=!!J.current&&se===qn(a,s)&&(s.mode===`oauth`||s.mode===`auto`&&E?.state===`oauth_required`)&&E?.state!==`connected`,Be=/^(?:https?:\/\/)?(?:localhost|127\.0\.0\.1|\[::1\])(?=[:/]|$)/i.test(a.url.trim()),Ve=B[Number(U)];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_,{open:e.open,onOpenChange:e=>{e||ke()},children:(0,$.jsxs)(m,{children:[(0,$.jsx)(d,{className:`fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(h,{ref:ge,tabIndex:-1,className:`fixed left-1/2 top-1/2 z-[60] flex h-[min(44rem,calc(100dvh-2rem))] w-[min(42rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay`,onOpenAutoFocus:e=>{e.preventDefault(),ge.current?.focus()},children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge p-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(g,{className:`font-semibold`,children:e.mode===`edit`?t.setupEditTitle:t.setupTitle}),(0,$.jsx)(f,{className:`mt-1 text-sm text-fg-muted`,children:t.setupHint})]}),(0,$.jsx)(`button`,{type:`button`,disabled:u===`saving`||xe,onClick:ke,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover disabled:opacity-50`,"aria-label":n.modalClose,children:(0,$.jsx)(fe,{className:`size-5`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-5`,children:[N?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(Z,{variant:`ghost`,onClick:()=>P(!1),children:t.setupImportBack}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.setupImportEmpty}),(0,$.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[t.setupImport,(0,$.jsx)(`textarea`,{className:Y(Ln,`mt-1.5 min-h-40 font-mono text-xs`),value:F,placeholder:`{"mcpServers": {"docs": {"url": "https://example.com/mcp"}}}`,onChange:e=>{I(e.target.value),V([]),z(``)}})]}),(0,$.jsx)(Z,{variant:`secondary`,disabled:!F.trim(),onClick:Ae,children:t.setupImportPreview}),L?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:L}):null,Ve?(0,$.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.setupImportScope}),(0,$.jsxs)(`label`,{className:`block text-sm font-medium`,children:[t.setupImportChoose,(0,$.jsx)(w,{"aria-label":t.setupImportChoose,className:Y(Ln,`mt-1.5`),value:U,onChange:e=>ee(e.target.value),children:B.map((e,t)=>(0,$.jsx)(T,{value:String(t),children:e.displayName||e.id||un(e)},t))})]}),(0,$.jsxs)(`p`,{className:`break-all text-sm text-fg-muted`,children:[Ve.transport===`stdio`?t.setupUseCommand:t.setupUseUrl,` · `,un(Ve)]})]}):null]}):(0,$.jsxs)(`form`,{ref:ve,noValidate:!0,onBlurCapture:e=>{if(e.target instanceof HTMLInputElement&&e.target.dataset.field===`url`&&a.url.trim())try{Ut(a.url)}catch{C({field:`url`,message:t.setupAddressInvalid,focus:!1})}},onSubmit:e=>{e.preventDefault(),Pe()},children:[(0,$.jsxs)(`fieldset`,{disabled:Se||b,className:`min-w-0 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)($e,{className:`flex gap-1`,role:`group`,"aria-label":t.transportLabel,children:[`streamable-http`,`sse`,`stdio`].map(e=>(0,$.jsx)(Z,{type:`button`,variant:a.transport===e?`secondary`:`ghost`,"aria-pressed":a.transport===e,onClick:()=>De({transport:e}),children:e===`stdio`?t.setupUseCommand:e===`sse`?r===`zh`?`旧版 SSE`:`Legacy SSE`:t.setupUseUrl},e))}),(0,$.jsx)(Z,{type:`button`,variant:`ghost`,onClick:()=>P(!0),children:t.setupImport})]}),(0,$.jsx)(`div`,{children:(0,$.jsx)(Wn,{row:a,t,variant:`basic`,onUpdate:De},`${a.transport}-${W}`)}),a.transport===`stdio`?null:(0,$.jsx)(`div`,{"data-field":`auth`,children:(0,$.jsx)(Vn,{allowExisting:!!a.extra.auth||a.headers.some(e=>!!e.reference),draft:s,onChange:Oe,t})}),S?(0,$.jsx)(`p`,{id:i,ref:ye,tabIndex:-1,role:`alert`,className:`text-sm text-danger`,children:S.message}):null,(0,$.jsxs)(`details`,{"data-field":`advanced`,className:`rounded-lg border border-edge p-3`,open:j,onToggle:e=>M(e.currentTarget.open),children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:t.setupAdvanced}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsx)(Wn,{row:a,t,variant:`advanced`,idReadOnly:oe,showOAuth:s.mode===`oauth`,onUpdate:De}),a.transport!==`stdio`&&s.mode!==`headers`&&s.mode!==`existing`?(0,$.jsx)(Bn,{additional:!0,headers:s.additionalHeaders,onChange:e=>Oe({additionalHeaders:e}),t}):null]})]}),(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:a.transport===`stdio`?t.setupCommandHostHint:Be?t.setupLocalhostHint:t.setupGatewayHint}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.setupTestNotice})]}),(0,$.jsx)(`button`,{type:`submit`,hidden:!0})]}),b?(0,$.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-fg`,children:t.setupReloadRequired}):null,!N&&!b?(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,"aria-live":`polite`,children:[u===`idle`?null:(0,$.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(H,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),u===`saving`?t.setupSaving:t.setupChecking]}),u===`idle`&&oe&&!Ce&&!E&&!v&&!xe?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:we?t.setupDisabled:e.lastCheck?t.setupLastCheck.replace(`{{count}}`,String(e.lastCheck.toolCount)):t.setupSavedUnchecked}):null,E?.state===`connected`?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-success`,children:[(0,$.jsx)(O,{className:`size-4 shrink-0`,"aria-hidden":!0}),E.toolCount?t.setupConnected.replace(`{{count}}`,String(E.toolCount)):t.setupZeroTools]}),(0,$.jsx)(Z,{ref:_e,variant:`secondary`,onClick:()=>ie(!0),children:t.viewTools})]}):null,E?.state===`token_required`?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:t.setupNeedsAuth}):null,E?.state===`auth_unknown`?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:r===`zh`?`认证方式尚未确定。请核实服务接入说明,选择 Token 或已确认支持的 OAuth。`:`Authentication is undetermined. Check the integration guide and select a Token or verified OAuth method.`}):null,E?.state===`oauth_required`&&!xe?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.setupOAuthRequired}):null,xe?(0,$.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-4`,children:[(0,$.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(H,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),t.setupAuthorizing]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[k?.authorizationUrl?(0,$.jsxs)(Z,{variant:`secondary`,onClick:()=>void Le(),children:[(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0}),t.oauthOpenAuthorization]}):null,(0,$.jsx)(Z,{variant:`ghost`,onClick:()=>void Ie(),children:t.setupCancelAuth})]}),k?.acceptsRedirect?(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm text-accent-fg`,children:t.setupRemoteFallback}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.setupRedirectHint}),(0,$.jsxs)(`label`,{className:`mt-2 block text-sm`,children:[t.setupRedirectLabel,(0,$.jsx)(`input`,{className:Ln,value:G,onChange:e=>ne(e.target.value)})]}),(0,$.jsx)(Z,{className:`mt-2`,disabled:!G.trim(),onClick:()=>void Re(),children:t.setupContinue})]}):null]}):null,v?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-1 text-sm`,children:[(0,$.jsx)(`p`,{className:`text-danger`,children:v}),v!==t.setupSaveFailed&&u!==`saving`?(0,$.jsx)(`p`,{className:`text-fg-muted`,children:t.setupTestFailure}):null]}):null]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge p-4`,children:[(0,$.jsx)(Z,{variant:`secondary`,disabled:u===`saving`||xe,onClick:ke,children:oe||b?t.setupClose:n.modalCancel}),b?null:N?(0,$.jsx)(Z,{variant:`primary`,disabled:!Ve,onClick:je,children:t.setupImportApply}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{variant:E?.state===`connected`?`secondary`:`primary`,disabled:Se,onClick:()=>ze?void Ne():void Pe(),children:ze?t.setupSignIn:t.setupTestConnection}),E?.state===`connected`&&se===qn(a,s)?(0,$.jsxs)($.Fragment,{children:[we?(0,$.jsx)(Z,{variant:`secondary`,disabled:Se,onClick:()=>void Fe(!0),children:t.setupEnableSave}):null,(0,$.jsx)(Z,{variant:`primary`,disabled:Se,"aria-busy":Se,onClick:()=>void Fe(),children:oe?t.setupSaveOnly:t.setupAddConnection})]}):null]})]})]})]})}),(0,$.jsx)(et,{open:K,title:t.setupUnsavedTitle,description:t.setupUnsavedHint,confirmLabel:t.setupDiscard,cancelLabel:t.setupKeepEditing,onCancel:()=>ae(!1),onConfirm:e.onClose,overlayClassName:`z-[70]`,contentClassName:`z-[70]`}),re?(0,$.jsx)(sn,{draftId:J.current,serverId:a.id,displayName:a.displayName,returnFocusTo:_e.current,t,onClose:()=>ie(!1)}):null]})}var Yn=`recommended`,Xn=`builtin`,Zn=`composio`,Qn=`xopc-store`;function $n(e,t=`en`){return e==="default"&&t.startsWith(`zh`)?Yn:Xn}function er(e,t){let n=e.connectorManifest;if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=n;if(r.contractVersion!==1||r.id!==e.name)return null;let i=r.runtime,a=r.auth;if(!i||typeof i!=`object`||Array.isArray(i)||!a||typeof a!=`object`||Array.isArray(a))return null;let o=i,s=a;if(o.type!==`mcp`||typeof o.serverId!=`string`)return null;let c=[`code`,`docs`,`browser`,`data`,`automation`,`custom`].includes(String(r.category??``))?r.category:`custom`,l=s.mode===`oauth`?{mode:`oauth`,...typeof s.clientId==`string`?{clientId:s.clientId}:{}}:s.mode===`apiKey`?{mode:`apiKey`}:{mode:`none`},u=e.localizations?.[t===`zh`?`zh-CN`:`en`];return{id:e.name,version:e.latestVersion??`store`,displayName:u?.displayName??(typeof r.displayName==`string`?r.displayName:e.name),description:u?.description??(typeof r.description==`string`?r.description:e.description),category:c,kind:`mcp`,source:`store`,...e.branding?.iconUrl?{branding:{logoUrl:e.branding.iconUrl,source:`registry`}}:{},capabilities:Array.isArray(r.capabilities)?r.capabilities.filter(e=>typeof e==`string`):[],tags:Array.isArray(r.tags)?r.tags.filter(e=>typeof e==`string`):[`store`],auth:l,setup:r.setup&&typeof r.setup==`object`&&!Array.isArray(r.setup)?r.setup:{},runtime:{type:`mcp`,serverId:o.serverId}}}function tr(e){return v(e.map(e=>({connector:e,service:{id:e.id,source:e.source===`builtin`?`builtin-connector`:e.source===`store`?`store-connector`:`registry-connector`}})),`en`).map(e=>e.connector)}function nr(e){return e?.startsWith(`/`)&&!e.startsWith(`//`)?e:`/user-model`}function rr({embedded:e=!1,onHeaderActionChange:t}){let n=me().filter(pn),r=c(e=>e.language),o=u(r),l=o.connectorsSettings,d=o.mcpSettings,f=s(e=>e.conversationId),p=!!f,m=a(),[h,g]=i(),_=h.get(`understanding`)===`1`,v=nr(h.get(`returnTo`)),S=!!h.get(`returnTo`)&&!_,C=h.get(`tab`),[w,T]=(0,Q.useState)(!_&&C===`connected`?`connected`:`discover`),{data:D}=he(p&&w===`discover`&&!_?[`service-recommendations`,r]:null,()=>y(r),{revalidateOnFocus:!1}),O=(0,Q.useMemo)(()=>new Set(D?.items.filter(e=>e.service?.source===`store-plugin`).map(e=>b(e.id))??[]),[D]),k=(0,Q.useRef)(!1),[A,F]=(0,Q.useState)({catalog:[],registryCatalog:[],instances:[],loading:!0,error:null}),[I,L]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(!1),[B,V]=(0,Q.useState)(1),[U,ee]=(0,Q.useState)(void 0),[W,te]=(0,Q.useState)(``),[G,ne]=(0,Q.useState)(_||S?h.get(`connector`)??``:``),[K,ae]=(0,Q.useState)($n(_?`understanding`:`default`,r)),[oe,se]=(0,Q.useState)(`name`),[q,J]=(0,Q.useState)(_?`understand`:`all`),[ce,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(null),[X,_e]=(0,Q.useState)(null),[ve,ye]=(0,Q.useState)(null),[be,xe]=(0,Q.useState)(null),{data:Se,mutate:Ce}=ge(p),we=Se?.payload?.config,Te=(0,Q.useMemo)(()=>we===void 0?null:Kt(we),[we]),Ee=Te?.servers??[],De=A.instances.length+Ee.length+n.length,[Oe,ke]=(0,Q.useState)({});(0,Q.useEffect)(()=>{if(ke({}),!p||!we)return;let e=new AbortController;return an(e.signal).then(t=>{e.signal.aborted||ke(t)}).catch(()=>{}),()=>e.abort()},[p,we]);let Ae=(0,Q.useCallback)(async()=>{if(!f){F({catalog:[],registryCatalog:[],instances:[],loading:!1,error:null});return}F(e=>({...e,loading:!0,error:null}));try{let[e,t]=await Promise.all([Pe(),je()]);F(n=>({catalog:e,registryCatalog:n.registryCatalog,instances:t,loading:!1,error:null}))}catch(e){F({catalog:[],registryCatalog:[],instances:[],loading:!1,error:e instanceof Error?e.message:String(e)})}},[f]);(0,Q.useEffect)(()=>{Ae()},[Ae]),(0,Q.useEffect)(()=>{k.current||A.loading||p&&!Te||(T(_?`discover`:De>0?`connected`:`discover`),k.current=!0)},[p,De,Te,_,A.loading]),(0,Q.useEffect)(()=>{ae(e=>e===`builtin`||e===`recommended`?$n(_?`understanding`:`default`,r):e)},[r,_]);let Me=(0,Q.useCallback)(e=>{k.current=!0,T(e)},[]),Ne=(0,Q.useMemo)(()=>[{id:Zn,displayName:l.composioSourceName},{id:Qn,displayName:l.storeSourceName}],[l.composioSourceName,l.storeSourceName]),Fe=(0,Q.useCallback)(async e=>{if(!p||K===`builtin`||K===`recommended`){F(e=>({...e,registryCatalog:[]})),V(1),ee(void 0);return}let t=G.trim(),n=Math.max(e?.page??1,1),i=e?.append??!1,a=K===`all`?Ne:Ne.filter(e=>e.id===K);if(a.length!==0){L(!0),i?F(e=>({...e,error:null})):(V(1),ee(void 0),F(e=>({...e,registryCatalog:[],error:null})));try{let e=await Promise.all(a.map(async e=>{if(e.id===`composio`){let e=await Ve({q:t||void 0,page:n,pageSize:24,verification:`experimental`});return{connectors:e.connectors,totalPages:e.meta.totalPages}}let i=await ze({q:t||void 0,page:n,pageSize:24,sort:oe===`source`?`newest`:`downloads`});return{connectors:i.items.flatMap(e=>{let t=er(e,r);return t?[t]:[]}),totalPages:i.meta.totalPages}})),o=tr(e.flatMap(e=>e.connectors)),s=Math.max(1,...e.map(e=>e.totalPages??1));V(n),ee(s),F(e=>({...e,registryCatalog:i?tr([...e.registryCatalog,...o]):o}))}catch(e){F(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{L(!1)}}},[oe,G,K,p,Ne,r]);(0,Q.useEffect)(()=>{if(w!==`discover`||A.loading)return;if(K===`builtin`||K===`recommended`){F(e=>({...e,registryCatalog:[]})),V(1),ee(void 0);return}let e=window.setTimeout(()=>{Fe()},G.trim()?350:0);return()=>window.clearTimeout(e)},[G,K,Fe,A.loading,w]);let Ie=(0,Q.useMemo)(()=>new Set(A.instances.map(e=>e.connectorId)),[A.instances]),Le=(0,Q.useMemo)(()=>new Map([...A.catalog,...A.registryCatalog].map(e=>[e.id,e])),[A.catalog,A.registryCatalog]);(0,Q.useEffect)(()=>{if(A.loading)return;let e=h.get(`connector`),t=h.get(`instance`);if(!e&&!t)return;let n=A.instances.find(n=>t?n.instanceId===t:n.connectorId===e);if(n)k.current=!0,te(``),pe(n.instanceId),_e(n),T(`connected`);else if(e){let t=Le.get(e);if(!t)return;k.current=!0,ae($n(_?`understanding`:`default`,r)),ne(``),de(t),T(`discover`)}let i=new URLSearchParams(h);i.delete(`connector`),i.delete(`instance`),i.set(`tab`,n?`connected`:`discover`),g(i,{replace:!0})},[Le,_,r,h,g,A.instances,A.loading]);let Re=(0,Q.useCallback)(async e=>{z(!0),F(e=>({...e,error:null}));try{let t=await He(e);le(re(t.definition,{packageName:t.packageName,version:t.version,reviewHash:t.reviewHash,permissions:t.permissions}))}catch(e){F(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{z(!1)}},[]);(0,Q.useEffect)(()=>{let e=h.get(`storeConnector`);if(!p||!e)return;let t=new URLSearchParams(h);t.delete(`storeConnector`),g(t,{replace:!0}),Re(e)},[p,h,g,Re]);let Be=(0,Q.useMemo)(()=>new Set(A.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[A.instances]),Ue=(0,Q.useCallback)(async e=>{let t=await on(e);await Ce(),await Ae(),t.reloadRequired&&F(e=>({...e,error:d.setupReloadRequired}))},[Ae,Ce,d.setupReloadRequired]),We=(0,Q.useCallback)(()=>{xe({mode:`add`,row:jn(Ee,Be)})},[Ee,Be]),Ge=Qe(e=>e.setPageHeader),Ke=Qe(e=>e.clearPageHeader),qe=(0,Q.useMemo)(()=>({searchLabel:w===`connected`?l.connectedSearchPlaceholder:l.discoverSearchPlaceholder,search:(0,$.jsx)(ct,{value:w===`connected`?W:G,onChange:w===`connected`?te:ne,placeholder:w===`connected`?l.connectedSearchPlaceholder:l.discoverSearchPlaceholder}),secondary:(0,$.jsx)(jt,{onRefresh:w===`connected`&&p?Ae:void 0,refreshing:A.loading,refreshLabel:l.refreshConnections,onBrowseCatalog:()=>Me(`discover`),onAddCustomServer:We,addLabel:l.addConnection,browseLabel:l.addFromCatalog,customLabel:l.addCustomServerAdvanced,serviceLabel:r.startsWith(`zh`)?`应用连接服务`:`Connection service`,moreActionsLabel:o.capabilitiesHub.moreActions})}),[W,l,G,p,r,Ae,o.capabilitiesHub.moreActions,We,Me,A.loading,w]);(0,Q.useLayoutEffect)(()=>e?(t?.(qe),()=>t?.(null)):(Ge({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:l.title})}),end:(0,$.jsx)(lt,{contribution:qe})}),()=>Ke()),[Ke,l.title,e,qe,t,Ge]);let Je=(0,Q.useMemo)(()=>A.instances.map(e=>({instance:e,value:Ct(e,Le.get(e.connectorId))})),[Le,A.instances]),Ye=(0,Q.useMemo)(()=>new Map(Je.map(({instance:e,value:t})=>[e.instanceId,t])),[Je]),Xe=(0,Q.useMemo)(()=>A.instances.filter(e=>N(e,W)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=Ye.get(e.instanceId)?.state??`checking`,i=Ye.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[W,Ye,A.instances]),et=(0,Q.useMemo)(()=>Xe.filter(e=>Ye.get(e.instanceId)?.state===`needs_setup`),[Ye,Xe]),tt=(0,Q.useMemo)(()=>Xe.filter(e=>Ye.get(e.instanceId)?.state!==`needs_setup`),[Ye,Xe]),nt=(0,Q.useMemo)(()=>Ee.filter(e=>P(e,W)),[W,Ee]),rt=(0,Q.useMemo)(()=>{let e=W.trim().toLowerCase();return n.filter(t=>[t.name,t.description,...(t.setup?.authorizations??[]).map(e=>e.title),...(t.components?.mcp??[]).map(e=>e.name)].filter(Boolean).join(` `).toLowerCase().includes(e))},[W,n]),it=Xe.length+nt.length+rt.length,at=(0,Q.useMemo)(()=>A.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1&&j(e)),[A.catalog]),st=(0,Q.useMemo)(()=>K===`recommended`?[]:K===`builtin`?at:K===`all`?tr([...at,...A.registryCatalog]):A.registryCatalog,[at,K,A.registryCatalog]),ut=(0,Q.useMemo)(()=>{let e=_?st.filter(e=>e.understanding?.mode===`activity`):tr(st).filter(e=>!O.has(b(e.id)));return M(q===`all`?e:e.filter(e=>xt(e).includes(q)),G,oe)},[oe,G,st,_,q,O]),dt=(0,Q.useMemo)(()=>bt.filter(e=>st.some(t=>xt(t).includes(e))),[st]);(0,Q.useEffect)(()=>{q!==`all`&&!dt.includes(q)&&J(`all`)},[dt,q]);let ft=w===`discover`&&K!==`builtin`&&!!(U&&B<U),mt=(0,Q.useMemo)(()=>A.instances.find(e=>e.instanceId===fe)??X,[fe,X,A.instances]),_t=(0,Q.useMemo)(()=>[{value:Yn,label:r===`zh`?`推荐服务`:`Recommended services`},{value:`all`,label:l.discoverSourceAll},{value:Xn,label:l.discoverSourceBuiltin},...Ne.map(e=>({value:e.id,label:e.displayName}))],[l.discoverSourceAll,l.discoverSourceBuiltin,Ne,r]),St=[{id:`connected`,label:l.tabConnected,count:De},{id:`discover`,label:l.tabDiscover}];return(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:Y(`mx-auto flex w-full max-w-7xl flex-col gap-6 px-4 sm:px-6 lg:px-8`,e?`pb-7 pt-3 lg:pb-9 lg:pt-4`:`py-7 lg:py-9`),children:[p?null:(0,$.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel px-4 py-3 text-sm text-fg-muted`,children:l.tokenHint}),_?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:l.understandingSetupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:l.understandingSetupHint})]}),(0,$.jsx)(Z,{type:`button`,variant:`secondary`,className:`shrink-0`,onClick:()=>m(v),children:l.understandingSetupDone})]}):null,S?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:l.recoverySetupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:l.recoverySetupHint})]}),(0,$.jsx)(Z,{type:`button`,variant:`secondary`,className:`min-h-11 shrink-0`,onClick:()=>m(v),children:l.recoverySetupDone})]}):null,(0,$.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,$.jsx)(Ze,{items:St,activeTab:w,onChange:Me,ariaLabel:l.navAria,tabIdPrefix:`connectors-tab`,panelIdPrefix:`connectors-panel`,className:`flex-wrap`})}),A.error?(0,$.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:A.error}):null,w===`connected`&&p?(0,$.jsx)(`div`,{className:`flex flex-col gap-6`,children:A.loading?(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":l.loading,children:ht.slice(0,3).map(e=>(0,$.jsx)(yt,{},e))}):De===0?(0,$.jsxs)(`div`,{className:`py-14 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:l.connectionsEmpty}),(0,$.jsx)(Z,{type:`button`,variant:`primary`,className:`mt-4`,onClick:()=>Me(`discover`),children:l.addFromCatalog})]}):it===0?(0,$.jsx)(`div`,{className:`py-14 text-center text-sm text-fg-muted`,children:l.connectionsSearchEmpty}):(0,$.jsxs)(`div`,{className:`space-y-6`,children:[et.length?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:l.needsAttentionTitle}),(0,$.jsx)(`span`,{className:`text-xs tabular-nums text-amber-700 dark:text-amber-300`,children:et.length})]}),(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:et.map(e=>(0,$.jsx)(An,{instance:e,definition:Le.get(e.connectorId),highlighted:e.instanceId===ve,onOpenDetails:e=>{ye(null),pe(e.instanceId),_e(e)},t:l},e.instanceId))})]}):null,tt.length||rt.length?(0,$.jsx)(`section`,{children:(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:[tt.map(e=>(0,$.jsx)(An,{instance:e,definition:Le.get(e.connectorId),highlighted:e.instanceId===ve,onOpenDetails:e=>{ye(null),pe(e.instanceId),_e(e)},t:l},e.instanceId)),rt.map(e=>(0,$.jsx)(mn,{extension:e,language:r,onOpen:()=>m(ot(e.pluginId,`connections`,e.authorizationStatus===`required`))},e.id))]})}):null,nt.length||!W.trim()?(0,$.jsx)(fn,{servers:nt,lastChecks:Oe,t:d,cs:l,onAdd:We,onEdit:e=>xe({mode:`edit`,row:structuredClone(e)}),onRemove:Ue}):null]})}):null,w===`discover`&&p?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[_?null:(0,$.jsx)($e,{className:`flex min-w-0 flex-1 basis-80 flex-wrap gap-2`,role:`group`,"aria-label":l.taskFilterAria,indicatorClassName:`rounded-lg bg-surface-active`,children:[`all`,...dt].map(e=>(0,$.jsx)(`button`,{type:`button`,className:Y(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,q===e?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":q===e,onClick:()=>J(e),children:e===`all`?l.taskAll:l.connectorBenefitHeadings[e]},e))}),(0,$.jsxs)(`div`,{className:Y(`ml-auto grid w-full gap-2 sm:flex sm:w-auto sm:justify-end`,_?`grid-cols-1`:`grid-cols-2`),children:[_?null:(0,$.jsx)(`div`,{className:`min-w-0 sm:w-40`,children:(0,$.jsx)(E,{value:K,options:_t,placeholder:l.discoverSourceAll,allowEmpty:!1,ariaLabel:l.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:ae})}),K===`recommended`?null:(0,$.jsx)(`div`,{className:`min-w-0 sm:w-40`,children:(0,$.jsx)(E,{value:oe,options:[{value:`name`,label:l.sortName},{value:`source`,label:l.sortSource}],placeholder:l.sortName,allowEmpty:!1,ariaLabel:l.sortAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:e=>se(e)})})]})]}),K===`recommended`?(0,$.jsx)(x,{layout:`cards`,initialCount:6,query:G,onChanged:async()=>{await Ae(),await Ce()}}):(A.loading||I)&&ut.length===0?(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":l.loading,children:ht.map(e=>(0,$.jsx)(vt,{},e))}):ut.length===0?(0,$.jsx)(`div`,{className:`py-14 text-center text-sm text-fg-muted`,children:l.discoverEmpty}):(0,$.jsxs)(`div`,{className:`relative`,children:[I?(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":l.loading,children:(0,$.jsx)(H,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:ut.map(e=>(0,$.jsx)(pt,{connector:e,installed:Ie.has(e.id)||gt(e,A.instances),onInstall:e=>{if(e.source===`store`){Re(e.id);return}le(re(e))},onOpenDetails:e.source===`store`?void 0:de,t:l},e.id))}),ft?(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsxs)(Z,{type:`button`,variant:`secondary`,disabled:I||R,onClick:()=>void Fe({page:B+1,append:!0}),children:[I?(0,$.jsx)(H,{className:`size-4 animate-spin`}):null,l.loadMore]})}):null]})]}):null]}),ce?(0,$.jsx)(ie,{draft:ce,onChange:le,onClose:()=>le(null),t:l,onInstalled:async e=>{await Ae(),await Ce(),ye(e.instanceId),Me(`connected`)}}):null,ue?(0,$.jsx)(Dt,{connector:ue,installed:Ie.has(ue.id)||gt(ue,A.instances),onClose:()=>de(null),onInstall:e=>le(re(e)),t:l}):null,mt?(0,$.jsx)(kn,{instance:mt,definition:Le.get(mt.connectorId),onClose:()=>{pe(null),_e(null)},onChanged:Ae,t:l,mcp:d}):null,be?(0,$.jsx)(Jn,{open:!0,mode:be.mode,initialRow:be.row,lastCheck:be.mode===`edit`?Oe[be.row.id]:void 0,existingCustomServers:Ee,config:we,managedServerIds:Be,t:d,cs:l,onClose:()=>xe(null),onSaved:async()=>{await Ce(),await Ae(),Me(`connected`)}},`${be.mode}-${be.row.clientKey}`):null]})})}export{rr as ConnectorsPage};
@@ -1 +0,0 @@
1
- import{p as e}from"./locale-store-fGFrr4_4.js";var t=e(()=>({connectionState:`idle`,error:null}));function n(e){t.setState(e)}export{t as n,n as t};