@xopcai/xopc 0.0.406 → 0.0.407

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 (272) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BE3ci_lj.js → agent-avatar-dicebear-CPNoFyoV.js} +1 -1
  4. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BB0O3b4I.js +1 -0
  5. package/dist/gateway/static/root/assets/agents-Y7XtlqVm.js +77 -0
  6. package/dist/gateway/static/root/assets/{agents-admin-api-D6XzhsQy.js → agents-admin-api-D0UyB0Y_.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-BDbJKxa-.js → app-management-settings-panel-BOAkMTQ7.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-CEOOrVYb.js → appearance-settings-BWPt4-vh.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-Ln5N1PK3.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-B7pzPErg.js → archive-plugin-CNjE6PYZ.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-CcQjEiqk.js → automations-page-BsP4j7Nw.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-workspace-lq17XY3n.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-D5kTu6gH.js → binary-plugins-AFWJskT6.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-CnW6rF_e.js → block-editor-SQ53S4oy.js} +40 -40
  15. package/dist/gateway/static/root/assets/{browser-automation-inputs-CAcUtInP.js → browser-automation-inputs-C2SC9h-c.js} +1 -1
  16. package/dist/gateway/static/root/assets/browser-automations-page-kRoqj1qn.js +3 -0
  17. package/dist/gateway/static/root/assets/browser-settings-page-dZhjL3oj.js +3 -0
  18. package/dist/gateway/static/root/assets/capabilities-CD6PzNK7.js +1 -0
  19. package/dist/gateway/static/root/assets/capabilities-page-Dnp_ilKR.js +2 -0
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-BA9kBBqE.js +8 -0
  21. package/dist/gateway/static/root/assets/{capability-header-actions-jztljvVW.js → capability-header-actions-Cq5XWEDs.js} +1 -1
  22. package/dist/gateway/static/root/assets/channels-BZCzeWtD.js +1 -0
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-BVlFOKJj.js → chat-terminal-dock-BC4EyhTx.js} +2 -2
  24. package/dist/gateway/static/root/assets/computer-settings-page-MxcoTOP1.js +1 -0
  25. package/dist/gateway/static/root/assets/{connector-service-page-BNcTUa99.js → connector-service-page-tSQ3a_Ti.js} +1 -1
  26. package/dist/gateway/static/root/assets/connectors-page-h5FTgews.js +1 -0
  27. package/dist/gateway/static/root/assets/{date-picker-BKUmdSp7.js → date-picker-CavoWXMc.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-BarQvwoO.js → dependency-picker-Cl-3upFX.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-IvADYxyi.js → desktop-pet-B-RDVNqR.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-y6WzhGEK.js → desktop-pet-settings-rttWyUzY.js} +1 -1
  31. package/dist/gateway/static/root/assets/device-pairing-wizard-6hqiv1ui.js +1 -0
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-DnEvwMTm.js → directory-picker-path-field-1rEGI8IE.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-CCvuK1m0.js → extension-debug-page-BaswNoXz.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-DegRwY3R.js → extension-page-uCMJMnc_.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-B8UQgGgZ.js → extension-settings-page-DiczmHyl.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-swr-BvuySoCX.js → gateway-config-swr-CTXr917C.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-realtime-SBtdXzco.js → gateway-realtime-CP6L2jIR.js} +1 -1
  38. package/dist/gateway/static/root/assets/gateway-realtime-store-yXB4a40_.js +1 -0
  39. package/dist/gateway/static/root/assets/gateway-settings-DH5MOwxf.js +1 -0
  40. package/dist/gateway/static/root/assets/{gateway-startup-retry-CEpuztYK.js → gateway-startup-retry-DD2fsxdd.js} +1 -1
  41. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-MjAoJQJX.js → highlighted-body-KQOG7T2V-B62h4sJ4.js} +1 -1
  42. package/dist/gateway/static/root/assets/home-page-BsjMhloP.js +2 -0
  43. package/dist/gateway/static/root/assets/{image-generation-api-SQDixWjO.js → image-generation-api-Di7HnFSL.js} +1 -1
  44. package/dist/gateway/static/root/assets/{imports-page-1ZId0Ng0.js → imports-page-DpKfYZMT.js} +1 -1
  45. package/dist/gateway/static/root/assets/index-BUv4J0JN.js +267 -0
  46. package/dist/gateway/static/root/assets/index-Cr4I4q1J.css +1 -0
  47. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-yMwBt1Sv.js → keyboard-shortcuts-settings-D1Q1kTMI.js} +1 -1
  48. package/dist/gateway/static/root/assets/local-app-workbench-page-CnaLbgJb.js +1 -0
  49. package/dist/gateway/static/root/assets/{local-apps-page-CF6_kS9C.js → local-apps-page-CSO0RkyG.js} +1 -1
  50. package/dist/gateway/static/root/assets/{local-session-drafts-DhJjHCfQ.js → local-session-drafts-TqLFKwYo.js} +1 -1
  51. package/dist/gateway/static/root/assets/{locale-store-D5h-Ha6-.js → locale-store-D_migb9R.js} +1 -1
  52. package/dist/gateway/static/root/assets/logs-page-DruO5LTf.js +2 -0
  53. package/dist/gateway/static/root/assets/management-settings-Dw3tQKNe.js +1 -0
  54. package/dist/gateway/static/root/assets/{markdown-view-CthsQiiO.js → markdown-view-vQSMUUY_.js} +1 -1
  55. package/dist/gateway/static/root/assets/{media-plugins-UYX1YivF.js → media-plugins-CrHXsih_.js} +1 -1
  56. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CNzdVIcE.js +1 -0
  57. package/dist/gateway/static/root/assets/messages-D__oW2yE.js +3 -0
  58. package/dist/gateway/static/root/assets/note-detail-panel-DCZ6Vgd_.js +5 -0
  59. package/dist/gateway/static/root/assets/note-image-lightbox-BXNZw7lJ.js +1 -0
  60. package/dist/gateway/static/root/assets/notes-page-Bqy9Rh_j.js +8 -0
  61. package/dist/gateway/static/root/assets/{page-context-capture-button-DOrPS73o.js → page-context-capture-button-DQHbuYER.js} +1 -1
  62. package/dist/gateway/static/root/assets/personal-page-C--WEB5c.js +1 -0
  63. package/dist/gateway/static/root/assets/personal-proactivity-BJcZ3Yhi.js +1 -0
  64. package/dist/gateway/static/root/assets/personal-settings-panel-Cwgc13ls.js +1 -0
  65. package/dist/gateway/static/root/assets/plugin-details-dialog-DxkFHaU-.js +1 -0
  66. package/dist/gateway/static/root/assets/plugin-presentation-CO5BFDGW.js +1 -0
  67. package/dist/gateway/static/root/assets/{preview-open-alternatives-BP9C0kH3.js → preview-open-alternatives-BW7P2akd.js} +1 -1
  68. package/dist/gateway/static/root/assets/{product-open-page-D151rJVy.js → product-open-page-BnlpaYs-.js} +1 -1
  69. package/dist/gateway/static/root/assets/product-preview-content-DkXx1Vt8.js +1 -0
  70. package/dist/gateway/static/root/assets/project-detail-page-CtyCpIx8.js +1 -0
  71. package/dist/gateway/static/root/assets/projects-page-CJ0s-bI5.js +1 -0
  72. package/dist/gateway/static/root/assets/{registry-api-Bf0hVPNV.js → registry-api-4NZOh0iz.js} +1 -1
  73. package/dist/gateway/static/root/assets/remote-access-hub-yItNjAR3.js +1 -0
  74. package/dist/gateway/static/root/assets/{runtime-tools-api-ByH1meP7.js → runtime-tools-api-CmEWVrOg.js} +1 -1
  75. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DyLxlqWV.js → runtime-tools-settings-panel-BGRbt79f.js} +1 -1
  76. package/dist/gateway/static/root/assets/{schema-form-ClP4uPSj.js → schema-form-B9VP7ldU.js} +1 -1
  77. package/dist/gateway/static/root/assets/{session-api-fVuszA_P.js → session-api-aQLptIs9.js} +1 -1
  78. package/dist/gateway/static/root/assets/session-manager-D2sLfkw-.js +16 -0
  79. package/dist/gateway/static/root/assets/sessions-page-3O5S9efw.js +1 -0
  80. package/dist/gateway/static/root/assets/settings-advanced-gate-BE-SKsf6.js +1 -0
  81. package/dist/gateway/static/root/assets/{settings-form-section-B4NShgv-.js → settings-form-section-BA2RkU1S.js} +1 -1
  82. package/dist/gateway/static/root/assets/settings-page-BUT0FzfI.js +1 -0
  83. package/dist/gateway/static/root/assets/{setup-status-panel-BVKQ2inq.js → setup-status-panel-1oWs6iPS.js} +1 -1
  84. package/dist/gateway/static/root/assets/{share-preview-page-BxN9t3MD.js → share-preview-page-CVNey8Lq.js} +1 -1
  85. package/dist/gateway/static/root/assets/shares-settings-Bb6YoDmU.js +1 -0
  86. package/dist/gateway/static/root/assets/{skill-api-E0E-MH1S.js → skill-api-BWi0G9Ii.js} +1 -1
  87. package/dist/gateway/static/root/assets/skill-reload-api-DspV2olR.js +1 -0
  88. package/dist/gateway/static/root/assets/skills-page-SbNv1vpY.js +2 -0
  89. package/dist/gateway/static/root/assets/{style-Bs9x3WBj.js → style-DlOTU5bN.js} +1 -1
  90. package/dist/gateway/static/root/assets/{system-settings-panel-DpQPaJId.js → system-settings-panel-DbS1qtOh.js} +1 -1
  91. package/dist/gateway/static/root/assets/task-detail-page-uSwizzx8.js +2 -0
  92. package/dist/gateway/static/root/assets/{task-expandable-content-BoGtWYbk.js → task-expandable-content-D0ahXP9o.js} +1 -1
  93. package/dist/gateway/static/root/assets/tracing-settings-page-BMhVvXXd.js +1 -0
  94. package/dist/gateway/static/root/assets/{tunnel-api-3GopOQ_S.js → tunnel-api-CO9rJLFh.js} +1 -1
  95. package/dist/gateway/static/root/assets/{usage-page-B8j47CWQ.js → usage-page-DVzIDec4.js} +1 -1
  96. package/dist/gateway/static/root/assets/{use-autosave-CYIuWnRn.js → use-autosave-DqPaXiX2.js} +1 -1
  97. package/dist/gateway/static/root/assets/user-model-page-BYZCHCzG.js +2 -0
  98. package/dist/gateway/static/root/assets/{voice-api-key-field-BN37Lklj.js → voice-api-key-field-C_iOzfIt.js} +1 -1
  99. package/dist/gateway/static/root/assets/{voice-config-api-CRjdZdJF.js → voice-config-api-4yGMrp7J.js} +1 -1
  100. package/dist/gateway/static/root/assets/{work-discovery-overlay-C_bcAAX6.js → work-discovery-overlay-n59s18s0.js} +1 -1
  101. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-B5oKCzTn.js → workflow-run-setup-panel-Lp6Vumxc.js} +2 -2
  102. package/dist/gateway/static/root/assets/workflows-page-B5BqN1Y1.js +6 -0
  103. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DGGi4zVC.js → xopc-cloud-account-card-QSDUy0uF.js} +1 -1
  104. package/dist/gateway/static/root/index.html +16 -15
  105. package/dist/package.js +1 -1
  106. package/dist/packages/gateway-contract/src/capabilities.js +30 -3
  107. package/dist/src/agent/agent-manager.js +1 -1
  108. package/dist/src/agent/background-review/run-background-review.js +1 -1
  109. package/dist/src/agent/external-tools/cliProvider.js +3 -3
  110. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  111. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  112. package/dist/src/agent/prompt/conversational-configuration-guide.d.ts +4 -0
  113. package/dist/src/agent/prompt/conversational-configuration-guide.js +25 -0
  114. package/dist/src/agent/prompt/service-prompt-builder.js +6 -1
  115. package/dist/src/agent/prompt/system-prompt.js +2 -2
  116. package/dist/src/agent/service.js +1 -1
  117. package/dist/src/agent/skills/index.js +1 -1
  118. package/dist/src/agent/skills/managed-store.js +1 -1
  119. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  120. package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +8 -0
  121. package/dist/src/agent/tool-manuals/xopc-configuration.js +55 -0
  122. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  123. package/dist/src/agent/tool-manuals/xopc-use.js +4 -1
  124. package/dist/src/agent/tools/factory.js +0 -5
  125. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  126. package/dist/src/agent/tools/tool-manual-tool.d.ts +1 -0
  127. package/dist/src/agent/tools/tool-manual-tool.js +27 -2
  128. package/dist/src/agent/tools/xopc-use-tool.js +14 -9
  129. package/dist/src/agent-catalog/capabilities.js +29 -3
  130. package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +1 -1
  131. package/dist/src/agent-catalog/repository.js +1 -1
  132. package/dist/src/agent-config/index.js +2 -2
  133. package/dist/src/agent-config/schema.d.ts +0 -116
  134. package/dist/src/agent-config/schema.js +2 -32
  135. package/dist/src/automations/capabilities/drafts.js +1 -1
  136. package/dist/src/bootstrap/application-state.js +1 -1
  137. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  138. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  139. package/dist/src/capabilities/runtime/product.js +1 -1
  140. package/dist/src/capabilities/store-connector.d.ts +9 -1
  141. package/dist/src/capabilities/store-connector.js +30 -1
  142. package/dist/src/cli/commands/agents.js +1 -1
  143. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  144. package/dist/src/cli/commands/models.js +1 -1
  145. package/dist/src/cli/commands/onboard/model.js +1 -1
  146. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  147. package/dist/src/config/agent-profile.js +1 -1
  148. package/dist/src/config/schema.d.ts +1 -1
  149. package/dist/src/connectors/cli/adapterRegistry.js +1 -8
  150. package/dist/src/connectors/cli/runtime.js +1 -1
  151. package/dist/src/connectors/composio-catalog.d.ts +2 -2
  152. package/dist/src/connectors/composio-catalog.js +3 -8
  153. package/dist/src/connectors/composio-sessions.js +2 -0
  154. package/dist/src/connectors/composio.js +0 -6
  155. package/dist/src/connectors/connection-candidates.js +0 -5
  156. package/dist/src/connectors/connection-capabilities.js +0 -4
  157. package/dist/src/connectors/excluded-connectors.d.ts +4 -0
  158. package/dist/src/connectors/excluded-connectors.js +24 -0
  159. package/dist/src/connectors/install.js +3 -0
  160. package/dist/src/connectors/integration-strategy.js +0 -5
  161. package/dist/src/connectors/providers.d.ts +0 -1
  162. package/dist/src/connectors/providers.js +2 -14
  163. package/dist/src/execution-environments/local-worktree-manager.js +1 -1
  164. package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
  165. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  166. package/dist/src/gateway/agents-admin.js +2 -2
  167. package/dist/src/gateway/hono/routes/agents.js +1 -1
  168. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  169. package/dist/src/gateway/hono/routes/notes.js +2 -2
  170. package/dist/src/gateway/hono/routes/personal-agent.js +4 -5
  171. package/dist/src/gateway/hono/routes/projects.js +2 -2
  172. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  173. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  174. package/dist/src/gateway/image-generation-setup.js +1 -1
  175. package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
  176. package/dist/src/gateway/service.js +4 -4
  177. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  178. package/dist/src/home-intelligence/host.js +2 -2
  179. package/dist/src/imports/importService.js +1 -1
  180. package/dist/src/local-apps/service.js +1 -1
  181. package/dist/src/personal-agent/communication.d.ts +1 -1
  182. package/dist/src/personal-agent/communication.js +1 -1
  183. package/dist/src/personal-agent/default-style.d.ts +2 -0
  184. package/dist/src/personal-agent/default-style.js +11 -0
  185. package/dist/src/personal-agent/persona.d.ts +1 -1
  186. package/dist/src/personal-agent/persona.js +1 -1
  187. package/dist/src/personal-agent/policy.d.ts +1 -1
  188. package/dist/src/personal-agent/policy.js +0 -1
  189. package/dist/src/personal-agent/proactivity/service.js +1 -4
  190. package/dist/src/personal-agent/prompts.d.ts +1 -5
  191. package/dist/src/personal-agent/prompts.js +28 -39
  192. package/dist/src/personal-agent/reply-composer.js +3 -2
  193. package/dist/src/personal-agent/reply-style.d.ts +10 -2
  194. package/dist/src/personal-agent/reply-style.js +61 -3
  195. package/dist/src/personal-agent/repository.d.ts +0 -8
  196. package/dist/src/personal-agent/repository.js +1 -9
  197. package/dist/src/personal-agent/service.d.ts +2 -32
  198. package/dist/src/personal-agent/service.js +12 -18
  199. package/dist/src/platform/contracts.d.ts +3 -3
  200. package/dist/src/runtime-tools/archive.js +1 -1
  201. package/dist/src/storage/sqlite/migrations/259_personal_default_style.sql +10 -0
  202. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  203. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  204. package/dist/src/storage/sqlite/schema.js +1 -1
  205. package/dist/src/tasks/capabilities/read.js +2 -2
  206. package/dist/src/tasks/capabilities/write.js +1 -1
  207. package/dist/src/tasks/task-main-update-decision-service.js +1 -1
  208. package/dist/src/tui/backends/embedded-backend.js +1 -1
  209. package/dist/src/voice/realtime/persona-context.js +1 -1
  210. package/package.json +5 -2
  211. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DzDaum4Y.js +0 -1
  212. package/dist/gateway/static/root/assets/agents-BfC3FYYe.js +0 -77
  213. package/dist/gateway/static/root/assets/apps-page-CpoG_3PG.js +0 -1
  214. package/dist/gateway/static/root/assets/automations-workspace-BVTP3pzt.js +0 -6
  215. package/dist/gateway/static/root/assets/browser-BLJWD7WI.js +0 -8
  216. package/dist/gateway/static/root/assets/browser-automations-page-DT7-lnPN.js +0 -3
  217. package/dist/gateway/static/root/assets/browser-settings-page-ByK8znt2.js +0 -3
  218. package/dist/gateway/static/root/assets/capabilities-Dl3LttAm.js +0 -1
  219. package/dist/gateway/static/root/assets/capabilities-page-C8tv6M_O.js +0 -2
  220. package/dist/gateway/static/root/assets/capabilities-settings-panel-OVLgL6yL.js +0 -8
  221. package/dist/gateway/static/root/assets/capability-icon-DVoZxEgW.js +0 -1
  222. package/dist/gateway/static/root/assets/capability-links-DzQWK1Fh.js +0 -1
  223. package/dist/gateway/static/root/assets/channels-D8BKMMPW.js +0 -1
  224. package/dist/gateway/static/root/assets/computer-settings-page-CvQgrTwb.js +0 -1
  225. package/dist/gateway/static/root/assets/connectors-page-CWlLRQpK.js +0 -1
  226. package/dist/gateway/static/root/assets/device-pairing-wizard-D3IUZ8xW.js +0 -1
  227. package/dist/gateway/static/root/assets/gateway-realtime-store-dKq2fm2X.js +0 -1
  228. package/dist/gateway/static/root/assets/gateway-settings-DlLyLsXY.js +0 -1
  229. package/dist/gateway/static/root/assets/home-page-DAYtNK3o.js +0 -2
  230. package/dist/gateway/static/root/assets/index-K2cy4f-3.js +0 -260
  231. package/dist/gateway/static/root/assets/index-QegseiyI.css +0 -1
  232. package/dist/gateway/static/root/assets/local-app-workbench-page-a7J0NPIs.js +0 -1
  233. package/dist/gateway/static/root/assets/logs-page-C8y5yhoM.js +0 -2
  234. package/dist/gateway/static/root/assets/management-settings-C7dL_jNu.js +0 -1
  235. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-7zpLTDLZ.js +0 -1
  236. package/dist/gateway/static/root/assets/messages-Bwv-AOYl.js +0 -3
  237. package/dist/gateway/static/root/assets/note-detail-panel-Bxm523Up.js +0 -5
  238. package/dist/gateway/static/root/assets/note-image-lightbox-B7ARnjnB.js +0 -1
  239. package/dist/gateway/static/root/assets/notes-page-BOeS2v6x.js +0 -8
  240. package/dist/gateway/static/root/assets/personal-page-BujiHops.js +0 -1
  241. package/dist/gateway/static/root/assets/plugin-details-dialog-XOzQrJQN.js +0 -1
  242. package/dist/gateway/static/root/assets/plugin-presentation-CPEwVLd4.js +0 -1
  243. package/dist/gateway/static/root/assets/product-preview-content-CAo0XpP-.js +0 -1
  244. package/dist/gateway/static/root/assets/project-detail-page-CxB_kF0F.js +0 -1
  245. package/dist/gateway/static/root/assets/projects-page-Dvu_3c2g.js +0 -1
  246. package/dist/gateway/static/root/assets/remote-access-hub-CbzBV_BL.js +0 -1
  247. package/dist/gateway/static/root/assets/session-manager-DMDBMYfh.js +0 -16
  248. package/dist/gateway/static/root/assets/sessions-page-CvfoPeM6.js +0 -1
  249. package/dist/gateway/static/root/assets/settings-advanced-gate-BOkrHL8q.js +0 -1
  250. package/dist/gateway/static/root/assets/settings-page-C54bw5J9.js +0 -1
  251. package/dist/gateway/static/root/assets/shares-settings-BOa9NAUc.js +0 -1
  252. package/dist/gateway/static/root/assets/skill-reload-api-DEN6tOwG.js +0 -1
  253. package/dist/gateway/static/root/assets/skills-page-CeNVBQG9.js +0 -2
  254. package/dist/gateway/static/root/assets/task-detail-page-DzK53B5p.js +0 -2
  255. package/dist/gateway/static/root/assets/tracing-settings-page-BUUnZfZW.js +0 -1
  256. package/dist/gateway/static/root/assets/user-model-page-DxcH74eP.js +0 -2
  257. package/dist/gateway/static/root/assets/workflows-page-Bo5b5t_9.js +0 -6
  258. package/dist/src/agent/tools/personal-preference-tool.d.ts +0 -10
  259. package/dist/src/agent/tools/personal-preference-tool.js +0 -55
  260. package/dist/src/connectors/china-catalog.d.ts +0 -2
  261. package/dist/src/connectors/china-catalog.js +0 -873
  262. package/dist/src/connectors/cli/adapters/lark.d.ts +0 -2
  263. package/dist/src/connectors/cli/adapters/lark.js +0 -143
  264. package/dist/src/connectors/cli/adapters/larkShortcuts.d.ts +0 -3
  265. package/dist/src/connectors/cli/adapters/larkShortcuts.js +0 -64
  266. package/dist/src/connectors/cli/adapters/wecom.d.ts +0 -2
  267. package/dist/src/connectors/cli/adapters/wecom.js +0 -97
  268. package/dist/src/connectors/cli/adapters/wps365/bundle.js +0 -575
  269. package/dist/src/connectors/cli/adapters/wps365.d.ts +0 -2
  270. package/dist/src/connectors/cli/adapters/wps365.js +0 -115
  271. package/dist/src/connectors/cli/distributions.d.ts +0 -4
  272. package/dist/src/connectors/cli/distributions.js +0 -69
@@ -1 +0,0 @@
1
- import{a as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,n as ee,o as c,p as l,r as u,s as d,t as f,u as p,v as m}from"./schemas-CObaziC7.js";import{c as h,f as g,g as _,l as te,n as ne,o as v,p as y,u as b,v as x}from"./tasks-B4bZpO6O.js";import{i as re,n as S,t as ie}from"./local-apps-yys1VChX.js";import{g as C,h as w}from"./local-session-drafts-DhJjHCfQ.js";var T=p({id:l(),kind:f([`task`,`connector_approval`]),title:l(),detail:l().optional(),reason:f([`needs_input`,`blocked`,`user_input`,`user_approval`,`dependency`,`external`,`scheduled`,`retry`,`paused`,`overdue`,`due_soon`,`decision_needed`,`approval_required`]),urgency:f([`now`,`soon`]),href:l(),projectId:l().optional(),projectName:l().optional(),dueAt:s().int().nonnegative().optional(),updatedAt:s(),response:e(`kind`,[p({kind:d(`connector_approval`),approvalId:l()}),p({kind:d(`task`),taskId:l(),canRetry:o()})]).optional()});p({id:l(),kind:f([`automation_run`,`workflow_run`]),runId:l(),title:l(),detail:l(),reason:f([`run_failed`,`run_timeout`]),href:l(),updatedAt:s(),conversationId:l().optional()});var E=e(`type`,[p({type:d(`task_review`),label:l(),taskId:l()}),p({type:d(`retry_task`),label:l(),taskId:l()}),p({type:d(`open`),label:l(),href:l()}),p({type:d(`connector_decision`),label:l(),approvalId:l(),decision:f([`approve`,`deny`])}),p({type:d(`retry_run`),label:l(),subjectKind:f([`automation_run`,`workflow_run`]),runId:l()}),p({type:d(`acknowledge_run`),label:l(),subjectKind:f([`automation_run`,`workflow_run`]),runId:l()})]),D=p({id:l(),kind:f([`decision`,`failure`,`running`,`scheduled`]),title:l(),summary:l(),recommendation:l().optional(),dueAt:s().int().nonnegative().optional(),statusLabel:l().optional(),updatedAt:s(),openAction:E.optional(),primaryAction:E.optional(),secondaryActions:u(E).max(2).default([])}),ae=p({conversationId:l(),runId:l(),title:l().optional(),agentId:l().optional(),updatedAt:s()}),oe=r({id:l().trim().min(1).max(300),sourceType:f([`project`,`task`,`conversation`,`calendar`,`mail`,`communication`,`file`,`user_model`]),sourceRef:l().trim().min(1).max(1e3),revision:l().trim().min(1).max(300),observation:l().trim().min(1).max(1e3),observedAt:s().int().nonnegative(),freshUntil:s().int().nonnegative(),href:l().trim().min(1).max(2e3).optional()}),O=r({kind:f([`connector`,`skill`,`agent`]),capability:l().trim().min(1).max(200),resolvedId:l().trim().min(1).max(300).optional(),readiness:f([`ready`,`needs_setup`,`unavailable`]),required:o(),recoveryPath:l().trim().min(1).max(2e3).optional(),reason:l().trim().min(1).max(500).optional()}),k=r({kind:f([`connector`,`skill`,`agent`]),capability:l().trim().min(1).max(200),code:f([`not_installed`,`disabled`,`agent_not_allowed`,`scope_too_narrow`,`connection_missing`,`account_selection_required`,`reauthorization_required`,`requirements_unmet`,`model_invocation_disabled`,`tool_gated`,`agent_unavailable`]),message:l().trim().min(1).max(500),recoveryPath:l().trim().min(1).max(2e3)}),A=e(`state`,[r({state:d(`ready`)}),r({state:d(`needs_setup`),blockers:u(k).min(1).max(12),recoveryActions:u(r({capability:l().trim().min(1).max(200),href:l().trim().min(1).max(2e3)})).min(1).max(12),degradedAction:r({mode:d(`degraded_start`)}).optional()})]),j=r({id:l().trim().min(1).max(200),revision:s().int().positive(),kind:f([`project_next_step`,`delivery_risk`,`meeting_prep`,`commitment_follow_up`,`automation_candidate`]),projectId:l().trim().min(1).max(200).optional(),title:l().trim().min(1).max(160),outcome:l().trim().min(1).max(1e3),rationale:l().trim().min(1).max(1500),evidence:u(oe).min(1).max(8),confidence:f([`high`,`medium`,`low`]),urgency:f([`now`,`today`,`this_week`]),estimatedMinutes:s().int().min(1).max(480).optional(),risk:f([`analysis`,`external_read`,`file_write`,`external_write`]),proposedSteps:u(l().trim().min(1).max(500)).min(1).max(6),capabilities:u(O).max(12),verification:u(l().trim().min(1).max(500)).max(8),actionPrompt:l().trim().min(1).max(4e3),degradedActionPrompt:l().trim().min(1).max(4e3).optional(),continuation:e(`kind`,[r({kind:d(`automation`),reason:d(`repeated_success`),href:l().trim().min(1).max(4e3),successCount:s().int().min(2)})]).optional(),actions:r({canStart:o(),canDiscuss:o(),degradedStartAvailable:o()}),generatedAt:s().int().nonnegative(),expiresAt:s().int().nonnegative()}),M=r({id:l().trim().min(1).max(200),revision:s().int().positive(),question:l().trim().min(1).max(500),options:u(r({id:l().trim().min(1).max(100),label:l().trim().min(1).max(200)})).min(2).max(3),evidenceIds:u(l().trim().min(1).max(300)).min(1).max(8)}),N=e(`state`,[r({state:d(`disabled`)}),r({state:d(`quiet`),reason:f([`no_change`,`insufficient_value`,`model_unavailable`,`generation_failed`,`budget_exhausted`])}),r({state:d(`refreshing`),previous:j.optional(),requestedAt:s().int().nonnegative()}),r({state:d(`clarification`),question:M,generatedAt:s().int().nonnegative(),expiresAt:s().int().nonnegative()}),r({state:d(`ready`),primary:j,alternatives:u(j).max(2),placement:f([`primary`,`compact`]),generatedAt:s().int().nonnegative(),expiresAt:s().int().nonnegative(),stale:o()})]);r({idempotencyKey:l().trim().min(1).max(200),locale:l().trim().max(30).optional()}),r({idempotencyKey:l().trim().min(1).max(200),expectedRevision:s().int().positive(),kind:f([`already_done`,`irrelevant`,`too_early`,`source_incorrect`,`less_like_this`,`snoozed`]),reasonCode:l().trim().min(1).max(100).optional(),note:l().trim().min(1).max(1e3).optional(),snoozedUntil:s().int().nonnegative().optional()}),r({idempotencyKey:l().trim().min(1).max(200)});var P=r({items:u(r({opportunity:j,status:f([`available`,`started`,`discussing`,`completed`,`snoozed`,`dismissed`,`expired`,`superseded`]),feedbackKind:f([`started`,`discussed`,`already_done`,`irrelevant`,`too_early`,`source_incorrect`,`less_like_this`,`snoozed`]).optional(),updatedAt:s().int().nonnegative(),snoozedUntil:s().int().nonnegative().optional(),href:l().trim().min(1).max(2e3).optional()})).max(100)});r({idempotencyKey:l().trim().min(1).max(200),expectedRevision:s().int().positive(),mode:f([`start`,`degraded_start`,`discuss`])});var F=e(`outcome`,[r({outcome:d(`task`),taskId:l(),href:l()}),r({outcome:d(`chat_draft`),href:l()}),r({outcome:d(`needs_setup`),preflight:A})]),I=p({runningConversations:u(ae).default([]),needsUser:u(D),background:u(D),backgroundCount:s().int().nonnegative(),decisions:u(T),advisor:N,attentionPolicy:p({visibleDecisionCount:s().int().nonnegative(),suppressedDecisionCount:s().int().nonnegative(),visibleAttentionCount:s().int().nonnegative(),suppressedAttentionCount:s().int().nonnegative()}).default({visibleDecisionCount:0,suppressedDecisionCount:0,visibleAttentionCount:0,suppressedAttentionCount:0})});r({window:r({since:s().int().nonnegative(),until:s().int().nonnegative()}),currentStrategyVersion:l().trim().min(1).max(100),generations:r({total:s().int().nonnegative(),succeeded:s().int().nonnegative(),quiet:s().int().nonnegative(),failed:s().int().nonnegative(),estimatedCostUsd:s().nonnegative()}),outcomes:r({opportunities:s().int().nonnegative(),started:s().int().nonnegative(),discussed:s().int().nonnegative(),completed:s().int().nonnegative(),corrected:s().int().nonnegative(),expired:s().int().nonnegative()}),rates:r({start:s().min(0).max(1),completionFromStarted:s().min(0).max(1),correction:s().min(0).max(1)}),feedback:r({alreadyDone:s().int().nonnegative(),irrelevant:s().int().nonnegative(),tooEarly:s().int().nonnegative(),sourceIncorrect:s().int().nonnegative(),lessLikeThis:s().int().nonnegative()}),strategies:u(r({version:l().trim().min(1).max(100),generations:s().int().nonnegative(),opportunities:s().int().nonnegative(),started:s().int().nonnegative(),completed:s().int().nonnegative()}))});var L=p({northStar:p({weeklyTrustedProgress:s(),weeklyActiveUsers:s(),trustedProgressPerWeeklyActiveUser:s()}),tasks:p({total:s(),achieved:s(),partial:s(),notAchieved:s(),userCorrected:s(),achievementRate:s(),correctionRate:s(),trusted:s(),trustedRate:s()})});function R(e){return I.parse(e)}var z=e(`kind`,[p({kind:d(`once`),at:l()}),p({kind:d(`interval`),everyMs:s().positive(),anchorMs:s().optional()}),p({kind:d(`cron`),expr:l(),tz:l().optional()})]),B=e(`kind`,[p({kind:d(`manual`)}),p({kind:d(`schedule`),schedule:z}),p({kind:d(`webhook`),secretId:l().optional()}),p({kind:d(`event`),eventType:l(),source:l().optional(),payloadMatch:n(l(),a([l(),s(),o(),ee()])).optional()})]),V=e(`kind`,[p({kind:d(`agent`),agentId:l().optional(),instruction:l(),workingDirectory:l().optional(),model:l().optional(),timeoutSeconds:s().positive().optional()}),p({kind:d(`workflow`),workflowId:l(),agentId:l().optional(),input:i().optional(),inputEnvelope:i().optional(),goal:l().optional(),concurrency:s().int().positive().optional(),maxSubagents:s().int().nonnegative().optional(),timeoutSeconds:s().positive().optional()}),p({kind:d(`browser_automation`),automationId:l(),inputs:n(l(),i()).optional(),timeoutSeconds:s().positive().optional()}),p({kind:d(`task_command`),taskId:l(),command:ne}),p({kind:d(`system`),capability:f([`home.advisor.refresh`,`personal.proactivity.tick`,`memory.temporal_sweep`,`memory.daily_reconciliation`,`memory.weekly_knowledge`])})]),H=f([`queued`,`running`,`cancelling`,`succeeded`,`failed`,`cancelled`,`timeout`]),se=e(`kind`,[p({key:l(),kind:d(`gateway_event`)}),p({key:l(),kind:d(`webhook`),endpoint:l().url().startsWith(`https://`),secretId:l()}),p({key:l(),kind:d(`file`),targetId:l(),pathTemplate:l()}),p({key:l(),kind:d(`card`),channelId:l(),templateId:l()})]),U=p({id:l(),name:l(),description:l().optional(),projectId:l().optional(),enabled:o(),trigger:B,action:V,safety:p({mode:f([`suggest_only`,`ask_before_apply`,`auto_apply`])}).optional(),conversationMode:f([`new_session`,`continuous`]).optional(),delivery:p({notificationPolicy:f([`attention`,`all`,`none`]),destinations:u(se)}),reliability:p({executionTimeoutSeconds:s().positive().optional(),retryCount:s().int().nonnegative().optional(),maxConcurrentRuns:s().int().positive().optional(),disableAfterConsecutiveFailures:s().int().positive().optional()}).optional(),management:p({owner:l(),editable:u(f([`enabled`,`trigger`])),runnable:o(),deletable:o()}).optional(),state:p({nextRunAtMs:s().optional(),runningRunId:l().optional(),lastRunAtMs:s().optional(),lastRunStatus:H.optional(),lastError:l().optional(),consecutiveFailures:s().int().nonnegative().optional()}),createdAtMs:s(),updatedAtMs:s()}),W=p({id:l(),automationId:l(),automationName:l(),status:H,triggerSnapshot:B,actionSnapshot:V,manual:o(),createdAtMs:s(),startedAtMs:s().optional(),endedAtMs:s().optional(),durationMs:s().optional(),summary:l().optional(),error:l().optional(),conversationId:l().optional(),workflowRunId:l().optional(),model:l().optional(),deadlineAtMs:s().optional(),currentPhase:f([`queued`,`action`,`cancelling`,`completed`]).optional(),cancelRequestedAtMs:s().optional(),cancelConfirmedAtMs:s().optional(),termination:p({reason:f([`completed`,`failed`,`user_cancelled`,`deadline_exceeded`]),component:f([`automation`,`agent_turn`,`tool`,`mcp`,`process`]).optional(),componentName:l().optional(),cancellationConfirmed:o()}).optional(),heartbeatAtMs:s().optional(),leaseOwner:l().optional(),leaseExpiresAtMs:s().optional(),attemptNumber:s().int().positive().optional(),rootRunId:l().optional()}),G=p({id:l(),runId:l(),automationId:l(),type:f([`run.queued`,`run.started`,`run.deadline_resolved`,`run.cancel_requested`,`run.cancel_confirmed`,`run.cancellation_unconfirmed`,`run.recovered`,`action.started`,`action.retry_scheduled`,`action.completed`,`action.failed`,`run.completed`]),message:l(),data:i().optional(),createdAtMs:s()}),K=p({totalAutomations:s().int().nonnegative(),enabledAutomations:s().int().nonnegative(),runningRuns:s().int().nonnegative(),failedLastHour:s().int().nonnegative(),nextRun:p({automationId:l(),name:l(),runAtMs:s()}).optional(),pendingEvents:s().int().nonnegative(),oldestPendingEventAgeMs:s().int().nonnegative(),projectionDeadLetters:s().int().nonnegative(),pendingRunDeliveries:s().int().nonnegative(),runDeliveryDeadLetters:s().int().nonnegative(),pendingResultDeliveries:s().int().nonnegative(),resultDeliveryDeadLetters:s().int().nonnegative(),activeExecutions:s().int().nonnegative(),activeDeliveryLeases:s().int().nonnegative()});f([`http`,`agent`,`cli`,`automation`,`mcp`,`extension`]),f([`INVALID_INPUT`,`FORBIDDEN`,`NOT_FOUND`,`REVISION_CONFLICT`,`CONTRACT_CHANGED`,`APPROVAL_REQUIRED`,`IN_PROGRESS`,`UNAVAILABLE`,`OUTCOME_UNKNOWN`,`CANCELLED`,`INTERNAL`]);var ce=r({majorVersion:s().int().positive(),descriptorDigest:l().regex(/^[a-f0-9]{64}$/),input:c(),idempotencyKey:l().min(1).max(200).optional()}),le=p({triggerSummary:l(),actionSummary:l(),safetyNotes:u(l()),requiredConfirmations:u(l()),canRunNow:o(),runNowBlockedReason:l().optional()});r({agentId:l().trim().min(1).max(64).optional(),language:f([`en`,`zh`]).default(`en`)}),p({draftId:l(),explanation:l(),assumptions:u(l()),risks:u(l()),automation:t({name:l(),trigger:c(),action:c()}),simulation:le,repairAttempts:s().int().nonnegative()}),p({draftId:l(),patch:n(l(),c()),explanation:l(),expectedEffect:l(),risks:u(l()),requiresApproval:o(),repairAttempts:s().int().nonnegative()});var ue=r({eventId:l().min(1),kind:f([`note`,`task`,`project`,`automation`,`local_app`]),id:l().min(1),revision:s().int().nonnegative(),operation:f([`created`,`updated`,`deleted`]),operationId:l().optional()}),q=r({id:l().trim().min(1).max(512)});q.extend({expectedVersion:s().int().positive(),reason:l().trim().min(1).max(4096).default(`TaskRun cancelled`)}),q.extend({rating:f([`helpful`,`not_helpful`]),reason:l().trim().max(4096).optional()}),p({ok:d(!0),feedback:p({id:l(),runId:l(),rating:f([`helpful`,`not_helpful`]),reason:l().optional(),createdAt:s()})}),p({ok:d(!0),run:y,receipt:b,model:v.pick({task:!0,operationalState:!0,attention:!0,allowedCommands:!0}),executionStopConfirmed:d(!1)}),q.extend({enabled:o(),expectedRevision:s().int().nonnegative()}),p({ok:d(!0),automation:U.loose()}).extend({run:W.loose()}),p({ok:d(!0),cancelled:o(),confirmed:o()}),p({ok:d(!0),marked:d(!0)}),r({projectId:l().trim().min(1).max(512).optional()}),p({ok:d(!0),count:s().int().nonnegative()}),q.extend({reason:l().trim().min(1).max(2e3)}),r({runId:l().trim().min(1).max(200),destinationKey:l().trim().min(1).max(100),reason:l().trim().min(1).max(2e3)}),p({ok:d(!0),accepted:d(!0)}),q.extend({expectedRevision:s().int().nonnegative().nullable()}),p({ok:d(!0),removed:o(),automation:U.loose().optional(),cancelRunId:l().optional()});var de=r({status:f([`inbox`,`processed`,`archived`,`trashed`]).optional(),kind:f([`thought`,`todo`,`voice`,`media`,`bookmark`,`mixed`,`task`]).optional(),tag:l().max(512).optional(),projectId:l().min(1).max(512).optional(),unassigned:o().optional(),agentEdited:o().optional(),search:l().max(4096).optional(),pinned:o().optional(),limit:s().int().min(1).max(100).default(20),offset:s().int().min(0).default(0),sortBy:f([`createdAt`,`updatedAt`,`lastOpenedAt`]).optional(),sortOrder:f([`asc`,`desc`]).optional()}),J=t({id:l().min(1),markdown:l(),kind:f([`thought`,`todo`,`voice`,`media`,`bookmark`,`mixed`,`task`]),status:f([`inbox`,`processed`,`archived`,`trashed`]),createdAt:s(),updatedAt:s(),title:l().optional(),localVersion:s().optional()}),fe=p({note:J});q.extend({expectedRevision:s().int().positive(),revokeShares:o().default(!0)}),p({deleted:d(!0),revokedShares:s().int().nonnegative()});var pe=r({title:l().max(1e3).optional(),markdown:l().max(2e6).default(``),kind:J.shape.kind.optional(),tags:u(l().max(512)).max(100).optional(),capturedVia:r({channel:f([`app`,`web`,`electron`,`tui`,`telegram`,`wechat`,`feishu`]),platform:f([`ios`,`android`,`harmonyos`]).optional()}).default({channel:`web`}),pinned:o().default(!1),projectId:l().min(1).optional()});r({id:l().min(1),expectedRevision:s().int().positive(),trigger:f([`edit`,`ai_edit`,`sync`,`restore`]).optional(),patch:r({title:l().max(1e3).optional(),markdown:l().max(2e6).optional(),tags:u(l().max(512)).max(100).optional(),pinned:o().optional(),kind:J.shape.kind.optional(),status:J.shape.status.optional(),localVersion:s().int().positive().optional(),ai:n(l(),c()).optional(),aiDeep:t({processedAt:s()}).optional()})}),r({text:l().trim().min(1).max(2e6),capturedVia:pe.shape.capturedVia}),r({id:l().min(1),expectedRevision:s().int().positive().optional(),content:l().trim().min(1).max(2e6),heading:l().trim().min(1).max(1e3).default(`AI 讨论沉淀`)}),r({id:l().min(1),timestamp:s().int().positive(),expectedRevision:s().int().positive()});var me=t({items:u(t({id:l().min(1)})),total:s().int().nonnegative()}),he=r({phase:_.optional(),priority:te.optional(),projectId:l().min(1).max(512).optional(),search:l().max(4096).optional(),limit:s().int().min(1).max(200).default(50),offset:s().int().nonnegative().default(0)}),Y=t({id:l().min(1),name:l(),slug:l(),status:f([`planned`,`active`,`paused`,`completed`,`cancelled`,`archived`]),executionMode:f([`local_checkout`,`managed_worktree`]),successCriteria:u(l()),scope:n(l(),i()),nonGoals:u(l()),health:f([`unknown`,`on_track`,`at_risk`,`off_track`]),version:s().int().positive(),createdAt:s(),updatedAt:s(),workspaceRoot:l().optional(),defaultAgentId:l().optional()}),ge=r({id:l().trim().min(1),expectedVersion:s().int().positive(),pinned:o()});p({ok:d(!0),project:Y}),r({workspacePath:l().trim().min(1).max(4096),agentId:l().trim().min(1).max(512).optional(),defaultAgentId:l().trim().max(512).optional(),projectKind:f([`auto`,`coding`,`general`,`unknown`]).optional(),autoCreate:o().default(!1),conversationId:m().optional()}),p({ok:d(!0),project:Y.nullable(),reason:f([`exact`,`contained`,`auto_created`]).optional(),created:o().optional()}),ge.omit({pinned:!0}),p({ok:d(!0),deleted:d(!0),executionStopConfirmed:d(!1)});var X={name:l().trim().min(1).max(1e3).optional(),description:l().max(2e4).optional(),defaultAgentId:l().trim().max(512).optional(),workspaceRoot:l().trim().min(1).max(4096).optional(),createWorkspaceRoot:o().optional(),executionMode:Y.shape.executionMode.optional(),brief:l().max(2e4).optional(),instructions:l().max(1e5).optional(),outcome:l().max(2e4).optional(),successCriteria:u(l().max(4096)).max(100).optional(),scope:n(l(),c()).optional(),nonGoals:u(l().max(4096)).max(100).optional(),health:Y.shape.health.optional(),ownerId:l().max(512).optional(),targetAt:s().finite().optional()};r({...X,projectKind:f([`auto`,`coding`,`general`,`unknown`]).optional(),autoUnderstand:o().default(!1)}).refine(e=>!!(e.name||e.workspaceRoot),`name or workspaceRoot is required`),r({id:l().trim().min(1),expectedVersion:s().int().positive(),patch:r({...X,status:Y.shape.status.optional(),description:X.description.unwrap().nullable().optional(),defaultAgentId:X.defaultAgentId.unwrap().nullable().optional(),workspaceRoot:l().trim().max(4096).nullable().optional(),brief:X.brief.unwrap().nullable().optional(),instructions:X.instructions.unwrap().nullable().optional(),outcome:X.outcome.unwrap().nullable().optional(),ownerId:X.ownerId.unwrap().nullable().optional(),targetAt:X.targetAt.unwrap().nullable().optional()}).refine(e=>Object.values(e).some(e=>e!==void 0),`Empty project patch`)});var _e=r({status:Y.shape.status.optional(),search:l().max(4096).optional(),sortBy:f([`updatedAt`,`createdAt`,`name`]).optional(),sortOrder:f([`asc`,`desc`]).optional(),limit:s().int().min(1).max(500).default(50),offset:s().int().nonnegative().default(0)}),Z=t({id:l(),projectId:l(),title:l(),status:f([`planned`,`active`,`completed`,`cancelled`]),sortOrder:s(),createdAt:s(),updatedAt:s()}),Q=t({id:l(),projectId:l(),summary:l(),health:Y.shape.health,createdAt:s()}),$={title:l().trim().min(1).max(1e3),description:l().max(2e4).optional(),status:Z.shape.status.optional(),targetAt:s().int().nonnegative().optional(),sortOrder:s().int().optional()};r({projectId:l().trim().min(1),...$}),r({projectId:l().trim().min(1),id:l().trim().min(1),expectedRevision:s().int().nonnegative(),patch:r({...$,description:l().max(2e4).nullable().optional(),targetAt:s().int().nonnegative().nullable().optional()}).partial().refine(e=>Object.values(e).some(e=>e!==void 0),`Empty milestone patch`)}).omit({patch:!0}),p({ok:d(!0),milestone:Z,project:Y}),p({ok:d(!0),deleted:d(!0)}),r({projectId:l().trim().min(1),expectedVersion:s().int().positive(),health:Y.shape.health,summary:l().trim().min(1).max(2e4),progress:u(l().max(1e4)).max(100).default([]),risks:u(l().max(1e4)).max(100).default([]),nextSteps:u(l().max(1e4)).max(100).default([])}),p({ok:d(!0),update:Q,project:Y});var ve={"xopc.context.resolve":{input:w,output:C},"xopc.notes.preview_edit":{input:q.extend({instruction:l().trim().min(1).max(16e3),markdown:l().max(2e6).optional(),context:t({type:f([`selection`,`section`,`block`,`note`]),range:r({start:s().int().nonnegative(),end:s().int().nonnegative()})}).optional()}),output:p({message:l(),patch:p({id:l(),summary:l(),operations:u(p({type:d(`replaceRange`),from:s().int().nonnegative(),to:s().int().nonnegative(),markdown:l()}))})})},"xopc.automations.get_run":{input:q,output:p({ok:d(!0),run:W.loose()})},"xopc.automations.run_events":{input:q,output:p({ok:d(!0),events:u(G.loose())})},"xopc.automations.metrics":{input:r({}),output:p({ok:d(!0),metrics:K})},"xopc.automations.events":{input:r({type:l().trim().min(1).max(512).optional(),source:l().trim().min(1).max(512).optional(),limit:s().int().min(1).max(200).default(50)}),output:p({ok:d(!0),items:u(p({event:p({id:l(),type:l(),schemaVersion:s().int(),source:l(),subject:p({kind:l(),id:l()}).optional(),payload:n(l(),i()),occurredAtMs:s(),ingestedAtMs:s(),correlationId:l(),causationId:l().optional(),rootEventId:l(),chainDepth:s().int(),dedupeKey:l().optional(),trust:f([`system`,`user`,`connector`,`untrusted_webhook`])}),projectionStatus:f([`pending`,`projecting`,`retrying`,`projected`,`dead_letter`]),projectionAttempts:s().int(),projectionError:l().optional(),deliveries:u(p({automationId:l(),status:f([`pending`,`retrying`,`queued`,`completed`,`failed`,`cancelled`,`skipped`,`dead_letter`]),runId:l().optional(),attempts:s().int(),lastError:l().optional()}))}))})},"xopc.automations.deliveries":{input:r({runId:l().trim().min(1).max(200).optional(),status:f([`pending`,`delivering`,`retrying`,`delivered`,`dead_letter`]).optional(),limit:s().int().min(1).max(200).default(50)}),output:p({ok:d(!0),items:u(p({runId:l(),destinationKey:l(),kind:l(),status:f([`pending`,`delivering`,`retrying`,`delivered`,`dead_letter`]),attempts:s().int(),nextAttemptAtMs:s(),lastError:l().optional(),createdAtMs:s(),updatedAtMs:s()}))})},"xopc.automations.product_events":{input:r({eventType:l().trim().min(1).max(512),source:l().trim().min(1).max(512).optional(),payloadKey:l().trim().min(1).max(512).optional(),payloadValue:l().max(4096).optional(),limit:s().int().min(1).max(100).default(10)}).refine(e=>e.payloadKey===void 0==(e.payloadValue===void 0),`payloadKey and payloadValue must be supplied together`),output:p({ok:d(!0),items:u(p({run:W.loose(),triggerEvent:G.loose()}))})},"xopc.automations.list":{input:r({projectId:l().trim().min(1).optional()}),output:p({ok:d(!0),items:u(U.loose()),projectId:l().optional()})},"xopc.automations.get":{input:q,output:p({ok:d(!0),automation:U.loose()})},"xopc.automations.history":{input:r({automationId:l().trim().min(1).optional(),projectId:l().trim().min(1).optional(),limit:s().int().min(1).max(200).default(50)}),output:p({ok:d(!0),items:u(W.loose()),projectId:l().optional()})},"xopc.settings.open":{input:r({section:l().trim().regex(/^[a-z0-9][a-z0-9/_-]*$/i).max(512).default(`overview`),title:l().trim().min(1).max(512).default(`Settings`),summary:l().trim().max(4096).optional()}),output:p({ok:d(!0),settings:p({section:l(),title:l(),summary:l().optional()})})},"xopc.local_apps.list":{input:r({}),output:p({apps:u(S)})},"xopc.local_apps.get":{input:q,output:p({app:ie})},"xopc.local_apps.validate":{input:q,output:p({validation:re})},"xopc.projects.get":{input:q,output:p({ok:d(!0),project:Y})},"xopc.projects.list":{input:_e,output:t({ok:d(!0),items:u(Y),total:s().int().nonnegative()})},"xopc.projects.list_milestones":{input:q,output:p({ok:d(!0),projectId:l(),items:u(Z)})},"xopc.projects.list_updates":{input:q.extend({limit:s().int().min(1).max(500).default(20)}),output:p({ok:d(!0),projectId:l(),items:u(Q)})},"xopc.task_runs.get":{input:q,output:p({ok:d(!0),run:y,receipt:b.optional(),events:u(g),activeWaits:u(x)})},"xopc.task_runs.list":{input:r({taskId:l().trim().min(1),limit:s().int().min(1).max(200).default(20)}),output:p({ok:d(!0),taskId:l(),items:u(y),receipts:u(b),activeWaits:u(x)})},"xopc.notes.project_summaries":{input:r({}),output:p({items:u(p({id:l(),name:l(),description:l().optional(),noteCount:s().int().nonnegative(),updatedAt:s().optional()}))})},"xopc.notes.history":{input:q,output:p({entries:u(p({timestamp:s().int().nonnegative(),trigger:f([`edit`,`ai_edit`,`sync`,`restore`]),snippet:l().optional()}))})},"xopc.notes.snapshot":{input:q.extend({timestamp:s().int().nonnegative()}),output:p({snapshot:p({noteId:l(),timestamp:s().int().nonnegative(),trigger:f([`edit`,`ai_edit`,`sync`,`restore`]),title:l().optional(),markdown:l(),tags:u(l()).optional(),kind:J.shape.kind,status:J.shape.status})})},"xopc.notes.get":{input:q,output:fe},"xopc.notes.list":{input:de,output:me},"xopc.tasks.metrics":{input:r({}),output:p({ok:d(!0),metrics:L})},"xopc.tasks.get":{input:q,output:v},"xopc.tasks.list":{input:he,output:h.extend({total:s().int().nonnegative()})}};export{P as a,F as i,ve as n,R as o,ue as r,ce as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/skills-page-CeNVBQG9.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-K2cy4f-3.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-D5h-Ha6-.js","assets/messages-Bwv-AOYl.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-CthsQiiO.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-B2HK1psj.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/mermaid-render-604gISVe.js","assets/xml-_d7dTN2Q.js","assets/app-link-BV_eGr7l.js","assets/product-delivery-DwmnNJvk.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Ct4sKkUf.css","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/session-manager-DMDBMYfh.js","assets/gateway-realtime-SBtdXzco.js","assets/gateway-realtime-store-dKq2fm2X.js","assets/local-session-drafts-DhJjHCfQ.js","assets/session-api-fVuszA_P.js","assets/gateway-startup-retry-CEpuztYK.js","assets/constants-DeXt1mV-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-Bf0hVPNV.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-D6XzhsQy.js","assets/gateway-config-swr-BvuySoCX.js","assets/capabilities-Dl3LttAm.js","assets/tasks-B4bZpO6O.js","assets/specialists-4bkS5rZ4.js","assets/files-Bw4SBGdM.js","assets/sliding-indicator-hwz0sx3h.js","assets/index-QegseiyI.css","assets/capability-header-actions-jztljvVW.js","assets/capability-icon-DVoZxEgW.js","assets/capability-links-DzQWK1Fh.js","assets/skill-api-E0E-MH1S.js","assets/skill-reload-api-DEN6tOwG.js","assets/connectors-page-CWlLRQpK.js","assets/number-input-DDeqHK-G.js","assets/connector-service-page-BNcTUa99.js","assets/plugin-details-dialog-XOzQrJQN.js","assets/plugin-presentation-CPEwVLd4.js","assets/browser-BLJWD7WI.js","assets/apps-page-CpoG_3PG.js","assets/agents-BfC3FYYe.js","assets/directory-picker-path-field-DnEvwMTm.js","assets/image-generation-api-SQDixWjO.js","assets/settings-page-layout-Dx5S-Msc.js","assets/channels-D8BKMMPW.js","assets/schema-form-ClP4uPSj.js"])))=>i.map(i=>d[i]);
2
- 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"./preload-helper-zJ_50EbN.js";import{f as a,g as o,m as s,r as c,t as l}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as ee}from"./messages-Bwv-AOYl.js";import{n as te}from"./locale-store-D5h-Ha6-.js";import{Go as u,Rc as d,bl as f,yl as p}from"./index-K2cy4f-3.js";import{t as m}from"./capability-links-DzQWK1Fh.js";import{t as ne}from"./capability-header-actions-jztljvVW.js";var h=n(),g=r();function re(e){let t=(0,h.c)(11),{section:n,zh:r}=e,i;t[0]!==n||t[1]!==r?(i=n===`skills`?{text:r?`查看 Agent 可使用的技能。插件附带的技能由所属插件统一更新和卸载。`:`Browse skills available to agents. Skills included in a plugin are updated and removed with that plugin.`,href:`/capabilities/extensions?tab=user`,label:r?`管理插件`:`Manage plugins`}:n===`connectors`?{text:r?`管理账号连接与授权。插件提供的账号统一在插件详情中连接。`:`Manage accounts and authorization. Connect plugin accounts from their plugin details.`,href:`/capabilities/extensions?tab=marketplace`,label:r?`发现更多插件`:`Discover plugins`}:n===`extensions`?{text:r?`安装和管理整套能力,包括技能、工具与账号连接。默认供所有 Agent 使用。`:`Install and manage skills, tools and account connections together. Available to all agents by default.`,href:`/capabilities/connectors?tab=connected`,label:r?`查看账号连接`:`View connections`}:null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=i;if(!a)return null;let o;t[3]===a.text?o=t[4]:(o=(0,g.jsx)(`p`,{className:`text-fg-muted`,children:a.text}),t[3]=a.text,t[4]=o);let s;t[5]!==a.href||t[6]!==a.label?(s=(0,g.jsx)(l,{className:`rounded text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,to:a.href,children:a.label}),t[5]=a.href,t[6]=a.label,t[7]=s):s=t[7];let c;return t[8]!==o||t[9]!==s?(c=(0,g.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-wrap items-center gap-x-3 gap-y-1 px-4 pb-1 pt-3 text-xs leading-5 sm:px-6 lg:px-8`,children:[o,s]}),t[8]=o,t[9]=s,t[10]=c):c=t[10],c}var _=e(t(),1),ie=(0,_.lazy)(()=>i(()=>import(`./skills-page-CeNVBQG9.js`).then(e=>({default:e.SkillsPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59]))),ae=(0,_.lazy)(()=>i(()=>import(`./connectors-page-CWlLRQpK.js`).then(e=>({default:e.ConnectorsPage})),__vite__mapDeps([60,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,61,55,56,57,62]))),oe=(0,_.lazy)(()=>i(()=>import(`./plugin-details-dialog-XOzQrJQN.js`).then(e=>({default:e.PluginDetailsDialog})),__vite__mapDeps([63,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,57,64,65]))),se=(0,_.lazy)(()=>i(()=>import(`./apps-page-CpoG_3PG.js`).then(e=>({default:e.ExtensionsPage})),__vite__mapDeps([66,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,64,65]))),ce=(0,_.lazy)(()=>i(()=>import(`./agents-BfC3FYYe.js`).then(e=>({default:e.AgentsSettingsPanel})),__vite__mapDeps([67,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,61,68,69,70]))),v=(0,_.lazy)(()=>i(()=>import(`./channels-D8BKMMPW.js`).then(e=>({default:e.ChannelsSettingsPanel})),__vite__mapDeps([71,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,65,72,61,70])));function y(e){return p.includes(e)?e:null}function b(e){let t=(0,h.c)(3),{label:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Array.from({length:6},x),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,g.jsx)(`div`,{className:`mx-auto grid w-full max-w-7xl gap-4 px-4 pb-7 pt-3 sm:grid-cols-2 sm:px-6 lg:grid-cols-3 lg:px-8 lg:pb-9 lg:pt-4`,"aria-label":n,"aria-busy":!0,children:r}),t[1]=n,t[2]=i),i}function x(e,t){return(0,g.jsx)(d,{className:`h-40 rounded-xl`},t)}function S(){let e=(0,h.c)(70),t=te(T),n;e[0]===t?n=e[1]:(n=ee(t),e[0]=t,e[1]=n);let r=n,i=r.capabilitiesHub,{section:l,detailId:d}=s(),[x]=o(),S=a(),E;e[2]===x?E=e[3]:(E=x.get(`plugin`),e[2]=x,e[3]=E);let D=E,O;e[4]!==S||e[5]!==x?(O=()=>{let e=new URLSearchParams(x);e.delete(`plugin`),e.delete(`connect`),S({search:e.toString()},{replace:!0,preventScrollReset:!0})},e[4]=S,e[5]=x,e[6]=O):O=e[6];let k=O,A;e[7]===l?A=e[8]:(A=y(l),e[7]=l,e[8]=A);let j=A,M=j??p[0],N=r.productNavigation.sections[`capabilities-${M}`],P=u(w),F=u(C),I;e[9]===M?I=e[10]:(I={section:M,value:null},e[9]=M,e[10]=I);let[L,R]=(0,_.useState)(I),z=M===`extensions`&&d?null:L.section===M?L.value:null,B;e[11]===M?B=e[12]:(B=e=>{R({section:M,value:e})},e[11]=M,e[12]=B);let V=B,H,U;if(e[13]!==F||e[14]!==z||e[15]!==N||e[16]!==P?(H=()=>(P({startExtra:null,main:(0,g.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:N}),end:(0,g.jsx)(ne,{contribution:z})}),()=>F()),U=[F,z,N,P],e[13]=F,e[14]=z,e[15]=N,e[16]=P,e[17]=H,e[18]=U):(H=e[17],U=e[18]),(0,_.useLayoutEffect)(H,U),M===`extensions`&&d){let t;e[19]===x?t=e[20]:(t=x.get(`from`)===`connections`?`connections`:x.get(`from`)===`skills`?`skills`:`installed`,e[19]=x,e[20]=t);let n;e[21]===x?n=e[22]:(n=x.get(`connect`),e[21]=x,e[22]=n);let r=n===`1`,i;e[23]!==d||e[24]!==x||e[25]!==r||e[26]!==t?(i=m(d,t,r,x.get(`returnTo`)??void 0),e[23]=d,e[24]=x,e[25]=r,e[26]=t,e[27]=i):i=e[27];let a;return e[28]===i?a=e[29]:(a=(0,g.jsx)(c,{replace:!0,to:i}),e[28]=i,e[29]=a),a}if(!j){let t;return e[30]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,g.jsx)(c,{to:f(p[0]),replace:!0}),e[30]=t):t=e[30],t}let W;e[31]!==d||e[32]!==t||e[33]!==M?(W=d?null:(0,g.jsx)(re,{section:M,zh:t.startsWith(`zh`)}),e[31]=d,e[32]=t,e[33]=M,e[34]=W):W=e[34];let G;e[35]===i.discoverLoading?G=e[36]:(G=(0,g.jsx)(b,{label:i.discoverLoading}),e[35]=i.discoverLoading,e[36]=G);let K;e[37]!==d||e[38]!==V||e[39]!==M?(K=M===`agents`?(0,g.jsx)(ce,{agentId:d,onHeaderActionChange:V}):null,e[37]=d,e[38]=V,e[39]=M,e[40]=K):K=e[40];let q;e[41]!==V||e[42]!==M?(q=M===`skills`?(0,g.jsx)(ie,{embedded:!0,onHeaderActionChange:V}):null,e[41]=V,e[42]=M,e[43]=q):q=e[43];let J;e[44]!==V||e[45]!==M?(J=M===`connectors`?(0,g.jsx)(ae,{embedded:!0,onHeaderActionChange:V}):null,e[44]=V,e[45]=M,e[46]=J):J=e[46];let Y;e[47]!==d||e[48]!==V||e[49]!==M?(Y=M===`channels`?(0,g.jsx)(v,{channelId:d,onHeaderActionChange:V}):null,e[47]=d,e[48]=V,e[49]=M,e[50]=Y):Y=e[50];let X;e[51]!==V||e[52]!==M?(X=M===`extensions`?(0,g.jsx)(se,{embedded:!0,onHeaderActionChange:V}):null,e[51]=V,e[52]=M,e[53]=X):X=e[53];let Z;e[54]!==M||e[55]!==K||e[56]!==q||e[57]!==J||e[58]!==Y||e[59]!==X||e[60]!==G?(Z=(0,g.jsxs)(_.Suspense,{fallback:G,children:[K,q,J,Y,X]},M),e[54]=M,e[55]=K,e[56]=q,e[57]=J,e[58]=Y,e[59]=X,e[60]=G,e[61]=Z):Z=e[61];let Q;e[62]!==k||e[63]!==D||e[64]!==x?(Q=D?(0,g.jsx)(_.Suspense,{fallback:null,children:(0,g.jsx)(oe,{pluginId:D,initialConnect:x.get(`connect`)===`1`,onClose:k},D)}):null,e[62]=k,e[63]=D,e[64]=x,e[65]=Q):Q=e[65];let $;return e[66]!==Z||e[67]!==Q||e[68]!==W?($=(0,g.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[W,Z,Q]}),e[66]=Z,e[67]=Q,e[68]=W,e[69]=$):$=e[69],$}function C(e){return e.clearPageHeader}function w(e){return e.setPageHeader}function T(e){return e.language}export{S as CapabilitiesPage};
@@ -1,8 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-swr-BIWyz7Rc.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js"])))=>i.map(i=>d[i]);
2
- 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"./preload-helper-zJ_50EbN.js";import{d as a,g as o,m as s,r as c,t as l}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./external-link-DjqjBmc3.js";import{t as f}from"./eye-CABVeTq0.js";import{t as p}from"./plus-Q2yW6OE7.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./messages-Bwv-AOYl.js";import{t as g}from"./cn-0WouolD0.js";import{a as _,c as v,i as y,n as b,r as x}from"./locale-store-D5h-Ha6-.js";import{a as S,i as C,n as w,o as T,r as E,s as D,t as O}from"./dist-BGTk37IG.js";import{i as k}from"./vendor-swr-BIWyz7Rc.js";import{n as A,r as j}from"./gateway-config-swr-BvuySoCX.js";import{n as M,t as N}from"./registry-api-Bf0hVPNV.js";import{$i as P,$l as F,$s as I,Ao as L,As as R,At as ee,Bt as z,Cn as B,Ct as V,Dn as H,Dt as te,En as U,Et as ne,F as W,Fc as G,Fn as K,Ft as re,G as ie,Gs as ae,Gt as oe,Ht as se,I as q,Ic as ce,In as J,Is as le,Js as Y,Jt as ue,Ju as de,Kc as X,Ks as fe,Kt as pe,Ku as me,L as he,Ls as ge,Lt as _e,Ml as ve,Mt as ye,Nl as be,Ns as xe,Nt as Se,Of as Ce,Ot as we,Ps as Te,Pt as Ee,Rc as De,Rs as Oe,Rt as ke,Sl as Ae,Sn as je,St as Me,Tn as Ne,Tt as Pe,Ut as Fe,Vs as Ie,Vt as Le,Wl as Re,Ws as ze,Xd as Be,Xl as Ve,Xs as He,Xt as Ue,Ys as We,Yt as Ge,Za as Ke,_t as qe,as as Je,bn as Ye,bt as Xe,cf as Ze,dd as Qe,df as $e,ds as et,du as tt,ea as nt,ec as rt,eo as it,fs as Z,hd as at,js as ot,jt as st,kf as ct,kt as lt,nu as ut,qn as dt,qs as ft,qt as pt,ss as mt,to as ht,us as gt,vl as _t,vs as vt,vt as yt,vu as bt,wl as xt,wn as St,wt as Ct,wu as wt,xn as Tt,xt as Et,ys as Dt,yt as Ot,yu as kt,zt as At,zu as jt}from"./index-K2cy4f-3.js";import{t as Mt}from"./number-input-DDeqHK-G.js";import{n as Nt,r as Pt}from"./settings-page-layout-Dx5S-Msc.js";import{n as Ft,t as It}from"./settings-form-section-B4NShgv-.js";import{n as Lt,t as Rt}from"./use-autosave-CYIuWnRn.js";import{c as zt,f as Bt,i as Vt,l as Ht,n as Ut,o as Wt,r as Gt,s as Kt,t as qt,u as Jt}from"./voice-config-api-CRjdZdJF.js";import{t as Yt}from"./voice-api-key-field-BN37Lklj.js";import{a as Xt,i as Zt,n as Qt,o as $t,r as en,s as tn,t as nn}from"./image-generation-api-SQDixWjO.js";import{t as rn}from"./xopc-cloud-account-card-DGGi4zVC.js";var an=n(),Q=e(t(),1),$=r(),on={en:{addTitle:`Add image service`,editTitle:`Manage image service`,intro:`Connect an endpoint that implements the OpenAI Images protocol.`,connection:`Connection`,providerId:`Provider ID`,providerIdHint:`Lowercase letters, numbers, hyphens, or underscores.`,name:`Display name`,baseUrl:`Base URL`,auth:`Authentication`,bearer:`Bearer token`,header:`Custom API key header`,none:`No authentication`,headerName:`Header name`,apiKey:`API key`,apiKeyHint:`Stored in the local credential store, separate from models.json.`,apiKeyUrl:`API key page (optional)`,docsUrl:`Documentation page (optional)`,openKeyPage:`Create API key`,paths:`Protocol and network`,generationsPath:`Generations path`,editsPath:`Edits path`,allowedHosts:`Allowed private hosts (optional)`,allowedHostsHint:`One exact hostname or IP per line. Private endpoints stay blocked unless listed here.`,staticHeaders:`Static headers (optional)`,staticHeadersHint:`One per line: X-Tenant: value. Credential headers are rejected.`,models:`Image models`,addModel:`Add model`,modelId:`Model ID`,modelName:`Name (optional)`,defaultModel:`Default model`,maxCount:`Max images`,defaultCount:`Default count`,defaultSize:`Default size`,format:`Output format`,supportsSize:`Supports size`,edit:`Supports edits`,remove:`Remove`,cancel:`Cancel`,save:`Save service`,saving:`Saving…`,test:`Test generation`,testing:`Generating…`,delete:`Delete service`,confirmDelete:`Delete permanently`,saved:`Image service saved.`,deleted:`Image service deleted.`,testReady:`Test image generated.`,show:`Show key`,hide:`Hide key`,copy:`Copy key`,copied:`Copied`,revealFailed:`Unable to reveal the saved key.`,notRevealable:`No revealable key is stored locally.`,required:`Complete the required connection and model fields.`,duplicateModels:`Model IDs must be unique.`,invalidHeaders:`Static headers must use “Name: value”, one per line.`},zh:{addTitle:`添加图片服务`,editTitle:`管理图片服务`,intro:`连接一个严格实现 OpenAI Images 协议的服务端点。`,connection:`连接信息`,providerId:`Provider ID`,providerIdHint:`仅支持小写字母、数字、连字符和下划线。`,name:`显示名称`,baseUrl:`Base URL`,auth:`认证方式`,bearer:`Bearer Token`,header:`自定义 API Key Header`,none:`无需认证`,headerName:`Header 名称`,apiKey:`API Key`,apiKeyHint:`密钥单独保存在本机凭据存储,不写入 models.json。`,apiKeyUrl:`API Key 创建页面(可选)`,docsUrl:`协议文档页面(可选)`,openKeyPage:`去创建 API Key`,paths:`协议与网络`,generationsPath:`生成路径`,editsPath:`编辑路径`,allowedHosts:`允许访问的私有主机(可选)`,allowedHostsHint:`每行一个精确主机名或 IP;未列出的私网端点保持阻止。`,staticHeaders:`静态 Headers(可选)`,staticHeadersHint:`每行一个:X-Tenant: value。认证 Header 会被拒绝。`,models:`图片模型`,addModel:`添加模型`,modelId:`模型 ID`,modelName:`名称(可选)`,defaultModel:`默认模型`,maxCount:`单次最大张数`,defaultCount:`默认张数`,defaultSize:`默认尺寸`,format:`输出格式`,supportsSize:`支持尺寸参数`,edit:`支持图片编辑`,remove:`移除`,cancel:`取消`,save:`保存服务`,saving:`保存中…`,test:`测试生成`,testing:`生成中…`,delete:`删除服务`,confirmDelete:`确认永久删除`,saved:`图片服务已保存。`,deleted:`图片服务已删除。`,testReady:`测试图片生成成功。`,show:`显示密钥`,hide:`隐藏密钥`,copy:`复制密钥`,copied:`已复制`,revealFailed:`无法查看已保存的密钥。`,notRevealable:`本机没有可查看的密钥。`,required:`请补全必填的连接和模型信息。`,duplicateModels:`模型 ID 不能重复。`,invalidHeaders:`静态 Header 必须使用“名称: 值”格式,每行一个。`}},sn=`mt-1.5 h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`;function cn(e){let t=e??{id:``,capabilities:{generate:{maxCount:1,supportsSize:!0},edit:{enabled:!1}}};return{original:t,id:t.id,name:t.name??``,maxCount:String(t.capabilities.generate?.maxCount??1),defaultCount:t.defaults?.count?String(t.defaults.count):``,defaultSize:t.defaults?.size??``,outputFormat:t.defaults?.outputFormat??``,supportsSize:t.capabilities.generate?.supportsSize??!1,editEnabled:t.capabilities.edit?.enabled??!1}}function ln(e){let t=e.split(`
3
- `).map(e=>e.trim()).filter(Boolean);if(t.length===0)return;let n=t.map(e=>{let t=e.indexOf(`:`);if(t<=0||!e.slice(t+1).trim())throw Error(`invalid_headers`);return[e.slice(0,t).trim(),e.slice(t+1).trim()]});return Object.fromEntries(n)}function un({open:e,onOpenChange:t,provider:n,configured:r,language:i,onSaved:a,portalContainer:o,onPendingChange:s}){let c=on[i],[l,u]=(0,Q.useState)(``),[d,h]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(`bearer`),[x,k]=(0,Q.useState)(`x-api-key`),[A,j]=(0,Q.useState)(``),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(`/images/generations`),[R,ee]=(0,Q.useState)(`/images/edits`),[z,B]=(0,Q.useState)(``),[V,H]=(0,Q.useState)(``),[te,U]=(0,Q.useState)([cn()]),[ne,W]=(0,Q.useState)(``),[G,K]=(0,Q.useState)(),[re,ie]=(0,Q.useState)(!1),[ae,oe]=(0,Q.useState)(),[se,q]=(0,Q.useState)(),[ce,J]=(0,Q.useState)();(0,Q.useEffect)(()=>(s?.(!!G),()=>s?.(!1)),[G,s]),(0,Q.useEffect)(()=>{if(!e)return;let t=n?.imageGeneration;u(n?.providerId??``),h(t?.name??``),v(n?.baseUrl??``),b(t?.auth.type??`bearer`),k(t?.auth.type===`header`?t.auth.headerName:`x-api-key`),j(r?`••••••••••••`:``),N(t?.apiKeyUrl??``),F(t?.documentationUrl??``),L(t?.paths?.generations??`/images/generations`),ee(t?.paths?.edits??`/images/edits`),B(t?.network?.allowedHosts.join(`
4
- `)??``),H(Object.entries(n?.headers??{}).map(([e,t])=>`${e}: ${t}`).join(`
5
- `)),U(t?.models.map(cn)??[cn()]),W(t?.defaultModel??``),q(void 0),K(void 0),ie(!1),oe(void 0),J(void 0)},[r,e,n]);let le=(0,Q.useMemo)(()=>te.filter(e=>e.id.trim()).map(e=>({value:e.id.trim(),label:e.name.trim()||e.id.trim()})),[te]),Y=(e,t)=>{U(n=>n.map((n,r)=>r===e?{...n,...t}:n))},ue=()=>{let e=l.trim(),t=te.map(e=>({...e,id:e.id.trim(),name:e.name.trim()}));if(!e||!d.trim()||!_.trim()||t.some(e=>!e.id))throw Error(c.required);if(new Set(t.map(e=>e.id)).size!==t.length)throw Error(c.duplicateModels);let n=ne||t[0]?.id;if(!n||!t.some(e=>e.id===n))throw Error(c.required);let r;try{r=ln(V)}catch{throw Error(c.invalidHeaders)}return{providerId:e,input:{baseUrl:_.trim(),...r?{headers:r}:{},imageGeneration:{api:`openai-images`,name:d.trim(),...P.trim()?{documentationUrl:P.trim()}:{},...M.trim()?{apiKeyUrl:M.trim()}:{},defaultModel:n,auth:y===`header`?{type:`header`,headerName:x.trim()}:{type:y},paths:{...I.trim()?{generations:I.trim()}:{},...R.trim()?{edits:R.trim()}:{}},...z.trim()?{network:{allowedHosts:z.split(`
6
- `).map(e=>e.trim()).filter(Boolean)}}:{},models:t.map(e=>({...e.original,id:e.id,...e.name?{name:e.name}:{name:void 0},capabilities:{...e.original.capabilities,generate:{...e.original.capabilities.generate,maxCount:Math.max(1,Number.parseInt(e.maxCount,10)||1),supportsSize:e.supportsSize},edit:{...e.original.capabilities.edit,enabled:e.editEnabled}},defaults:{...e.original.defaults,...e.defaultCount?{count:Math.max(1,Number.parseInt(e.defaultCount,10)||1)}:{count:void 0},...e.defaultSize.trim()?{size:e.defaultSize.trim()}:{size:void 0},...e.outputFormat?{outputFormat:e.outputFormat}:{outputFormat:void 0}}}))}}}},fe=async()=>{let e=ue();return await Zt(e.providerId,e.input),y!==`none`&&A.trim()&&!Te(A)&&await Xt(e.providerId,A.trim()),await a(e.providerId),e},pe=async()=>{K(`save`),oe(void 0),q(void 0);try{await fe(),j(y===`none`?``:`••••••••••••`),q(c.saved)}catch(e){oe(e instanceof Error?e.message:String(e))}finally{K(void 0)}},me=async()=>{K(`test`),oe(void 0),q(void 0),J(void 0);try{let e=await fe();J((await $t(e.providerId,e.input.imageGeneration.defaultModel)).images[0]?.dataUrl),q(c.testReady)}catch(e){oe(e instanceof Error?e.message:String(e))}finally{K(void 0)}},he=async()=>{if(n){if(!re){ie(!0);return}K(`delete`),oe(void 0);try{await nn(n.providerId),await a(),t(!1)}catch(e){oe(e instanceof Error?e.message:String(e))}finally{K(void 0)}}};return(0,$.jsx)(O,{open:e,onOpenChange:e=>{G||t(e)},children:(0,$.jsxs)(T,{container:o,children:[(0,$.jsx)(S,{className:g(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Dt)}),(0,$.jsxs)(E,{className:g(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(88vh,760px)] w-[min(calc(100%-2rem),52rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,vt),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(D,{className:`font-semibold text-fg`,children:n?c.editTitle:c.addTitle}),(0,$.jsx)(C,{className:`mt-1 text-sm text-fg-muted`,children:c.intro})]}),(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:!!G,className:`rounded-md p-1 text-fg-muted hover:bg-surface-inset hover:text-fg`,"aria-label":c.cancel,children:(0,$.jsx)(m,{className:`size-5`})})})]}),(0,$.jsxs)(`fieldset`,{disabled:!!G,className:`min-h-0 min-w-0 flex-1 space-y-6 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`section`,{className:`space-y-4`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:c.connection}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.providerId,(0,$.jsx)(`input`,{value:l,disabled:!!n,onChange:e=>u(e.target.value),placeholder:`my-image-service`,className:sn}),(0,$.jsx)(`span`,{className:`mt-1 block font-normal text-fg-subtle`,children:c.providerIdHint})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.name,(0,$.jsx)(`input`,{value:d,onChange:e=>h(e.target.value),placeholder:`My Image Service`,className:sn})]})]}),(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[c.baseUrl,(0,$.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),placeholder:`https://api.example.com/v1`,className:sn})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.auth,(0,$.jsx)(gt,{value:y,options:[{value:`bearer`,label:c.bearer},{value:`header`,label:c.header},{value:`none`,label:c.none}],placeholder:c.auth,allowEmpty:!1,onChange:e=>b(e),triggerClassName:`mt-1.5`})]}),y===`header`?(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.headerName,(0,$.jsx)(`input`,{value:x,onChange:e=>k(e.target.value),className:sn})]}):null]}),y===`none`?null:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,$.jsx)(`label`,{htmlFor:`custom-image-api-key`,className:`text-xs font-medium text-fg-muted`,children:c.apiKey}),M.trim()?(0,$.jsxs)(`a`,{href:M.trim(),target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-accent hover:underline`,children:[c.openKeyPage,(0,$.jsx)(Ce,{className:`size-3.5`})]}):null]}),(0,$.jsx)(xe,{id:`custom-image-api-key`,value:A,onChange:e=>j(Te(A)?e.replace(/^•+/,``):e),labels:{show:c.show,hide:c.hide,copy:c.copy,copied:c.copied},reveal:()=>pt(l).then(e=>e.apiKey),loadFailedLabel:c.revealFailed,notInConfigFile:c.notRevealable}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:c.apiKeyHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.apiKeyUrl,(0,$.jsx)(`input`,{value:M,onChange:e=>N(e.target.value),placeholder:`https://…`,className:sn})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.docsUrl,(0,$.jsx)(`input`,{value:P,onChange:e=>F(e.target.value),placeholder:`https://…`,className:sn})]})]}),(0,$.jsxs)(`details`,{className:`rounded-lg border border-edge bg-surface-inset px-3 py-2.5`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:c.paths}),(0,$.jsxs)(`div`,{className:`mt-3 grid gap-4 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.generationsPath,(0,$.jsx)(`input`,{value:I,onChange:e=>L(e.target.value),className:sn})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.editsPath,(0,$.jsx)(`input`,{value:R,onChange:e=>ee(e.target.value),className:sn})]})]}),(0,$.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[c.allowedHosts,(0,$.jsx)(`textarea`,{value:z,onChange:e=>B(e.target.value),rows:2,placeholder:`127.0.0.1
7
- image-server.lan`,className:`mt-1.5 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 font-mono text-xs text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,$.jsx)(`span`,{className:`mt-1 block font-normal text-fg-subtle`,children:c.allowedHostsHint})]}),(0,$.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[c.staticHeaders,(0,$.jsx)(`textarea`,{value:V,onChange:e=>H(e.target.value),rows:3,className:`mt-1.5 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 font-mono text-xs text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,$.jsx)(`span`,{className:`mt-1 block font-normal text-fg-subtle`,children:c.staticHeadersHint})]})]})]}),(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:c.models}),(0,$.jsxs)(X,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,onClick:()=>U(e=>[...e,cn()]),children:[(0,$.jsx)(p,{className:`size-4`}),c.addModel]})]}),(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[c.defaultModel,(0,$.jsx)(gt,{value:ne||le[0]?.value||``,options:le,placeholder:c.defaultModel,allowEmpty:!1,onChange:W,triggerClassName:`mt-1.5 max-w-sm`})]}),te.map((e,t)=>(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.modelId,(0,$.jsx)(`input`,{value:e.id,onChange:e=>Y(t,{id:e.target.value}),placeholder:`image-1`,className:sn})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.modelName,(0,$.jsx)(`input`,{value:e.name,onChange:e=>Y(t,{name:e.target.value}),className:sn})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.maxCount,(0,$.jsx)(`input`,{type:`number`,min:1,value:e.maxCount,onChange:e=>Y(t,{maxCount:e.target.value}),className:sn})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.defaultCount,(0,$.jsx)(`input`,{type:`number`,min:1,value:e.defaultCount,onChange:e=>Y(t,{defaultCount:e.target.value}),className:sn})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.defaultSize,(0,$.jsx)(`input`,{value:e.defaultSize,onChange:e=>Y(t,{defaultSize:e.target.value}),placeholder:`1024x1024`,className:sn})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[c.format,(0,$.jsx)(gt,{value:e.outputFormat,options:[{value:`png`,label:`PNG`},{value:`jpeg`,label:`JPEG`},{value:`webp`,label:`WebP`}],placeholder:c.format,allowEmpty:!0,onChange:e=>Y(t,{outputFormat:e}),triggerClassName:`mt-1.5`})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-4`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e.supportsSize,onChange:e=>Y(t,{supportsSize:e.target.checked})}),c.supportsSize]}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e.editEnabled,onChange:e=>Y(t,{editEnabled:e.target.checked})}),c.edit]}),(0,$.jsxs)(`button`,{type:`button`,disabled:te.length===1,onClick:()=>U(e=>e.filter((e,n)=>n!==t)),className:`ml-auto inline-flex items-center gap-1 text-xs text-red-600 disabled:opacity-40 dark:text-red-400`,children:[(0,$.jsx)(be,{className:`size-3.5`}),c.remove]})]})]},t))]}),ce?(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(f,{className:`size-4`}),c.testReady]}),(0,$.jsx)(`img`,{src:ce,alt:`Generated provider test`,className:`max-h-72 rounded-lg object-contain`})]}):null,se?(0,$.jsx)(`p`,{className:`rounded-lg bg-emerald-500/10 px-3 py-2 text-sm text-emerald-700 dark:text-emerald-300`,role:`status`,children:se}):null,ae?(0,$.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-400`,children:ae}):null]}),(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-t border-edge px-5 py-3`,children:[n?(0,$.jsxs)(X,{variant:`secondary`,className:`border-red-500/30 text-red-600 hover:bg-red-500/10 dark:text-red-400`,disabled:!!G,onClick:()=>void he(),children:[G===`delete`?(0,$.jsx)(de,{className:`size-4 animate-spin`}):(0,$.jsx)(be,{className:`size-4`}),re?c.confirmDelete:c.delete]}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(X,{variant:`secondary`,disabled:!!G,children:c.cancel})}),(0,$.jsxs)(X,{variant:`secondary`,disabled:!!G,onClick:()=>void me(),children:[G===`test`?(0,$.jsx)(de,{className:`size-4 animate-spin`}):null,G===`test`?c.testing:c.test]}),(0,$.jsxs)(X,{variant:`primary`,disabled:!!G,onClick:()=>void pe(),children:[G===`save`?(0,$.jsx)(de,{className:`size-4 animate-spin`}):null,G===`save`?c.saving:c.save]})]})]})]})]})})}var dn=`••••••••••••`,fn={en:{title:`Image generation`,intro:`Configure the default image model and service. Agents inherit this setting unless overridden in Agent settings.`,provider:`Provider`,model:`Model`,apiKey:`API key`,getApiKey:`Get API key`,apiKeyHint:`Stored in the local credential store, never in xopc.json.`,existingKey:`A credential or environment variable is already available. Leave this blank to reuse it.`,savedKey:`A credential is saved. Use the eye button to view it, or type a new key to replace it.`,revealFailed:`Unable to load the saved API key.`,keyNotRevealable:`This credential comes from an environment variable or another non-revealable source.`,advanced:`Provider settings`,enable:`Enable image generation`,enabling:`Verifying and enabling…`,enabled:`Image generation is ready.`,addService:`Add image service`,manageService:`Manage service`,custom:`Custom`,current:`Current`,configured:`Credential ready`,needsKey:`API key required`,connect:`Connect to a gateway to continue.`,loadError:`Unable to load image generation settings.`,selectModel:`Select a model`,show:`Show key`,hide:`Hide key`,copy:`Copy key`,copied:`Copied`},zh:{title:`图片生成`,intro:`配置全局图片生成模型和服务。各智能体默认继承此设置,也可在智能体详情中单独覆盖。`,provider:`Provider`,model:`模型`,apiKey:`API Key`,getApiKey:`获取 API Key`,apiKeyHint:`密钥只保存在本机凭据存储中,不会写入 xopc.json。`,existingKey:`已有凭据或环境变量;留空即可继续使用。`,savedKey:`凭据已保存。点击眼睛可查看,直接输入新密钥可替换。`,revealFailed:`无法读取已保存的 API Key。`,keyNotRevealable:`当前凭据来自环境变量或其他不可查看的来源。`,advanced:`服务商设置`,enable:`启用图片生成`,enabling:`正在验证并启用…`,enabled:`图片生成已可用。`,addService:`添加图片服务`,manageService:`管理服务`,custom:`自定义`,current:`当前使用`,configured:`凭据已就绪`,needsKey:`需要 API Key`,connect:`请先连接网关。`,loadError:`无法加载图片生成设置。`,selectModel:`选择模型`,show:`显示密钥`,hide:`隐藏密钥`,copy:`复制密钥`,copied:`已复制`}};async function pn(){let e=await _(x(`/api/image-generation/default`));if(!e.payload)throw Error(`Invalid default image generation response`);return e.payload}function mn(e){let t=e?.indexOf(`/`)??-1;return t>0?e.slice(0,t):void 0}function hn(e){let t=e?.indexOf(`/`)??-1;return t>0?e.slice(t+1):void 0}function gn(e){return Object.fromEntries(e.configFields.map(t=>[t.key,e.config[t.key]??(t.required?t.options?.[0]?.value??``:``)]))}function _n(e){let t=(0,an.c)(11),{field:n,value:r,onChange:i}=e,a;t[0]!==n.label||t[1]!==n.options||t[2]!==n.placeholder||t[3]!==n.required||t[4]!==n.type||t[5]!==i||t[6]!==r?(a=n.type===`select`?(0,$.jsx)(gt,{value:r,options:(n.options??[]).map(vn),placeholder:n.placeholder??n.label,allowEmpty:!n.required,onChange:i,triggerClassName:`mt-1.5`}):(0,$.jsx)(`input`,{type:`url`,value:r,required:n.required,onChange:e=>i(e.target.value),placeholder:n.placeholder,className:`mt-1.5 h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),t[0]=n.label,t[1]=n.options,t[2]=n.placeholder,t[3]=n.required,t[4]=n.type,t[5]=i,t[6]=r,t[7]=a):a=t[7];let o;return t[8]!==n.label||t[9]!==a?(o=(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n.label,a]}),t[8]=n.label,t[9]=a,t[10]=o):o=t[10],o}function vn(e){return{value:e.value,label:e.label}}function yn(){let e=(0,an.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(De,{className:`h-24 rounded-xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:[t,(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Array.from({length:5}).map(bn)}),(0,$.jsx)(De,{className:`h-64 rounded-xl`})]}),e[1]=n):n=e[1],n}function bn(e,t){return(0,$.jsx)(De,{className:`h-24 rounded-xl`},t)}function xn({connectOnly:e=!1,onConnected:t,onPendingChange:n}={}){let r=b(e=>e.language),a=fn[r],o=!!v(e=>e.conversationId),[s,c]=(0,Q.useState)(``),[l,d]=(0,Q.useState)(``),[f,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)({}),[y,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null);(0,Q.useEffect)(()=>(n?.(y||C),()=>n?.(!1)),[y,C,n]);let[D,O]=(0,Q.useState)(),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(),{data:L,isLoading:R,error:ee,mutate:z}=k(o?x(`/api/image-generation/catalog`):null,en,{revalidateOnFocus:!1}),{data:B,isLoading:V,error:H,mutate:te}=k(o?x(`/api/image-generation/custom-providers`):null,Qt,{revalidateOnFocus:!1}),{data:U,isLoading:ne,error:W,mutate:G}=k(o?`default-image-generation`:null,pn,{revalidateOnFocus:!1});(0,Q.useEffect)(()=>{if(!L||!U)return;let e=mn(U.model?.primary),t=L.find(t=>t.id===e)??L.find(e=>e.configured)??L[0];t&&(c(t.id),d(t.id===e&&hn(U.model?.primary)||t.defaultModel),m(t.configured?dn:``),g(gn(t)))},[U,L]);let K=L?.find(e=>e.id===s),re=K?K.apiKeyUrl??st(K.id,r)[0]?.href:void 0,ie=(0,Q.useMemo)(()=>(K?.models??[]).map(e=>({value:e,label:e})),[K?.models]),ae=U?.model?.primary,oe=!!(K&&l&&(K.credentialMode!==`api-key`||K.configured||f.trim())&&K.configFields.every(e=>!e.required||h[e.key]?.trim()));if(!o)return(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.connect});if(R||V||ne)return(0,$.jsx)(yn,{});if(ee||H||W||!L||!B)return(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a.loadError});let se=e=>{c(e.id),d(e.defaultModel),m(e.configured?dn:``),g(gn(e)),O(void 0)},q=()=>{I(void 0),P(!0)},ce=()=>{let e=B.find(e=>e.providerId===K?.id);e&&(I(e),P(!0))},J=async n=>{let[r,i]=await Promise.all([te(),z()]);if(n&&i?.some(e=>e.id===n)){let a=i.find(e=>e.id===n);c(a.id),d(a.defaultModel),m(a.configured?dn:``),g(gn(a)),I(r?.find(e=>e.providerId===n)),e&&a.configured&&t?.()}},le=async()=>{if(!(!K||!oe)){S(!0),O(void 0),M(!1);try{if(e){f.trim()&&!Te(f)&&await Xt(K.id,f.trim()),Object.keys(h).length&&await _(x(`/api/config`),{method:`PATCH`,body:JSON.stringify({providersConfig:{[K.id]:h}})});let[e]=await Promise.all([z(),A()]);if(!e?.find(e=>e.id===K.id)?.configured)throw Error(r===`zh`?`连接尚未就绪,请先完成对应服务的授权或凭据设置。`:`Connection is not ready. Complete authorization or credentials first.`);M(!0),t?.();return}let n=await _(x(`/api/image-generation/default/setup`),{method:`POST`,body:JSON.stringify({providerId:K.id,modelId:l,...f.trim()&&!Te(f)?{apiKey:f.trim()}:{},providerConfig:Object.fromEntries(Object.entries(h).filter(([,e])=>e.trim()))})});if(!n.payload)throw Error(`Invalid setup response`);await Promise.all([G(n.payload.default,{revalidate:!1}),z(n.payload.providers,{revalidate:!1}),i(async()=>{let{mutate:e}=await import(`./vendor-swr-BIWyz7Rc.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2])).then(({mutate:e})=>Promise.all([e(`settings-agent-defaults`),e(`settings-gateway-agents`)])),A()]),m(dn),M(!0)}catch(e){O(e instanceof Error?e.message:String(e))}finally{S(!1)}}};return(0,$.jsxs)(`div`,{ref:E,className:`flex flex-col gap-4`,children:[(0,$.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,$.jsx)(at,{className:`size-5`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:e?r===`zh`?`连接图片来源,不修改默认模型,也不发送生成测试请求。`:`Connect image sources without changing defaults or sending generation tests.`:a.intro})]})]})}),(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:a.provider}),(0,$.jsxs)(X,{variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,onClick:q,children:[(0,$.jsx)(p,{className:`size-4`}),a.addService]})]}),(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:L.map(e=>{let t=e.id===s,n=e.id===mn(ae);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>se(e),className:`min-h-24 rounded-xl p-4 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${t?`bg-accent-soft shadow-surface`:`bg-surface-base/55 hover:bg-surface-hover`}`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.label}),e.source===`custom`?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-[10px] text-fg-subtle`,children:a.custom}):null]}),(0,$.jsx)(`span`,{"aria-hidden":!n,className:`shrink-0 rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent ${n?``:`invisible`}`,children:a.current})]}),(0,$.jsxs)(`span`,{className:`mt-2 flex items-center gap-1.5 text-xs ${e.configured?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`}`,children:[e.configured||e.credentialMode!==`api-key`?(0,$.jsx)(u,{className:`size-3.5`}):(0,$.jsx)(Qe,{className:`size-3.5`}),e.configured||e.credentialMode!==`api-key`?a.configured:a.needsKey]})]},e.id)})})]}),K?(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[e?null:(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a.model,(0,$.jsx)(gt,{value:l,options:ie,placeholder:a.selectModel,allowEmpty:!1,onChange:d,triggerClassName:`mt-1.5`})]}),K.configFields.filter(e=>e.required).map(e=>(0,$.jsx)(_n,{field:e,value:h[e.key]??``,onChange:t=>g(n=>({...n,[e.key]:t}))},e.key))]}),K.source===`custom`?(0,$.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,$.jsxs)(X,{variant:`secondary`,onClick:ce,children:[(0,$.jsx)(ut,{className:`size-4`}),a.manageService]})}):null,K.credentialMode===`api-key`?(0,$.jsxs)(`div`,{className:`mt-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`label`,{htmlFor:`image-generation-api-key`,className:`text-xs font-medium text-fg-muted`,children:a.apiKey}),re?(0,$.jsxs)(`a`,{href:re,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,children:[a.getApiKey,(0,$.jsx)(Ce,{className:`size-3.5`,"aria-hidden":`true`})]}):null]}),(0,$.jsx)(xe,{id:`image-generation-api-key`,value:f,onChange:e=>m(Te(f)?e.replace(/^•+/,``):e),placeholder:K.configured?a.existingKey:a.needsKey,labels:{show:a.show,hide:a.hide,copy:a.copy,copied:a.copied},reveal:()=>pt(K.id).then(e=>e.apiKey),loadFailedLabel:a.revealFailed,notInConfigFile:a.keyNotRevealable,className:`mt-1.5`,autoComplete:`new-password`},K.id),(0,$.jsx)(`span`,{className:`mt-1.5 block font-normal leading-relaxed text-fg-subtle`,children:K.configured?a.savedKey:a.apiKeyHint})]}):null,K.configFields.some(e=>!e.required)?(0,$.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-base/55 px-3 py-2.5`,children:[(0,$.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 text-sm font-medium text-fg-muted`,children:[(0,$.jsx)(Ve,{className:`size-4`}),a.advanced]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,children:K.configFields.filter(e=>!e.required).map(e=>(0,$.jsx)(_n,{field:e,value:h[e.key]??``,onChange:t=>g(n=>({...n,[e.key]:t}))},e.key))})]}):null,j?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg bg-emerald-500/10 px-3 py-2 text-sm text-emerald-700 dark:text-emerald-300`,role:`status`,children:e?r===`zh`?`连接已保存`:`Connection saved`:a.enabled}):null,D?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-400`,children:D}):null,(0,$.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,$.jsxs)(X,{variant:`primary`,disabled:!oe||y,onClick:()=>void le(),children:[y?(0,$.jsx)(de,{className:`size-4 animate-spin`}):(0,$.jsx)(u,{className:`size-4`}),(0,$.jsxs)(`span`,{className:`grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:a.enable}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:a.enabling}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:e?y?r===`zh`?`保存中…`:`Saving…`:r===`zh`?`保存图片连接`:`Save image connection`:y?a.enabling:a.enable})]})]})})]}):null,(0,$.jsx)(un,{portalContainer:T?.closest(`[role="dialog"]`),onPendingChange:w,open:N,onOpenChange:P,provider:F,configured:!!(F&&L.find(e=>e.id===F.providerId)?.configured),language:r,onSaved:J})]})}function Sn({disabled:e=!1,modes:t,onPendingChange:n}){let r=b(e=>e.language),i=r===`zh`,[a,o]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>(n?.(a),()=>n?.(!1)),[a,n]);let[s,c]=(0,Q.useState)(``),{data:l,mutate:u,error:d}=k(x(`/api/voice/catalog`),async e=>{let t=await _(e);return We.parse(t.payload)}),f=i?{transcription:`录音转文字`,"transcription.stream":`实时听写 / 语音助手输入`,speech:`消息朗读`,"speech.stream":`语音助手输出`,conversation:`自然语音对话`}:{transcription:`Recorded transcription`,"transcription.stream":`Live dictation / assistant input`,speech:`Message readout`,"speech.stream":`Assistant speech`,conversation:`Natural conversation`},p=async e=>{if(l){o(!0),c(``);try{let t=await _(x(e?`/api/voice/selection`:`/api/voice/catalog/refresh`),{method:e?`PUT`:`POST`,...e?{body:JSON.stringify({revision:l.revision,selection:e})}:{}});await u(We.parse(t.payload),!1),await A()}catch(e){c(e instanceof Error?e.message:String(e)),await u()}finally{o(!1)}}};return(0,$.jsxs)(`section`,{className:`space-y-4 rounded-xl bg-surface-hover/20 p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:i?`XOPC 托管语音模型`:`XOPC managed voice models`}),(0,$.jsx)(X,{variant:`secondary`,disabled:a||e||!l,onClick:()=>void p(),children:i?`刷新目录`:`Refresh catalog`})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`修改在下次调用生效。各设备共用此 Gateway 的配置。`:`Changes apply to the next call and are shared across devices.`}),s||d?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:s||String(d)}):null,l?(0,$.jsx)($.Fragment,{children:t.map(t=>{let n=l.selections.find(e=>e.mode===t),o=l.models.filter(e=>e.voice.modes.includes(t)),s=o.find(e=>e.id===n?.model),c=s?.voice.voices.filter(e=>He(e,t))??[],u=n?.voice??c.find(e=>e.id===s?.voice.defaultVoice)?.id??c[0]?.id??``;return(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[(0,$.jsx)(`span`,{children:f[t]}),(0,$.jsxs)(et,{className:`w-full`,value:n?.model??``,disabled:a||e||!o.length,onChange:e=>void p({mode:t,model:e.target.value}),children:[(0,$.jsx)(Z,{value:``,disabled:!0,children:i?`选择模型`:`Choose model`}),n&&!s?(0,$.jsxs)(Z,{value:n.model,disabled:!0,children:[n.model,` · `,i?`不可用`:`Unavailable`]}):null,o.map(e=>(0,$.jsx)(Z,{value:e.id,children:nt(e,r)},e.id))]}),o.length?null:(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i?`暂无可用模型`:`No available model`})]}),s&&c.length>0?(0,$.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[(0,$.jsx)(`span`,{children:i?`音色`:`Voice`}),(0,$.jsxs)(et,{className:`w-full`,value:u,disabled:a||e,onChange:e=>void p({mode:t,model:s.id,voice:e.target.value}),children:[n?.voice&&!c.some(e=>e.id===n.voice)?(0,$.jsxs)(Z,{value:n.voice,disabled:!0,children:[n.voice,` · `,i?`当前场景不可用`:`Unavailable for this mode`]}):null,c.map(e=>(0,$.jsxs)(Z,{value:e.id,children:[nt(e,r),e.gender?` · ${i?e.gender===`female`?`女声`:`男声`:e.gender}`:``,e.style?` · ${e.style}`:``]},e.id))]}),c.find(e=>e.id===u)?.description?(0,$.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:c.find(e=>e.id===u)?.description}):null]}):null]},t)})}):(0,$.jsx)(De,{className:`h-48 w-full`})]})}function Cn({v:e}){let t=I(e=>e.microphoneId),n=I(e=>e.setMicrophoneId),[r,i]=(0,Q.useState)([]),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(!1),l=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{l.current=!0;let e=()=>{navigator.mediaDevices?.enumerateDevices().then(e=>{l.current&&i(e.filter(e=>e.kind===`audioinput`))}).catch(()=>{})};return e(),navigator.mediaDevices?.addEventListener(`devicechange`,e),()=>{l.current=!1,navigator.mediaDevices?.removeEventListener(`devicechange`,e)}},[]);let u=async()=>{c(!0),o(``);try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop());let e=await navigator.mediaDevices.enumerateDevices();l.current&&i(e.filter(e=>e.kind===`audioinput`))}catch(e){l.current&&o(e instanceof Error?e.message:String(e))}finally{l.current&&c(!1)}};return(0,$.jsxs)(`section`,{className:`space-y-4 rounded-xl bg-surface-hover/20 p-4`,children:[(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,$.jsx)(`span`,{children:e.experience.microphone}),(0,$.jsxs)(et,{value:t,onChange:e=>n(e.target.value),children:[(0,$.jsx)(Z,{value:``,children:e.experience.systemDevice}),t&&!r.some(e=>e.deviceId===t)?(0,$.jsx)(Z,{value:t,children:e.experience.unavailable}):null,r.filter(e=>e.deviceId&&e.deviceId!=="default").map((t,n)=>(0,$.jsx)(Z,{value:t.deviceId,children:t.label||`${e.experience.microphone} ${n+1}`},t.deviceId))]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.experience.deviceHint}),(0,$.jsx)(X,{variant:`secondary`,disabled:s,onClick:()=>void u(),children:e.experience.refreshDevices}),a?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:a}):null]})}var wn=(0,Q.createContext)(null);function Tn(e){let t=(0,an.c)(18),n,r;t[0]===e?(n=t[1],r=t[2]):({to:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let[i]=o(),a=(0,Q.useContext)(wn),s,c;t[3]===r?(s=t[4],c=t[5]):(s=new URLSearchParams(r.split(`?`)[1]??``),c=B(s.get(`configure`)),t[3]=r,t[4]=s,t[5]=c);let u=c,d;t[6]!==a||t[7]!==n||t[8]!==s||t[9]!==u?(d=e=>{n.onClick?.(e),!e.defaultPrevented&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&e.button===0&&a&&u&&s.get(`tab`)===`services`&&(e.preventDefault(),a(u))},t[6]=a,t[7]=n,t[8]=s,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==i||t[12]!==r?(f=St(r,i),t[11]=i,t[12]=r,t[13]=f):f=t[13];let p;return t[14]!==n||t[15]!==d||t[16]!==f?(p=(0,$.jsx)(l,{...n,onClick:d,to:f}),t[14]=n,t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function En(e){let t=(0,an.c)(19),{zh:n}=e,{data:r,error:i,mutate:a}=k(`voice-dictation-route`,Dn),o,s;t[0]===a?(o=t[1],s=t[2]):(o=()=>{let e=()=>{a()};return window.addEventListener(`voice-config-changed`,e),window.addEventListener(`config-reload`,e),()=>{window.removeEventListener(`voice-config-changed`,e),window.removeEventListener(`config-reload`,e)}},s=[a],t[0]=a,t[1]=o,t[2]=s),(0,Q.useEffect)(o,s);let c=n?`同时用于聊天听写`:`Also used for chat dictation`,l;t[3]===c?l=t[4]:(l=(0,$.jsx)(`h2`,{className:`font-medium text-fg`,children:c}),t[3]=c,t[4]=l);let u=n?`默认与录音识别共用模型。已有的独立听写设置会保留。`:`Dictation shares this recognition model. Existing separate dictation settings are preserved.`,d;t[5]===u?d=t[6]:(d=(0,$.jsx)(`p`,{className:`text-fg-muted`,children:u}),t[5]=u,t[6]=d);let f;t[7]!==r||t[8]!==i||t[9]!==n?(f=!r&&!i?(0,$.jsx)(De,{className:`h-5 w-64 max-w-full`}):(0,$.jsx)(`p`,{role:i?`alert`:`status`,className:`text-fg-muted`,children:i?n?`暂时无法读取听写状态。`:`Dictation status could not be loaded.`:r?.mode===`recorded`?n?`当前使用 ${r.provider},点击完成后转为文字。`:`Using ${r.provider}. Choose Finish to transcribe.`:r?.mode===`streaming`?n?`当前使用流式识别${r.provider?` · ${r.provider}`:``}。`:`Using streaming recognition${r.provider?` · ${r.provider}`:``}.`:n?`听写未就绪,请检查识别模型或已有的流式配置。`:`Check the recognition model or existing streaming configuration.`}),t[7]=r,t[8]=i,t[9]=n,t[10]=f):f=t[10];let p;t[11]!==r?.mode||t[12]!==n?(p=r?.mode===`recorded`?null:(0,$.jsx)(Tn,{className:`inline-block text-accent-fg hover:underline`,to:`/settings/capabilities/models?tab=services&configure=transcription`,children:n?`管理识别服务`:`Manage recognition services`}),t[11]=r?.mode,t[12]=n,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==d||t[16]!==f||t[17]!==p?(m=(0,$.jsxs)(`section`,{className:`space-y-2 rounded-xl border border-edge p-4 text-sm`,children:[l,d,f,p]}),t[14]=l,t[15]=d,t[16]=f,t[17]=p,t[18]=m):m=t[18],m}function Dn(){return ze(AbortSignal.timeout(15e3))}function On({v:e,canListen:t,canSpeak:n,disabled:r,onVerified:i}){let a=e.setup,o=(0,Q.useContext)(Ie)?.active??!1,[s,c]=(0,Q.useState)(`idle`),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(``),p=(0,Q.useRef)(`idle`),m=(0,Q.useRef)(null),h=(0,Q.useRef)(!1),g=e=>{p.current=e,c(e)},_=()=>{m.current?.(),m.current=null};(0,Q.useEffect)(()=>()=>m.current?.(),[]);async function v(e){_(),i?.({input:!1,output:!1}),h.current=!1,u(``),f(``),g(e?`connecting`:`playing`);let t=new AbortController,r,o,s,c,l=()=>{o?.cancel(),r?.getTracks().forEach(e=>e.stop()),s?.stop(`surface_closed`)},d=window.setTimeout(()=>v(a.timeout),6e4);m.current=()=>{t.abort(),window.clearTimeout(d),l(),c?.close()};function v(e){t.signal.aborted||(g(`error`),f(e),_())}async function y(){g(`playing`),l();try{let e=await Ht(t.signal);if(t.signal.aborted)return;c?.enqueue(e,()=>{t.signal.aborted||(window.clearTimeout(d),g(`confirm`))})}catch(e){v(e instanceof Error?e.message:a.testFailed)}}try{if(n&&(c=new ft,await c.start(),t.signal.throwIfAborted()),!e){await y();return}let d=window.electronAPI?.system;if(d){let e=await d.requestMicrophone();if(t.signal.throwIfAborted(),e.status===`denied`)throw Error(a.microphoneDenied)}if(r=await navigator.mediaDevices.getUserMedia({audio:rt()}),t.signal.aborted){l();return}if(s=await Y.connect({purpose:`dictation`,signal:t.signal,onEvent:e=>{t.signal.aborted||(e.type===`session.error`&&v(a.testFailed),p.current===`listening`&&(e.type===`input.transcript.delta`&&u(e.payload.text),e.type===`input.transcript.final`&&e.payload.text.trim()&&(u(e.payload.text.trim()),h.current=!0,n?y():(g(`passed`),i?.({input:!0,output:!1}),_()))))},onClose:()=>{(p.current===`listening`||p.current===`connecting`)&&v(a.testFailed)}}),t.signal.aborted){l();return}let f;if(o=await ae.start(r,{onSamples:e=>{f&&!t.signal.aborted&&s?.sendAudio(f.push(e))}}),t.signal.aborted){l();return}f=new fe(o.sampleRate,s.session.inputFormat.sampleRate),g(`listening`)}catch(e){if(t.signal.aborted){l();return}v(e instanceof Error?e.message:a.testFailed)}}let y=s===`connecting`||s===`listening`||s===`playing`;return(0,$.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-surface-base/45 p-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(X,{type:`button`,variant:`primary`,disabled:o||r||!t||y,onClick:()=>void v(!0),children:[y?(0,$.jsx)(de,{className:`size-4 animate-spin`}):(0,$.jsx)(jt,{className:`size-4`}),n?a.test:a.testInput]}),(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:o||r||!n||y,onClick:()=>void v(!1),children:[(0,$.jsx)(kt,{className:`size-4`}),e.tts.test.play]}),y?(0,$.jsxs)(X,{type:`button`,variant:`ghost`,onClick:()=>{_(),g(`idle`)},children:[(0,$.jsx)(Re,{className:`size-4`}),e.tts.test.stop]}):null]}),(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`space-y-2 text-xs text-fg-muted`,children:[s===`idle`?(0,$.jsx)(`p`,{children:o?e.experience.endCallBeforeTest:r?a.saveBeforeTest:a.microphoneHint}):null,s===`connecting`?(0,$.jsx)(`p`,{children:a.connecting}):null,s===`listening`?(0,$.jsx)(`p`,{children:a.speakNow}):null,l?(0,$.jsx)(`p`,{className:`rounded-lg bg-surface-base p-3 text-sm text-fg`,children:l}):null,s===`playing`?(0,$.jsx)(`p`,{children:a.playing}):null,s===`confirm`?(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{children:a.heardQuestion}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>{_(),i?.({input:h.current,output:!0}),g(`passed`)},children:a.heard}),(0,$.jsx)(X,{type:`button`,variant:`ghost`,onClick:()=>{_(),g(`error`),f(a.notHeard)},children:a.notHeardButton})]}):null,s===`passed`?(0,$.jsx)(`p`,{children:h.current?n?a.passed:a.inputPassed:a.outputPassed}):null,s===`error`?(0,$.jsx)(`p`,{role:`alert`,className:`text-red-600 dark:text-red-400`,children:d}):null]})]})}function kn(e){let t=(0,an.c)(78),{section:n,v:r,form:i,pending:a,onChange:o}=e,s=b(Pn),c=r.setup,l;t[0]===i?l=t[1]:(l=JSON.stringify(i),t[0]=i,t[1]=l);let u=l,d;t[2]===u?d=t[3]:(d={signature:u,input:!1,output:!1},t[2]=u,t[3]=d);let[f,p]=(0,Q.useState)(d);f.signature!==u&&p({signature:u,input:!1,output:!1});let m;t[4]!==a||t[5]!==u?(m=a?null:[`voice-realtime-status`,u],t[4]=a,t[5]=u,t[6]=m):m=t[6];let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!0},t[7]=h):h=t[7];let{data:g,error:_,isLoading:v}=k(m,qt,h),y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=x(`/api/voice/catalog`),t[8]=y):y=t[8];let{data:S}=k(y,Nn),C=i.voice.realtime,w=C.tts,T=w?.provider??g?.tts?.provider,E=g?.tts?.model,D;t[9]!==E||t[10]!==T?(D=T&&E?[`realtime-voices`,T,E]:null,t[9]=E,t[10]=T,t[11]=D):D=t[11];let O;t[12]!==E||t[13]!==T?(O=()=>Ut(T,E,`realtime`),t[12]=E,t[13]=T,t[14]=O):O=t[14];let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1},t[15]=A):A=t[15];let{data:j}=k(D,O,A),M;t[16]===j?M=t[17]:(M=j===void 0?[]:j,t[16]=j,t[17]=M);let N=M,P=N,F;t[18]===N?F=t[19]:(F=N.filter(Mn),t[18]=N,t[19]=F);let I=F,L=C.defaultEngine===`omni`,R=L?C.omni?.voice??``:w?.voice??``,ee;t[20]!==S?.models||t[21]!==L||t[22]!==I||t[23]!==C.omni||t[24]!==P?(ee=L&&C.omni?.provider===`qwen-token-plan-cn`?[{id:C.omni.voice,name:C.omni.voice}]:L?C.omni?.provider===`xopc-cloud`?S?.models.find(e=>e.id===C.omni?.model)?.voice.voices.filter(jn)??[]:I.length?I:[`Cherry`,`Ethan`,`Serena`,`Chelsie`].map(An):P,t[20]=S?.models,t[21]=L,t[22]=I,t[23]=C.omni,t[24]=P,t[25]=ee):ee=t[25];let z=ee,B=!!(g?.enabled&&g.stt),V=!!(g?.enabled&&g.tts),H;t[26]!==i||t[27]!==o||t[28]!==C?(H=e=>o({...i,voice:{...i.voice,realtime:{...C,...e}}}),t[26]=i,t[27]=o,t[28]=C,t[29]=H):H=t[29];let te=H,U;t[30]!==a||t[31]!==C.enabled||t[32]!==c.disabled||t[33]!==c.needsSetup||t[34]!==c.pending||t[35]!==c.unverified||t[36]!==c.verified||t[37]!==u||t[38]!==f.signature?(U=(e,t)=>C.enabled?a?c.pending:e?t&&f.signature===u?c.verified:c.unverified:c.needsSetup:c.disabled,t[30]=a,t[31]=C.enabled,t[32]=c.disabled,t[33]=c.needsSetup,t[34]=c.pending,t[35]=c.unverified,t[36]=c.verified,t[37]=u,t[38]=f.signature,t[39]=U):U=t[39];let ne=U,W;t[40]!==R||t[41]!==s||t[42]!==L||t[43]!==T||t[44]!==C.bargeIn||t[45]!==C.defaultEngine||t[46]!==C.enabled||t[47]!==C.omni||t[48]!==C.tts||t[49]!==c.bargeIn||t[50]!==c.defaultVoice||t[51]!==c.enable||t[52]!==c.voice||t[53]!==n||t[54]!==w||t[55]!==g?.tts||t[56]!==te||t[57]!==r.experience||t[58]!==r.realtime||t[59]!==z?(W=n===`listening`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:c.enable}),(0,$.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":C.enabled,className:`ui-checkbox`,checked:C.enabled,onChange:e=>te({enabled:e.target.checked})})]}),(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,$.jsx)(`span`,{children:r.experience.defaultMode}),(0,$.jsxs)(et,{value:C.defaultEngine,className:ge,onChange:e=>te({defaultEngine:e.target.value}),children:[(0,$.jsx)(Z,{value:`agent`,children:r.experience.assistant}),(0,$.jsx)(Z,{value:`omni`,children:r.experience.natural})]})]}),(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[C.defaultEngine===`agent`?r.experience.assistantHint:r.experience.naturalHint,` `,r.experience.nextCall]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsx)(`label`,{htmlFor:`realtime-voice`,className:`text-sm font-medium text-fg`,children:c.voice}),(0,$.jsxs)(et,{id:`realtime-voice`,className:`${ge} w-full sm:w-56`,value:R,disabled:L?!C.omni:!w&&!g?.tts,onChange:e=>{if(L&&C.omni){te({omni:{...C.omni,voice:e.target.value}});return}if(T===`alibaba`||T===`xopc-cloud`){let t={...C.tts,provider:T};e.target.value?t.voice=e.target.value:delete t.voice,te({tts:t})}},children:[L?null:(0,$.jsx)(Z,{value:``,children:c.defaultVoice}),R&&!z.some(e=>e.id===R)?(0,$.jsx)(Z,{value:R,children:R}):null,z.map(e=>(0,$.jsxs)(Z,{value:e.id,children:[nt(e,s),`gender`in e&&e.gender?` · ${e.gender===`female`?`女声`:`男声`}`:``,`style`in e&&e.style?` · ${e.style}`:``]},e.id))]}),(()=>{let e=z.find(e=>e.id===R);return e&&`description`in e&&typeof e.description==`string`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.description}):null})()]}),(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-4 text-sm text-fg`,children:[(0,$.jsxs)(`span`,{children:[c.bargeIn,(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:r.realtime.bargeInDescription})]}),(0,$.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":C.bargeIn,checked:C.bargeIn,className:`size-4 accent-accent`,onChange:e=>te({bargeIn:e.target.checked})})]})]}):null,t[40]=R,t[41]=s,t[42]=L,t[43]=T,t[44]=C.bargeIn,t[45]=C.defaultEngine,t[46]=C.enabled,t[47]=C.omni,t[48]=C.tts,t[49]=c.bargeIn,t[50]=c.defaultVoice,t[51]=c.enable,t[52]=c.voice,t[53]=n,t[54]=w,t[55]=g?.tts,t[56]=te,t[57]=r.experience,t[58]=r.realtime,t[59]=z,t[60]=W):W=t[60];let G;t[61]!==B||t[62]!==V||t[63]!==_||t[64]!==v||t[65]!==a||t[66]!==n||t[67]!==u||t[68]!==g||t[69]!==ne||t[70]!==r||t[71]!==f.input||t[72]!==f.output?(G=n===`diagnostics`?(0,$.jsxs)($.Fragment,{children:[v?(0,$.jsx)(De,{className:`h-16 w-full`}):(0,$.jsxs)(`div`,{className:`space-y-2 text-sm`,role:`status`,children:[(0,$.jsxs)(`p`,{children:[r.experience.dictationReady,` · `,ne(B,f.input)]}),(0,$.jsxs)(`p`,{children:[r.experience.agentReady,` · `,ne(B&&V,f.input&&f.output)]}),(0,$.jsxs)(`p`,{children:[r.experience.omniReady,` · `,ne(!!(g?.enabled&&g.omni),!1)]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.experience.configurationOnly}),(0,$.jsx)(On,{v:r,canListen:B,canSpeak:V,disabled:a||v||!!_,onVerified:e=>p({signature:u,...e})},`${u}:${JSON.stringify(g)}`)]}):null,t[61]=B,t[62]=V,t[63]=_,t[64]=v,t[65]=a,t[66]=n,t[67]=u,t[68]=g,t[69]=ne,t[70]=r,t[71]=f.input,t[72]=f.output,t[73]=G):G=t[73];let K;return t[74]!==c.service||t[75]!==W||t[76]!==G?(K=(0,$.jsxs)(`section`,{className:`space-y-5 rounded-xl bg-surface-hover/20 p-4 sm:p-5`,"aria-label":c.service,children:[W,G]}),t[74]=c.service,t[75]=W,t[76]=G,t[77]=K):K=t[77],K}function An(e){return{id:e,name:e}}function jn(e){return He(e,`conversation`)}function Mn(e){return[`Cherry`,`Ethan`,`Serena`,`Chelsie`].includes(e.id)}async function Nn(e){return We.parse((await _(e)).payload)}function Pn(e){return e.language}function Fn(e){let t=(0,an.c)(19),{value:n,onChange:r}=e,i=b(In)===`zh`,a=i?`通话指令`:`Conversation instructions`,o;t[0]===a?o=t[1]:(o=(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:a}),t[0]=a,t[1]=o);let s=i?`通话会接续当前会话。可在这里调整语气与回答方式。`:`Calls continue the current conversation. Adjust tone and response style here.`,c;t[2]===s?c=t[3]:(c=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s}),t[2]=s,t[3]=c);let l=i?`通话指令`:`Conversation instructions`,u;t[4]===l?u=t[5]:(u=(0,$.jsx)(`span`,{children:l}),t[4]=l,t[5]=u);let d;t[6]!==r||t[7]!==n?(d=e=>r({...n,instructions:e.target.value}),t[6]=r,t[7]=n,t[8]=d):d=t[8];let f;t[9]!==d||t[10]!==n.instructions?(f=(0,$.jsx)(`textarea`,{className:`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,rows:3,maxLength:8e3,value:n.instructions,onChange:d}),t[9]=d,t[10]=n.instructions,t[11]=f):f=t[11];let p;t[12]!==u||t[13]!==f?(p=(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[u,f]}),t[12]=u,t[13]=f,t[14]=p):p=t[14];let m;return t[15]!==o||t[16]!==c||t[17]!==p?(m=(0,$.jsxs)(`details`,{className:`space-y-3 rounded-xl bg-surface-hover/20 p-4`,children:[o,c,p]}),t[15]=o,t[16]=c,t[17]=p,t[18]=m):m=t[18],m}function In(e){return e.language}var Ln=le;function Rn(){return g(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,Oe,`dark:border-edge`)}function zn(){return g(ge,le)}function Bn(e){return!e||e<=0?``:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Vn(e,t){let n=window.atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return URL.createObjectURL(new Blob([r],{type:t}))}function Hn(e,t){switch(e){case`xopc-cloud`:return t.setup.hosted;case`openai`:return t.stt.openai;case`alibaba`:return t.stt.alibaba;case`groq`:return`Groq`;default:return e}}function Un(e,t){switch(e){case`xopc-cloud`:return t.setup.hosted;case`openai`:return t.tts.providerOpenai;case`alibaba`:return t.stt.alibaba;case`edge`:return t.tts.providerEdge;case`minimax`:return`MiniMax`;default:return e}}function Wn(e,t){switch(e){case`edge`:return t.tts.providerHints.edge;case`openai`:return t.tts.providerHints.openai;case`alibaba`:return t.tts.providerHints.alibaba;case`minimax`:return t.tts.providerHints.minimax;default:return t.tts.providerHints.generic}}function Gn(e){return{maskedHelp:e.apiKeyMaskedHelp,copy:e.apiKeyCopy,copied:e.apiKeyCopied,show:e.apiKeyShow,hide:e.apiKeyHide,notInConfigFile:e.apiKeyNotInConfigFile,loadFailed:e.apiKeyRevealFailed}}function Kn(e,t){let n=e[t.key];return typeof n==`string`||typeof n==`number`||typeof n==`boolean`?n:t.defaultValue===void 0?t.type===`boolean`?!1:``:t.defaultValue}function qn(e,t){if(e.type===`boolean`)return!!t;if(e.type!==`number`)return t;let n=String(t).trim();if(!n)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function Jn(e,t){switch(t.type){case`reset`:return{form:null,baseline:null};case`sync`:{let e=structuredClone(t.value);return{form:e,baseline:structuredClone(e)}}case`update`:return{...e,form:t.updater(e.form)};case`saved`:{let n=structuredClone(t.value);return{form:e.form!==null&&JSON.stringify(e.form)!==JSON.stringify(t.value)?e.form:n,baseline:structuredClone(n)}}}}function Yn(e){let t=(0,an.c)(4),[n,r]=(0,Q.useState)(0),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>r(Xn),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==e?(a=(0,$.jsx)(Zn,{...e,onReload:i},n),t[1]=n,t[2]=e,t[3]=a):a=t[3],a}function Xn(e){return e+1}function Zn({capability:e,onPendingChange:t,disabled:n=!1,onReload:r}){let i=b(e=>e.language),a=h(i).voiceSettings,o=I(e=>e.captions),s=I(e=>e.setCaptions),c=!!v(e=>e.conversationId),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useReducer)(Jn,{form:null,baseline:null}),p=d.form,m=d.baseline,[g,_]=(0,Q.useState)(null),y=(0,Q.useRef)(!1),S=(0,Q.useRef)({}),C=(0,Q.useRef)(p);C.current=p;let w=(0,Q.useRef)({parsed:null,models:void 0}),{data:T,error:E,isLoading:D,mutate:O}=j(c),{data:A,error:M,isLoading:N,mutate:P}=k(c?x(`/api/voice/models`):null,Gt,{revalidateOnFocus:!1}),{data:F,error:L,isLoading:R}=k(c?x(`/api/voice/providers`):null,Vt,{revalidateOnFocus:!1}),{data:ee,error:z,isLoading:B}=k(c?x(`/api/voice/stt-providers`):null,Wt,{revalidateOnFocus:!1}),V=(0,Q.useMemo)(()=>F?.providers??[],[F]),te=(0,Q.useMemo)(()=>ee?.providers??[],[ee]),U=(0,Q.useMemo)(()=>T?.payload?.config===void 0?null:Kt(T.payload.config),[T]),ne=(0,Q.useMemo)(()=>!p||!m?!1:JSON.stringify(p)!==JSON.stringify(m),[p,m]);c?U!==null&&A!==void 0&&!y.current&&(w.current.parsed!==U||w.current.models!==A)&&(w.current={parsed:U,models:A},S.current=Jt(T?.payload?.config),f({type:`sync`,value:U}),_(A)):(w.current.parsed!==null||w.current.models!==void 0)&&(w.current={parsed:null,models:void 0},f({type:`reset`}),_(null),y.current=!1);let W=!!(c&&(U===null||A===void 0||F===void 0||ee===void 0)&&(D||N||R||B)),G=E instanceof Error?E.message:E?String(E):M instanceof Error?M.message:M?String(M):L instanceof Error?L.message:L?String(L):z instanceof Error?z.message:z?String(z):null,K=(0,Q.useCallback)(e=>{y.current=!0,f({type:`update`,updater:t=>t?{...t,stt:{...t.stt,...e},...e.provider&&e.provider!==`xopc-cloud`?{voice:{...t.voice,realtime:{...t.voice.realtime,stt:void 0}}}:{}}:null})},[]),re=(0,Q.useCallback)(e=>{y.current=!0,f({type:`update`,updater:t=>{if(!t)return null;let n=t.stt.fallback??{enabled:!1,order:[]};return{...t,stt:{...t.stt,fallback:{...n,...e}}}}})},[]),ie=(0,Q.useCallback)(e=>{y.current=!0,f({type:`update`,updater:t=>t?{...t,voice:{...t.voice,input:{...t.voice.input,refinement:{...t.voice.input.refinement,...e}}}}:null})},[]),ae=(0,Q.useCallback)(e=>{y.current=!0,f({type:`update`,updater:t=>t?{...t,voice:{...t.voice,languageMode:e,...e===`auto`?{language:i}:{}}}:null})},[i]),oe=(0,Q.useCallback)(e=>{y.current=!0,f({type:`update`,updater:t=>t?{...t,voice:{...t.voice,realtime:{...t.voice.realtime,...e}}}:null})},[]),se=(0,Q.useCallback)(e=>{y.current=!0,f({type:`update`,updater:t=>t?{...t,tts:{...t.tts,...e}}:null})},[]),q=Rt({value:p,dirty:ne,onSave:(0,Q.useCallback)(async t=>{try{let n=await zt(t,e,S.current[e]);S.current={...S.current,...n},f({type:`saved`,value:t}),y.current=!!(C.current&&JSON.stringify(C.current)!==JSON.stringify(t))}catch(e){throw Error(e instanceof Error?e.message:a.saveError)}},[a.saveError,e])});(0,Q.useEffect)(()=>{t?.(ne||q.status===`saving`||l)},[ne,q.status,l,t]),(0,Q.useEffect)(()=>()=>t?.(!1),[t]);let ce=(0,Q.useCallback)(e=>{y.current=!0,f({type:`update`,updater:()=>e})},[]);if(!c)return(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.needToken})});if(W)return(0,$.jsx)(H,{rows:4});if(!p||g===null)return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:G??a.loadError}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>{O(),P()},children:a.retry})]});let J=p.stt,le=p.tts,Y=p.voice.input.refinement,ue=Gn(a);return(0,$.jsxs)(`fieldset`,{disabled:n||l,className:`flex min-w-0 flex-col gap-4`,onBlurCapture:q.error?void 0:q.onBlurCapture,children:[(0,$.jsx)(Lt,{status:q.status,error:q.error}),q.error?(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(X,{variant:`secondary`,onClick:q.retry,children:i===`zh`?`重试保存`:`Retry saving`}),(0,$.jsx)(X,{variant:`ghost`,onClick:()=>{O().then(()=>r()).catch(()=>{})},children:i===`zh`?`重新加载(放弃未保存更改)`:`Reload and discard unsaved changes`})]}):null,e===`transcription`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(En,{zh:i===`zh`}),(0,$.jsx)(er,{managedModel:!0,v:a,apiKeyLabels:ue,stt:J,models:g,sttProviders:te,updateStt:K,updateSttFallback:re}),(0,$.jsx)($n,{v:a,voice:p.voice,updateLanguageMode:ae}),(0,$.jsxs)(`details`,{"data-voice-section":`input-processing`,className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[a.experience.inputProcessing,` · `,Y.mode===`off`?a.stt.refinementOff:Y.mode===`punctuation`?a.stt.refinementPunctuation:Y.mode===`light`?a.stt.refinementLight:a.setup.advanced]}),(0,$.jsxs)(`label`,{className:`mt-4 block space-y-2 text-sm`,children:[(0,$.jsx)(`span`,{children:a.stt.refinement}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.stt.refinementDesc}),(0,$.jsxs)(et,{className:zn(),value:Y.mode,onChange:e=>ie({mode:e.target.value}),children:[(0,$.jsx)(Z,{value:`off`,children:a.stt.refinementOff}),(0,$.jsx)(Z,{value:`punctuation`,children:a.stt.refinementPunctuation}),(0,$.jsx)(Z,{value:`light`,children:a.stt.refinementLight}),Y.mode===`custom`?(0,$.jsx)(Z,{value:`custom`,children:a.setup.advanced}):null]})]})]}),J.provider===`xopc-cloud`?(0,$.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:i===`zh`?`实时听写`:`Live dictation`}),(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(Sn,{modes:[`transcription.stream`],disabled:ne||q.status===`saving`,onPendingChange:u})})]}):null]}):e===`speech`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(nr,{managedModel:!0,v:a,apiKeyLabels:ue,tts:le,models:g,ttsProviders:V,updateTts:se}),(0,$.jsx)(Qn,{v:a,tts:le,updateTts:se})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(kn,{section:`listening`,v:a,form:p,pending:ne||q.status===`saving`||!!q.error,onChange:ce}),p.voice.realtime.defaultEngine===`omni`&&p.voice.realtime.omni?(0,$.jsx)(Fn,{value:p.voice.realtime.omni,onChange:e=>oe({omni:e})}):null,(0,$.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(12rem,18rem)] sm:items-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.experience.pace}),(0,$.jsxs)(et,{className:zn(),value:String(p.voice.realtime.silenceDurationMs),onChange:e=>oe({silenceDurationMs:Number(e.target.value)}),children:[(0,$.jsx)(Z,{value:`800`,children:a.experience.fast}),(0,$.jsx)(Z,{value:`1200`,children:a.experience.standard}),(0,$.jsx)(Z,{value:`2000`,children:a.experience.relaxed}),[800,1200,2e3].includes(p.voice.realtime.silenceDurationMs)?null:(0,$.jsxs)(Z,{value:String(p.voice.realtime.silenceDurationMs),children:[p.voice.realtime.silenceDurationMs,` ms`]})]})]})}),(0,$.jsxs)(`label`,{className:`flex items-center justify-between text-sm`,children:[a.experience.captions,(0,$.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":o,className:`ui-checkbox`,checked:o,onChange:e=>s(e.target.checked)})]}),p.voice.realtime.defaultEngine===`agent`&&J.provider===`xopc-cloud`?(0,$.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:i===`zh`?`语音助手输出`:`Assistant speech output`}),(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(Sn,{modes:[`speech.stream`],disabled:ne||q.status===`saving`,onPendingChange:u})})]}):null,(0,$.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:i===`zh`?`麦克风、扬声器与诊断`:`Microphone, speakers and diagnostics`}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsx)(Cn,{v:a}),(0,$.jsx)(kn,{section:`diagnostics`,v:a,form:p,pending:ne||q.status===`saving`||!!q.error,onChange:ce})]})]})]})]})}function Qn(e){let t=(0,an.c)(29),{v:n,tts:r,updateTts:i}=e,a;t[0]===n.setup.readout?a=t[1]:(a=(0,$.jsx)(`span`,{className:`font-medium`,children:n.setup.readout}),t[0]=n.setup.readout,t[1]=a);let o=n.setup.readout,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=zn(),t[2]=s):s=t[2];let c=r.enabled?r.trigger:`off`,l;t[3]===i?l=t[4]:(l=e=>i({enabled:e.target.value!==`off`,trigger:e.target.value}),t[3]=i,t[4]=l);let u;t[5]===n.tts.triggerOff?u=t[6]:(u=(0,$.jsx)(Z,{value:`off`,children:n.tts.triggerOff}),t[5]=n.tts.triggerOff,t[6]=u);let d;t[7]===n.tts.triggerInbound?d=t[8]:(d=(0,$.jsx)(Z,{value:`inbound`,children:n.tts.triggerInbound}),t[7]=n.tts.triggerInbound,t[8]=d);let f;t[9]===n.tts.triggerAlways?f=t[10]:(f=(0,$.jsx)(Z,{value:`always`,children:n.tts.triggerAlways}),t[9]=n.tts.triggerAlways,t[10]=f);let p;t[11]===n.tts.triggerTagged?p=t[12]:(p=(0,$.jsx)(Z,{value:`tagged`,children:n.tts.triggerTagged}),t[11]=n.tts.triggerTagged,t[12]=p);let m;t[13]!==c||t[14]!==l||t[15]!==u||t[16]!==d||t[17]!==f||t[18]!==p||t[19]!==n.setup.readout?(m=(0,$.jsxs)(et,{"aria-label":o,className:s,value:c,onChange:l,children:[u,d,f,p]}),t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f,t[18]=p,t[19]=n.setup.readout,t[20]=m):m=t[20];let h;t[21]!==a||t[22]!==m?(h=(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[a,m]}),t[21]=a,t[22]=m,t[23]=h):h=t[23];let g;t[24]===n.setup.readoutHint?g=t[25]:(g=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.setup.readoutHint}),t[24]=n.setup.readoutHint,t[25]=g);let _;return t[26]!==h||t[27]!==g?(_=(0,$.jsxs)(`section`,{className:`space-y-2 rounded-xl bg-surface-hover/20 p-4 sm:p-5`,children:[h,g]}),t[26]=h,t[27]=g,t[28]=_):_=t[28],_}function $n(e){let t=(0,an.c)(22),{v:n,voice:r,updateLanguageMode:i}=e,a;t[0]===n.language.title?a=t[1]:(a=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.language.title}),t[0]=n.language.title,t[1]=a);let o=r.languageMode===`auto`?n.language.autoDescription:n.language.manualDescription,s;t[2]===o?s=t[3]:(s=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:o}),t[2]=o,t[3]=s);let c;t[4]!==a||t[5]!==s?(c=(0,$.jsxs)(`div`,{children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=zn(),t[7]=l):l=t[7];let u;t[8]===i?u=t[9]:(u=e=>i(e.target.value),t[8]=i,t[9]=u);let d;t[10]===n.language.auto?d=t[11]:(d=(0,$.jsx)(Z,{value:`auto`,children:n.language.auto}),t[10]=n.language.auto,t[11]=d);let f;t[12]===n.language.manual?f=t[13]:(f=(0,$.jsx)(Z,{value:`manual`,children:n.language.manual}),t[12]=n.language.manual,t[13]=f);let p;t[14]!==u||t[15]!==d||t[16]!==f||t[17]!==r.languageMode?(p=(0,$.jsxs)(et,{className:l,value:r.languageMode,onChange:u,children:[d,f]}),t[14]=u,t[15]=d,t[16]=f,t[17]=r.languageMode,t[18]=p):p=t[18];let m;return t[19]!==c||t[20]!==p?(m=(0,$.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(12rem,18rem)] sm:items-center`,children:[c,p]})}),t[19]=c,t[20]=p,t[21]=m):m=t[21],m}function er(e){let t=(0,an.c)(65),{v:n,apiKeyLabels:r,stt:i,models:a,sttProviders:o,updateStt:s,updateSttFallback:c,managedModel:l}=e,u=l===void 0?!1:l,d;if(t[0]!==o){let e=new Set;d=[];for(let t of o)e.has(t.id)||(e.add(t.id),d.push(t));t[0]=o,t[1]=d}else d=t[1];let f=d,p,m,h,_;if(t[2]!==a||t[3]!==f||t[4]!==i.provider||t[5]!==i.providers){p=f.find(e=>e.id===i.provider);let e;t[10]!==i.provider||t[11]!==i.providers?(e=i.providers?.[i.provider]??{},t[10]=i.provider,t[11]=i.providers,t[12]=e):e=t[12],h=e,m=a?.stt?.[i.provider]?.length?a.stt[i.provider]:p?.models??[],_=p?.fields.find(tr),t[2]=a,t[3]=f,t[4]=i.provider,t[5]=i.providers,t[6]=p,t[7]=m,t[8]=h,t[9]=_}else p=t[6],m=t[7],h=t[8],_=t[9];let v=_,y=typeof h.model==`string`?h.model:void 0,b=y??(typeof v?.defaultValue==`string`?v.defaultValue:m[0]?.id),x;t[13]!==i.provider||t[14]!==i.providers||t[15]!==s?(x=e=>{s({providers:{...i.providers??{},[i.provider]:{...i.providers?.[i.provider]??{},...e}}})},t[13]=i.provider,t[14]=i.providers,t[15]=s,t[16]=x):x=t[16];let S=x,C,w;t[17]!==y||t[18]!==b||t[19]!==u||t[20]!==v||t[21]!==S?(C=()=>{!u&&v&&b&&y!==b&&S({model:b})},w=[u,y,b,v,S],t[17]=y,t[18]=b,t[19]=u,t[20]=v,t[21]=S,t[22]=C,t[23]=w):(C=t[22],w=t[23]),(0,Q.useEffect)(C,w);let T;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(jt,{"aria-hidden":`true`,className:`size-4 text-accent`,strokeWidth:1.75}),t[24]=T):T=t[24];let E;t[25]===n.stt.title?E=t[26]:(E=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[T,n.stt.title]}),t[25]=n.stt.title,t[26]=E);let D;t[27]===n.stt.enable?D=t[28]:(D=(0,$.jsx)(`span`,{children:n.stt.enable}),t[27]=n.stt.enable,t[28]=D);let O;t[29]===s?O=t[30]:(O=e=>s({enabled:e.target.checked}),t[29]=s,t[30]=O);let k;t[31]!==i.enabled||t[32]!==O?(k=(0,$.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":i.enabled,className:`ui-checkbox`,checked:i.enabled,onChange:O}),t[31]=i.enabled,t[32]=O,t[33]=k):k=t[33];let A;t[34]!==k||t[35]!==D?(A=(0,$.jsxs)(`label`,{className:`flex min-h-10 items-center gap-2 text-xs text-fg-muted`,children:[D,k]}),t[34]=k,t[35]=D,t[36]=A):A=t[36];let j;t[37]!==A||t[38]!==E?(j=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[E,A]}),t[37]=A,t[38]=E,t[39]=j):j=t[39];let M;t[40]===n.stt.description?M=t[41]:(M=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.stt.description}),t[40]=n.stt.description,t[41]=M);let N;t[42]!==j||t[43]!==M?(N=(0,$.jsxs)(`div`,{className:`mb-4`,children:[j,M]}),t[42]=j,t[43]=M,t[44]=N):N=t[44];let P;t[45]!==p?.fields||t[46]!==r||t[47]!==b||t[48]!==u||t[49]!==m||t[50]!==f||t[51]!==h||t[52]!==i.enabled||t[53]!==i.fallback?.enabled||t[54]!==i.provider||t[55]!==S||t[56]!==s||t[57]!==c||t[58]!==n?(P=i.enabled?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[u?null:(0,$.jsxs)(`div`,{className:g(`flex flex-col gap-1.5`,Ln),children:[(0,$.jsx)(ur,{children:n.stt.provider}),(0,$.jsx)(et,{"aria-label":n.stt.provider,className:zn(),value:i.provider,onChange:e=>s({provider:e.target.value}),children:f.map(e=>(0,$.jsxs)(Z,{value:e.id,children:[Hn(e.id,n),e.configured?``:` *`]},e.id))})]}),(0,$.jsx)(rr,{managedModel:u,kind:`stt`,providerId:i.provider,fields:p?.fields??[],providerSlice:h,models:m,currentModel:b,apiKeyLabels:r,onPatch:S})]}),i.provider===`alibaba`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.setup.keyHint}):null,(0,$.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:n.stt.fallback}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.stt.fallback}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.stt.fallbackDesc})]}),(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i.fallback?.enabled??!1,onChange:e=>c({enabled:e.target.checked})})]})]})]}):null,t[45]=p?.fields,t[46]=r,t[47]=b,t[48]=u,t[49]=m,t[50]=f,t[51]=h,t[52]=i.enabled,t[53]=i.fallback?.enabled,t[54]=i.provider,t[55]=S,t[56]=s,t[57]=c,t[58]=n,t[59]=P):P=t[59];let F;t[60]===P?F=t[61]:(F=(0,$.jsx)(`div`,{className:`space-y-4`,children:P}),t[60]=P,t[61]=F);let I;return t[62]!==N||t[63]!==F?(I=(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:[N,F]}),t[62]=N,t[63]=F,t[64]=I):I=t[64],I}function tr(e){return e.key===`model`}function nr({v:e,apiKeyLabels:t,tts:n,models:r,ttsProviders:i,updateTts:a,managedModel:o=!1}){let[s,c]=(0,Q.useState)(e.tts.test.sampleText),[l,u]=(0,Q.useState)({status:`idle`}),d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useCallback)(()=>{p.current?.abort(),p.current=null,d.current?.pause(),d.current=null,f.current&&=(URL.revokeObjectURL(f.current),null)},[]),h=(0,Q.useMemo)(()=>{let e=new Set,t=[];for(let n of i)e.has(n.id)||(e.add(n.id),t.push(n));return t},[i]),_=h.find(e=>e.id===n.provider),v=n.providers?.[n.provider]??{},y=r?.tts?.[n.provider]?.length?r.tts[n.provider]:_?.models??[],b=_?.fields.find(e=>e.key===`model`),x=_?.fields.find(e=>e.key===`voice`),S=typeof v.model==`string`?v.model:void 0,C=S??(typeof b?.defaultValue==`string`?b.defaultValue:y[0]?.id),w=y.find(e=>e.id===C),T=r?.ttsVoices?.[n.provider]?.length?r.ttsVoices[n.provider]:_?.voices??[],{data:E=[]}=k(C?`voice:tts:${n.provider}:${C}`:null,()=>Ut(n.provider,C??``),{revalidateOnFocus:!1}),D=E.length>0?E:T,O=typeof v.voice==`string`?v.voice:void 0,A=O??D.find(e=>e.id===w?.tts?.defaultVoice)?.id??(typeof x?.defaultValue==`string`?x.defaultValue:D[0]?.id),j=(_?.fields??[]).filter(e=>(e.key!==`speed`||w?.tts?.speed!==!1)&&(e.key!==`instructions`||w?.tts?.instructions!==!1)),M=(0,Q.useCallback)(e=>{a({providers:{...n.providers??{},[n.provider]:{...n.providers?.[n.provider]??{},...e}}})},[n.provider,n.providers,a]);(0,Q.useEffect)(()=>{if(o)return;let e={};b&&C&&S!==C&&(e.model=C),x&&A&&O!==A&&(e.voice=A),Object.keys(e).length>0&&M(e)},[o,S,O,C,A,b,M,x]),(0,Q.useEffect)(()=>()=>m(),[m]);let N=(0,Q.useCallback)(e=>{a({provider:e}),u({status:`idle`})},[a]),P=(0,Q.useCallback)(async()=>{let t=s.trim();if(!t){u({status:`error`,message:e.tts.test.emptyText});return}m();let r=new AbortController;p.current=r,u({status:`loading`});try{let i=await Bt({text:t,provider:n.provider,providerConfig:v,...C?{model:C}:{},...A?{voice:A}:{}},r.signal);if(r.signal.aborted)return;let a=Vn(i.audio,i.mimeType);f.current=a;let o=new Audio(a);d.current=o;let s=[i.provider,i.format,i.latencyMs===void 0?void 0:`${i.latencyMs}ms`,Bn(i.audioSize)].filter(Boolean).join(` · `);o.addEventListener(`ended`,()=>u({status:`done`,summary:s}),{once:!0}),o.addEventListener(`error`,()=>u({status:`error`,message:e.tts.test.playFailed}),{once:!0}),await o.play(),u({status:`playing`,summary:s})}catch(e){if(r.signal.aborted)return;m(),u({status:`error`,message:e instanceof Error?e.message:String(e)})}},[C,A,v,m,s,n.provider,e.tts.test.emptyText,e.tts.test.playFailed]);return(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mb-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(xt,{className:`size-4 text-accent`,strokeWidth:1.75}),e.tts.title]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.tts.description})]}),(0,$.jsx)(`div`,{className:`space-y-4`,children:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:o?null:(0,$.jsxs)(`div`,{className:g(`flex flex-col gap-1.5`,Ln),children:[(0,$.jsx)(ur,{children:e.tts.provider}),(0,$.jsx)(et,{"aria-label":e.tts.provider,className:zn(),value:n.provider,onChange:e=>N(e.target.value),children:h.map(t=>(0,$.jsx)(Z,{value:t.id,children:Un(t.id,e)},t.id))}),(0,$.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[_?.configured?e.tts.configured:_?.diagnostics.requiresApiKey?`${e.tts.needsKey} · ${_.diagnostics.envKeys?.join(`, `)??e.stt.apiKey}`:e.tts.noKeyNeeded,` · `,_?.description??Wn(n.provider,e)]})]})}),(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:(0,$.jsx)(rr,{managedModel:o,kind:`tts`,providerId:n.provider,fields:j,providerSlice:v,models:y,voices:D,currentModel:C,currentVoice:A,apiKeyLabels:t,onPatch:M,resetVoiceOnModelChange:!0})}),(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-panel/80 p-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:e.tts.test.title}),(0,$.jsxs)(`div`,{className:`mt-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,$.jsx)(`div`,{children:(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.tts.test.description})}),(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,$.jsxs)(X,{type:`button`,variant:`primary`,onClick:()=>void P(),disabled:l.status===`loading`,className:`h-9`,children:[l.status===`loading`?(0,$.jsx)(de,{className:`size-4 animate-spin`}):(0,$.jsx)(kt,{className:`size-4`}),l.status===`loading`?e.tts.test.generating:e.tts.test.play]}),(0,$.jsxs)(X,{type:`button`,variant:`secondary`,onClick:()=>{m(),u(e=>e.status===`playing`?{status:`done`,summary:e.summary}:{status:`idle`})},disabled:l.status!==`playing`,className:`h-9`,children:[(0,$.jsx)(Re,{className:`size-4`}),e.tts.test.stop]})]})]}),(0,$.jsxs)(`details`,{className:`mt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:e.setup.sampleText}),(0,$.jsx)(`textarea`,{className:g(Rn(),`mt-3 min-h-20 resize-y`),value:s,onChange:e=>c(e.target.value),maxLength:1e3})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2 text-xs`,children:[(0,$.jsxs)(`span`,{className:`text-fg-subtle`,children:[s.length,`/1000`]}),l.status===`playing`||l.status===`done`?(0,$.jsxs)(`span`,{className:`text-emerald-700 dark:text-emerald-200`,children:[l.status===`playing`?e.tts.test.playing:e.tts.test.ready,` · `,l.summary]}):null,l.status===`error`?(0,$.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:l.message}):null]})]})]})]})})]})}function rr(e){let t=(0,an.c)(48),{kind:n,providerId:r,fields:i,providerSlice:a,models:o,voices:s,currentModel:c,currentVoice:l,apiKeyLabels:u,onPatch:d,resetVoiceOnModelChange:f,managedModel:p}=e,m;t[0]===s?m=t[1]:(m=s===void 0?[]:s,t[0]=s,t[1]=m);let _=m,v=f===void 0?!1:f,y=p===void 0?!1:p,x=b(sr),S;t[2]===x?S=t[3]:(S=h(x),t[2]=x,t[3]=S);let C=S.voiceSettings,w=y,T=or,E=ar,D,O,k;if(t[4]!==u||t[5]!==c||t[6]!==l||t[7]!==i||t[8]!==n||t[9]!==x||t[10]!==y||t[11]!==o||t[12]!==d||t[13]!==r||t[14]!==a||t[15]!==v||t[16]!==w||t[17]!==C||t[18]!==_){let e;t[22]===w?e=t[23]:(e=e=>!w||e.key!==`model`&&!E(e),t[22]=w,t[23]=e);let s=i.filter(e),f;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>!T(e),t[24]=f):f=t[24];let p=s.filter(f),m;t[25]!==u||t[26]!==c||t[27]!==l||t[28]!==n||t[29]!==x||t[30]!==y||t[31]!==o||t[32]!==d||t[33]!==r||t[34]!==a||t[35]!==v||t[36]!==C||t[37]!==_?(m=e=>e.map(e=>y&&e.key===`model`?null:e.key===`apiKey`?(0,$.jsxs)(`div`,{className:g(`flex flex-col gap-1.5`,Ln),children:[(0,$.jsx)(ur,{htmlFor:`voice-${n}-${r}-api-key`,children:C.stt.apiKey}),(0,$.jsx)(Yt,{kind:n,providerId:r,fieldId:`voice-${n}-${r}-api-key`,value:typeof a.apiKey==`string`?a.apiKey:``,onChange:e=>d({apiKey:e}),labels:u,placeholder:e.placeholder}),e.description?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:e.description}):null]},e.key):e.key===`model`&&o.length>0?(0,$.jsxs)(`div`,{className:g(`flex flex-col gap-1.5`,Ln),children:[(0,$.jsx)(ur,{htmlFor:`voice-${n}-${r}-model`,children:C.stt.model}),(0,$.jsx)(et,{id:`voice-${n}-${r}-model`,className:zn(),value:c??``,onChange:e=>d({model:e.target.value,...v?{voice:void 0}:{}}),children:o.map(ir)})]},e.key):e.key===`voice`&&_.length>0?(0,$.jsxs)(`div`,{className:g(`flex flex-col gap-1.5`,Ln),children:[(0,$.jsx)(ur,{htmlFor:`voice-${n}-${r}-voice`,children:C.tts.voice}),(0,$.jsxs)(et,{id:`voice-${n}-${r}-voice`,className:zn(),value:l??``,onChange:e=>d({voice:e.target.value}),children:[l&&!_.some(e=>e.id===l)?(0,$.jsxs)(Z,{value:l,children:[l,` · unavailable`]}):null,_.map(e=>(0,$.jsxs)(Z,{value:e.id,children:[nt(e,x),e.gender?` · ${e.gender===`female`?`女声`:`男声`}`:``,e.style?` · ${e.style}`:``]},e.id))]}),_.find(e=>e.id===l)?.description?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:_.find(e=>e.id===l)?.description}):null]},e.key):(0,$.jsx)(cr,{fieldId:`voice-${n}-${r}-${e.key}`,field:e,value:Kn(a,e),onChange:t=>d({[e.key]:t}),className:e.type===`textarea`?`sm:col-span-2`:Ln},e.key)),t[25]=u,t[26]=c,t[27]=l,t[28]=n,t[29]=x,t[30]=y,t[31]=o,t[32]=d,t[33]=r,t[34]=a,t[35]=v,t[36]=C,t[37]=_,t[38]=m):m=t[38];let h=m;t[39]!==i||t[40]!==n||t[41]!==x||t[42]!==w?(D=w&&i.some(E)?(0,$.jsx)(Tn,{className:`text-sm text-accent-fg hover:underline`,to:`/settings/capabilities/models?tab=services&configure=${n===`stt`?`transcription`:`speech`}`,children:x===`zh`?`管理服务连接`:`Manage service connection`}):null,t[39]=i,t[40]=n,t[41]=x,t[42]=w,t[43]=D):D=t[43],O=h(s.filter(T)),k=p.length?(0,$.jsxs)(`details`,{className:`rounded-lg border border-edge p-3 sm:col-span-2`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:C.experience.providerOptions}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:h(p)})]}):null,t[4]=u,t[5]=c,t[6]=l,t[7]=i,t[8]=n,t[9]=x,t[10]=y,t[11]=o,t[12]=d,t[13]=r,t[14]=a,t[15]=v,t[16]=w,t[17]=C,t[18]=_,t[19]=D,t[20]=O,t[21]=k}else D=t[19],O=t[20],k=t[21];let A;return t[44]!==D||t[45]!==O||t[46]!==k?(A=(0,$.jsxs)($.Fragment,{children:[D,O,k]}),t[44]=D,t[45]=O,t[46]=k,t[47]=A):A=t[47],A}function ir(e){return(0,$.jsx)(Z,{value:e.id,children:e.name},e.id)}function ar(e){return e.secret||e.type===`password`||[`apiKey`,`baseUrl`,`region`,`groupId`].includes(e.key)}function or(e){return e.required||[`apiKey`,`model`,`voice`].includes(e.key)}function sr(e){return e.language}function cr(e){let t=(0,an.c)(37),{fieldId:n,field:r,value:i,onChange:a,className:o}=e,s=n??`voice-schema-field-${r.key}`,c=r.description;if(r.type===`boolean`){let e;t[0]===o?e=t[1]:(e=g(`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,o),t[0]=o,t[1]=e);let n;t[2]===r.label?n=t[3]:(n=(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.label}),t[2]=r.label,t[3]=n);let s;t[4]===c?s=t[5]:(s=c?(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:c}):null,t[4]=c,t[5]=s);let l;t[6]!==n||t[7]!==s?(l=(0,$.jsxs)(`span`,{children:[n,s]}),t[6]=n,t[7]=s,t[8]=l):l=t[8];let u=!!i,d;t[9]!==r||t[10]!==a?(d=e=>a(qn(r,e.target.checked)),t[9]=r,t[10]=a,t[11]=d):d=t[11];let f;t[12]!==u||t[13]!==d?(f=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:u,onChange:d}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==e||t[16]!==l||t[17]!==f?(p=(0,$.jsxs)(`label`,{className:e,children:[l,f]}),t[15]=e,t[16]=l,t[17]=f,t[18]=p):p=t[18],p}let l=typeof i==`boolean`?``:String(i),u;t[19]===o?u=t[20]:(u=g(`flex flex-col gap-1.5`,o),t[19]=o,t[20]=u);let d;t[21]!==r.label||t[22]!==s?(d=(0,$.jsx)(ur,{htmlFor:s,children:r.label}),t[21]=r.label,t[22]=s,t[23]=d):d=t[23];let f;t[24]!==o||t[25]!==r||t[26]!==l||t[27]!==s||t[28]!==a?(f=r.type===`select`?(0,$.jsx)(et,{id:s,className:zn(),value:l,required:r.required,onChange:e=>a(qn(r,e.target.value)),children:(r.options??[]).map(lr)}):r.type===`textarea`?(0,$.jsx)(`textarea`,{id:s,className:g(Rn(),`min-h-24 resize-y`),value:l,required:r.required,placeholder:r.placeholder,onChange:e=>a(qn(r,e.target.value))}):r.type===`password`?(0,$.jsx)(xe,{id:s,className:o,value:l,onChange:e=>a(qn(r,e)),placeholder:r.placeholder,labels:R}):r.type===`number`?(0,$.jsx)(Mt,{id:s,className:Rn(),autoComplete:r.secret?`new-password`:`off`,spellCheck:!1,value:l,required:r.required,allowEmpty:!r.required,placeholder:r.placeholder,min:r.min,max:r.max,step:r.step,onChange:e=>a(qn(r,e.target.value))}):(0,$.jsx)(`input`,{id:s,className:Rn(),type:`text`,autoComplete:r.secret?`new-password`:`off`,spellCheck:!1,value:l,required:r.required,placeholder:r.placeholder,min:r.min,max:r.max,step:r.step,onChange:e=>a(qn(r,e.target.value))}),t[24]=o,t[25]=r,t[26]=l,t[27]=s,t[28]=a,t[29]=f):f=t[29];let p;t[30]===c?p=t[31]:(p=c?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:c}):null,t[30]=c,t[31]=p);let m;return t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p?(m=(0,$.jsxs)(`div`,{className:u,children:[d,f,p]}),t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m):m=t[36],m}function lr(e){return(0,$.jsx)(Z,{value:e.id,children:e.name},e.id)}function ur(e){let t=(0,an.c)(3),{children:n,htmlFor:r}=e,i;return t[0]!==n||t[1]!==r?(i=r?(0,$.jsx)(`label`,{htmlFor:r,className:`text-sm font-medium text-fg`,children:n}):(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function dr(e){return e.some(e=>e.disabled?!1:e.type===`searxng`?e.url.trim().length>0:e.apiKey.trim().length>0)}function fr(e){let t=e&&typeof e==`object`&&`tools`in e?e.tools:void 0,n=t&&typeof t==`object`&&`web`in t?t.web:void 0,r=n&&typeof n==`object`&&`region`in n?n.region:void 0,i=r===`cn`||r===`global`?r:`auto`,a=n&&typeof n==`object`&&`search`in n?n.search:void 0,o=a&&typeof a==`object`?a:{},s=typeof o.maxResults==`number`&&Number.isFinite(o.maxResults)?Math.floor(o.maxResults):5,c=n&&typeof n==`object`&&`blocklist`in n?n.blocklist:void 0,l=c&&typeof c==`object`?c:{},u=Array.isArray(l.domains)?l.domains.filter(e=>typeof e==`string`&&e.trim().length>0):[],d=o.providers;return{regionMode:i,maxResults:s,providers:Array.isArray(d)?d.map((e,t)=>{let n=e&&typeof e==`object`?e:{},r=n.type,i=r===`brave`||r===`tavily`||r===`bing`||r===`searxng`||r===`deepseek`?r:`brave`;return{clientKey:`search-provider-${t}`,type:i,apiKey:typeof n.apiKey==`string`?n.apiKey:``,url:typeof n.url==`string`?n.url:``,disabled:n.disabled===!0}}):[],blocklistEnabled:l.enabled===!0,blocklistDomains:u}}async function pr(e){let t=e.regionMode===`auto`?`auto`:e.regionMode===`cn`?`cn`:`global`,n={maxResults:e.maxResults,providers:e.providers.map(e=>{let t={type:e.type,apiKey:e.apiKey};return(e.type===`searxng`||e.type===`deepseek`)&&e.url.trim()&&(t.url=e.url.trim().replace(/\/+$/,``)),e.disabled&&(t.disabled=!0),t})};await _(x(`/api/config`),{method:`PATCH`,body:JSON.stringify({tools:{web:{region:t,search:n,blocklist:{enabled:e.blocklistEnabled,domains:e.blocklistDomains}}}})}),A()}async function mr(e){let t=await _(x(`/api/tools/web/reveal-search-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({index:e})});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}function hr(e){let t=(0,an.c)(8),{label:n,description:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function gr(){return g(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,Oe,`dark:border-edge`)}function _r(){return g(ge,le)}var vr=[`brave`,`tavily`,`bing`,`searxng`,`deepseek`];function yr(){return{clientKey:crypto.randomUUID(),type:`brave`,apiKey:``,url:``,disabled:!1}}var br=it();function xr(){let e=h(b(e=>e.language)),t=e.webSearchSettings,n=e.logs,r=!!v(e=>e.conversationId),[i,a]=(0,Q.useReducer)(br,{form:null,baseline:null}),o=i.form,s=i.baseline,c=(0,Q.useRef)(!1),l=(0,Q.useRef)(o);l.current=o;let u=(0,Q.useRef)(null),{data:d,error:f,isLoading:m,mutate:_}=j(r);ht({enabled:r,parsed:(0,Q.useMemo)(()=>d?.payload?.config===void 0?null:fr(d.payload.config),[d]),dirty:c.current,trackedParsedRef:u,dispatch:a,onResetDirty:()=>{c.current=!1}});let y=!!(r&&m&&d===void 0&&!f),x=f instanceof Error?f.message:f?String(f):null,S=(0,Q.useMemo)(()=>!o||!s?!1:JSON.stringify(o)!==JSON.stringify(s),[o,s]),C=(0,Q.useCallback)(e=>{c.current=!0,a({type:`patch`,patch:e})},[]),w=Rt({value:o,dirty:S,onSave:(0,Q.useCallback)(async e=>{try{await pr(e),a({type:`saved`,value:e}),c.current=!!(l.current&&JSON.stringify(l.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});if(!r)return(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})});if(y)return(0,$.jsx)(H,{rows:3});if(!o)return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:x??t.loadError}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>void _(),children:n.refresh})]});let T=dr(o.providers);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,onBlurCapture:w.onBlurCapture,children:[w.error?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:w.error}):null,(0,$.jsxs)(It,{children:[(0,$.jsx)(Ft,{icon:bt,title:t.sectionSearch,subtitle:t.sectionSearchHint,trailing:(0,$.jsx)(Lt,{status:w.status,error:w.error})}),(0,$.jsxs)(`div`,{className:`flex max-w-2xl flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-edge bg-surface-base/55 px-4 py-3`,children:[(0,$.jsx)(Be,{className:`mt-0.5 size-5 shrink-0 text-accent`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.cloudProvider}),(0,$.jsx)(`span`,{className:g(`rounded-full px-2 py-0.5 text-[11px] font-medium`,T?`bg-surface-panel text-fg-muted`:`bg-accent-soft text-accent`),children:T?t.cloudOverridden:t.cloudAutomatic})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-subtle`,children:T?t.cloudOverriddenHint:t.cloudAutomaticHint})]})]}),(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:t.providersTitle}),o.providers.map((n,r)=>(0,$.jsx)(Sr,{row:n,providerIndex:r,labels:t,secretLabels:ot(e.providersSettings),onChange:e=>{let t=[...o.providers];t[r]=e,C({providers:t})},onRemove:()=>{C({providers:o.providers.filter((e,t)=>t!==r)})}},n.clientKey??r)),(0,$.jsxs)(X,{type:`button`,variant:`secondary`,className:`w-fit gap-1.5 text-sm`,onClick:()=>C({providers:[...o.providers,yr()]}),children:[(0,$.jsx)(p,{className:`size-4`}),t.addProvider]})]})]}),(0,$.jsxs)(It,{children:[(0,$.jsx)(Ft,{icon:Ve,title:t.sectionPreferences}),(0,$.jsxs)(`div`,{className:`grid max-w-2xl gap-4 sm:grid-cols-2`,children:[(0,$.jsx)(hr,{label:t.regionLabel,description:t.regionDesc,children:(0,$.jsxs)(et,{className:_r(),value:o.regionMode,onChange:e=>C({regionMode:e.target.value}),children:[(0,$.jsx)(Z,{value:`auto`,children:t.regionAuto}),(0,$.jsx)(Z,{value:`cn`,children:t.regionCn}),(0,$.jsx)(Z,{value:`global`,children:t.regionGlobal})]})}),(0,$.jsx)(ie,{title:t.maxResultsLabel,summary:o.maxResults,children:(0,$.jsx)(hr,{label:t.maxResultsLabel,description:t.maxResultsDesc,children:(0,$.jsx)(Mt,{type:`number`,min:1,max:50,className:gr(),value:o.maxResults,onChange:e=>C({maxResults:Math.max(1,Math.min(50,Number(e.target.value)||5))})})})})]})]}),(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[t.sectionBlocklist,` · `,o.blocklistEnabled?o.blocklistDomains.length:0]}),(0,$.jsxs)(It,{children:[(0,$.jsx)(Ft,{icon:F,title:t.sectionBlocklist,subtitle:t.sectionBlocklistHint}),(0,$.jsxs)(`div`,{className:`flex max-w-2xl flex-col gap-4`,children:[(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:o.blocklistEnabled,onChange:e=>C({blocklistEnabled:e.target.checked})}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:t.blocklistEnabled}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:t.blocklistEnabledDesc})]})]}),o.blocklistEnabled?(0,$.jsx)(hr,{label:t.blocklistDomains,description:t.blocklistDomainsDesc,children:(0,$.jsx)(`textarea`,{className:g(gr(),`min-h-[6rem] font-mono text-xs`),value:o.blocklistDomains.join(`
8
- `),placeholder:t.blocklistDomainsPlaceholder,onChange:e=>{C({blocklistDomains:e.target.value.split(/\r?\n/).flatMap(e=>{let t=e.trim().toLowerCase();return t?[t]:[]})})}})}):null]})]})]})]})}function Sr(e){let t=(0,an.c)(56),{row:n,providerIndex:r,labels:i,secretLabels:a,onChange:o,onRemove:s}=e,c;t[0]===r?c=t[1]:(c=()=>mr(r).then(Cr),t[0]=r,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=g(_r(),`min-w-[8rem]`),t[2]=u):u=t[2];let d=n.type,f;t[3]!==o||t[4]!==n?(f=e=>o({...n,type:e.target.value,url:``,apiKey:``}),t[3]=o,t[4]=n,t[5]=f):f=t[5];let p;t[6]===i.providerTypes?p=t[7]:(p=vr.map(e=>(0,$.jsx)(Z,{value:e,children:i.providerTypes[e]},e)),t[6]=i.providerTypes,t[7]=p);let m;t[8]!==n.type||t[9]!==f||t[10]!==p?(m=(0,$.jsx)(et,{className:u,value:d,onChange:f,children:p}),t[8]=n.type,t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]!==o||t[13]!==n?(h=e=>o({...n,disabled:e.target.checked}),t[12]=o,t[13]=n,t[14]=h):h=t[14];let _;t[15]!==n.disabled||t[16]!==h?(_=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:n.disabled,onChange:h}),t[15]=n.disabled,t[16]=h,t[17]=_):_=t[17];let v;t[18]!==i.disabled||t[19]!==_?(v=(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs text-fg-muted`,children:[_,i.disabled]}),t[18]=i.disabled,t[19]=_,t[20]=v):v=t[20];let y;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(be,{className:`size-4`}),t[21]=y):y=t[21];let b;t[22]===s?b=t[23]:(b=(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-fg-muted`,onClick:s,children:y}),t[22]=s,t[23]=b);let x;t[24]!==b||t[25]!==v?(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[v,b]}),t[24]=b,t[25]=v,t[26]=x):x=t[26];let S;t[27]!==x||t[28]!==m?(S=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[m,x]}),t[27]=x,t[28]=m,t[29]=S):S=t[29];let C;t[30]!==i.deepseekUrlDesc||t[31]!==i.deepseekUrlLabel||t[32]!==i.urlDesc||t[33]!==i.urlLabel||t[34]!==o||t[35]!==n?(C=n.type===`searxng`||n.type===`deepseek`?(0,$.jsx)(hr,{label:n.type===`deepseek`?i.deepseekUrlLabel:i.urlLabel,description:n.type===`deepseek`?i.deepseekUrlDesc:i.urlDesc,children:(0,$.jsx)(`input`,{type:`url`,className:gr(),value:n.url,placeholder:n.type===`deepseek`?`https://api.deepseek.com`:`http://localhost:8080`,onChange:e=>o({...n,url:e.target.value})})}):null,t[30]=i.deepseekUrlDesc,t[31]=i.deepseekUrlLabel,t[32]=i.urlDesc,t[33]=i.urlLabel,t[34]=o,t[35]=n,t[36]=C):C=t[36];let w;t[37]!==o||t[38]!==n?(w=e=>o({...n,apiKey:e}),t[37]=o,t[38]=n,t[39]=w):w=t[39];let T;t[40]!==i.keyPlaceholder||t[41]!==i.keyPlaceholderMasked||t[42]!==i.saveError||t[43]!==l||t[44]!==n.apiKey||t[45]!==a||t[46]!==w?(T=(0,$.jsx)(xe,{value:n.apiKey,onChange:w,placeholder:i.keyPlaceholder,labels:a,reveal:l,loadFailedLabel:i.saveError,notInConfigFile:i.keyPlaceholderMasked}),t[40]=i.keyPlaceholder,t[41]=i.keyPlaceholderMasked,t[42]=i.saveError,t[43]=l,t[44]=n.apiKey,t[45]=a,t[46]=w,t[47]=T):T=t[47];let E;t[48]!==i.apiKeyDesc||t[49]!==i.apiKeyLabel||t[50]!==T?(E=(0,$.jsx)(hr,{label:i.apiKeyLabel,description:i.apiKeyDesc,children:T}),t[48]=i.apiKeyDesc,t[49]=i.apiKeyLabel,t[50]=T,t[51]=E):E=t[51];let D;return t[52]!==S||t[53]!==C||t[54]!==E?(D=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-surface-panel/60 p-4`,children:[S,C,E]}),t[52]=S,t[53]=C,t[54]=E,t[55]=D):D=t[55],D}function Cr(e){return e.apiKey??null}function wr(e,t,n=[]){return e.filter(e=>!n.includes(e.providerId)&&e.uses.some(e=>e.id===t&&e.choices.length>0))}function Tr(e){let t=(0,an.c)(75),{use:n,data:r,language:i,labels:a,onSaved:o,inline:s,onPendingChange:c,onEditingChange:l}=e,u=s===void 0?!1:s,d=i===`zh`,[f,p]=(0,Q.useState)(),[m,h]=(0,Q.useState)(!1),g;t[0]===c?g=t[1]:(g=e=>{h(e),c?.(e)},t[0]=c,t[1]=g);let _=g,v=n===`transcription`?`stt`:n===`speech`?`tts`:void 0,y,b,x;if(t[2]!==r.builtinRows||t[3]!==r.cards||t[4]!==r.customConfig?.providers||t[5]!==r.loading||t[6]!==n){let e=new Set(r.cards.filter(e=>!Pe(e.id)||!!r.customConfig?.providers?.[e.id]).map(Pr));y=[...new Set([...r.builtinRows.map(Nr),...e])].filter(t=>!Pe(t)||e.has(t)).sort(),b=k,x=r.loading?null:[`capability-service-connections`,n,y.join(`,`)],t[2]=r.builtinRows,t[3]=r.cards,t[4]=r.customConfig?.providers,t[5]=r.loading,t[6]=n,t[7]=y,t[8]=b,t[9]=x}else y=t[7],b=t[8],x=t[9];let S;t[10]!==y||t[11]!==n||t[12]!==v?(S=async()=>{let e=v===`stt`?await Wt():v===`tts`?await Vt():void 0,t=e?.providers.filter(Mr).map(jr),r=e?.providers.filter(Ar).map(kr)??[],i=t?y.filter(e=>t.includes(e)):y,a=await Promise.allSettled(i.map(Ee));return{services:wr(a.flatMap(Or),n,r),failed:a.some(Dr)}},t[10]=y,t[11]=n,t[12]=v,t[13]=S):S=t[13];let C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[14]=C):C=t[14];let{data:w,error:T,isLoading:E,mutate:D}=b(x,S,C),O;t[15]===w?.services?O=t[16]:(O=new Set(w?.services.map(Er)),t[15]=w?.services,t[16]=O);let A=O,j,M;if(t[17]!==l||t[18]!==f?(j=()=>(l?.(!!f),()=>l?.(!1)),M=[f,l],t[17]=l,t[18]=f,t[19]=j,t[20]=M):(j=t[19],M=t[20]),(0,Q.useEffect)(j,M),f&&u){let e;if(t[21]!==r.builtinRows||t[22]!==f){let n;t[24]===f?n=t[25]:(n=e=>e.id===f,t[24]=f,t[25]=n),e=r.builtinRows.find(n),t[21]=r.builtinRows,t[22]=f,t[23]=e}else e=t[23];let a;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>p(void 0),t[26]=a):a=t[26];let s;t[27]!==D||t[28]!==o?(s=()=>{D(),p(void 0),o()},t[27]=D,t[28]=o,t[29]=s):s=t[29];let c;return t[30]!==i||t[31]!==f||t[32]!==_||t[33]!==e||t[34]!==s||t[35]!==n?(c=(0,$.jsx)(`section`,{className:`overflow-hidden rounded-xl border border-edge`,children:(0,$.jsx)(Et,{inline:!0,providerId:f,row:e,targetUse:n,language:i,onPendingChange:_,onDone:a,onApplied:s},f)}),t[30]=i,t[31]=f,t[32]=_,t[33]=e,t[34]=s,t[35]=n,t[36]=c):c=t[36],c}let N=d?`选择服务`:`Choose a service`,P;t[37]===N?P=t[38]:(P=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:N}),t[37]=N,t[38]=P);let F;t[39]!==r.loading||t[40]!==E?(F=r.loading||E?(0,$.jsx)(De,{className:`h-24 w-full`}):null,t[39]=r.loading,t[40]=E,t[41]=F):F=t[41];let I;t[42]!==w?.failed||t[43]!==T||t[44]!==D||t[45]!==d?(I=T||w?.failed?(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:[d?`部分服务目录暂时不可用。`:`Some service catalogs are unavailable.`,(0,$.jsx)(X,{variant:`ghost`,onClick:()=>void D(),children:d?`重试`:`Retry`})]}):null,t[42]=w?.failed,t[43]=T,t[44]=D,t[45]=d,t[46]=I):I=t[46];let L;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(L=[!0,!1],t[47]=L):L=t[47];let R;t[48]!==m||t[49]!==w?.services||t[50]!==d?(R=L.map(e=>{let t=w?.services.filter(t=>t.configured===e)??[];return t.length?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:e?d?`已连接`:`Connected`:d?`添加服务`:`Add a service`}),t.map(t=>(0,$.jsxs)(`button`,{type:`button`,disabled:m,onClick:()=>p(t.providerId),className:`flex min-h-14 w-full items-center justify-between gap-3 rounded-lg px-3 py-3 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,$.jsx)(`span`,{className:`min-w-0 text-sm font-medium text-fg`,children:U(t.providerId,t.profile.name,d)}),(0,$.jsx)(`span`,{className:`shrink-0 text-sm text-accent-fg`,children:e?d?`选择`:`Choose`:d?`连接`:`Connect`})]},t.providerId))]},String(e)):null}),t[48]=m,t[49]=w?.services,t[50]=d,t[51]=R):R=t[51];let ee;t[52]!==w||t[53]!==d?(ee=w&&!w.services.length&&!w.failed?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d?`暂无支持此能力的模型服务。`:`No model services currently support this capability.`}):null,t[52]=w,t[53]=d,t[54]=ee):ee=t[54];let z=d?`仅列出支持${Tt[n][0]}的服务。`:`Only compatible services are shown. Reuse saved credentials, then return to select a model.`,B;t[55]===z?B=t[56]:(B=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:z}),t[55]=z,t[56]=B);let V;t[57]!==r.builtinRows||t[58]!==r.customConfig||t[59]!==A||t[60]!==a||t[61]!==i||t[62]!==D||t[63]!==o||t[64]!==f||t[65]!==n?(V=f?(0,$.jsx)(Ot,{open:!0,initialProviderId:f,initialUse:n,connectOnly:!0,onOpenChange:e=>{e||p(void 0)},builtinRows:r.builtinRows.filter(e=>A.has(e.id)),customConfig:r.customConfig,labels:a,language:i,onSaved:()=>{D(),p(void 0),o()}},f):null,t[57]=r.builtinRows,t[58]=r.customConfig,t[59]=A,t[60]=a,t[61]=i,t[62]=D,t[63]=o,t[64]=f,t[65]=n,t[66]=V):V=t[66];let H;return t[67]!==P||t[68]!==F||t[69]!==I||t[70]!==R||t[71]!==ee||t[72]!==B||t[73]!==V?(H=(0,$.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4`,children:[P,F,I,R,ee,B,V]}),t[67]=P,t[68]=F,t[69]=I,t[70]=R,t[71]=ee,t[72]=B,t[73]=V,t[74]=H):H=t[74],H}function Er(e){return e.providerId}function Dr(e){return e.status===`rejected`}function Or(e){return e.status===`fulfilled`?[e.value]:[]}function kr(e){return e.id}function Ar(e){return e.diagnostics.requiresApiKey}function jr(e){return e.id}function Mr(e){return!e.diagnostics.requiresApiKey}function Nr(e){return e.id}function Pr(e){return e.id}function Fr({zh:e,kind:t,modelServiceIds:n,onSaved:r,onPendingChange:i}){let{data:a,error:o,mutate:s}=k([`native-voice-connections`,t??`all`,n.join(`,`)],async()=>{let[e,r]=await Promise.all([t===`tts`?Promise.resolve({providers:[]}):Wt(),t===`stt`?Promise.resolve({providers:[]}):Vt()]);return[...e.providers.map(e=>({...e,kind:`stt`})),...r.providers.map(e=>({...e,kind:`tts`}))].filter(e=>e.diagnostics.requiresApiKey||!n.includes(e.id))}),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(!1),[h,g]=(0,Q.useState)(``);(0,Q.useEffect)(()=>(i?.(f),()=>i?.(!1)),[f,i]);let v=a?.find(e=>`${e.kind}:${e.id}`===c),y=v?.fields.filter(e=>e.secret||e.type===`password`||[`baseUrl`,`region`,`groupId`].includes(e.key))??[],b=async()=>{if(!(!v||m.current)){m.current=!0,p(!0),g(``);try{let t=Object.fromEntries(Object.entries(u).filter(([,e])=>e.trim()).map(([e,t])=>[e,t.trim()]));Object.keys(t).length&&await _(x(`/api/config`),{method:`PATCH`,body:JSON.stringify({[v.kind]:{providers:{[v.id]:t}}})});let[n]=await Promise.all([s(),Ue()]);if(!n?.find(e=>e.kind===v.kind&&e.id===v.id)?.configured)throw Error(e?`连接尚未就绪,请补齐所需凭据。`:`Connection is not ready. Complete the required credentials.`);d({}),r()}catch(e){g(e instanceof Error?e.message:String(e))}finally{m.current=!1,p(!1)}}};return a&&!a.length?null:(0,$.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:e?`其他语音服务与本地语音`:`Other voice services and local speech`}),(0,$.jsxs)(`section`,{className:`mt-4 space-y-4`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t===`stt`?e?`其他识别服务`:`Other recognition services`:t===`tts`?e?`其他合成服务与本地语音`:`Other synthesis services and local speech`:e?`语音 API 与本地语音`:`Voice APIs and local speech`}),!a&&!o?(0,$.jsx)(De,{className:`h-20 w-full`}):null,o?(0,$.jsxs)(`p`,{role:`alert`,children:[e?`语音服务加载失败`:`Could not load voice services`,(0,$.jsx)(X,{variant:`ghost`,onClick:()=>void s(),children:e?`重试`:`Retry`})]}):null,(0,$.jsxs)(et,{value:c,disabled:f,"aria-label":e?`语音服务接入`:`Connect voice service`,onChange:e=>{l(e.target.value),d({}),g(``)},children:[(0,$.jsx)(Z,{value:``,children:e?`选择语音来源`:`Choose a voice source`}),a?.map(n=>(0,$.jsxs)(Z,{value:`${n.kind}:${n.id}`,children:[n.displayName,t?``:` · ${n.kind.toUpperCase()}`,n.configured?e?` · 已连接`:` · Connected`:``]},`${n.kind}:${n.id}`))]}),v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:v.diagnostics.requiresApiKey?e?`此服务使用独立的 API Key。保存连接后,可在“模型与参数”中选用。`:`This service uses its own API key. Save the connection, then choose it in Model and parameters.`:e?`此来源无需 API Key,可返回能力设置选择。`:`No API key needed. Choose this source in capability settings.`}),y.map(t=>(0,$.jsxs)(`label`,{className:`block space-y-1 text-sm text-fg`,children:[(0,$.jsx)(`span`,{children:t.label}),t.secret||t.type===`password`?(0,$.jsx)(xe,{labels:R,value:u[t.key]??``,onChange:e=>d(n=>({...n,[t.key]:e})),disabled:f}):t.options?.length?(0,$.jsxs)(et,{value:u[t.key]??``,disabled:f,onChange:e=>d(n=>({...n,[t.key]:e.target.value})),children:[(0,$.jsx)(Z,{value:``,children:e?`保留现有值`:`Keep existing`}),t.options.map(e=>(0,$.jsx)(Z,{value:e.id,children:e.name},e.id))]}):(0,$.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-panel p-2`,value:u[t.key]??``,disabled:f,placeholder:t.placeholder,onChange:e=>d(n=>({...n,[t.key]:e.target.value}))})]},t.key)),h?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:h}):null,(0,$.jsx)(X,{disabled:f||!v.configured&&v.diagnostics.requiresApiKey&&!Object.values(u).some(e=>e.trim()),onClick:()=>void b(),children:f?e?`保存中…`:`Saving…`:e?`保存连接`:`Save connection`})]}):null]})]})}function Ir(e){let t=(0,an.c)(40),{label:n,value:r,currentLabel:i,options:a,loading:o,disabled:s,zh:c,onConnect:l,onSelect:u}=e,[d,f]=(0,Q.useState)(``),p;if(t[0]!==a||t[1]!==d){let e=d.trim().toLowerCase().split(/\s+/).filter(Boolean);p=a.filter(t=>{let n=`${t.label} ${t.group} ${t.value} ${t.searchText??``}`.toLowerCase();return e.every(e=>n.includes(e))}),t[0]=a,t[1]=d,t[2]=p}else p=t[2];let m=p,h;if(t[3]!==a||t[4]!==r){let e;t[6]===r?e=t[7]:(e=e=>e.value===r,t[6]=r,t[7]=e),h=a.find(e),t[3]=a,t[4]=r,t[5]=h}else h=t[5];let g=h,_;t[8]!==a||t[9]!==g?.group||t[10]!==r?(_=g?.group??a.find(e=>e.value.split(`/`)[0]===r?.split(`/`)[0])?.group,t[8]=a,t[9]=g?.group,t[10]=r,t[11]=_):_=t[11];let v=_,y;t[12]!==i||t[13]!==g?.label||t[14]!==r||t[15]!==c?(y=g?.label??(r?.endsWith(`/default`)?c?`默认模型`:`Default model`:i??r),t[12]=i,t[13]=g?.label,t[14]=r,t[15]=c,t[16]=y):y=t[16];let b=y,x=v?`${b} · ${v}`:b;if(!o&&!a.length){let e=`${c?`连接`:`Connect`} ${n}`,r=c?`连接服务以启用`:`Connect a service to enable`,i;return t[17]!==s||t[18]!==l||t[19]!==e||t[20]!==r?(i=(0,$.jsx)(X,{variant:`secondary`,className:`min-h-11 w-full sm:justify-start`,"aria-label":e,disabled:s,onClick:l,children:r}),t[17]=s,t[18]=l,t[19]=e,t[20]=r,t[21]=i):i=t[21],i}let S=r??``,C=c?`选择模型`:`Choose a model`,w=`${c?`选择`:`Select`} ${n}`,T=c?`搜索模型或服务`:`Search models or services`,E=m.length?void 0:c?`没有可用模型`:`No available models`,D;t[22]!==s||t[23]!==m||t[24]!==o||t[25]!==b||t[26]!==u||t[27]!==d||t[28]!==x||t[29]!==S||t[30]!==C||t[31]!==w||t[32]!==T||t[33]!==E?(D=(0,$.jsx)(gt,{value:S,options:m,selectedLabel:b,title:x,placeholder:C,ariaLabel:w,allowEmpty:!1,disabled:s,loading:o,onChange:u,searchPlaceholder:T,searchValue:d,onSearchChange:f,statusMessage:E,triggerClassName:`min-h-11`}),t[22]=s,t[23]=m,t[24]=o,t[25]=b,t[26]=u,t[27]=d,t[28]=x,t[29]=S,t[30]=C,t[31]=w,t[32]=T,t[33]=E,t[34]=D):D=t[34];let O;t[35]===v?O=t[36]:(O=v?(0,$.jsx)(`p`,{className:`px-1 text-xs text-fg-muted`,children:v}):null,t[35]=v,t[36]=O);let k;return t[37]!==D||t[38]!==O?(k=(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[D,O]}),t[37]=D,t[38]=O,t[39]=k):k=t[39],k}function Lr({data:e,zh:t,onChange:n,onSettings:r,onlyUse:i,disabled:a=!1,onPendingChange:o}){let{data:s,error:c,mutate:l}=k(`settings-agent-defaults`,K),{data:u}=j(!0),{data:d,isLoading:f,error:p,mutate:m}=k(`model-capability-media-sources`,async()=>{let e=await Promise.allSettled([Vt(),Wt(),en()]);return{ids:[...new Set(e.flatMap(e=>e.status===`fulfilled`?(Array.isArray(e.value)?e.value:e.value.providers).filter(e=>e.configured).map(e=>e.id):[]))],failed:e.some(e=>e.status===`rejected`)}}),h=[...new Set([...e.cards.filter(t=>t.configured&&(!Pe(t.id)||!!e.customConfig?.providers?.[t.id])).map(e=>e.id),...d?.ids??[]])].sort(),{data:g,isLoading:_,mutate:v}=k(e.loading?null:[`model-use-choices`,...h],async()=>{let e=await Promise.allSettled(h.map(Ee));return{previews:e.flatMap(e=>e.status===`fulfilled`&&e.value.configured?[e.value]:[]),failed:e.some(e=>e.status===`rejected`)}},{revalidateOnFocus:!1}),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>o?.(!1),[o]);let T=async(e,t)=>{if(C.current||a)return;let n=g?.previews.find(n=>n.uses.some(n=>n.id===e&&n.choices.some(e=>e.id===t)));if(!n)return;C.current=!0,o?.(!0),b(e),S(null);let r={mode:`replace`,selected:[e],overrides:{[e]:t}};try{let t=await re(n.providerId,r);await Se(n.providerId,r,t.revision),await Promise.all([l(),v()]),S({use:e})}catch(t){S({use:e,error:t instanceof Error?t.message:String(t)}),Promise.allSettled([l(),v()])}finally{C.current=!1,b(null),o?.(!1),requestAnimationFrame(()=>w.current?.querySelector(`[data-capability="${e}"] button[aria-label]`)?.focus())}},E=u?.payload?.config?Kt(u.payload.config):void 0;if(!s&&!c)return(0,$.jsx)(De,{className:`h-48 w-full rounded-xl`});if(c)return(0,$.jsxs)(`div`,{role:`alert`,className:`text-sm text-danger`,children:[t?`模型用途加载失败`:`Could not load model uses`,(0,$.jsx)(X,{variant:`ghost`,onClick:()=>void l(),children:t?`重试`:`Retry`})]});let D=s.defaults.models,O=D.background?.primary??D.chat.primary,A=e.builtinRows.find(e=>e.id===O.split(`/`)[0])?.setupProfile?.interactiveOnly!==!0,M=g?.previews[0]?.uses.find(e=>e.id===`background`),N=M?M.current:A?O:void 0,P=[{id:`chat`,label:t?`对话与任务`:`Chat and tasks`,ref:D.chat.primary},{id:`vision`,label:t?`看图`:`Image understanding`,ref:D.imageUnderstanding?.primary},{id:`image`,label:t?`画图`:`Image generation`,ref:D.imageGeneration?.primary},{id:`background`,label:t?`后台任务`:`Background tasks`,ref:N,inherited:!D.background&&!!N},{id:`transcription`,label:t?`录音与听写`:`Recording and dictation`,ref:E?.stt.enabled?`${E.stt.provider}/${E.stt.providers?.[E.stt.provider]?.model??`default`}`:void 0},{id:`speech`,label:t?`语音合成`:`Speech synthesis`,ref:E?.tts.enabled?`${E.tts.provider}/${E.tts.providers?.[E.tts.provider]?.model??`default`}`:void 0},{id:`conversation`,label:t?`实时语音对话`:`Realtime conversation`,ref:E?.voice.realtime.enabled?E.voice.realtime.defaultEngine===`omni`&&E.voice.realtime.omni?`${E.voice.realtime.omni.provider}/${E.voice.realtime.omni.model}`:E.voice.realtime.defaultEngine===`agent`?`agent`:void 0:void 0}];return(0,$.jsxs)(`section`,{ref:w,className:`@container min-w-0`,children:[(0,$.jsx)(`h2`,{className:i?`mb-2 text-sm font-semibold text-fg`:`sr-only`,children:i?t?`当前模型`:`Current model`:t?`能力总览`:`Capabilities`}),(0,$.jsx)(`div`,{className:i?`space-y-4`:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:Ye.filter(e=>!i||e.uses.includes(i)).map(o=>(0,$.jsxs)(`section`,{className:i?`min-w-0`:`min-w-0 border-t border-edge first:border-t-0`,children:[i?null:(0,$.jsxs)(`div`,{className:`flex items-center justify-between bg-surface-inset/55 px-4 py-2`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:o.label[+!t]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.uses[0]===`chat`?t?`基础能力`:`Core capability`:t?`按需启用`:`Optional`})]}),(0,$.jsx)(`div`,{className:i?`divide-y divide-edge-subtle`:`divide-y divide-edge-subtle px-4`,children:o.uses.filter(e=>!i||e===i).map(o=>{let s=P.find(e=>e.id===o),c=Rr(g?.previews??[],s.id,t),l=s.id===`conversation`&&E?.voice.realtime.enabled&&E.voice.realtime.defaultEngine===`agent`?t?`语音助手 · 使用对话、听写和语音输出配置`:`Voice assistant · Uses chat, dictation and voice output`:s.ref?e.allModels.find(e=>e.id===s.ref)?.name??s.ref:void 0;return(0,$.jsx)(`div`,{"data-capability":s.id,children:(0,$.jsxs)(`div`,{className:i?`py-2`:`grid grid-cols-1 items-center gap-x-3 gap-y-2 py-3 @min-[40rem]:gap-x-4 ${r?`@min-[40rem]:grid-cols-[minmax(0,1fr)_minmax(0,1.35fr)_auto]`:`@min-[40rem]:grid-cols-[minmax(0,1fr)_minmax(0,1.35fr)]`}`,children:[(0,$.jsxs)(`div`,{className:i?`hidden`:`col-start-1 row-start-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:Tt[s.id][+!t]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:s.ref?c.some(e=>e.value===s.ref||s.ref?.endsWith(`/default`)&&e.value.split(`/`)[0]===s.ref.split(`/`)[0])||s.ref===`agent`?null:t?`待连接`:`Connection needed`:t?`未配置`:`Not set up`})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:Ne[s.id][+!t]}),s.inherited?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t?`继承默认对话`:`Inherits chat default`}):null]}),(0,$.jsxs)(`div`,{className:i?`w-full min-w-0 space-y-1`:`row-start-2 w-full min-w-0 space-y-1 @min-[40rem]:col-span-1 @min-[40rem]:col-start-2 @min-[40rem]:row-start-1`,children:[(0,$.jsx)(Ir,{label:Tt[s.id][+!t],value:s.ref,currentLabel:l,options:c,loading:e.loading||_||f,disabled:y!==null||a,zh:t,onConnect:()=>n(s.id),onSelect:e=>{e!==s.ref&&T(s.id,e)}}),y===s.id?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:t?`正在切换…`:`Switching…`}):null,x?.use===s.id?(0,$.jsx)(`div`,{role:x.error?`alert`:`status`,className:`text-xs text-fg-muted`,children:x.error?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-danger`,children:t?`未能切换模型,请重试。`:`Could not switch models. Please retry.`}),(0,$.jsxs)(`details`,{className:`mt-1`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:t?`查看详情`:`Show details`}),(0,$.jsx)(`p`,{className:`mt-1 break-words`,children:x.error})]})]}):t?`已切换`:`Model changed`}):null]}),r&&(c.length>0||_||f)?(0,$.jsxs)(`div`,{className:`row-start-3 flex flex-wrap items-center justify-end gap-1 @min-[40rem]:col-start-3 @min-[40rem]:row-start-1`,children:[(0,$.jsx)(X,{variant:`ghost`,disabled:y!==null||a,onClick:()=>r(s.id),children:t?`设置`:`Settings`}),(0,$.jsx)(X,{variant:`ghost`,disabled:y!==null||a,onClick:()=>n(s.id),children:t?`管理服务`:`Manage services`})]}):null]})},s.id)})})]},o.uses[0]))}),(!r||i)&&(g?.failed||d?.failed||p)?(0,$.jsxs)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:[t?`部分服务的模型加载失败`:`Some model services could not be loaded`,(0,$.jsx)(X,{variant:`ghost`,onClick:()=>void Promise.all([m(),v()]),children:t?`重试`:`Retry`})]}):null,i||r?null:(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t?`快速与复杂任务模型随对话配置;音色、流式听写及电脑操作可在详细设置中调整。`:`Fast and complex task models follow chat setup. Voices, streaming dictation and Computer Use have detailed settings.`})]})}function Rr(e,t,n=!1){return e.flatMap(e=>e.uses.find(e=>e.id===t)?.choices.map(t=>({value:t.id,label:t.name,group:U(e.providerId,e.profile.name,n),searchText:e.profile.name}))??[])}function zr(e){let t=(0,an.c)(185),{model:n,isNew:r,providerId:i,onSave:a,onClose:o,m:s}=e,c=b(Vr)===`zh`,l;t[0]===n?l=t[1]:(l=()=>n?{...n}:we(``),t[0]=n,t[1]=l);let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(Br),h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(e,t)=>{d(n=>({...n,[e]:t})),p(t=>{let n=new Map(t);return n.delete(e),n})},t[2]=h):h=t[2];let _=h,v;t[3]!==u.computerUse||t[4]!==u.contextWindow||t[5]!==u.id||t[6]!==u.input||t[7]!==u.maxTokens||t[8]!==s.modelIdRequired||t[9]!==s.mustBePositive||t[10]!==c?(v=()=>{let e=new Map;return(u.id||``).trim()||e.set(`id`,s.modelIdRequired),u.contextWindow!==void 0&&u.contextWindow<=0&&e.set(`contextWindow`,s.mustBePositive),u.maxTokens!==void 0&&u.maxTokens<=0&&e.set(`maxTokens`,s.mustBePositive),u.computerUse&&!u.input?.includes(`image`)&&e.set(`computerUse`,c?`电脑控制模型必须支持图片输入`:`Computer Use requires image input`),p(e),e.size===0},t[3]=u.computerUse,t[4]=u.contextWindow,t[5]=u.id,t[6]=u.input,t[7]=u.maxTokens,t[8]=s.modelIdRequired,t[9]=s.mustBePositive,t[10]=c,t[11]=v):v=t[11];let y=v,x;t[12]!==u||t[13]!==o||t[14]!==a||t[15]!==y?(x=()=>{if(!y())return;let e=(u.id||``).trim();a({...u,id:e,name:u.name?.trim()||e,reasoning:u.reasoning||!1,input:u.input||[`text`],contextWindow:u.contextWindow??128e3,maxTokens:u.maxTokens??16384,cost:{input:u.cost?.input??0,output:u.cost?.output??0,cacheRead:u.cost?.cacheRead??0,cacheWrite:u.cost?.cacheWrite??0}}),o()},t[12]=u,t[13]=o,t[14]=a,t[15]=y,t[16]=x):x=t[16];let S=x,C=u,T;t[17]===C?T=t[18]:(T=ne(C),t[17]=C,t[18]=T);let E=T,O=r?s.addModelTitle:s.editModelTitle,k;t[19]===O?k=t[20]:(k=(0,$.jsx)(D,{className:`text-base font-semibold text-fg`,children:O}),t[19]=O,t[20]=k);let A;t[21]!==s.modelProviderLabel||t[22]!==i?(A=i?(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[s.modelProviderLabel,`: `,i]}):null,t[21]=s.modelProviderLabel,t[22]=i,t[23]=A):A=t[23];let j;t[24]!==k||t[25]!==A?(j=(0,$.jsxs)(`div`,{children:[k,A]}),t[24]=k,t[25]=A,t[26]=j):j=t[26];let M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=g(G,`p-1.5 hover:bg-surface-base`),t[27]=M):M=t[27];let N;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(m,{className:`size-4`}),t[28]=N):N=t[28];let P;t[29]===s.close?P=t[30]:(P=(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:M,"aria-label":s.close,children:N})}),t[29]=s.close,t[30]=P);let F;t[31]!==j||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-start justify-between gap-2`,children:[j,P]}),t[31]=j,t[32]=P,t[33]=F):F=t[33];let I;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:` *`}),t[34]=I):I=t[34];let L;t[35]===s.modelId?L=t[36]:(L=(0,$.jsxs)(`label`,{className:`mb-1 block text-xs font-medium text-fg`,children:[s.modelId,I]}),t[35]=s.modelId,t[36]=L);let R;t[37]===f?R=t[38]:(R=g(V(),f.has(`id`)&&`border-red-500`),t[37]=f,t[38]=R);let ee=u.id||``,z;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>_(`id`,e.target.value),t[39]=z):z=t[39];let B=!r,H;t[40]!==R||t[41]!==ee||t[42]!==B?(H=(0,$.jsx)(`input`,{className:R,value:ee,onChange:z,placeholder:`e.g. llama3.1:8b`,disabled:B}),t[40]=R,t[41]=ee,t[42]=B,t[43]=H):H=t[43];let U;t[44]===f?U=t[45]:(U=f.has(`id`)?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:f.get(`id`)}):null,t[44]=f,t[45]=U);let W;t[46]!==L||t[47]!==H||t[48]!==U?(W=(0,$.jsxs)(`div`,{children:[L,H,U]}),t[46]=L,t[47]=H,t[48]=U,t[49]=W):W=t[49];let K;t[50]===s.displayName?K=t[51]:(K=(0,$.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,children:s.displayName}),t[50]=s.displayName,t[51]=K);let re;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(re=V(),t[52]=re):re=t[52];let ie=u.name||``,ae;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ae=e=>_(`name`,e.target.value),t[53]=ae):ae=t[53];let oe;t[54]===ie?oe=t[55]:(oe=(0,$.jsx)(`input`,{className:re,value:ie,onChange:ae}),t[54]=ie,t[55]=oe);let se;t[56]!==K||t[57]!==oe?(se=(0,$.jsxs)(`div`,{children:[K,oe]}),t[56]=K,t[57]=oe,t[58]=se):se=t[58];let q;t[59]===s.inputTypes?q=t[60]:(q=(0,$.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,children:s.inputTypes}),t[59]=s.inputTypes,t[60]=q);let ce;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ce=te(),t[61]=ce):ce=t[61];let J;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(J=e=>_(`input`,Ct(e.target.value)),t[62]=J):J=t[62];let le;t[63]===s?le=t[64]:(le=Me.map(e=>(0,$.jsx)(Z,{value:e.value,children:s[e.labelKey]},e.value)),t[63]=s,t[64]=le);let Y;t[65]!==E||t[66]!==le?(Y=(0,$.jsx)(et,{className:ce,value:E,onChange:J,children:le}),t[65]=E,t[66]=le,t[67]=Y):Y=t[67];let ue;t[68]!==q||t[69]!==Y?(ue=(0,$.jsxs)(`div`,{children:[q,Y]}),t[68]=q,t[69]=Y,t[70]=ue):ue=t[70];let de=u.reasoning||!1,fe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>_(`reasoning`,e.target.checked),t[71]=fe):fe=t[71];let pe;t[72]===de?pe=t[73]:(pe=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:de,onChange:fe}),t[72]=de,t[73]=pe);let me;t[74]!==s.reasoning||t[75]!==pe?(me=(0,$.jsxs)(`label`,{className:`mt-6 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[pe,s.reasoning]}),t[74]=s.reasoning,t[75]=pe,t[76]=me):me=t[76];let he;t[77]!==ue||t[78]!==me?(he=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ue,me]}),t[77]=ue,t[78]=me,t[79]=he):he=t[79];let ge;t[80]===s.contextWindow?ge=t[81]:(ge=(0,$.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,children:s.contextWindow}),t[80]=s.contextWindow,t[81]=ge);let _e;t[82]===f?_e=t[83]:(_e=g(V(),f.has(`contextWindow`)&&`border-red-500`),t[82]=f,t[83]=_e);let ve=u.contextWindow??128e3,ye;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(ye=e=>_(`contextWindow`,parseInt(e.target.value,10)||0),t[84]=ye):ye=t[84];let be;t[85]!==_e||t[86]!==ve?(be=(0,$.jsx)(Mt,{type:`number`,min:1,className:_e,value:ve,onChange:ye}),t[85]=_e,t[86]=ve,t[87]=be):be=t[87];let xe;t[88]===f?xe=t[89]:(xe=f.has(`contextWindow`)?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:f.get(`contextWindow`)}):null,t[88]=f,t[89]=xe);let Se;t[90]!==ge||t[91]!==be||t[92]!==xe?(Se=(0,$.jsxs)(`div`,{children:[ge,be,xe]}),t[90]=ge,t[91]=be,t[92]=xe,t[93]=Se):Se=t[93];let Ce;t[94]===s.maxOutputTokens?Ce=t[95]:(Ce=(0,$.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,children:s.maxOutputTokens}),t[94]=s.maxOutputTokens,t[95]=Ce);let Te;t[96]===f?Te=t[97]:(Te=g(V(),f.has(`maxTokens`)&&`border-red-500`),t[96]=f,t[97]=Te);let Ee=u.maxTokens??16384,De;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(De=e=>_(`maxTokens`,parseInt(e.target.value,10)||0),t[98]=De):De=t[98];let Oe;t[99]!==Te||t[100]!==Ee?(Oe=(0,$.jsx)(Mt,{type:`number`,min:1,className:Te,value:Ee,onChange:De}),t[99]=Te,t[100]=Ee,t[101]=Oe):Oe=t[101];let ke;t[102]===f?ke=t[103]:(ke=f.has(`maxTokens`)?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:f.get(`maxTokens`)}):null,t[102]=f,t[103]=ke);let Ae;t[104]!==Ce||t[105]!==Oe||t[106]!==ke?(Ae=(0,$.jsxs)(`div`,{children:[Ce,Oe,ke]}),t[104]=Ce,t[105]=Oe,t[106]=ke,t[107]=Ae):Ae=t[107];let je;t[108]!==Se||t[109]!==Ae?(je=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Se,Ae]}),t[108]=Se,t[109]=Ae,t[110]=je):je=t[110];let Ne;t[111]===s.costSection?Ne=t[112]:(Ne=(0,$.jsx)(`p`,{className:`mb-2 text-xs font-semibold text-fg`,children:s.costSection}),t[111]=s.costSection,t[112]=Ne);let Pe;t[113]===s.costInput?Pe=t[114]:(Pe=(0,$.jsx)(`label`,{className:`mb-1 block text-xs text-fg-muted`,children:s.costInput}),t[113]=s.costInput,t[114]=Pe);let Fe;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=V(),t[115]=Fe):Fe=t[115];let Ie=u.cost?.input??0,Le;t[116]===u.cost?Le=t[117]:(Le=e=>_(`cost`,{...u.cost,input:parseFloat(e.target.value)||0,output:u.cost?.output??0,cacheRead:u.cost?.cacheRead??0,cacheWrite:u.cost?.cacheWrite??0}),t[116]=u.cost,t[117]=Le);let Re;t[118]!==Ie||t[119]!==Le?(Re=(0,$.jsx)(Mt,{type:`number`,step:`any`,min:0,className:Fe,value:Ie,onChange:Le}),t[118]=Ie,t[119]=Le,t[120]=Re):Re=t[120];let ze;t[121]!==Pe||t[122]!==Re?(ze=(0,$.jsxs)(`div`,{children:[Pe,Re]}),t[121]=Pe,t[122]=Re,t[123]=ze):ze=t[123];let Be;t[124]===s.costOutput?Be=t[125]:(Be=(0,$.jsx)(`label`,{className:`mb-1 block text-xs text-fg-muted`,children:s.costOutput}),t[124]=s.costOutput,t[125]=Be);let Ve;t[126]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=V(),t[126]=Ve):Ve=t[126];let He=u.cost?.output??0,Ue;t[127]===u.cost?Ue=t[128]:(Ue=e=>_(`cost`,{...u.cost,input:u.cost?.input??0,output:parseFloat(e.target.value)||0,cacheRead:u.cost?.cacheRead??0,cacheWrite:u.cost?.cacheWrite??0}),t[127]=u.cost,t[128]=Ue);let We;t[129]!==He||t[130]!==Ue?(We=(0,$.jsx)(Mt,{type:`number`,step:`any`,min:0,className:Ve,value:He,onChange:Ue}),t[129]=He,t[130]=Ue,t[131]=We):We=t[131];let Ge;t[132]!==Be||t[133]!==We?(Ge=(0,$.jsxs)(`div`,{children:[Be,We]}),t[132]=Be,t[133]=We,t[134]=Ge):Ge=t[134];let Ke;t[135]!==ze||t[136]!==Ge?(Ke=(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[ze,Ge]}),t[135]=ze,t[136]=Ge,t[137]=Ke):Ke=t[137];let qe;t[138]!==Ne||t[139]!==Ke?(qe=(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle pt-2 dark:border-edge`,children:[Ne,Ke]}),t[138]=Ne,t[139]=Ke,t[140]=qe):qe=t[140];let Je;t[141]!==W||t[142]!==se||t[143]!==he||t[144]!==je||t[145]!==qe?(Je=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[W,se,he,je,qe]}),t[141]=W,t[142]=se,t[143]=he,t[144]=je,t[145]=qe,t[146]=Je):Je=t[146];let Ye=c?`高级:电脑控制协议`:`Advanced: Computer Use protocol`,Xe;t[147]===Ye?Xe=t[148]:(Xe=(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:Ye}),t[147]=Ye,t[148]=Xe);let Ze=c?`电脑控制协议`:`Computer Use protocol`,Qe=u.computerUse?.profile??``,$e;t[149]===Symbol.for(`react.memo_cache_sentinel`)?($e=e=>_(`computerUse`,e.target.value?{profile:e.target.value}:void 0),t[149]=$e):$e=t[149];let tt=c?`未声明`:`Not declared`,nt;t[150]===tt?nt=t[151]:(nt=(0,$.jsx)(Z,{value:``,children:tt}),t[150]=tt,t[151]=nt);let rt,it,at;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,$.jsx)(Z,{value:`gui-plus-2026-02-26`,children:`GUI-Plus (2026-02-26)`}),it=(0,$.jsx)(Z,{value:`structured-tools-v1`,children:`structured-tools-v1`}),at=(0,$.jsx)(Z,{value:`openai-responses-computer-v1`,children:`OpenAI Responses Computer`}),t[152]=rt,t[153]=it,t[154]=at):(rt=t[152],it=t[153],at=t[154]);let ot;t[155]!==Ze||t[156]!==Qe||t[157]!==nt?(ot=(0,$.jsxs)(et,{"aria-label":Ze,value:Qe,onChange:$e,children:[nt,rt,it,at]}),t[155]=Ze,t[156]=Qe,t[157]=nt,t[158]=ot):ot=t[158];let st=c?`协议必须与模型 API 匹配。声明协议不代表模型已通过效果验证。`:`The protocol must match the model API. Declaring a protocol does not certify model quality.`,ct;t[159]===st?ct=t[160]:(ct=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:st}),t[159]=st,t[160]=ct);let lt;t[161]===f?lt=t[162]:(lt=f.has(`computerUse`)&&(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:f.get(`computerUse`)}),t[161]=f,t[162]=lt);let ut;t[163]!==ot||t[164]!==ct||t[165]!==lt?(ut=(0,$.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[ot,ct,lt]}),t[163]=ot,t[164]=ct,t[165]=lt,t[166]=ut):ut=t[166];let dt;t[167]!==Xe||t[168]!==ut?(dt=(0,$.jsxs)(`details`,{className:`mt-4 rounded-lg border border-edge p-3 text-sm text-fg`,children:[Xe,ut]}),t[167]=Xe,t[168]=ut,t[169]=dt):dt=t[169];let ft;t[170]!==Je||t[171]!==dt?(ft=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-1`,children:[Je,dt]}),t[170]=Je,t[171]=dt,t[172]=ft):ft=t[172];let pt;t[173]===s.cancel?pt=t[174]:(pt=(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:`secondary`,children:s.cancel})}),t[173]=s.cancel,t[174]=pt);let mt=r?s.addModelConfirm:s.saveModelConfirm,ht;t[175]!==S||t[176]!==mt?(ht=(0,$.jsx)(X,{type:`button`,variant:`primary`,className:`hover:bg-accent/90`,onClick:S,children:mt}),t[175]=S,t[176]=mt,t[177]=ht):ht=t[177];let gt;t[178]!==pt||t[179]!==ht?(gt=(0,$.jsxs)(`div`,{className:`mt-4 flex shrink-0 justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[pt,ht]}),t[178]=pt,t[179]=ht,t[180]=gt):gt=t[180];let _t;return t[181]!==F||t[182]!==ft||t[183]!==gt?(_t=(0,$.jsxs)($.Fragment,{children:[F,ft,gt]}),t[181]=F,t[182]=ft,t[183]=gt,t[184]=_t):_t=t[184],_t}function Br(){return new Map}function Vr(e){return e.language}function Hr(e){let t=(0,an.c)(16),{open:n,onOpenChange:r,providerId:i,model:a,isNew:o,onSave:s,m:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(S,{className:g(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Dt)}),t[0]=l):l=t[0];let u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=g(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(90vh,720px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,vt,`overflow-hidden rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`),t[1]=u):u=t[1];let d;t[2]!==o||t[3]!==c||t[4]!==a||t[5]!==r||t[6]!==s||t[7]!==n||t[8]!==i?(d=n?(0,$.jsx)(zr,{model:a,isNew:o,providerId:i,onSave:s,onClose:()=>r(!1),m:c},`${i??`none`}-${a?.id??`new`}`):null,t[2]=o,t[3]=c,t[4]=a,t[5]=r,t[6]=s,t[7]=n,t[8]=i,t[9]=d):d=t[9];let f;t[10]===d?f=t[11]:(f=(0,$.jsxs)(T,{children:[l,(0,$.jsx)(E,{className:u,onOpenAutoFocus:Ur,children:d})]}),t[10]=d,t[11]=f);let p;return t[12]!==r||t[13]!==n||t[14]!==f?(p=(0,$.jsx)(O,{open:n,onOpenChange:r,children:f}),t[12]=r,t[13]=n,t[14]=f,t[15]=p):p=t[15],p}function Ur(e){return e.preventDefault()}function Wr(e){let t=(0,an.c)(14),{providerId:n,inputId:r,value:i,onChange:a,labels:o}=e,s;t[0]===n?s=t[1]:(s=()=>pt(n).then(Gr),t[0]=n,t[1]=s);let c=s,l;t[2]!==r||t[3]!==o.apiKeyLabel?(l=(0,$.jsx)(`label`,{htmlFor:r,className:`text-sm font-medium text-fg`,children:o.apiKeyLabel}),t[2]=r,t[3]=o.apiKeyLabel,t[4]=l):l=t[4];let u;t[5]!==r||t[6]!==o||t[7]!==a||t[8]!==c||t[9]!==i?(u=(0,$.jsx)(xe,{id:r,value:i,onChange:a,placeholder:o.apiKeyPlaceholder,labels:o,reveal:c,loadFailedLabel:o.loadFailed,maskedHelp:o.maskedHelp,notInConfigFile:o.notInConfigFile}),t[5]=r,t[6]=o,t[7]=a,t[8]=c,t[9]=i,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Gr(e){return e.apiKey??null}function Kr(e){let t=(0,an.c)(23),{open:n,onOpenChange:r,providerId:i,isCustom:a,builtinRows:o,customConfig:s,allModels:c,labels:l,language:u,onSaved:d}=e,f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(!1),[h,_]=(0,Q.useState)(null),v;t[0]===r?v=t[1]:(v=e=>{e||(_(null),m(!1)),r(e)},t[0]=r,t[1]=v);let y=v,b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(S,{className:g(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,Dt)}),t[2]=b):b=t[2];let x,C,w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{f.current=document.activeElement instanceof HTMLElement?document.activeElement:null},C=e=>{f.current?.isConnected&&(e.preventDefault(),f.current.focus({preventScroll:!0}))},w=g(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(85vh,720px)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay`,vt),t[3]=x,t[4]=C,t[5]=w):(x=t[3],C=t[4],w=t[5]);let D;t[6]!==c||t[7]!==o||t[8]!==s||t[9]!==y||t[10]!==a||t[11]!==l||t[12]!==u||t[13]!==r||t[14]!==d||t[15]!==i||t[16]!==p||t[17]!==h?(D=(0,$.jsxs)(T,{children:[b,(0,$.jsx)(E,{onOpenAutoFocus:x,onCloseAutoFocus:C,className:w,children:h?(0,$.jsx)(Xe,{target:h,zh:u===`zh`,onDone:()=>y(!1)}):!a&&p?(0,$.jsx)(Et,{providerId:i,existingConnection:!0,row:o.find(e=>e.id===i),language:u,onApplied:d,onBack:()=>m(!1),onDone:()=>y(!1)}):a?(0,$.jsx)(Jr,{providerId:i,customConfig:s,labels:l,language:u,onClose:()=>r(!1),onSaved:d,onModelAdded:e=>_({providerId:i,modelIds:[e]})}):(0,$.jsx)(qr,{providerId:i,builtinRows:o,allModels:c,labels:l,language:u,onClose:()=>r(!1),onSaved:d,onQuickSetup:()=>m(!0)})})]}),t[6]=c,t[7]=o,t[8]=s,t[9]=y,t[10]=a,t[11]=l,t[12]=u,t[13]=r,t[14]=d,t[15]=i,t[16]=p,t[17]=h,t[18]=D):D=t[18];let k;return t[19]!==y||t[20]!==n||t[21]!==D?(k=(0,$.jsx)(O,{open:n,onOpenChange:y,children:D}),t[19]=y,t[20]=n,t[21]=D,t[22]=k):k=t[22],k}function qr({providerId:e,builtinRows:t,allModels:n,labels:r,language:i,onClose:a,onSaved:o,onQuickSetup:s}){let c=t.find(t=>t.id===e),f=ee[e],p=n.filter(t=>t.provider===e),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(c?.apiKey??``),[x,S]=(0,Q.useState)(!1),[C,T]=(0,Q.useState)(!1),[E,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),j=h(i).providersSettings,M=c?.supportsApiKey!==!1,N=c?.supportsOAuth===!0,P=c?.authMode===`oauth`&&c.authStatus===`connected`,F=c?.configured===!0&&c.activeKeySource!==`env`&&c.activeKeySource!==`extension`&&c.activeKeySource!==`models_json`,[I,L]=(0,Q.useState)(null),[R,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(`idle`),[te,U]=(0,Q.useState)(null),[ne,G]=(0,Q.useState)(null),[K,re]=(0,Q.useState)(null),[ie,ae]=(0,Q.useState)(``),J=(0,Q.useRef)(null),le=(0,Q.useRef)(null),Y=V===`waiting`||V===`waiting_code`,ue=(0,Q.useMemo)(()=>st(e,i),[e,i]),fe=y!==(c?.apiKey??``),ge=async()=>{let t=y.trim();if(!(!t||!M||oe(t))){S(!0),O(null);try{await pe({[e]:t}),T(!0),window.setTimeout(()=>{o(),a()},600)}catch(e){O(e instanceof Error?e.message:r.saveError)}finally{S(!1)}}};(0,Q.useEffect)(()=>{if(!I||!Y)return;let e=window.setInterval(()=>{(async()=>{try{let t=await At(I);t.status===`waiting_auth`||t.status===`waiting_code`?(H(t.status===`waiting_code`?`waiting_code`:`waiting`),B(t.message??null),U(t.authUrl??null),G(t.instructions??null),re(t.deviceCode??null),t.authUrl&&t.authUrl!==le.current&&(le.current=t.authUrl,q(t.authUrl,J.current).catch(()=>{}))):t.status===`completed`?(window.clearInterval(e),W(J.current),J.current=null,H(`success`),B(t.message??j.saved),window.setTimeout(()=>{o(),a()},600)):(t.status===`failed`||t.status===`cancelled`)&&(window.clearInterval(e),W(J.current),J.current=null,H(`error`),B(t.error??t.message??j.revokeFailed))}catch{}})()},1e3);return()=>window.clearInterval(e)},[I,Y,a,o,j.revokeFailed,j.saved]),(0,Q.useEffect)(()=>()=>{I&&ke(I).catch(()=>{})},[I]),(0,Q.useEffect)(()=>()=>{W(J.current),J.current=null},[]);let ve=async()=>{try{await Fe(e),o(),a()}catch{}},xe=async()=>{W(J.current),J.current=he(),le.current=null,H(`waiting`),B(j.oauthStarting),U(null),G(null),re(null),O(null);try{L((await Le(e)).sessionId)}catch(e){W(J.current),J.current=null,H(`error`),B(e instanceof Error?e.message:j.revokeFailed)}},Se=async()=>{if(I){try{await _e(I)}catch{}W(J.current),J.current=null,le.current=null,H(`idle`),B(null),L(null),U(null),G(null),re(null)}},Ce=async()=>{if(!(!I||!ie.trim()))try{await se(I,ie.trim()),ae(``),B(j.oauthProcessingCode)}catch(e){H(`error`),B(e instanceof Error?e.message:j.revokeFailed)}},we=async()=>{try{await z(e),o(),a()}catch(e){O(e instanceof Error?e.message:j.revokeFailed)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-5 py-4`,children:[(0,$.jsx)(D,{className:`text-base font-semibold text-fg`,children:c?.name??e}),(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:g(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ce.press),children:(0,$.jsx)(m,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 overflow-y-auto px-5 py-4`,children:[s?(0,$.jsx)(X,{variant:`secondary`,onClick:s,children:i===`zh`?`配置模型用途`:`Configure model uses`}):null,f?.description?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.description}):null,c?.baseUrl?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.apiUrlLabel}),(0,$.jsx)(`code`,{className:`break-all rounded-lg border border-edge-subtle bg-surface-panel/60 px-3 py-2 font-mono text-xs text-fg-muted`,children:c.baseUrl})]}):c?.category===`extension`?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.apiUrlExtensionHint}):null,M?(0,$.jsx)(Wr,{providerId:e,inputId:`manage-api-key`,value:y,onChange:e=>{b(e),T(!1)},labels:{apiKeyLabel:r.apiKeyLabel,apiKeyPlaceholder:r.apiKeyPlaceholder,maskedHelp:r.maskedHelp,copy:r.copy,copied:r.copied,show:r.showKey,hide:r.hideKey,notInConfigFile:r.notInConfigFile,loadFailed:r.loadFailed}}):c?.category===`extension`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:r.extensionKeyHint}),c?.extensionId?(0,$.jsxs)(l,{to:`/settings/ext/${encodeURIComponent(c.extensionId)}`,className:`inline-flex w-fit items-center gap-1 font-medium text-accent hover:underline`,title:r.extensionSettingsLinkTitle,onClick:a,children:[r.openExtensionSettings,(0,$.jsx)(d,{className:`size-3`,"aria-hidden":!0})]}):null]}):null,N?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:j.oauth}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:P?j.sourceOauth:j.oauthHint})]}),P?(0,$.jsx)(X,{type:`button`,variant:`secondary`,className:`gap-1.5 text-red-600 dark:text-red-400`,onClick:()=>void we(),children:j.revoke}):(0,$.jsxs)(X,{type:`button`,variant:`primary`,className:`gap-1.5`,disabled:Y,onClick:()=>void xe(),children:[Y?(0,$.jsx)(de,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),j.oauth]})]}),R?(0,$.jsx)(`p`,{className:g(`text-xs`,V===`error`?`text-red-600 dark:text-red-400`:`text-fg-muted`),children:R}):null,V===`waiting`||V===`waiting_code`?(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[te?(0,$.jsxs)(`a`,{href:te,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 rounded-md bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:bg-accent-hover`,children:[(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),j.openAuthPage]}):null,(0,$.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>void Se(),children:j.cancelOAuth})]}):null,ne?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:ne}):null,K?(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j.deviceCodeLabel}),(0,$.jsx)(`code`,{className:`mt-1 block select-all font-mono text-lg font-semibold tracking-widest text-fg`,children:K}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:j.deviceCodeHint})]}):null,V===`waiting_code`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(`input`,{type:`text`,value:ie,onChange:e=>ae(e.target.value),onKeyDown:e=>e.key===`Enter`&&void Ce(),placeholder:j.pasteRedirectUrl,className:g(`min-w-0 flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle`,Oe)}),(0,$.jsx)(X,{type:`button`,variant:`primary`,onClick:()=>void Ce(),children:j.submitCode})]}):null]}):null,ue.length>0&&M?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ue.map(({kind:e,href:t})=>(0,$.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-accent hover:underline`,children:[ye(e,r),(0,$.jsx)(d,{className:`size-3`,"aria-hidden":!0})]},e))}):null,p.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsxs)(`span`,{className:`text-sm font-medium text-fg`,children:[r.modelsLabel,` (`,p.length,`)`]}),(0,$.jsxs)(`label`,{className:`mb-2 flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:_,onChange:e=>v(e.target.checked)}),i===`zh`?`仅电脑控制模型`:`Computer Use only`]}),(0,$.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-lg border border-edge-subtle bg-surface-panel/40 p-2`,children:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:p.filter(e=>!_||e.computerUse).map(e=>(0,$.jsxs)(`span`,{className:`inline-block rounded-md bg-surface-hover px-2 py-1 text-xs text-fg-muted`,children:[nt(e,i),e.computerUse?` · Computer Use`:``]},e.id))})})]}):(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.noModels}),E?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:E}):null]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle px-5 py-3`,children:[F?(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>A(!0),children:[(0,$.jsx)(be,{className:`size-3.5`,"aria-hidden":!0}),r.remove]}):(0,$.jsx)(`span`,{}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:M&&fe&&!oe(y.trim())?(0,$.jsx)(X,{type:`button`,variant:`primary`,disabled:!y.trim()||x||C,onClick:()=>void ge(),children:C?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),r.saved]}):x?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(de,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.saving]}):r.save}):null})]}),(0,$.jsx)(Ke,{open:k,title:r.removeConfirmTitle,description:r.removeConfirmDescription.replace(`{{provider}}`,c?.name??e),confirmLabel:r.removeConfirmAction,cancelLabel:r.cancel,destructive:!0,onConfirm:()=>void ve(),onCancel:()=>A(!1)})]})}function Jr({providerId:e,customConfig:t,labels:n,language:r,onClose:i,onSaved:a,onModelAdded:o}){let s=h(r).modelsSettings,c=t?.providers[e],[l,u]=(0,Q.useState)(c?.baseUrl??``),[d,f]=(0,Q.useState)(c?.apiKey??``),[_,v]=(0,Q.useState)(c?.models??[]),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(c?.modelDiscovery?.enabled===!0),[C,T]=(0,Q.useState)(!1),[E,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(null),L=n=>{if(!t)return null;let r=d.trim(),i={...c,baseUrl:l.trim()||void 0,apiKey:oe(r)?c?.apiKey:r||void 0,...n};return{providers:{...t.providers,[e]:i}}},R=async()=>{let e=L({models:_,modelDiscovery:{enabled:x}});if(e){T(!0),O(null);try{await lt(e),a(),i()}catch(e){O(e instanceof Error?e.message:n.saveError)}finally{T(!1)}}},ee=async()=>{if(t)try{let{[e]:n,...r}=t.providers;await lt({providers:r}),a(),i()}catch{}},z=(e,t)=>{I({model:e,isNew:t}),P(!0)},B=async e=>{if(!F)return;let t=F.isNew&&!_.some(t=>t.id===e.id),r=F.isNew?[..._,e]:_.map(t=>t.id===e.id?e:t);v(r);let i=L({models:r});if(i)try{await lt(i),a(),t&&!e.computerUse&&o(e.id)}catch(e){O(e instanceof Error?e.message:n.saveError)}},V=async e=>{let t=_.filter(t=>t.id!==e);v(t),M(null);let r=L({models:t});if(r)try{await lt(r),a()}catch(e){O(e instanceof Error?e.message:n.saveError)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(D,{className:`text-base font-semibold text-fg`,children:e}),(0,$.jsx)(`span`,{className:`rounded bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium text-fg-subtle`,children:n.custom})]}),(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:g(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ce.press),children:(0,$.jsx)(m,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`label`,{htmlFor:`manage-base-url`,className:`text-sm font-medium text-fg`,children:n.baseUrlLabel}),(0,$.jsx)(`input`,{id:`manage-base-url`,type:`url`,autoComplete:`off`,value:l,onChange:e=>u(e.target.value),className:g(`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle`,Oe)})]}),(0,$.jsx)(Wr,{providerId:e,inputId:`manage-custom-api-key`,value:d,onChange:f,labels:{apiKeyLabel:n.apiKeyLabel,apiKeyPlaceholder:n.apiKeyPlaceholder,maskedHelp:n.maskedHelp,copy:n.copy,copied:n.copied,show:n.showKey,hide:n.hideKey,notInConfigFile:n.notInConfigFile,loadFailed:n.loadFailed}}),(0,$.jsxs)(`label`,{className:`flex items-start gap-3 rounded-xl border border-edge-subtle bg-surface-panel/40 p-3`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>S(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-accent`}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r===`zh`?`自动同步模型目录`:`Automatically sync model catalog`}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-muted`,children:r===`zh`?`启动时及定时从此服务的 /models 接口更新模型。`:`Update models from this service’s /models endpoint at startup and on schedule.`})]})]}),(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle pt-3`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-sm font-semibold text-fg`,children:[s.modelsSection,_.length>0?` (${_.length})`:``]}),(0,$.jsxs)(X,{type:`button`,variant:`primary`,className:`gap-1.5 px-2 py-1 text-xs`,onClick:()=>z(null,!0),children:[(0,$.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),s.addModel]})]}),(0,$.jsxs)(`label`,{className:`mb-2 flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:y,onChange:e=>b(e.target.checked)}),r===`zh`?`仅电脑控制模型`:`Computer Use only`]}),_.filter(e=>!y||e.computerUse).length===0?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s.modelsEmpty}):(0,$.jsx)(`ul`,{className:`space-y-2`,children:_.filter(e=>!y||e.computerUse).map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-2 rounded-lg border border-edge-subtle bg-surface-panel/40 px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.id}),e.computerUse&&(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Computer Use`}),e.name&&e.name!==e.id?(0,$.jsx)(`div`,{className:`truncate text-xs text-fg-muted`,children:e.name}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,className:g(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ce.press),onClick:()=>z(e,!1),"aria-label":s.editModel,children:(0,$.jsx)(wt,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,className:g(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-red-600 dark:hover:text-red-400`,ce.press),onClick:()=>M(e.id),"aria-label":s.removeModel,children:(0,$.jsx)(be,{className:`size-3.5`,"aria-hidden":!0})})]})]},e.id))})]}),E?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:E}):null]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle px-5 py-3`,children:[(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>A(!0),children:[(0,$.jsx)(be,{className:`size-3.5`,"aria-hidden":!0}),n.remove]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,$.jsx)(X,{type:`button`,variant:`primary`,disabled:C,onClick:()=>void R(),children:C?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(de,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),n.saving]}):n.save})})]}),(0,$.jsx)(Ke,{open:k,title:n.removeConfirmTitle,description:n.removeConfirmDescription.replace(`{{provider}}`,e),confirmLabel:n.removeConfirmAction,cancelLabel:n.cancel,destructive:!0,onConfirm:()=>void ee(),onCancel:()=>A(!1)}),(0,$.jsx)(Ke,{open:j!==null,title:s.removeModel,description:s.removeModelConfirm.replace(`{{id}}`,j??``),confirmLabel:n.removeConfirmAction,cancelLabel:n.cancel,destructive:!0,onConfirm:()=>{j&&V(j)},onCancel:()=>M(null)}),(0,$.jsx)(Hr,{open:N,onOpenChange:e=>{P(e),e||I(null)},providerId:e,model:F?.model??null,isNew:F?.isNew??!1,onSave:e=>void B(e),m:s})]})}var Yr=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],Xr=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`,Zr={en:{fast:[`Fast tasks`,`Short, low-latency work`],reasoning:[`Complex reasoning`,`Planning and multi-step analysis`],coding:[`Coding`,`Implementation and debugging`],review:[`Review`,`Critique and verification`],vision:[`Vision`,`Image and visual analysis`],understanding:[`Understanding`,`Long-form content comprehension`]},zh:{fast:[`快速任务`,`简短、低延迟的工作`],reasoning:[`复杂推理`,`规划和多步骤分析`],coding:[`编程`,`实现、调试和代码修改`],review:[`审查`,`检查、批评和验证`],vision:[`视觉任务`,`图片和视觉内容分析`],understanding:[`内容理解`,`长内容阅读和理解`]}};function Qr(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function $r(e){let t=(0,an.c)(38),{draft:n,setDraft:r,zh:i,capability:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[0]=o):o=t[0];let s=k(N,M,o),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let l=c,u=i?Zr.zh:Zr.en,d;t[3]!==n||t[4]!==r?(d=(e,t)=>{let i={...n.models.intents};t?i[e]=Qr(i[e],t):delete i[e],r({...n,models:{...n.models,intents:i}})},t[3]=n,t[4]=r,t[5]=d):d=t[5];let f=d,p;t[6]!==a||t[7]!==n||t[8]!==l||t[9]!==s.error||t[10]!==s.isLoading||t[11]!==r||t[12]!==i?(p=a===`chat`?(0,$.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:(0,$.jsx)(ie,{title:i?`模型回退`:`Model fallbacks`,summary:i?`已配置 ${n.models.chat.fallbacks.length} 个备用模型。`:`${n.models.chat.fallbacks.length} fallback models configured.`,children:(0,$.jsx)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:(0,$.jsx)(tn,{primary:n.models.chat.primary,value:n.models.chat.fallbacks,models:l,loading:s.isLoading,error:s.error,zh:i,onChange:e=>r({...n,models:{...n.models,chat:{...n.models.chat,fallbacks:e}}})})})})}):null,t[6]=a,t[7]=n,t[8]=l,t[9]=s.error,t[10]=s.isLoading,t[11]=r,t[12]=i,t[13]=p):p=t[13];let m;t[14]!==a||t[15]!==n||t[16]!==r||t[17]!==i?(m=a===`image`?(0,$.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:n.models.imageGeneration?(0,$.jsx)(ie,{title:i?`图片执行策略`:`Image execution policy`,summary:i?`当前超时与回退策略继续生效。`:`The current timeout and fallback policy remains active.`,children:(0,$.jsxs)(`div`,{className:`mt-5 grid gap-4 rounded-xl bg-surface-base/45 p-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,$.jsx)(Mt,{allowEmpty:!0,type:`number`,min:1,className:`${Xr} mt-2`,value:n.models.imageGeneration.timeoutMs??``,onChange:e=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,timeoutMs:e.target.value?Number(e.target.value):void 0}}})})]}),(0,$.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,$.jsx)(L,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":i?`服务商自动回退`:`Automatic provider fallback`,children:[!0,!1].map(e=>(0,$.jsx)(X,{"aria-pressed":n.models.imageGeneration?.autoProviderFallback===e,variant:n.models.imageGeneration?.autoProviderFallback===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,autoProviderFallback:e}}}),children:e?i?`开启`:`On`:i?`关闭`:`Off`},String(e)))})]})]})}):null}):null,t[14]=a,t[15]=n,t[16]=r,t[17]=i,t[18]=m):m=t[18];let h;t[19]!==a||t[20]!==n||t[21]!==l||t[22]!==s.error||t[23]!==s.isLoading||t[24]!==r||t[25]!==i?(h=a===`vision`&&n.models.imageUnderstanding?(0,$.jsx)(ie,{title:i?`模型回退`:`Model fallbacks`,summary:i?`主模型不可用时使用已配置的备用模型。`:`Use configured fallback models when the primary is unavailable.`,children:(0,$.jsx)(tn,{primary:n.models.imageUnderstanding.primary,value:n.models.imageUnderstanding.fallbacks,models:l.filter(ei),loading:s.isLoading,error:s.error,zh:i,onChange:e=>r({...n,models:{...n.models,imageUnderstanding:{...n.models.imageUnderstanding,fallbacks:e}}})})}):null,t[19]=a,t[20]=n,t[21]=l,t[22]=s.error,t[23]=s.isLoading,t[24]=r,t[25]=i,t[26]=h):h=t[26];let g;t[27]!==a||t[28]!==u||t[29]!==n||t[30]!==f||t[31]!==i?(g=a===`chat`?(0,$.jsx)(ie,{title:i?`任务模型路由`:`Task model routing`,summary:i?`已配置 ${Object.keys(n.models.intents).length} 类任务路由;其他任务使用默认模型。`:`${Object.keys(n.models.intents).length} task routes configured; other tasks use the default model.`,children:(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i?`按任务选择模型`:`Route by task`}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i?`仅在确实需要不同模型时设置;否则保持“使用默认对话模型”。`:`Set a route only when a task genuinely needs another model; otherwise keep the default.`}),(0,$.jsx)(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:Yr.map(e=>(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:u[e][0]}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:u[e][1]})]}),(0,$.jsx)(P,{value:n.models.intents[e]?.primary??``,placeholder:i?`使用默认对话模型`:`Use default conversation model`,searchPlaceholder:i?`搜索模型或服务商`:`Search models or providers`,noMatches:i?`没有匹配的模型`:`No matching models`,allowEmpty:!0,emptyLabel:i?`使用默认对话模型`:`Use default conversation model`,showProviderInTrigger:!1,contentAlign:`start`,className:`w-full`,ariaLabel:i?`${u[e][0]}模型`:`${u[e][0]} model`,onChange:t=>f(e,t)})]},e))})]})}):null,t[27]=a,t[28]=u,t[29]=n,t[30]=f,t[31]=i,t[32]=g):g=t[32];let _;return t[33]!==p||t[34]!==m||t[35]!==h||t[36]!==g?(_=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[p,m,h,g]}),t[33]=p,t[34]=m,t[35]=h,t[36]=g,t[37]=_):_=t[37],_}function ei(e){return e.vision}function ti(e){let t=(0,an.c)(9),{data:n,error:r}=k(`settings-agent-defaults`,K);if(r&&!n){let e=String(r),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e}),t[0]=e,t[1]=n),n}if(!n){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(De,{className:`h-32 rounded-xl`}),t[2]=e):e=t[2],e}let i;t[3]===n.defaults.models?i=t[4]:(i=JSON.stringify(n.defaults.models),t[3]=n.defaults.models,t[4]=i);let a;return t[5]!==n.defaults||t[6]!==e||t[7]!==i?(a=(0,$.jsx)(ni,{...e,initial:n.defaults},i),t[5]=n.defaults,t[6]=e,t[7]=i,t[8]=a):a=t[8],a}function ni(e){let t=(0,an.c)(36),{initial:n,capability:r,zh:i,disabled:a,onPendingChange:o}=e,s;t[0]===n?s=t[1]:(s=()=>structuredClone(n),t[0]=n,t[1]=s);let[c,l]=(0,Q.useState)(s),u;t[2]===n?u=t[3]:(u=()=>structuredClone(n),t[2]=n,t[3]=u);let[d,f]=(0,Q.useState)(u),p;t[4]===c.models?p=t[5]:(p=JSON.stringify(c.models),t[4]=c.models,t[5]=p);let m;t[6]===d.models?m=t[7]:(m=JSON.stringify(d.models),t[6]=d.models,t[7]=m);let h=p!==m,g;t[8]!==n.models||t[9]!==i?(g=async e=>{let t=await K();if(JSON.stringify(t.defaults.models)!==JSON.stringify(n.models))throw Error(i?`模型设置已变化,请刷新后重试。`:`Model settings changed. Refresh before retrying.`);f((await J({...t.defaults,models:e.models},{scope:`models`,expectedModels:n.models})).defaults),await Ue()},t[8]=n.models,t[9]=i,t[10]=g):g=t[10];let _=g,v;t[11]!==h||t[12]!==c||t[13]!==_?(v={value:c,dirty:h,onSave:_,delayMs:0},t[11]=h,t[12]=c,t[13]=_,t[14]=v):v=t[14];let y=Rt(v),b=h||y.status===`saving`||!!y.error,x,S;t[15]!==o||t[16]!==b?(x=()=>(o(b),()=>o(!1)),S=[b,o],t[15]=o,t[16]=b,t[17]=x,t[18]=S):(x=t[17],S=t[18]),(0,Q.useEffect)(x,S);let C=a||y.status===`saving`,w;t[19]!==y.error||t[20]!==y.status?(w=(0,$.jsx)(Lt,{status:y.status,error:y.error}),t[19]=y.error,t[20]=y.status,t[21]=w):w=t[21];let T;t[22]!==y.error||t[23]!==y.retry||t[24]!==i?(T=y.error?(0,$.jsx)(X,{variant:`secondary`,onClick:y.retry,children:i?`重试保存`:`Retry saving`}):null,t[22]=y.error,t[23]=y.retry,t[24]=i,t[25]=T):T=t[25];let E;t[26]!==r||t[27]!==c||t[28]!==i?(E=(0,$.jsx)($r,{capability:r,draft:c,setDraft:l,zh:i}),t[26]=r,t[27]=c,t[28]=i,t[29]=E):E=t[29];let D;return t[30]!==y.onBlurCapture||t[31]!==w||t[32]!==T||t[33]!==E||t[34]!==C?(D=(0,$.jsxs)(`fieldset`,{disabled:C,onBlurCapture:y.onBlurCapture,className:`min-w-0 space-y-3`,children:[w,T,E]}),t[30]=y.onBlurCapture,t[31]=w,t[32]=T,t[33]=E,t[34]=C,t[35]=D):D=t[35],D}function ri(e){return e.status===`ready`?`ready`:e.status===`disabled`?`off`:e.status===`degraded`?`degraded`:e.rejected?.length?`misconfigured`:`not-configured`}function ii(e,t){if(e.startsWith(`agentCatalog.defaults.models`))return{label:t?`模型与能力`:`Models and capabilities`,href:`/settings/capabilities/models`};let n=e.match(/^agentCatalog\.agents\.([^.]+)\.models/);return n?.[1]?{label:t?`智能体 ${n[1]}`:`Agent ${n[1]}`,href:dt(n[1])}:e.startsWith(`sessions.`)?{label:t?`会话模型覆盖`:`Session model override`,href:`/settings/sessions`}:{label:e,href:`/settings/agent-defaults`}}function ai(e,t){switch(e){case`computer-use`:return{guidance:t?`选择兼容的电脑控制模型;本机权限需单独授权`:`Select a compatible computer model; local access requires separate approval`,action:t?`配置电脑控制`:`Configure computer use`};case`vision`:return{guidance:t?`接入支持图片理解的模型服务`:`Connect a model service that supports vision`,action:t?`去接入模型`:`Connect model`};case`image-generation`:return{guidance:t?`选择图片模型并配置所需凭据`:`Choose an image model and configure its credentials`,action:t?`去配置图片生成`:`Configure image generation`};case`stt`:return{guidance:t?`选择语音识别服务,或安装自管 STT 插件`:`Choose a speech-to-text service or install a self-managed STT plugin`,action:t?`去配置语音识别`:`Configure speech-to-text`};case`tts`:return{guidance:t?`选择语音合成服务并完成凭据配置`:`Choose a text-to-speech service and configure its credentials`,action:t?`去配置语音合成`:`Configure text-to-speech`}}}async function oi(){let e=await y(x(`/api/models/catalog`)),t=await e.json().catch(()=>null);if(!e.ok||!t?.ok||!t.payload)throw Error(t?.error?.message??`HTTP ${e.status}`);return t.payload}async function si(){let e=await y(x(`/api/capabilities/readiness`)),t=await e.json().catch(()=>null);if(!e.ok||!t?.ok||!t.payload)throw Error(t?.error?.message??`HTTP ${e.status}`);return t.payload}function ci({showCapabilities:e=!0}={}){let t=b(e=>e.language)===`zh`,{data:n,error:r,isLoading:i}=k(Ge,oi,{revalidateOnFocus:!0,refreshInterval:6e4}),{data:a}=k(ue,si,{revalidateOnFocus:!1}),[o,s]=(0,Q.useState)(!1),[c,d]=(0,Q.useState)(null),f=Object.values(n?.sources??{}),p=f.reduce((e,t)=>e+t.models.filter(e=>e.availability===`available`).length,0),m=(n?.references??[]).filter(e=>e.availability===`unavailable`),h=n?.sync.lastSuccessAt??Math.max(0,...f.map(e=>e.lastSuccessAt)),_=!!r,v=n?.sync.sourceErrors??{},S=[...n?.sync.lastError?[[`catalog`,n.sync.lastError]]:[],...Object.entries(v),...c?[[`refresh`,c]]:[],...r instanceof Error?[[`load`,r.message]]:[]],C=n?.sync.lastAttemptAt??h,w=Object.entries(a?.capabilities??{}).filter(([e])=>e!==`computer-use`||Je()),T=w.some(([,e])=>{let t=ri(e);return t===`degraded`||t===`misconfigured`}),E=w.filter(([,e])=>ri(e)===`ready`).length,D=(0,Q.useRef)(null);if((0,Q.useEffect)(()=>{T&&!i&&D.current?.setAttribute(`open`,``)},[T,i]),i)return(0,$.jsx)(De,{className:`h-24 w-full rounded-2xl`});let O=async()=>{s(!0),d(null);try{let e=await y(x(`/api/models/catalog/refresh`),{method:`POST`});if(!e.ok)throw Error(`HTTP ${e.status}`);await Ue()}catch(e){d(e instanceof Error?e.message:String(e))}finally{s(!1)}};return(0,$.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/25 p-4 sm:p-5`,children:[e?(0,$.jsxs)(`details`,{ref:D,className:`group`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer list-none rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsxs)(`div`,{className:`flex min-h-10 items-center gap-2`,children:[T?(0,$.jsx)(ve,{className:`size-4 text-amber-500`,"aria-hidden":!0}):E===w.length&&w.length>0?(0,$.jsx)(u,{className:`size-4 text-emerald-500`,"aria-hidden":!0}):(0,$.jsx)(Ze,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:t?`可选能力`:`Optional capabilities`}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs font-normal text-fg-muted`,children:t?`${E}/${w.length} 项已配置,不影响基础聊天功能`:`${E} of ${w.length} configured · Not required for chat`})]}),(0,$.jsx)($e,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-open:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]})}),a?(0,$.jsx)(`div`,{className:`mt-3 grid gap-1 sm:grid-cols-2`,children:Object.entries(a.capabilities).map(([e,n])=>{if(e===`computer-use`&&!Je())return null;let r=e===`vision`?t?`图片理解`:`Vision`:e===`image-generation`?t?`图片生成`:`Image generation`:e===`computer-use`?t?`电脑控制模型`:`Computer use model`:e.toUpperCase(),i=n.selectionSource!==`explicit-config`,a=ri(n),o=a===`degraded`||a===`misconfigured`,s=ai(e,t),c=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 text-xs font-medium text-fg`,children:r}),(0,$.jsx)(`span`,{className:a===`ready`?`shrink-0 text-xs text-emerald-600 dark:text-emerald-400`:a===`off`||a===`not-configured`?`shrink-0 text-xs text-fg-muted`:`shrink-0 text-xs text-amber-600 dark:text-amber-400`,children:a===`ready`?e===`computer-use`?t?`已配置`:`Configured`:t?`可用`:`Ready`:a===`off`?t?`已关闭`:`Off`:a===`not-configured`?t?`未配置`:`Not configured`:a===`degraded`?t?`正在使用备用方案`:`Using fallback`:t?`需处理`:`Needs attention`})]}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,title:n.primary?`${n.primary.provider}/${n.primary.model}`:void 0,children:n.primary?`${i?t?`自动`:`Auto`:t?`显式`:`Explicit`} · ${n.primary.provider}/${n.primary.model}`:a===`not-configured`?t?`可稍后按需配置`:`Set up later if needed`:t?`已配置的模型不可用`:`The configured model is unavailable`}),o?(0,$.jsxs)(`div`,{className:`mt-2 rounded-lg bg-amber-500/10 p-2`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-amber-700 dark:text-amber-300`,children:n.status===`degraded`?t?`当前配置不可用,正在使用备用方案。${s.guidance}`:`The current configuration is unavailable, so a fallback is in use. ${s.guidance}.`:s.guidance}),(0,$.jsxs)(`span`,{className:`mt-1 inline-flex items-center gap-1 text-xs font-medium text-accent`,children:[s.action,(0,$.jsx)(ct,{className:`size-3.5`,"aria-hidden":!0})]})]}):null]}),u={"aria-label":o?`${r}:${s.action}`:`${t?`配置`:`Configure`} ${r}`,className:g(`rounded-lg bg-surface-base/45 px-3 py-3 text-left transition-colors`,o?`bg-amber-500/5 hover:bg-amber-500/10`:`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`)};if(e===`computer-use`)return(0,$.jsx)(l,{to:`/settings/computer-use`,...u,children:c},e);let d={vision:`vision`,"image-generation":`image`,stt:`transcription`,tts:`speech`}[e];return(0,$.jsx)(`button`,{type:`button`,"aria-haspopup":`dialog`,...u,onClick:()=>_t(d,o?`services`:`settings`),children:c},e)})}):null]}):null,m.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-2`,"aria-live":`polite`,children:m.map(e=>(0,$.jsx)(`div`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 p-3`,children:(()=>{let n=!!v[e.ref.split(`/`)[0]??``],r=ii(e.locations[0]??``,t);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(ve,{className:`mt-0.5 size-4 shrink-0 text-amber-500`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`p`,{className:`break-words text-sm font-medium text-fg`,children:[e.ref,(0,$.jsx)(`span`,{className:`ml-2 font-normal text-amber-700 dark:text-amber-300`,children:n?t?`暂时无法验证`:`Temporarily unverified`:t?`不可用`:`Unavailable`})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[n?t?`模型目录同步暂时失败,当前状态可能已过期;不会影响其他可用模型。`:`Catalog sync temporarily failed, so this status may be stale. Other available models are unaffected.`:t?`此模型已无法从当前配置中解析,使用它的功能可能失败。`:`This model no longer resolves from the current configuration. Features using it may fail.`,C?` · ${t?`最近检测`:`Last checked`} ${new Date(C).toLocaleString()}`:``]}),e.suggestedRef?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[t?`可替换为`:`Suggested replacement`,`:`,(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:e.suggestedRef})]}):null]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1`,children:[(0,$.jsxs)(X,{className:`px-2.5 py-1.5 text-xs`,variant:`ghost`,disabled:o,onClick:()=>void O(),children:[o?(0,$.jsx)(de,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(tt,{className:`size-3.5`,"aria-hidden":!0}),o?t?`检测中…`:`Checking…`:t?`重新检测`:`Check again`]}),(0,$.jsx)(X,{asChild:!0,className:`px-2.5 py-1.5 text-xs`,variant:`ghost`,children:(0,$.jsxs)(l,{to:r.href,children:[(0,$.jsx)(Ae,{className:`size-3.5`,"aria-hidden":!0}),e.suggestedRef?t?`更换模型`:`Replace model`:t?`调整配置`:`Adjust configuration`]})}),(0,$.jsxs)(`details`,{className:`group/references`,children:[(0,$.jsxs)(`summary`,{className:`touch-target inline-flex cursor-pointer list-none items-center gap-1 rounded-xl px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[t?`查看 ${e.locations.length} 处引用`:`View ${e.locations.length} ${e.locations.length===1?`reference`:`references`}`,(0,$.jsx)($e,{className:`size-3.5 transition-transform group-open/references:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 pl-2 text-xs text-fg-muted`,children:e.locations.map(e=>{let n=ii(e,t);return(0,$.jsx)(`li`,{children:(0,$.jsx)(l,{className:`inline-flex rounded px-1.5 py-1 text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,to:n.href,title:e,children:n.label})},e)})})]})]})]})})()},e.ref))}):null,_||c?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:_?t?`暂时无法读取模型状态,请重新检测;详细信息可在高级诊断中查看。`:`Model status is temporarily unavailable. Check again; details are available in Advanced diagnostics.`:t?`重新检测失败,请稍后重试;详细信息可在高级诊断中查看。`:`The check failed. Try again later; details are available in Advanced diagnostics.`}):null,(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`summary`,{className:`min-h-8 cursor-pointer rounded-md py-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:t?`高级诊断`:`Advanced diagnostics`}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{children:t?`${f.length} 个来源,${p} 个可用模型${h?` · 最近同步 ${new Date(h).toLocaleString()}`:``}`:`${f.length} sources, ${p} available models${h?` · Last synced ${new Date(h).toLocaleString()}`:``}`}),S.length>0?(0,$.jsx)(`div`,{className:`mt-2 space-y-1 rounded-lg bg-surface-base/45 p-2 font-mono text-[11px] leading-5`,"aria-label":t?`同步错误详情`:`Sync error details`,children:S.map(([e,t],n)=>(0,$.jsxs)(`p`,{className:`break-words`,children:[e,`: `,t]},`${e}-${n}`))}):null]}),(0,$.jsxs)(X,{className:`shrink-0`,type:`button`,variant:`secondary`,disabled:o,onClick:()=>void O(),children:[o?(0,$.jsx)(de,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(tt,{className:`size-4`,"aria-hidden":!0}),o?t?`刷新中…`:`Refreshing…`:t?`刷新目录`:`Refresh catalog`]})]})]})]})}function li(e){let t=(0,an.c)(167),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{inlineUse:r,inlineView:i,onViewChange:u,onPendingChange:d}=n,f=i===void 0?`settings`:i,p=b(pi),m=p===`zh`,g;t[2]===p?g=t[3]:(g=h(p),t[2]=p,t[3]=g);let _=g.capabilitiesSettings,{capability:v}=s(),[y,x]=o(),{state:S}=a(),C;t[4]===y?C=t[5]:(C=je(y.get(`returnTo`)),t[4]=y,t[5]=C);let w=C,[T,E]=(0,Q.useState)(),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(!1),F=j||N||k,[I,L]=(0,Q.useState)(!1),[R,ee]=(0,Q.useState)(null),z=(0,Q.useRef)(null),V=yt(),H=fi,te,U;t[6]!==d||t[7]!==F?(te=()=>(d?.(F),()=>d?.(!1)),U=[F,d],t[6]=d,t[7]=F,t[8]=te,t[9]=U):(te=t[8],U=t[9]),(0,Q.useEffect)(te,U);let ne,W;t[10]!==v||t[11]!==r||t[12]!==S||t[13]!==y||t[14]!==x?(ne=()=>{if(r||v!==`models`)return;let e=B(y.get(`configure`));if(!e&&y.get(`add`)!==`1`)return;let t=window.setTimeout(()=>{e?_t(e,y.get(`tab`)===`services`?`services`:`settings`):L(!0);let t=new URLSearchParams(y);t.delete(`configure`),t.delete(`tab`),t.delete(`add`),x(t,{replace:!0,state:S})},0);return()=>window.clearTimeout(t)},W=[v,r,y,x,S],t[10]=v,t[11]=r,t[12]=S,t[13]=y,t[14]=x,t[15]=ne,t[16]=W):(ne=t[15],W=t[16]),(0,Q.useEffect)(ne,W);let G;t[17]!==r||t[18]!==u||t[19]!==F?(G=e=>{if(!F){if(!r){_t(e,`services`);return}u?.(`services`),E(void 0)}},t[17]=r,t[18]=u,t[19]=F,t[20]=G):G=t[20];let K=G,re;t[21]===u?re=t[22]:(re=e=>{H(),u?.(`settings`),E(e)},t[21]=u,t[22]=re);let ie=re;if(r){let e=f===`services`,n=N||k,i;t[23]!==r||t[24]!==K||t[25]!==V||t[26]!==n||t[27]!==m?(i=(0,$.jsx)(Lr,{data:V,zh:m,onlyUse:r,disabled:n,onPendingChange:M,onChange:K}),t[23]=r,t[24]=K,t[25]=V,t[26]=n,t[27]=m,t[28]=i):i=t[28];let a;t[29]!==e||t[30]!==i?(a=(0,$.jsx)(`div`,{hidden:e,children:i}),t[29]=e,t[30]=i,t[31]=a):a=t[31];let o;t[32]!==T||t[33]!==r||t[34]!==f||t[35]!==m?(o=T===r&&f===`settings`?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:m?`服务设置已保存`:`Service settings saved`}):null,t[32]=T,t[33]=r,t[34]=f,t[35]=m,t[36]=o):o=t[36];let s=f!==`services`,c;t[37]!==ie||t[38]!==r?(c=()=>ie(r),t[37]=ie,t[38]=r,t[39]=c):c=t[39];let l;t[40]!==_.addProviderDialog||t[41]!==r||t[42]!==p||t[43]!==V||t[44]!==c?(l=(0,$.jsx)(Tr,{inline:!0,onEditingChange:O,use:r,data:V,language:p,labels:_.addProviderDialog,onPendingChange:A,onSaved:c},r),t[40]=_.addProviderDialog,t[41]=r,t[42]=p,t[43]=V,t[44]=c,t[45]=l):l=t[45];let u;t[46]!==ie||t[47]!==D||t[48]!==r||t[49]!==V||t[50]!==m?(u=r===`transcription`||r===`speech`?(0,$.jsx)(`div`,{hidden:D,children:(0,$.jsx)(Fr,{kind:r===`transcription`?`stt`:`tts`,modelServiceIds:V.builtinRows.map(di),zh:m,onPendingChange:A,onSaved:()=>ie(r)},r)}):null,t[46]=ie,t[47]=D,t[48]=r,t[49]=V,t[50]=m,t[51]=u):u=t[51];let d;t[52]!==ie||t[53]!==r?(d=r===`image`?(0,$.jsx)(xn,{connectOnly:!0,onPendingChange:A,onConnected:()=>ie(r)}):null,t[52]=ie,t[53]=r,t[54]=d):d=t[54];let h;t[55]!==k||t[56]!==s||t[57]!==l||t[58]!==u||t[59]!==d?(h=(0,$.jsxs)(`fieldset`,{hidden:s,disabled:k,className:`min-w-0 space-y-3`,children:[l,u,d]}),t[55]=k,t[56]=s,t[57]=l,t[58]=u,t[59]=d,t[60]=h):h=t[60];let g=f===`services`,v;t[61]!==k||t[62]!==r||t[63]!==j?(v=r===`transcription`||r===`speech`||r===`conversation`?(0,$.jsx)(Yn,{capability:r,onPendingChange:P,disabled:j||k},r):null,t[61]=k,t[62]=r,t[63]=j,t[64]=v):v=t[64];let y;t[65]!==k||t[66]!==r||t[67]!==j||t[68]!==m?(y=r===`chat`||r===`vision`||r===`image`?(0,$.jsx)(ti,{capability:r,zh:m,disabled:j||k,onPendingChange:P}):null,t[65]=k,t[66]=r,t[67]=j,t[68]=m,t[69]=y):y=t[69];let b;t[70]!==r||t[71]!==m?(b=r===`background`?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m?`使用所选模型执行自动化、定时和无人值守任务。此设置不会启用任务,也不会自动改用其他计费服务。`:`Use the selected model for automations, schedules and unattended tasks. This does not enable tasks or automatically switch billing services.`}):null,t[70]=r,t[71]=m,t[72]=b):b=t[72];let x;t[73]!==g||t[74]!==v||t[75]!==y||t[76]!==b?(x=(0,$.jsxs)(`div`,{hidden:g,className:`space-y-4`,children:[v,y,b]}),t[73]=g,t[74]=v,t[75]=y,t[76]=b,t[77]=x):x=t[77];let S;t[78]!==K||t[79]!==o||t[80]!==h||t[81]!==x?(S=(0,$.jsxs)(wn.Provider,{value:K,children:[o,h,x]}),t[78]=K,t[79]=o,t[80]=h,t[81]=x,t[82]=S):S=t[82];let C;return t[83]!==a||t[84]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[a,S]}),t[83]=a,t[84]=S,t[85]=C):C=t[85],C}if(v===`search`){let e;t[86]===p?e=t[87]:(e=h(p),t[86]=p,t[87]=e);let n;t[88]===e.nav.settingsSearch?n=t[89]:(n=(0,$.jsx)(Nt,{title:e.nav.settingsSearch}),t[88]=e.nav.settingsSearch,t[89]=n);let r;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(xr,{}),t[90]=r):r=t[90];let i;return t[91]===n?i=t[92]:(i=(0,$.jsxs)(Pt,{children:[n,r]}),t[91]=n,t[92]=i),i}if(v!==`models`){let e;return t[93]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(c,{to:`/settings/capabilities/models`,replace:!0}),t[93]=e):e=t[93],e}let ae=m?`模型与能力`:`Models and capabilities`,oe=m?`按用途选择模型,在设置中调整参数与服务连接。`:`Choose models by purpose. Adjust parameters and connections in settings.`,se;t[94]===p?se=t[95]:(se=mt(p,`configuration`),t[94]=p,t[95]=se);let q;t[96]!==_.docsLink||t[97]!==se?(q=(0,$.jsx)(`a`,{href:se,target:`_blank`,rel:`noreferrer`,className:`inline-flex min-h-11 items-center rounded-lg px-2 text-xs text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:_.docsLink}),t[96]=_.docsLink,t[97]=se,t[98]=q):q=t[98];let ce;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>{z.current?.scrollIntoView?.({block:`start`}),z.current?.focus({preventScroll:!0})},t[99]=ce):ce=t[99];let J=m?`服务账户`:`Service accounts`,le;t[100]!==F||t[101]!==J?(le=(0,$.jsx)(X,{variant:`secondary`,disabled:F,onClick:ce,children:J}),t[100]=F,t[101]=J,t[102]=le):le=t[102];let Y;t[103]!==q||t[104]!==le?(Y=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[q,le]}),t[103]=q,t[104]=le,t[105]=Y):Y=t[105];let ue;t[106]!==ae||t[107]!==oe||t[108]!==Y?(ue=(0,$.jsx)(Nt,{title:ae,subtitle:oe,actions:Y}),t[106]=ae,t[107]=oe,t[108]=Y,t[109]=ue):ue=t[109];let de;t[110]!==w||t[111]!==m?(de=w?(0,$.jsx)(l,{to:w,className:`text-sm text-accent-fg hover:underline`,children:m?`返回`:`Back`}):null,t[110]=w,t[111]=m,t[112]=de):de=t[112];let fe;t[113]===F?fe=t[114]:(fe=e=>{F||_t(e)},t[113]=F,t[114]=fe);let pe;t[115]!==K||t[116]!==V||t[117]!==F||t[118]!==fe||t[119]!==m?(pe=(0,$.jsx)(Lr,{data:V,zh:m,disabled:F,onPendingChange:M,onChange:K,onSettings:fe}),t[115]=K,t[116]=V,t[117]=F,t[118]=fe,t[119]=m,t[120]=pe):pe=t[120];let me=m?`连接的服务`:`Connected services`,he;t[121]===me?he=t[122]:(he=(0,$.jsx)(`h2`,{id:`model-services-heading`,className:`text-base font-semibold text-fg`,children:me}),t[121]=me,t[122]=he);let ge=m?`在这里管理账户和密钥;各项能力的模型与参数在上方调整。`:`Manage accounts and keys here. Choose models and adjust capability settings above.`,_e;t[123]===ge?_e=t[124]:(_e=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ge}),t[123]=ge,t[124]=_e);let ve;t[125]!==he||t[126]!==_e?(ve=(0,$.jsxs)(`div`,{children:[he,_e]}),t[125]=he,t[126]=_e,t[127]=ve):ve=t[127];let ye;t[128]!==_.xopcCloudAccount||t[129]!==V.cards?(ye=V.cards.some(ui)?(0,$.jsx)(rn,{labels:_.xopcCloudAccount}):null,t[128]=_.xopcCloudAccount,t[129]=V.cards,t[130]=ye):ye=t[130];let be,xe;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>L(!0),xe=(e,t)=>ee({providerId:e,isCustom:t}),t[131]=be,t[132]=xe):(be=t[131],xe=t[132]);let Se;t[133]!==_.connectedProviders||t[134]!==V?(Se=(0,$.jsx)(qe,{labels:_.connectedProviders,data:V,onAdd:be,onManage:xe}),t[133]=_.connectedProviders,t[134]=V,t[135]=Se):Se=t[135];let Ce;t[136]===V.cards.length?Ce=t[137]:(Ce=V.cards.length>0?(0,$.jsx)(ci,{showCapabilities:!1}):null,t[136]=V.cards.length,t[137]=Ce);let we;t[138]===m?we=t[139]:(we=Je()?(0,$.jsx)(l,{className:`inline-block text-sm text-accent-fg hover:underline`,to:`/settings/computer-use`,children:m?`电脑操作设置`:`Computer use settings`}):null,t[138]=m,t[139]=we);let Te;t[140]!==ve||t[141]!==ye||t[142]!==Se||t[143]!==Ce||t[144]!==we?(Te=(0,$.jsxs)(`section`,{ref:z,tabIndex:-1,"aria-labelledby":`model-services-heading`,className:`space-y-4 scroll-mt-4 rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[ve,ye,Se,Ce,we]}),t[140]=ve,t[141]=ye,t[142]=Se,t[143]=Ce,t[144]=we,t[145]=Te):Te=t[145];let Ee;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=()=>{H(),L(!1)},t[146]=Ee):Ee=t[146];let De;t[147]!==I||t[148]!==_.addProviderDialog||t[149]!==p||t[150]!==V.builtinRows||t[151]!==V.customConfig?(De=(0,$.jsx)(Ot,{open:I,connectOnly:!0,onOpenChange:L,builtinRows:V.builtinRows,customConfig:V.customConfig,labels:_.addProviderDialog,language:p,onSaved:Ee}),t[147]=I,t[148]=_.addProviderDialog,t[149]=p,t[150]=V.builtinRows,t[151]=V.customConfig,t[152]=De):De=t[152];let Oe;t[153]!==_.manageProviderDialog||t[154]!==p||t[155]!==R||t[156]!==V.allModels||t[157]!==V.builtinRows||t[158]!==V.customConfig?(Oe=R?(0,$.jsx)(Kr,{open:!0,onOpenChange:e=>{e||ee(null)},providerId:R.providerId,isCustom:R.isCustom,builtinRows:V.builtinRows,customConfig:V.customConfig,allModels:V.allModels,labels:_.manageProviderDialog,language:p,onSaved:H}):null,t[153]=_.manageProviderDialog,t[154]=p,t[155]=R,t[156]=V.allModels,t[157]=V.builtinRows,t[158]=V.customConfig,t[159]=Oe):Oe=t[159];let ke;return t[160]!==ue||t[161]!==de||t[162]!==pe||t[163]!==Te||t[164]!==De||t[165]!==Oe?(ke=(0,$.jsxs)(Pt,{children:[ue,de,pe,Te,De,Oe]}),t[160]=ue,t[161]=de,t[162]=pe,t[163]=Te,t[164]=De,t[165]=Oe,t[166]=ke):ke=t[166],ke}function ui(e){return e.id===`xopc-cloud`&&!e.isCustom}function di(e){return e.id}function fi(){Ue()}function pi(e){return e.language}export{li as CapabilitiesSettingsPanel};
@@ -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"./cn-0WouolD0.js";var a=n(),o=e(t(),1),s=r();function c(e){let t=(0,a.c)(12),{iconUrl:n,fallback:r,className:c}=e,[l,u]=(0,o.useState)(!1),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>u(!1),t[0]=d):d=t[0];let f;t[1]===n?f=t[2]:(f=[n],t[1]=n,t[2]=f),(0,o.useEffect)(d,f);let p;t[3]===c?p=t[4]:(p=i(`flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-edge bg-white`,c),t[3]=c,t[4]=p);let m;t[5]!==r||t[6]!==l||t[7]!==n?(m=n&&!l?(0,s.jsx)(`img`,{src:n,alt:``,loading:`lazy`,draggable:!1,className:`size-8 object-contain`,onError:()=>u(!0)}):(0,s.jsx)(r,{className:`size-5 text-fg-muted`,"aria-hidden":!0}),t[5]=r,t[6]=l,t[7]=n,t[8]=m):m=t[8];let h;return t[9]!==p||t[10]!==m?(h=(0,s.jsx)(`span`,{className:p,children:m}),t[9]=p,t[10]=m,t[11]=h):h=t[11],h}export{c as t};
@@ -1 +0,0 @@
1
- function e(e,n,r=!1,i){let[a,o]=t(n,i).split(`?`),s=new URLSearchParams(o);return s.set(`plugin`,e),r?s.set(`connect`,`1`):s.delete(`connect`),`${a}?${s}`}function t(e,t){return t&&/^\/capabilities\/(skills|connectors|extensions)(?:\?|$)/.test(t)&&!/[\\#\r\n]/.test(t)?t:e===`connections`?`/capabilities/connectors?tab=connected`:e===`skills`?`/capabilities/skills?tab=installed&source=plugin`:`/capabilities/extensions?tab=user`}function n(e,t){return`/chat/new?${new URLSearchParams({draft:t?`请帮我使用${e}插件。`:`Help me use the ${e} plugin.`,projectScope:`none`})}`}export{n,e as t};