@xopcai/xopc 0.0.301 → 0.0.303

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 (138) 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/{activity-store-sCQ2ErNm.js → activity-store-DCi5rh4e.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-L6Vh9fL1.js → agent-avatar-dicebear-Ch3DzUvP.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-4oGrNj3m.js +1 -0
  6. package/dist/gateway/static/root/assets/{agents-CjwnFadx.js → agents-DXHD-ST3.js} +1 -1
  7. package/dist/gateway/static/root/assets/{api-pwK0DxZJ.js → api-CAV9PN9i.js} +1 -1
  8. package/dist/gateway/static/root/assets/api-fPapljyb.js +1 -0
  9. package/dist/gateway/static/root/assets/app-management-settings-panel-CdXnNtTg.js +1 -0
  10. package/dist/gateway/static/root/assets/appearance-settings-izNAyDhW.js +1 -0
  11. package/dist/gateway/static/root/assets/apps-page-BQb3RCga.js +1 -0
  12. package/dist/gateway/static/root/assets/{archive-plugin-BT7OnQyy.js → archive-plugin-BKGzaVvM.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-load-CQGhCfVn.js → attachment-load-8bARdLnp.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-CHeFkkKk.js → automations-page-BAEenyzx.js} +1 -1
  15. package/dist/gateway/static/root/assets/{automations-workspace-B_-VM4Va.js → automations-workspace-5vTl4x0h.js} +3 -3
  16. package/dist/gateway/static/root/assets/{binary-plugins-D_8pZaqQ.js → binary-plugins-Cv3GS9Eo.js} +1 -1
  17. package/dist/gateway/static/root/assets/{block-editor-m48cnmng.js → block-editor-DUeb92LG.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-automation-inputs-jciex8-r.js → browser-automation-inputs-BGT0xoTv.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-automations-page-ct9dHGJF.js → browser-automations-page-D1O22WIf.js} +1 -1
  20. package/dist/gateway/static/root/assets/browser-settings-page-CH9prS-f.js +3 -0
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-DMURlZbj.js +8 -0
  22. package/dist/gateway/static/root/assets/{channels-settings-BeDwuVtH.js → channels-settings-CFBS3Yqy.js} +1 -1
  23. package/dist/gateway/static/root/assets/{channels-status-swr-Cz3X8Gfa.js → channels-status-swr-C_icwbWj.js} +1 -1
  24. package/dist/gateway/static/root/assets/{chat-terminal-dock-Bn_th7oe.js → chat-terminal-dock-D-JYPVYl.js} +1 -1
  25. package/dist/gateway/static/root/assets/computer-settings-page-Bcfp948A.js +1 -0
  26. package/dist/gateway/static/root/assets/{connectors-page-D9xCnhbY.js → connectors-page-DI1c3BMz.js} +1 -1
  27. package/dist/gateway/static/root/assets/{cron-expression-C0ogAVG7.js → cron-expression-BJMBFKCh.js} +1 -1
  28. package/dist/gateway/static/root/assets/{date-picker-HtU776kx.js → date-picker-BFRIn5y9.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dependency-picker-DvDdN4Xu.js → dependency-picker-UtoUm57Q.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-BWi5FE7D.js → desktop-pet-Bryx7gRM.js} +1 -1
  31. package/dist/gateway/static/root/assets/desktop-pet-settings-DFsyEJUr.js +1 -0
  32. package/dist/gateway/static/root/assets/device-pairing-wizard-C3TQVPRy.js +1 -0
  33. package/dist/gateway/static/root/assets/extension-debug-page-DQlFTVBx.js +1 -0
  34. package/dist/gateway/static/root/assets/{extension-page-DxotmtcG.js → extension-page-BSsqRDXh.js} +1 -1
  35. package/dist/gateway/static/root/assets/extension-settings-page-DbVZv9ve.js +1 -0
  36. package/dist/gateway/static/root/assets/{gateway-config-swr-COJzzscc.js → gateway-config-swr-D5AM8cyQ.js} +1 -1
  37. package/dist/gateway/static/root/assets/gateway-settings-DUqVsB3X.js +1 -0
  38. package/dist/gateway/static/root/assets/{gateway-startup-retry-211-jptU.js → gateway-startup-retry-CSJWdnFs.js} +1 -1
  39. package/dist/gateway/static/root/assets/{heartbeat-settings-DAHqGRKZ.js → heartbeat-settings-Cxowc29b.js} +1 -1
  40. package/dist/gateway/static/root/assets/{home-page-BU59mAGQ.js → home-page-CLkumXdN.js} +1 -1
  41. package/dist/gateway/static/root/assets/{image-generation-api-sO31fQr_.js → image-generation-api-BNh604hw.js} +1 -1
  42. package/dist/gateway/static/root/assets/{imports-page-BQ4HTIVc.js → imports-page-DXNfRmk9.js} +1 -1
  43. package/dist/gateway/static/root/assets/index-BLRIcVQa.css +1 -0
  44. package/dist/gateway/static/root/assets/index-gheM453N.js +79 -0
  45. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-5Hcec8Xf.js +1 -0
  46. package/dist/gateway/static/root/assets/{local-app-workbench-page-BtEQDQeQ.js → local-app-workbench-page-BDg1-fcw.js} +2 -2
  47. package/dist/gateway/static/root/assets/{local-apps-page-BrEO9hz5.js → local-apps-page-CXPaPDGm.js} +1 -1
  48. package/dist/gateway/static/root/assets/{locale-store-DuG-kbsP.js → locale-store-DLK05Y1a.js} +1 -1
  49. package/dist/gateway/static/root/assets/logs-page-BWZc5jwO.js +2 -0
  50. package/dist/gateway/static/root/assets/{management-settings-DC67VTpr.js → management-settings-COa3PhMs.js} +1 -1
  51. package/dist/gateway/static/root/assets/{markdown-view-B1q2w6W_.js → markdown-view-B8maDRWh.js} +1 -1
  52. package/dist/gateway/static/root/assets/{media-plugins-DdoSox1I.js → media-plugins-tSJ0CvcX.js} +1 -1
  53. package/dist/gateway/static/root/assets/{messages-BYbx4OuI.js → messages-C9h8SImu.js} +3 -3
  54. package/dist/gateway/static/root/assets/note-detail-panel-D_YGzNcR.js +5 -0
  55. package/dist/gateway/static/root/assets/notes-page-D1f2oI2-.js +8 -0
  56. package/dist/gateway/static/root/assets/{page-tabs-B_I0YuTK.js → page-tabs-CQx6H-GS.js} +1 -1
  57. package/dist/gateway/static/root/assets/{preview-open-alternatives--5Zt1oSs.js → preview-open-alternatives-A3-bVtdy.js} +1 -1
  58. package/dist/gateway/static/root/assets/{proactive-page-BBJZB2RV.js → proactive-page-D46cR3sf.js} +1 -1
  59. package/dist/gateway/static/root/assets/{product-open-page-CKFPKr0A.js → product-open-page-CujZXOea.js} +1 -1
  60. package/dist/gateway/static/root/assets/project-detail-page-CRlD_Rwv.js +1 -0
  61. package/dist/gateway/static/root/assets/{projects-page-BUsI5G7U.js → projects-page-mmX0SavY.js} +1 -1
  62. package/dist/gateway/static/root/assets/{registry-api-BDgFNu05.js → registry-api-BMFL4vis.js} +1 -1
  63. package/dist/gateway/static/root/assets/remote-access-hub-Cqr3K6T5.js +1 -0
  64. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-CR0qvq9C.js +5 -0
  65. package/dist/gateway/static/root/assets/{schema-form-CuIDQtYN.js → schema-form-BUD9lLEE.js} +1 -1
  66. package/dist/gateway/static/root/assets/sessions-page-CPkvbdJP.js +1 -0
  67. package/dist/gateway/static/root/assets/settings-advanced-gate-Cu0DAbeH.js +1 -0
  68. package/dist/gateway/static/root/assets/settings-form-section-BZPCUH6a.js +1 -0
  69. package/dist/gateway/static/root/assets/{settings-page-BBG4jliE.js → settings-page-XoHmqIdm.js} +1 -1
  70. package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +1 -0
  71. package/dist/gateway/static/root/assets/{setup-status-panel-DXqDeXNi.js → setup-status-panel-D8fQF1jZ.js} +1 -1
  72. package/dist/gateway/static/root/assets/{share-preview-page-DbE7gsDd.js → share-preview-page-BgHqwTuT.js} +1 -1
  73. package/dist/gateway/static/root/assets/shares-settings-Id4vRHzI.js +1 -0
  74. package/dist/gateway/static/root/assets/skill-reload-api-BB2Fj_di.js +1 -0
  75. package/dist/gateway/static/root/assets/{skills-page-Dh33NKoP.js → skills-page-BAwF4LpS.js} +1 -1
  76. package/dist/gateway/static/root/assets/{skills-page.utils-BNz7GQvw.js → skills-page.utils-CH-quGxZ.js} +1 -1
  77. package/dist/gateway/static/root/assets/{system-settings-panel-C3L8_KEq.js → system-settings-panel-CGC7eBso.js} +1 -1
  78. package/dist/gateway/static/root/assets/task-detail-page-BVjw812D.js +1 -0
  79. package/dist/gateway/static/root/assets/theme-store-KfFEGMlp.js +1 -0
  80. package/dist/gateway/static/root/assets/tunnel-api-Do98Xk05.js +1 -0
  81. package/dist/gateway/static/root/assets/{use-autosave-DSrlXbBg.js → use-autosave-BydB6x2K.js} +1 -1
  82. package/dist/gateway/static/root/assets/user-model-page-Nv68a4ak.js +2 -0
  83. package/dist/gateway/static/root/assets/{voice-api-key-field-9P97T0CT.js → voice-api-key-field-CPUDBcag.js} +1 -1
  84. package/dist/gateway/static/root/assets/{voice-config-api-DJvwbFbz.js → voice-config-api-bZqN8-UF.js} +1 -1
  85. package/dist/gateway/static/root/assets/{work-discovery-overlay-CoVHgrQY.js → work-discovery-overlay-D_FmJbGH.js} +1 -1
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BR-S_IGS.js → workflow-run-setup-panel-1lZ_btki.js} +1 -1
  87. package/dist/gateway/static/root/assets/workflows-page-DFOhccm3.js +6 -0
  88. package/dist/gateway/static/root/index.html +10 -10
  89. package/dist/package.js +1 -1
  90. package/dist/src/cli/commands/connectors.js +1 -1
  91. package/dist/src/config/schema.js +1 -1
  92. package/dist/src/connectors/auth-provider-registry.js +1 -1
  93. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  94. package/dist/src/connectors/connection-recovery-service.js +1 -1
  95. package/dist/src/connectors/health.js +1 -1
  96. package/dist/src/gateway/automation-agent-session.js +6 -2
  97. package/dist/src/gateway/heartbeat/service.js +2 -2
  98. package/dist/src/gateway/hono/routes/capabilities.js +1 -1
  99. package/dist/src/gateway/hono/routes/connectors.js +3 -3
  100. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  101. package/dist/src/heartbeat/index.js +1 -1
  102. package/dist/src/storage/sqlite/session-repository.js +9 -0
  103. package/dist/src/tui/tui-startup-resources.js +1 -1
  104. package/package.json +2 -2
  105. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C22DdeJ6.js +0 -1
  106. package/dist/gateway/static/root/assets/api-BjlN9GPQ.js +0 -1
  107. package/dist/gateway/static/root/assets/app-management-settings-panel-BPanjQB6.js +0 -1
  108. package/dist/gateway/static/root/assets/appearance-settings-CUWA2E_f.js +0 -1
  109. package/dist/gateway/static/root/assets/apps-page-D8hP1XhF.js +0 -1
  110. package/dist/gateway/static/root/assets/browser-settings-page-DNX0BZFM.js +0 -3
  111. package/dist/gateway/static/root/assets/capabilities-settings-panel-nvCpR13B.js +0 -8
  112. package/dist/gateway/static/root/assets/computer-model-settings-BOObauzH.js +0 -1
  113. package/dist/gateway/static/root/assets/computer-settings-page-BicG-IvN.js +0 -1
  114. package/dist/gateway/static/root/assets/desktop-pet-settings-CptAwdZd.js +0 -1
  115. package/dist/gateway/static/root/assets/device-pairing-wizard-C8BiZYwP.js +0 -1
  116. package/dist/gateway/static/root/assets/extension-debug-page-nRRdMurF.js +0 -1
  117. package/dist/gateway/static/root/assets/extension-settings-page-BK2t7aFl.js +0 -1
  118. package/dist/gateway/static/root/assets/gateway-settings-rIGo_jeB.js +0 -1
  119. package/dist/gateway/static/root/assets/index-54o0AGdj.js +0 -79
  120. package/dist/gateway/static/root/assets/index-R89i_XYi.css +0 -1
  121. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BSgsIe7E.js +0 -1
  122. package/dist/gateway/static/root/assets/logs-page-DhXIIoc0.js +0 -2
  123. package/dist/gateway/static/root/assets/note-detail-panel-CCIA4VbP.js +0 -5
  124. package/dist/gateway/static/root/assets/notes-page-C8JeFMSH.js +0 -8
  125. package/dist/gateway/static/root/assets/project-detail-page-DeTeDel1.js +0 -1
  126. package/dist/gateway/static/root/assets/remote-access-hub-DSGwCc4h.js +0 -1
  127. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-BY9oD7eN.js +0 -5
  128. package/dist/gateway/static/root/assets/sessions-page-zAeJa1Ae.js +0 -1
  129. package/dist/gateway/static/root/assets/settings-advanced-gate-BG4EILeB.js +0 -1
  130. package/dist/gateway/static/root/assets/settings-form-section-C4D1p0xR.js +0 -1
  131. package/dist/gateway/static/root/assets/settings-page-layout-CsUQKRq0.js +0 -1
  132. package/dist/gateway/static/root/assets/shares-settings-BN_O6Dwt.js +0 -1
  133. package/dist/gateway/static/root/assets/skill-reload-api-Sq-IWawl.js +0 -1
  134. package/dist/gateway/static/root/assets/task-detail-page-CJ1WpRpN.js +0 -1
  135. package/dist/gateway/static/root/assets/theme-store-JzZVUvEh.js +0 -1
  136. package/dist/gateway/static/root/assets/tunnel-api-GLzwLaUZ.js +0 -1
  137. package/dist/gateway/static/root/assets/user-model-page-CX9eizCN.js +0 -2
  138. package/dist/gateway/static/root/assets/workflows-page-ea-j18xi.js +0 -6
@@ -1,5 +1,5 @@
1
- import { ConfigPersistenceError, persistConfigMutation } from "../../../config/config-mutation.js";
2
1
  import { getStoreConnectorInstallPlan, installStoreConnector, listStoreConnectors } from "../../../capabilities/store-connector.js";
2
+ import { ConfigPersistenceError, persistConfigMutation } from "../../../config/config-mutation.js";
3
3
  //#region src/gateway/hono/routes/capabilities.ts
4
4
  function errorMessage(error) {
5
5
  return error instanceof Error ? error.message : String(error);
@@ -12,16 +12,16 @@ import { createConnectorSetupSecretRequest, submitConnectorSetupSecret } from ".
12
12
  import { configureComposioApiKey, executeComposioTool, getComposioInstallationPolicy, getComposioToolkitAuthState, getComposioToolkitScope, inspectComposioConnectorHealth, listComposioConnections, listComposioTools, refreshComposioConnection, revokeComposioConnection, setComposioToolkitScope, updateComposioConnection, updateComposioInstallationPolicy } from "../../../connectors/composio.js";
13
13
  import { listConnectorProviders } from "../../../connectors/providers.js";
14
14
  import { getConnectorDefinition, listConnectorCatalog } from "../../../connectors/catalog.js";
15
- import { ConfigPersistenceError, persistConfigMutation } from "../../../config/config-mutation.js";
16
- import { getMcpOAuthManager } from "../../../agent/mcp/oauth/mcp-oauth-manager.js";
17
15
  import { recordConnectorHealthUsage } from "../../../connectors/usage.js";
18
16
  import { getConnectorInstance, getInstalledConnectorDefinition, listConnectorInstances } from "../../../connectors/instances.js";
17
+ import { installConnector, installConnectorDefinition, uninstallConnector, updateConnectorConfig } from "../../../connectors/install.js";
18
+ import { ConfigPersistenceError, persistConfigMutation } from "../../../config/config-mutation.js";
19
+ import { getMcpOAuthManager } from "../../../agent/mcp/oauth/mcp-oauth-manager.js";
19
20
  import { startConnectorAuthorization } from "../../../connectors/auth-provider-registry.js";
20
21
  import { composioLogoResponse } from "../../../connectors/composio-logo.js";
21
22
  import { inspectManagedComposioStatus } from "../../../connectors/composio-managed-client.js";
22
23
  import { appendComposioTriggerEvent, listComposioTriggerEvents } from "../../../connectors/composio-triggers.js";
23
24
  import { ingestLocalFolderSource } from "../../../connectors/connected-source-ingestion.js";
24
- import { installConnector, installConnectorDefinition, uninstallConnector, updateConnectorConfig } from "../../../connectors/install.js";
25
25
  import { previewConnectorDefinition, testConnectorInstance } from "../../../connectors/health.js";
26
26
  import { listUnderstandingSourceGrants, revokeUnderstandingSourceGrant } from "../../../user-context/sources/repository.js";
27
27
  import { setConnectorEnabled } from "../../../connectors/lifecycle.js";
@@ -1,8 +1,8 @@
1
1
  import { canonicalizeConfiguredMcpServer, normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
2
2
  import { loadMergedBundleMcpConfig } from "../../../agent/mcp/bundle-mcp-config.js";
3
+ import { isManagedConnectorServer } from "../../../connectors/materialize.js";
3
4
  import { getWorkspacePath } from "../../../config/workspace-path-helpers.js";
4
5
  import { getMcpOAuthManager } from "../../../agent/mcp/oauth/mcp-oauth-manager.js";
5
- import { isManagedConnectorServer } from "../../../connectors/materialize.js";
6
6
  import { listBundleMcpServerCapabilitiesForGateway, listBundleMcpServerToolsForGateway } from "../../../agent/mcp/bundle-mcp-gateway.js";
7
7
  //#region src/gateway/hono/routes/mcp.ts
8
8
  function registerMcpRoutes(authenticated, deps) {
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
2
+ import { appendCronEventLines } from "./event-prompt.js";
2
3
  import { isWithinActiveHours } from "./active-hours.js";
3
4
  import { isHeartbeatContentEmpty } from "./content-check.js";
4
- import { appendCronEventLines } from "./event-prompt.js";
5
5
  import { createHeartbeatWake } from "./wake.js";
6
6
  export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
@@ -73,6 +73,15 @@ function listSessionMetadata(query = {}) {
73
73
  const params = [];
74
74
  if (!query.includeHidden) {
75
75
  conditions.push(`s.hidden_from_session_list = 0`);
76
+ conditions.push(`NOT (
77
+ s.source_channel = 'automation'
78
+ AND (
79
+ COALESCE(CASE WHEN json_valid(s.custom_data_json)
80
+ THEN json_extract(s.custom_data_json, '$.systemInternal') END, 0) = 1
81
+ OR COALESCE(CASE WHEN json_valid(s.custom_data_json)
82
+ THEN json_extract(s.custom_data_json, '$.automationId') END, '') LIKE 'system-memory-%'
83
+ )
84
+ )`);
76
85
  conditions.push(`(
77
86
  s.source_channel NOT IN ('automation', 'workflow')
78
87
  OR COALESCE(TRIM(s.name), '') != ''
@@ -5,9 +5,9 @@ import { resolveBootstrapFilesSync } from "../agent/bootstrap/bootstrap-files.js
5
5
  import { createSkillConfigManager, isSkillEnabled } from "../agent/skills/config.js";
6
6
  import { loadSkills } from "../agent/skills/index.js";
7
7
  import { createWorkflowCatalog } from "../agent/workflow/catalog.js";
8
+ import { listConnectorInstances } from "../connectors/instances.js";
8
9
  import { getWorkspacePath } from "../config/workspace-path-helpers.js";
9
10
  import "../config/index.js";
10
- import { listConnectorInstances } from "../connectors/instances.js";
11
11
  import { basename } from "node:path";
12
12
  //#region src/tui/tui-startup-resources.ts
13
13
  init_paths();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xopcai/xopc",
3
- "version": "0.0.301",
3
+ "version": "0.0.303",
4
4
  "description": "Local-first personal AI assistant with reviewable user understanding, durable tasks, workflows, automations, and local or cloud models.",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -166,8 +166,8 @@
166
166
  "vitepress": "^1.6.4",
167
167
  "vitest": "4.1.5",
168
168
  "vue": "^3.5.35",
169
- "@xopcai/browser-control-contract": "0.1.0",
170
169
  "@xopcai/computer-control-contract": "0.1.0",
170
+ "@xopcai/browser-control-contract": "0.1.0",
171
171
  "@xopcai/endpoint-tools-client": "0.0.0",
172
172
  "@xopcai/endpoint-tools-protocol": "0.0.0",
173
173
  "@xopcai/gateway-contract": "0.0.0",
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./popover-select-DldSX8GX.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{c as l,n as u}from"./locale-store-DuG-kbsP.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{t as f}from"./button-CGlRPNzi.js";import{r as p}from"./gateway-config-swr-COJzzscc.js";import{t as m}from"./skeleton-BwbyijEw.js";import{n as h,t as g}from"./registry-api-BDgFNu05.js";import{Bc as _,Sc as v,Tc as y,Yl as b,Yu as x,Zu as S,_i as C,bc as w,cl as T,dn as E,jc as ee,un as D,wl as te,y as O,yn as ne}from"./index-54o0AGdj.js";import{n as k,r as A}from"./settings-page-layout-CsUQKRq0.js";import{n as j,t as re}from"./use-autosave-DSrlXbBg.js";import{u as M}from"./voice-config-api-DJvwbFbz.js";import{r as ie}from"./image-generation-api-sO31fQr_.js";var N=e(t(),1),ae=n(),P=r(),F={"xopc-cloud":`XOPC Cloud`,"xopc-local":`XOPC Local`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`,"tts-local-cli":`Local TTS`};function I(e,t,n){let r=e?.[t]?.[n];return typeof r==`string`&&r.trim()?r.trim():void 0}function L(e){return F[e]??e}function R(e){let t=(0,ae.c)(17),{icon:n,label:r,enabled:i,details:a,zh:o}=e,s;t[0]===n?s=t[1]:(s=(0,P.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,P.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,P.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=c);let l=i?o?`已启用`:`On`:o?`已关闭`:`Off`,u;t[4]===l?u=t[5]:(u=(0,P.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:l}),t[4]=l,t[5]=u);let d;t[6]!==c||t[7]!==u?(d=(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c,u]}),t[6]=c,t[7]=u,t[8]=d):d=t[8];let f=i?a:o?`不处理语音`:`Voice processing is disabled`,p;t[9]===f?p=t[10]:(p=(0,P.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:f}),t[9]=f,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,P.jsxs)(`div`,{className:`min-w-0`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==s||t[15]!==m?(h=(0,P.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-panel p-4`,children:[s,m]}),t[14]=s,t[15]=m,t[16]=h):h=t[16],h}function z(e){let t=(0,ae.c)(27),{zh:n}=e,{data:r,error:a,isLoading:o}=p(!0),s=r?.payload?.config,c,l,u;if(t[0]!==s){u=s===void 0?void 0:M(s);let e=u?I(u.stt.providers,u.stt.provider,`model`):void 0,n=u?I(u.tts.providers,u.tts.provider,`model`):void 0,r=u?I(u.tts.providers,u.tts.provider,`voice`):void 0;c=u?[L(u.stt.provider),e].filter(Boolean).join(` · `):void 0,l=u?[L(u.tts.provider),n,r].filter(Boolean).join(` · `):void 0,t[0]=s,t[1]=c,t[2]=l,t[3]=u}else c=t[1],l=t[2],u=t[3];let d=l,h=n?`语音能力`:`Voice capabilities`,g;t[4]===h?g=t[5]:(g=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:h}),t[4]=h,t[5]=g);let _=n?`语音识别和朗读由所有智能体共用,在语音设置中统一管理。`:`STT and TTS are shared by every agent and managed in global voice settings.`,v;t[6]===_?v=t[7]:(v=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_}),t[6]=_,t[7]=v);let y;t[8]!==g||t[9]!==v?(y=(0,P.jsxs)(`div`,{children:[g,v]}),t[8]=g,t[9]=v,t[10]=y):y=t[10];let b=n?`管理语音设置`:`Manage voice settings`,C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,P.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[11]=C):C=t[11];let w;t[12]===b?w=t[13]:(w=(0,P.jsx)(f,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,P.jsxs)(i,{to:`/settings/capabilities/voice`,children:[b,C]})}),t[12]=b,t[13]=w);let E;t[14]!==y||t[15]!==w?(E=(0,P.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[y,w]}),t[14]=y,t[15]=w,t[16]=E):E=t[16];let ee;t[17]!==a||t[18]!==o||t[19]!==c||t[20]!==d||t[21]!==u||t[22]!==n?(ee=o||!u?a?(0,P.jsx)(`p`,{className:`mt-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:n?`暂时无法读取语音配置。`:`Voice settings could not be loaded.`}):(0,P.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,P.jsx)(m,{className:`h-20 rounded-xl`}),(0,P.jsx)(m,{className:`h-20 rounded-xl`})]}):(0,P.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,P.jsx)(R,{icon:T,label:n?`语音转文字(STT)`:`Speech to text (STT)`,enabled:u.stt.enabled,details:c,zh:n}),(0,P.jsx)(R,{icon:x,label:n?`文字转语音(TTS)`:`Text to speech (TTS)`,enabled:u.tts.enabled,details:d,zh:n})]}),t[17]=a,t[18]=o,t[19]=c,t[20]=d,t[21]=u,t[22]=n,t[23]=ee):ee=t[23];let D;return t[24]!==E||t[25]!==ee?(D=(0,P.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[E,ee]}),t[24]=E,t[25]=ee,t[26]=D):D=t[26],D}var B=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],V=`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`,H={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 U(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function oe(e){let t=(0,ae.c)(35),{primary:n,value:r,models:i,loading:a,error:o,zh:c,onChange:l}=e,u;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],u=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=u}else u=t[3];let d=u,f=c?`回退顺序`:`Fallback order`,p;t[7]===f?p=t[8]:(p=(0,P.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:f}),t[7]=f,t[8]=p);let m=c?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,h;t[9]===m?h=t[10]:(h=(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==p||t[12]!==h?(g=(0,P.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,P.jsxs)(`div`,{children:[p,h]})}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==i||t[15]!==l||t[16]!==r||t[17]!==c?(_=r.length>0?(0,P.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full border border-edge bg-surface-panel py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,P.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,P.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,P.jsx)(`button`,{type:`button`,"aria-label":c?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>l(r.filter(t=>t!==e)),children:(0,P.jsx)(s,{className:`size-3`})})]},e))}):(0,P.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:c?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=l,t[16]=r,t[17]=c,t[18]=_):_=t[18];let v=c?`添加回退模型`:`Add fallback model`,y=c?`搜索模型或服务商`:`Search models or providers`,b=c?`没有可添加的模型`:`No models available to add`,x=c?`添加回退模型`:`Add fallback model`,S;t[19]!==l||t[20]!==r?(S=e=>{e&&l([...r,e])},t[19]=l,t[20]=r,t[21]=S):S=t[21];let w;t[22]!==d||t[23]!==o||t[24]!==a||t[25]!==b||t[26]!==x||t[27]!==S||t[28]!==v||t[29]!==y?(w=(0,P.jsx)(C,{value:``,models:d,modelsLoading:a,modelsError:o,placeholder:v,searchPlaceholder:y,noMatches:b,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:x,onChange:S}),t[22]=d,t[23]=o,t[24]=a,t[25]=b,t[26]=x,t[27]=S,t[28]=v,t[29]=y,t[30]=w):w=t[30];let T;return t[31]!==w||t[32]!==g||t[33]!==_?(T=(0,P.jsxs)(`div`,{children:[g,_,w]}),t[31]=w,t[32]=g,t[33]=_,t[34]=T):T=t[34],T}function W(e){let t=(0,ae.c)(121),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let o=d(g,h,a),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[1]=s):s=t[1];let c=d(`agent-defaults-image-models`,ie,s),l;t[2]===o.data?l=t[3]:(l=o.data??[],t[2]=o.data,t[3]=l);let u=l,p;t[4]===c.data?p=t[5]:(p=c.data??[],t[4]=c.data,t[5]=p);let m;t[6]===p?m=t[7]:(m=p.flatMap(G),t[6]=p,t[7]=m);let _=m,v=i?H.zh:H.en,y;t[8]!==n||t[9]!==r?(y=(e,t)=>{let i={...n.models.intents};t?i[e]=U(i[e],t):delete i[e],r({...n,models:{...n.models,intents:i}})},t[8]=n,t[9]=r,t[10]=y):y=t[10];let b=y,x=i?`默认对话模型`:`Default conversation model`,S;t[11]===x?S=t[12]:(S=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:x}),t[11]=x,t[12]=S);let w=i?`大多数对话和没有专用路由的任务都会使用它。`:`Used for most conversations and every task without a dedicated route.`,T;t[13]===w?T=t[14]:(T=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:w}),t[13]=w,t[14]=T);let E;t[15]!==T||t[16]!==S?(E=(0,P.jsxs)(`div`,{children:[S,T]}),t[15]=T,t[16]=S,t[17]=E):E=t[17];let ee=i?`主模型`:`Primary model`,D;t[18]===ee?D=t[19]:(D=(0,P.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:ee}),t[18]=ee,t[19]=D);let te=i?`选择模型`:`Select a model`,O=i?`搜索模型或服务商`:`Search models or providers`,ne=i?`没有匹配的模型`:`No matching models`,k=i?`默认对话模型`:`Default conversation model`,A;t[20]!==n||t[21]!==r?(A=e=>r({...n,models:{...n.models,chat:{...n.models.chat,primary:e}}}),t[20]=n,t[21]=r,t[22]=A):A=t[22];let j;t[23]!==n.models.chat.primary||t[24]!==te||t[25]!==O||t[26]!==ne||t[27]!==k||t[28]!==A?(j=(0,P.jsx)(C,{value:n.models.chat.primary,placeholder:te,searchPlaceholder:O,noMatches:ne,showProviderSettingsFooter:!0,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:k,onChange:A}),t[23]=n.models.chat.primary,t[24]=te,t[25]=O,t[26]=ne,t[27]=k,t[28]=A,t[29]=j):j=t[29];let re;t[30]!==D||t[31]!==j?(re=(0,P.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[D,j]}),t[30]=D,t[31]=j,t[32]=re):re=t[32];let M;t[33]!==n||t[34]!==r?(M=e=>r({...n,models:{...n.models,chat:{...n.models.chat,fallbacks:e}}}),t[33]=n,t[34]=r,t[35]=M):M=t[35];let N;t[36]!==n.models.chat.fallbacks||t[37]!==n.models.chat.primary||t[38]!==u||t[39]!==o.error||t[40]!==o.isLoading||t[41]!==M||t[42]!==i?(N=(0,P.jsx)(`div`,{className:`mt-6 border-t border-edge pt-5`,children:(0,P.jsx)(oe,{primary:n.models.chat.primary,value:n.models.chat.fallbacks,models:u,loading:o.isLoading,error:o.error,zh:i,onChange:M})}),t[36]=n.models.chat.fallbacks,t[37]=n.models.chat.primary,t[38]=u,t[39]=o.error,t[40]=o.isLoading,t[41]=M,t[42]=i,t[43]=N):N=t[43];let F;t[44]!==E||t[45]!==re||t[46]!==N?(F=(0,P.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[E,re,N]}),t[44]=E,t[45]=re,t[46]=N,t[47]=F):F=t[47];let I=i?`图片能力`:`Image capabilities`,L;t[48]===I?L=t[49]:(L=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:I}),t[48]=I,t[49]=L);let R=i?`没有图片任务时可以保持关闭。`:`Leave these off when the agents do not work with images.`,W;t[50]===R?W=t[51]:(W=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:R}),t[50]=R,t[51]=W);let K=i?`图片理解模型`:`Image understanding model`,q;t[52]===K?q=t[53]:(q=(0,P.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:K}),t[52]=K,t[53]=q);let J=n.models.imageUnderstanding?.primary??``,Y=i?`关闭图片理解`:`Image understanding off`,X=i?`搜索视觉模型`:`Search vision models`,Z=i?`没有可用的视觉模型`:`No vision models available`,se=i?`关闭图片理解`:`Image understanding off`,ce=i?`图片理解模型`:`Image understanding model`,le;t[54]!==n||t[55]!==r?(le=e=>{let t={...n.models};e?t.imageUnderstanding=U(t.imageUnderstanding,e):delete t.imageUnderstanding,r({...n,models:t})},t[54]=n,t[55]=r,t[56]=le):le=t[56];let ue;t[57]!==J||t[58]!==Y||t[59]!==X||t[60]!==Z||t[61]!==se||t[62]!==ce||t[63]!==le?(ue=(0,P.jsx)(C,{value:J,placeholder:Y,searchPlaceholder:X,noMatches:Z,capabilitiesFilter:`vision`,allowEmpty:!0,emptyLabel:se,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:ce,onChange:le}),t[57]=J,t[58]=Y,t[59]=X,t[60]=Z,t[61]=se,t[62]=ce,t[63]=le,t[64]=ue):ue=t[64];let de;t[65]!==q||t[66]!==ue?(de=(0,P.jsxs)(`div`,{children:[q,ue]}),t[65]=q,t[66]=ue,t[67]=de):de=t[67];let fe=i?`图片生成模型`:`Image generation model`,pe;t[68]===fe?pe=t[69]:(pe=(0,P.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:fe}),t[68]=fe,t[69]=pe);let me=n.models.imageGeneration?.primary??``,he=i?`关闭图片生成`:`Image generation off`,ge=i?`搜索图片模型或服务商`:`Search image models or providers`,_e=i?`没有可用的图片生成模型`:`No image generation models available`,ve=i?`关闭图片生成`:`Image generation off`,ye=i?`图片生成模型`:`Image generation model`,Q;t[70]!==n||t[71]!==r?(Q=e=>{let t={...n.models};e?t.imageGeneration={primary:e,fallbacks:t.imageGeneration?.fallbacks??[],timeoutMs:t.imageGeneration?.timeoutMs,autoProviderFallback:t.imageGeneration?.autoProviderFallback??!0}:delete t.imageGeneration,r({...n,models:t})},t[70]=n,t[71]=r,t[72]=Q):Q=t[72];let be;t[73]!==_||t[74]!==c.error||t[75]!==c.isLoading||t[76]!==me||t[77]!==he||t[78]!==ge||t[79]!==_e||t[80]!==ve||t[81]!==ye||t[82]!==Q?(be=(0,P.jsx)(C,{value:me,models:_,modelsLoading:c.isLoading,modelsError:c.error,placeholder:he,searchPlaceholder:ge,noMatches:_e,allowEmpty:!0,emptyLabel:ve,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:ye,onChange:Q}),t[73]=_,t[74]=c.error,t[75]=c.isLoading,t[76]=me,t[77]=he,t[78]=ge,t[79]=_e,t[80]=ve,t[81]=ye,t[82]=Q,t[83]=be):be=t[83];let $;t[84]!==pe||t[85]!==be?($=(0,P.jsxs)(`div`,{children:[pe,be]}),t[84]=pe,t[85]=be,t[86]=$):$=t[86];let xe;t[87]!==de||t[88]!==$?(xe=(0,P.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-2`,children:[de,$]}),t[87]=de,t[88]=$,t[89]=xe):xe=t[89];let Se;t[90]!==n||t[91]!==r||t[92]!==i?(Se=n.models.imageGeneration?(0,P.jsxs)(`div`,{className:`mt-5 grid gap-4 border-t border-edge pt-5 sm:grid-cols-2`,children:[(0,P.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,P.jsx)(`input`,{type:`number`,min:1,className:`${V} 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,P.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,P.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,P.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[!0,!1].map(e=>(0,P.jsx)(f,{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,t[90]=n,t[91]=r,t[92]=i,t[93]=Se):Se=t[93];let Ce;t[94]!==L||t[95]!==W||t[96]!==xe||t[97]!==Se?(Ce=(0,P.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[L,W,xe,Se]}),t[94]=L,t[95]=W,t[96]=xe,t[97]=Se,t[98]=Ce):Ce=t[98];let we;t[99]===i?we=t[100]:(we=(0,P.jsx)(z,{zh:i}),t[99]=i,t[100]=we);let Te=i?`按任务选择模型`:`Route by task`,Ee;t[101]===Te?Ee=t[102]:(Ee=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:Te}),t[101]=Te,t[102]=Ee);let De=i?`仅在确实需要不同模型时设置;否则保持“使用默认对话模型”。`:`Set a route only when a task genuinely needs another model; otherwise keep the default.`,Oe;t[103]===De?Oe=t[104]:(Oe=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:De}),t[103]=De,t[104]=Oe);let ke;t[105]!==v||t[106]!==n.models.intents||t[107]!==b||t[108]!==i?(ke=B.map(e=>(0,P.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,P.jsxs)(`div`,{className:`mb-3`,children:[(0,P.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:v[e][0]}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:v[e][1]})]}),(0,P.jsx)(C,{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?`${v[e][0]}模型`:`${v[e][0]} model`,onChange:t=>b(e,t)})]},e)),t[105]=v,t[106]=n.models.intents,t[107]=b,t[108]=i,t[109]=ke):ke=t[109];let Ae;t[110]===ke?Ae=t[111]:(Ae=(0,P.jsx)(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:ke}),t[110]=ke,t[111]=Ae);let je;t[112]!==Ee||t[113]!==Oe||t[114]!==Ae?(je=(0,P.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[Ee,Oe,Ae]}),t[112]=Ee,t[113]=Oe,t[114]=Ae,t[115]=je):je=t[115];let Me;return t[116]!==F||t[117]!==Ce||t[118]!==we||t[119]!==je?(Me=(0,P.jsxs)(`div`,{className:`space-y-5`,children:[F,Ce,we,je]}),t[116]=F,t[117]=Ce,t[118]=we,t[119]=je,t[120]=Me):Me=t[120],Me}function G(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var K=`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`;function q(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function J(e){let t=(0,ae.c)(151),{draft:n,setDraft:r,zh:i}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[0]=o):o=t[0];let s=d(`agent-defaults-workflows`,O,o),l;t[1]===s.data?l=t[2]:(l=s.data??[],t[1]=s.data,t[2]=l);let u;t[3]===l?u=t[4]:(u=l.map(Y),t[3]=l,t[4]=u);let p=u,m=n.workflows.allowed===void 0,h;t[5]!==n||t[6]!==r?(h=(e,t)=>{let i=n.workflows.allowed??[],a=t?[...new Set([...i,e])]:i.filter(t=>t!==e);r({...n,workflows:{...n.workflows,allowed:a}})},t[5]=n,t[6]=r,t[7]=h):h=t[7];let g=h,_=i?`执行限制`:`Execution limits`,v;t[8]===_?v=t[9]:(v=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_}),t[8]=_,t[9]=v);let y=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,b;t[10]===y?b=t[11]:(b=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x=i?`每次运行最多轮数`:`Maximum turns per run`,S=n.runtime.maxTurns??``,C=i?`系统默认`:`System default`,w;t[12]!==n||t[13]!==r?(w=e=>r({...n,runtime:{...n.runtime,maxTurns:q(e.target.value)}}),t[12]=n,t[13]=r,t[14]=w):w=t[14];let T;t[15]!==S||t[16]!==C||t[17]!==w?(T=(0,P.jsx)(`input`,{type:`number`,min:1,value:S,placeholder:C,onChange:w,className:`${K} mt-2`}),t[15]=S,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E;t[19]!==T||t[20]!==x?(E=(0,P.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[x,T]}),t[19]=T,t[20]=x,t[21]=E):E=t[21];let ee=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,D=n.runtime.timeoutMs??``,te=i?`系统默认`:`System default`,ne;t[22]!==n||t[23]!==r?(ne=e=>r({...n,runtime:{...n.runtime,timeoutMs:q(e.target.value)}}),t[22]=n,t[23]=r,t[24]=ne):ne=t[24];let k;t[25]!==D||t[26]!==te||t[27]!==ne?(k=(0,P.jsx)(`input`,{type:`number`,min:1,value:D,placeholder:te,onChange:ne,className:`${K} mt-2`}),t[25]=D,t[26]=te,t[27]=ne,t[28]=k):k=t[28];let A;t[29]!==ee||t[30]!==k?(A=(0,P.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[ee,k]}),t[29]=ee,t[30]=k,t[31]=A):A=t[31];let j=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,re=n.runtime.maxToolFailuresPerTurn??``,M=i?`系统默认`:`System default`,ie;t[32]!==n||t[33]!==r?(ie=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:q(e.target.value)}}),t[32]=n,t[33]=r,t[34]=ie):ie=t[34];let N;t[35]!==re||t[36]!==M||t[37]!==ie?(N=(0,P.jsx)(`input`,{type:`number`,min:1,value:re,placeholder:M,onChange:ie,className:`${K} mt-2`}),t[35]=re,t[36]=M,t[37]=ie,t[38]=N):N=t[38];let F;t[39]!==j||t[40]!==N?(F=(0,P.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[j,N]}),t[39]=j,t[40]=N,t[41]=F):F=t[41];let I;t[42]!==E||t[43]!==A||t[44]!==F?(I=(0,P.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[E,A,F]}),t[42]=E,t[43]=A,t[44]=F,t[45]=I):I=t[45];let L;t[46]!==I||t[47]!==v||t[48]!==b?(L=(0,P.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[v,b,I]}),t[46]=I,t[47]=v,t[48]=b,t[49]=L):L=t[49];let R=i?`提示词缓存`:`Prompt cache`,z;t[50]===R?z=t[51]:(z=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:R}),t[50]=R,t[51]=z);let B=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,V;t[52]===B?V=t[53]:(V=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:B}),t[52]=B,t[53]=V);let H=i?`缓存模式`:`Cache mode`,U;t[54]===H?U=t[55]:(U=(0,P.jsx)(`span`,{children:H}),t[54]=H,t[55]=U);let oe;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(oe=[`auto`,`off`],t[56]=oe):oe=t[56];let W;t[57]!==n||t[58]!==r||t[59]!==i?(W=(0,P.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:oe.map(e=>(0,P.jsx)(f,{variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e))}),t[57]=n,t[58]=r,t[59]=i,t[60]=W):W=t[60];let G;t[61]!==U||t[62]!==W?(G=(0,P.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[U,W]}),t[61]=U,t[62]=W,t[63]=G):G=t[63];let J;t[64]!==n||t[65]!==r||t[66]!==i?(J=n.runtime.promptCache?.mode===`auto`?(0,P.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,P.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,P.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[`short`,`long`].map(e=>(0,P.jsx)(f,{variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[64]=n,t[65]=r,t[66]=i,t[67]=J):J=t[67];let X;t[68]!==G||t[69]!==J?(X=(0,P.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[G,J]}),t[68]=G,t[69]=J,t[70]=X):X=t[70];let Z;t[71]!==z||t[72]!==V||t[73]!==X?(Z=(0,P.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[z,V,X]}),t[71]=z,t[72]=V,t[73]=X,t[74]=Z):Z=t[74];let se=i?`工作流`:`Workflows`,ce;t[75]===se?ce=t[76]:(ce=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:se}),t[75]=se,t[76]=ce);let le=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,ue;t[77]===le?ue=t[78]:(ue=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:le}),t[77]=le,t[78]=ue);let de=i?`默认工作流`:`Default workflow`,fe;t[79]===de?fe=t[80]:(fe=(0,P.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:de}),t[79]=de,t[80]=fe);let pe=n.workflows.default??``,me=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,he=i?`不设置默认工作流`:`No default workflow`,ge=i?`默认工作流`:`Default workflow`,_e;t[81]!==n||t[82]!==r?(_e=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[81]=n,t[82]=r,t[83]=_e):_e=t[83];let ve;t[84]!==pe||t[85]!==me||t[86]!==he||t[87]!==ge||t[88]!==_e||t[89]!==p||t[90]!==s.isLoading?(ve=(0,P.jsx)(a,{value:pe,options:p,placeholder:me,emptyLabel:he,disabled:s.isLoading,ariaLabel:ge,onChange:_e,triggerClassName:`mt-2`}),t[84]=pe,t[85]=me,t[86]=he,t[87]=ge,t[88]=_e,t[89]=p,t[90]=s.isLoading,t[91]=ve):ve=t[91];let ye;t[92]!==fe||t[93]!==ve?(ye=(0,P.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[fe,ve]}),t[92]=fe,t[93]=ve,t[94]=ye):ye=t[94];let Q;t[95]===s.error?Q=t[96]:(Q=s.error?(0,P.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[95]=s.error,t[96]=Q);let be=i?`允许调用的工作流`:`Allowed workflows`,$;t[97]===be?$=t[98]:($=(0,P.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:be}),t[97]=be,t[98]=$);let xe;t[99]!==n||t[100]!==r?(xe=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[99]=n,t[100]=r,t[101]=xe):xe=t[101];let Se=m?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,Ce;t[102]===Se?Ce=t[103]:(Ce=c(`rounded-xl border p-4 text-left`,Se),t[102]=Se,t[103]=Ce);let we=i?`允许全部工作流`:`Allow every workflow`,Te;t[104]===we?Te=t[105]:(Te=(0,P.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:we}),t[104]=we,t[105]=Te);let Ee=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,De;t[106]===Ee?De=t[107]:(De=(0,P.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ee}),t[106]=Ee,t[107]=De);let Oe;t[108]!==xe||t[109]!==Ce||t[110]!==Te||t[111]!==De?(Oe=(0,P.jsxs)(`button`,{type:`button`,onClick:xe,className:Ce,children:[Te,De]}),t[108]=xe,t[109]=Ce,t[110]=Te,t[111]=De,t[112]=Oe):Oe=t[112];let ke;t[113]!==n||t[114]!==r?(ke=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[113]=n,t[114]=r,t[115]=ke):ke=t[115];let Ae=m?`border-edge bg-surface-panel hover:border-edge-strong`:`border-accent bg-accent/5 ring-1 ring-accent/20`,je;t[116]===Ae?je=t[117]:(je=c(`rounded-xl border p-4 text-left`,Ae),t[116]=Ae,t[117]=je);let Me=i?`只允许选中的工作流`:`Allow selected workflows only`,Ne;t[118]===Me?Ne=t[119]:(Ne=(0,P.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Me}),t[118]=Me,t[119]=Ne);let Pe=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,Fe;t[120]===Pe?Fe=t[121]:(Fe=(0,P.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Pe}),t[120]=Pe,t[121]=Fe);let Ie;t[122]!==ke||t[123]!==je||t[124]!==Ne||t[125]!==Fe?(Ie=(0,P.jsxs)(`button`,{type:`button`,onClick:ke,className:je,children:[Ne,Fe]}),t[122]=ke,t[123]=je,t[124]=Ne,t[125]=Fe,t[126]=Ie):Ie=t[126];let Le;t[127]!==Oe||t[128]!==Ie?(Le=(0,P.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Oe,Ie]}),t[127]=Oe,t[128]=Ie,t[129]=Le):Le=t[129];let Re;t[130]!==m||t[131]!==n.workflows.allowed||t[132]!==g||t[133]!==s.data||t[134]!==s.isLoading||t[135]!==i?(Re=m?null:(0,P.jsxs)(`div`,{className:`mt-3 divide-y divide-edge rounded-xl border border-edge bg-surface-panel`,children:[(s.data??[]).map(e=>(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>g(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,P.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,P.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[130]=m,t[131]=n.workflows.allowed,t[132]=g,t[133]=s.data,t[134]=s.isLoading,t[135]=i,t[136]=Re):Re=t[136];let ze;t[137]!==$||t[138]!==Le||t[139]!==Re?(ze=(0,P.jsxs)(`div`,{className:`mt-6 border-t border-edge pt-5`,children:[$,Le,Re]}),t[137]=$,t[138]=Le,t[139]=Re,t[140]=ze):ze=t[140];let Be;t[141]!==ce||t[142]!==ue||t[143]!==ye||t[144]!==Q||t[145]!==ze?(Be=(0,P.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[ce,ue,ye,Q,ze]}),t[141]=ce,t[142]=ue,t[143]=ye,t[144]=Q,t[145]=ze,t[146]=Be):Be=t[146];let Ve;return t[147]!==L||t[148]!==Z||t[149]!==Be?(Ve=(0,P.jsxs)(`div`,{className:`space-y-5`,children:[L,Z,Be]}),t[147]=L,t[148]=Z,t[149]=Be,t[150]=Ve):Ve=t[150],Ve}function Y(e){return{value:e.id,label:e.title||e.name}}function X(e){return[...new Set(e)].sort()}function Z(e){let t=(0,ae.c)(99),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let{data:s,error:l,isLoading:u}=d(`agent-defaults-skills-catalog`,ne,a),[f,p]=(0,N.useState)(``),m=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;s?.catalog;let h;if(t[1]!==m||t[2]!==s?.catalog||t[3]!==f){let e=[...s?.catalog??[]],n=new Set(e.map(le));for(let t of m)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=f.trim().toLowerCase();h=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(ce),t[1]=m,t[2]=s?.catalog,t[3]=f,t[4]=h}else h=t[4];let g=h,_;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(_=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=_):_=t[8];let v=_,y;t[9]!==n||t[10]!==r?(y=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):X([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):X([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=y):y=t[11];let b=y,x;t[12]===s?.catalog?x=t[13]:(x=s?.catalog??[],t[12]=s?.catalog,t[13]=x);let S;if(t[14]!==v||t[15]!==x){let e;t[17]===v?e=t[18]:(e=e=>e.enabled&&v(e.name),t[17]=v,t[18]=e),S=x.filter(e),t[14]=v,t[15]=x,t[16]=S}else S=t[16];let C=S.length,w=i?`技能策略`:`Skill policy`,T;t[19]===w?T=t[20]:(T=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:w}),t[19]=w,t[20]=T);let E=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,D;t[21]===E?D=t[22]:(D=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:E}),t[21]=E,t[22]=D);let O;t[23]!==n||t[24]!==r?(O=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[23]=n,t[24]=r,t[25]=O):O=t[25];let k=n.skills.mode===`all-enabled`?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,A;t[26]===k?A=t[27]:(A=c(`flex items-start gap-3 rounded-xl border p-4 text-left`,k),t[26]=k,t[27]=A);let j;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,P.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[28]=j):j=t[28];let re=i?`使用所有已启用技能`:`Use every enabled skill`,M;t[29]===re?M=t[30]:(M=(0,P.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:re}),t[29]=re,t[30]=M);let ie=i?`推荐。以后启用的新技能也会自动可用,可单独排除。`:`Recommended. Newly enabled skills become available automatically; exclude exceptions below.`,F;t[31]===ie?F=t[32]:(F=(0,P.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:ie}),t[31]=ie,t[32]=F);let I;t[33]!==M||t[34]!==F?(I=(0,P.jsxs)(`span`,{children:[M,F]}),t[33]=M,t[34]=F,t[35]=I):I=t[35];let L;t[36]!==O||t[37]!==A||t[38]!==I?(L=(0,P.jsxs)(`button`,{type:`button`,onClick:O,className:A,children:[j,I]}),t[36]=O,t[37]=A,t[38]=I,t[39]=L):L=t[39];let R;t[40]!==n||t[41]!==r?(R=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[40]=n,t[41]=r,t[42]=R):R=t[42];let z=n.skills.mode===`selected`?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,B;t[43]===z?B=t[44]:(B=c(`flex items-start gap-3 rounded-xl border p-4 text-left`,z),t[43]=z,t[44]=B);let V;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,P.jsx)(te,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[45]=V):V=t[45];let H=i?`只使用选中的技能`:`Use selected skills only`,U;t[46]===H?U=t[47]:(U=(0,P.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:H}),t[46]=H,t[47]=U);let oe=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,W;t[48]===oe?W=t[49]:(W=(0,P.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:oe}),t[48]=oe,t[49]=W);let G;t[50]!==U||t[51]!==W?(G=(0,P.jsxs)(`span`,{children:[U,W]}),t[50]=U,t[51]=W,t[52]=G):G=t[52];let K;t[53]!==R||t[54]!==B||t[55]!==G?(K=(0,P.jsxs)(`button`,{type:`button`,onClick:R,className:B,children:[V,G]}),t[53]=R,t[54]=B,t[55]=G,t[56]=K):K=t[56];let q;t[57]!==L||t[58]!==K?(q=(0,P.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[L,K]}),t[57]=L,t[58]=K,t[59]=q):q=t[59];let J;t[60]!==D||t[61]!==q||t[62]!==T?(J=(0,P.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[T,D,q]}),t[60]=D,t[61]=q,t[62]=T,t[63]=J):J=t[63];let Y=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,Z;t[64]===Y?Z=t[65]:(Z=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:Y}),t[64]=Y,t[65]=Z);let ue=i?`当前默认可用 ${C} 个技能。`:`${C} skills are available by default.`,de;t[66]===ue?de=t[67]:(de=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ue}),t[66]=ue,t[67]=de);let fe;t[68]!==Z||t[69]!==de?(fe=(0,P.jsxs)(`div`,{children:[Z,de]}),t[68]=Z,t[69]=de,t[70]=fe):fe=t[70];let pe=i?`搜索技能`:`Search skills`,me;t[71]===pe?me=t[72]:(me=(0,P.jsx)(`span`,{className:`sr-only`,children:pe}),t[71]=pe,t[72]=me);let he;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,P.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[73]=he):he=t[73];let ge;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(ge=e=>p(e.target.value),t[74]=ge):ge=t[74];let _e=i?`搜索技能`:`Search skills`,ve;t[75]!==f||t[76]!==_e?(ve=(0,P.jsx)(`input`,{type:`search`,value:f,onChange:ge,placeholder:_e,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[75]=f,t[76]=_e,t[77]=ve):ve=t[77];let ye;t[78]!==me||t[79]!==ve?(ye=(0,P.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[me,he,ve]}),t[78]=me,t[79]=ve,t[80]=ye):ye=t[80];let Q;t[81]!==fe||t[82]!==ye?(Q=(0,P.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[fe,ye]}),t[81]=fe,t[82]=ye,t[83]=Q):Q=t[83];let be;t[84]===l?be=t[85]:(be=l?(0,P.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:l instanceof Error?l.message:String(l)}):null,t[84]=l,t[85]=be);let $;t[86]!==v||t[87]!==u||t[88]!==g||t[89]!==b||t[90]!==i?($=u?(0,P.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(se)}):(0,P.jsxs)(`div`,{className:`mt-4 max-h-[32rem] divide-y divide-edge overflow-y-auto rounded-xl border border-edge bg-surface-panel`,children:[g.map(e=>{let t=v(e.name);return(0,P.jsxs)(`label`,{className:c(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>b(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,P.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,P.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),g.length===0?(0,P.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[86]=v,t[87]=u,t[88]=g,t[89]=b,t[90]=i,t[91]=$):$=t[91];let xe;t[92]!==Q||t[93]!==be||t[94]!==$?(xe=(0,P.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[Q,be,$]}),t[92]=Q,t[93]=be,t[94]=$,t[95]=xe):xe=t[95];let Se;return t[96]!==J||t[97]!==xe?(Se=(0,P.jsxs)(`div`,{className:`space-y-5`,children:[J,xe]}),t[96]=J,t[97]=xe,t[98]=Se):Se=t[98],Se}function se(e){return(0,P.jsx)(m,{className:`h-14 rounded-xl`},e)}function ce(e,t){return e.name.localeCompare(t.name)}function le(e){return e.name}function ue(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function de(e){let t=(0,ae.c)(92),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,[o,s]=(0,N.useState)(``),[l,u]=(0,N.useState)(`all`),[d,p]=(0,N.useState)(),m;t[0]===i?m=t[1]:(m=new Map(i.map(pe)),t[0]=i,t[1]=m);let h=m,g;t[2]!==i||t[3]!==n.tools?(g=[...new Set([...i.map(fe),...Object.keys(n.tools)])].sort(),t[2]=i,t[3]=n.tools,t[4]=g):g=t[4];let _=g,y;if(t[5]!==_||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),y=_.filter(e),t[5]=_,t[6]=n.tools,t[7]=y}else y=t[7];let b=y.length,x;if(t[10]!==_||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),x=_.filter(e),t[10]=_,t[11]=n.tools,t[12]=x}else x=t[12];let S=x.length,C;if(t[15]!==_||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),C=_.filter(e),t[15]=_,t[16]=n.tools,t[17]=C}else C=t[17];let w;t[20]!==y.length||t[21]!==x.length||t[22]!==C.length?(w={allow:b,ask:S,deny:C.length},t[20]=y.length,t[21]=x.length,t[22]=C.length,t[23]=w):w=t[23];let T=w,E;if(t[24]!==_||t[25]!==h||t[26]!==n.tools||t[27]!==l||t[28]!==o){let e=o.trim().toLowerCase();E=_.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=h.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(l===`all`||r===l)}),t[24]=_,t[25]=h,t[26]=n.tools,t[27]=l,t[28]=o,t[29]=E}else E=t[29];let D=E,te;t[30]!==n||t[31]!==r?(te=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=te):te=t[32];let O=te,ne=a?`全部 ${_.length}`:`All ${_.length}`,k;t[33]===ne?k=t[34]:(k={id:`all`,label:ne},t[33]=ne,t[34]=k);let A=a?`允许 ${T.allow}`:`Allow ${T.allow}`,j;t[35]===A?j=t[36]:(j={id:`allow`,label:A},t[35]=A,t[36]=j);let re=a?`询问 ${T.ask}`:`Ask ${T.ask}`,M;t[37]===re?M=t[38]:(M={id:`ask`,label:re},t[37]=re,t[38]=M);let ie=a?`禁用 ${T.deny}`:`Deny ${T.deny}`,F;t[39]===ie?F=t[40]:(F={id:`deny`,label:ie},t[39]=ie,t[40]=F);let I;t[41]!==k||t[42]!==j||t[43]!==M||t[44]!==F?(I=[k,j,M,F],t[41]=k,t[42]=j,t[43]=M,t[44]=F,t[45]=I):I=t[45];let L=I,R=a?`默认工具权限`:`Default tool permissions`,z;t[46]===R?z=t[47]:(z=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:R}),t[46]=R,t[47]=z);let B=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,V;t[48]===B?V=t[49]:(V=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:B}),t[48]=B,t[49]=V);let H;t[50]!==z||t[51]!==V?(H=(0,P.jsxs)(`div`,{children:[z,V]}),t[50]=z,t[51]=V,t[52]=H):H=t[52];let U;t[53]!==l||t[54]!==L?(U=(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,children:L.map(e=>(0,P.jsx)(`button`,{type:`button`,onClick:()=>u(e.id),className:c(`rounded-lg px-3 py-1.5 text-xs font-medium`,l===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id))}),t[53]=l,t[54]=L,t[55]=U):U=t[55];let oe=a?`搜索工具`:`Search tools`,W;t[56]===oe?W=t[57]:(W=(0,P.jsx)(`span`,{className:`sr-only`,children:oe}),t[56]=oe,t[57]=W);let G;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,P.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=G):G=t[58];let K;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>s(e.target.value),t[59]=K):K=t[59];let q=a?`搜索工具`:`Search tools`,J;t[60]!==o||t[61]!==q?(J=(0,P.jsx)(`input`,{type:`search`,value:o,onChange:K,placeholder:q,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[60]=o,t[61]=q,t[62]=J):J=t[62];let Y;t[63]!==W||t[64]!==J?(Y=(0,P.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[W,G,J]}),t[63]=W,t[64]=J,t[65]=Y):Y=t[65];let X;t[66]!==U||t[67]!==Y?(X=(0,P.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[U,Y]}),t[66]=U,t[67]=Y,t[68]=X):X=t[68];let Z;if(t[69]!==h||t[70]!==n.tools||t[71]!==d||t[72]!==O||t[73]!==D||t[74]!==a){let e;t[76]!==h||t[77]!==n.tools||t[78]!==d||t[79]!==O||t[80]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=h.get(e),i=d===e;return(0,P.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,P.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,children:[`allow`,`ask`,`deny`].map(n=>(0,P.jsx)(`button`,{type:`button`,onClick:()=>O(e,{mode:n}),className:c(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-white`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),(0,P.jsx)(f,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>p(i?void 0:e),children:(0,P.jsx)(v,{className:`size-4`})})]})]}),i?(0,P.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,P.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,P.jsx)(`input`,{type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>O(e,{maxCallsPerTurn:ue(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,P.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,P.jsx)(`input`,{type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>O(e,{timeoutMs:ue(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[76]=h,t[77]=n.tools,t[78]=d,t[79]=O,t[80]=a,t[81]=e):e=t[81],Z=D.map(e),t[69]=h,t[70]=n.tools,t[71]=d,t[72]=O,t[73]=D,t[74]=a,t[75]=Z}else Z=t[75];let se;t[82]!==D.length||t[83]!==a?(se=D.length===0?(0,P.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[82]=D.length,t[83]=a,t[84]=se):se=t[84];let ce;t[85]!==Z||t[86]!==se?(ce=(0,P.jsxs)(`div`,{className:`mt-4 max-h-[38rem] divide-y divide-edge overflow-y-auto rounded-xl border border-edge bg-surface-panel`,children:[Z,se]}),t[85]=Z,t[86]=se,t[87]=ce):ce=t[87];let le;return t[88]!==H||t[89]!==X||t[90]!==ce?(le=(0,P.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[H,X,ce]}),t[88]=H,t[89]=X,t[90]=ce,t[91]=le):le=t[91],le}function fe(e){return e.id}function pe(e){return[e.id,e.description]}function me(){let e=(0,ae.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,P.jsxs)(A,{gap:`gap-5`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(m,{className:`h-7 w-56`}),(0,P.jsx)(m,{className:`h-4 w-96 max-w-full`})]}),(0,P.jsx)(m,{className:`h-9 w-28`})]}),(0,P.jsx)(m,{className:`h-20 rounded-2xl`}),(0,P.jsx)(m,{className:`h-12 rounded-xl`}),(0,P.jsx)(m,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function he(e){let t=(0,ae.c)(67),{initial:n,builtinTools:r,zh:i}=e,[a,o]=(0,N.useState)(`models`),s;t[0]===n?s=t[1]:(s=()=>structuredClone(n),t[0]=n,t[1]=s);let[l,u]=(0,N.useState)(s),d;t[2]===n?d=t[3]:(d=()=>structuredClone(n),t[2]=n,t[3]=d);let[p,m]=(0,N.useState)(d),h;t[4]===l?h=t[5]:(h=JSON.stringify(l),t[4]=l,t[5]=h);let g;t[6]===p?g=t[7]:(g=JSON.stringify(p),t[6]=p,t[7]=g);let v=h!==g,x=i?`模型`:`Models`,S;t[8]===x?S=t[9]:(S={id:`models`,label:x,icon:w},t[8]=x,t[9]=S);let C=i?`技能`:`Skills`,T;t[10]===C?T=t[11]:(T={id:`skills`,label:C,icon:_},t[10]=C,t[11]=T);let ee=i?`工具`:`Tools`,D;t[12]===ee?D=t[13]:(D={id:`tools`,label:ee,icon:y},t[12]=ee,t[13]=D);let te=i?`运行`:`Runtime`,O;t[14]===te?O=t[15]:(O={id:`runtime`,label:te,icon:b},t[14]=te,t[15]=O);let ne;t[16]!==D||t[17]!==O||t[18]!==S||t[19]!==T?(ne=[S,T,D,O],t[16]=D,t[17]=O,t[18]=S,t[19]=T,t[20]=ne):ne=t[20];let M=ne,ie;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ie=async e=>{let t=structuredClone(e),n=await E(t),r=structuredClone(n.defaults);u(e=>JSON.stringify(e)===JSON.stringify(t)?r:e),m(structuredClone(r))},t[21]=ie):ie=t[21];let F=ie,I;t[22]!==v||t[23]!==l?(I={value:l,dirty:v,onSave:F,delayMs:0},t[22]=v,t[23]=l,t[24]=I):I=t[24];let L=re(I),R=L.onBlurCapture,z=i?`智能体设置`:`Agent settings`,B;t[25]!==L.error||t[26]!==L.status?(B=(0,P.jsx)(j,{status:L.status,error:L.error}),t[25]=L.error,t[26]=L.status,t[27]=B):B=t[27];let V;t[28]!==z||t[29]!==B?(V=(0,P.jsx)(k,{title:z,actions:B}),t[28]=z,t[29]=B,t[30]=V):V=t[30];let H;t[31]!==L.error||t[32]!==L.retry||t[33]!==i?(H=L.error?(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,P.jsx)(`span`,{children:L.error}),(0,P.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:L.retry,children:i?`重试`:`Retry`})]}):null,t[31]=L.error,t[32]=L.retry,t[33]=i,t[34]=H):H=t[34];let U=i?`默认配置分区`:`Default configuration sections`,oe;t[35]!==a||t[36]!==M?(oe=M.map(e=>{let{id:t,label:n,icon:r}=e;return(0,P.jsxs)(`button`,{type:`button`,"aria-pressed":a===t,onClick:()=>o(t),className:c(`flex min-w-0 items-center justify-center gap-2 rounded-xl px-3 py-2.5 text-left transition-colors`,a===t?`bg-surface-panel text-fg shadow-surface ring-1 ring-edge`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,P.jsx)(r,{className:c(`size-4 shrink-0`,a===t?`text-accent`:`text-fg-subtle`)}),(0,P.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[35]=a,t[36]=M,t[37]=oe):oe=t[37];let G;t[38]!==U||t[39]!==oe?(G=(0,P.jsx)(`nav`,{className:`grid grid-cols-2 gap-2 rounded-2xl border border-edge bg-surface-base p-2 lg:grid-cols-4`,"aria-label":U,children:oe}),t[38]=U,t[39]=oe,t[40]=G):G=t[40];let K;t[41]!==a||t[42]!==l||t[43]!==i?(K=a===`models`?(0,P.jsx)(W,{draft:l,setDraft:u,zh:i}):null,t[41]=a,t[42]=l,t[43]=i,t[44]=K):K=t[44];let q;t[45]!==a||t[46]!==l||t[47]!==i?(q=a===`skills`?(0,P.jsx)(Z,{draft:l,setDraft:u,zh:i}):null,t[45]=a,t[46]=l,t[47]=i,t[48]=q):q=t[48];let Y;t[49]!==a||t[50]!==r||t[51]!==l||t[52]!==i?(Y=a===`tools`?(0,P.jsx)(de,{draft:l,setDraft:u,builtinTools:r,zh:i}):null,t[49]=a,t[50]=r,t[51]=l,t[52]=i,t[53]=Y):Y=t[53];let X;t[54]!==a||t[55]!==l||t[56]!==i?(X=a===`runtime`?(0,P.jsx)(J,{draft:l,setDraft:u,zh:i}):null,t[54]=a,t[55]=l,t[56]=i,t[57]=X):X=t[57];let se;return t[58]!==L.onBlurCapture||t[59]!==V||t[60]!==H||t[61]!==G||t[62]!==K||t[63]!==q||t[64]!==Y||t[65]!==X?(se=(0,P.jsxs)(A,{gap:`gap-5`,onBlurCapture:R,children:[V,H,G,K,q,Y,X]}),t[58]=L.onBlurCapture,t[59]=V,t[60]=H,t[61]=G,t[62]=K,t[63]=q,t[64]=Y,t[65]=X,t[66]=se):se=t[66],se}function ge(){let e=(0,ae.c)(17),t=l(ve),n=u(_e)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=d(t?`settings-agent-defaults`:null,D);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,P.jsx)(A,{children:(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,P.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,P.jsx)(f,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let l;return e[9]!==r||e[10]!==c?(l=(0,P.jsxs)(A,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=l):l=e[11],l}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,P.jsx)(me,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,P.jsx)(he,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=s):s=e[16],s}function _e(e){return e.language}function ve(e){return e.conversationId}export{ge as AgentDefaultsSettingsPanel};
@@ -1 +0,0 @@
1
- import{a as e,r as t}from"./locale-store-DuG-kbsP.js";var n=n=>e(t(n)),r=(n,r,i)=>e(t(n),{method:r,headers:{"content-type":`application/json`},body:JSON.stringify(i)});export{r as n,n as t};
@@ -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"./copy-Dv6d4Dvw.js";import{t as a}from"./cn-JdwAhgNB.js";import{a as o,n as s,r as c}from"./locale-store-DuG-kbsP.js";import{t as l}from"./messages-BYbx4OuI.js";import{a as u,i as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./copy-to-clipboard-HOJ79TWv.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-CGlRPNzi.js";import{t as y}from"./skeleton-BwbyijEw.js";import{i as b,o as x}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as S}from"./electron-env-Dit0bHgy.js";import{Ts as C,ca as w,el as T}from"./index-54o0AGdj.js";import{n as E,r as D}from"./settings-page-layout-CsUQKRq0.js";import{r as O,t as k}from"./settings-form-section-C4D1p0xR.js";import{t as A}from"./settings-loading-skeleton-CAmWMaOT.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,o]=(0,M.useReducer)(w,L),{info:s,loadError:c,actionError:l,copiedField:_,clearDialogOpen:y,clearConfirmChecked:S,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:O,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await g(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:O});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(A,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=S&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(k,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(T,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:a(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:a(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:a(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,C.press),onClick:()=>{o({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:a(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,C.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(h,{open:y,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,x)}),(0,N.jsxs)(p,{className:a(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:S,onChange:e=>o({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:a(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>o({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(h,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(f,{children:[(0,N.jsx)(u,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,x)}),(0,N.jsxs)(p,{className:a(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(d,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:O,onChange:e=>o({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),O?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await o(c(`/api/migrations/status`))).payload}async function B(){await o(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(y,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(y,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,N.jsx)(v,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=s(U),n;e[0]===t?n=e[1]:(n=l(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!S()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=O(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let o;e[18]===i.title?o=e[19]:(o=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=o);let c;e[20]===i.migrations?c=e[21]:(c=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=c);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==o||e[25]!==c||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[o,c,u]}),e[24]=o,e[25]=c,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
@@ -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{n as i,r as a}from"./popover-select-DldSX8GX.js";import{t as o}from"./cn-JdwAhgNB.js";import{a as s,n as c,r as l}from"./locale-store-DuG-kbsP.js";import{t as u}from"./messages-BYbx4OuI.js";import{n as d,r as f}from"./gateway-config-swr-COJzzscc.js";import{i as p}from"./theme-store-JzZVUvEh.js";import{t as m}from"./skeleton-BwbyijEw.js";import{Do as h,Ts as g,ri as _}from"./index-54o0AGdj.js";import{n as v,r as y}from"./settings-page-layout-CsUQKRq0.js";import{t as b}from"./settings-advanced-gate-BG4EILeB.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await s(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await d()}var E=r();function D(e){let t=(0,S.c)(13),{title:n,footer:r,children:i,className:a}=e,s;t[0]===a?s=t[1]:(s=o(`min-w-0`,a),t[0]=a,t[1]=s);let c;t[2]===n?c=t[3]:(c=n?(0,E.jsx)(`h2`,{className:`mb-2 px-1 text-xs font-medium text-fg-muted`,children:n}):null,t[2]=n,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,E.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:i}),t[4]=i,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,E.jsx)(`p`,{className:`mt-2 px-1 text-xs leading-5 text-fg-subtle`,children:r}):null,t[6]=r,t[7]=u);let d;return t[8]!==s||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,E.jsxs)(`section`,{className:s,children:[c,l,u]}),t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}},dawn:{light:{canvas:`#accdec`,panel:`#f8fbff`,accent:`#34363a`,fg:`#262626`,muted:`#e7ebf4`},dark:{canvas:`#172433`,panel:`#253342`,accent:`#d9dde2`,fg:`#f3f6fa`,muted:`#415264`}}};function k(e){let t=(0,S.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]===o?f=t[13]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=f);let p;t[14]===o?p=t[15]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=p);let m;t[16]!==c||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,f,p]}),t[16]=c,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==s||t[22]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[21]=s,t[22]=m,t[23]=h):h=t[23],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`},{value:`dawn`,labelKey:`colorSchemeDawn`}];function M(){let e=(0,S.c)(13),t=c(F),n;e[0]===t?n=e[1]:(n=u(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=p(P),a=p(N),s;e[2]===r.colorSchemeTitle?s=e[3]:(s=(0,E.jsx)(`div`,{className:`min-w-0`,children:(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.colorSchemeTitle})}),e[2]=r.colorSchemeTitle,e[3]=s);let l;e[4]!==r||e[5]!==i||e[6]!==a?(l=j.map(e=>{let{value:t,labelKey:n}=e,s=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":s,onClick:()=>a(t),className:o(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,g.pressCard,s?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:o(`text-xs font-medium leading-none`,s?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[4]=r,e[5]=i,e[6]=a,e[7]=l):l=e[7];let d;e[8]===l?d=e[9]:(d=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5`,children:l}),e[8]=l,e[9]=d);let f;return e[10]!==s||e[11]!==d?(f=(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3.5 sm:px-5 sm:py-4`,children:[s,d]}),e[10]=s,e[11]=d,e[12]=f):f=e[12],f}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(28),t=c(L),n;e[0]===t?n=e[1]:(n=u(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:s,isLoading:l}=f(!0),d=s?.payload?.config,p;e[2]===d?p=e[3]:(p=w(d),e[2]=d,e[3]=p);let h=p,[g,_]=(0,x.useState)(h),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===h?(D=e[5],O=e[6]):(D=()=>_(h),O=[h],e[4]=h,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`min-w-0 text-sm font-medium text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]!==r.activityDetailLevels||e[12]!==A||e[13]!==l||e[14]!==g||e[15]!==v?(M=l?(0,E.jsx)(m,{className:`h-10 w-full rounded-lg sm:max-w-[11rem]`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`w-full sm:max-w-[11rem]`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[11]=r.activityDetailLevels,e[12]=A,e[13]=l,e[14]=g,e[15]=v,e[16]=M):M=e[16];let N;e[17]!==j||e[18]!==M?(N=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[j,M]}),e[17]=j,e[18]=M,e[19]=N):N=e[19];let P;e[20]!==r.activityDetailSaveError||e[21]!==r.activityDetailSaving||e[22]!==b||e[23]!==v?(P=b||v?(0,E.jsx)(`p`,{className:o(`text-xs`,b?`text-red-600 dark:text-red-400`:`text-fg-subtle`),children:b?r.activityDetailSaveError:r.activityDetailSaving}):null,e[20]=r.activityDetailSaveError,e[21]=r.activityDetailSaving,e[22]=b,e[23]=v,e[24]=P):P=e[24];let F;return e[25]!==N||e[26]!==P?(F=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3.5 sm:px-5 sm:py-4`,children:[N,P]}),e[25]=N,e[26]=P,e[27]=F):F=e[27],F}function L(e){return e.language}function R(){let e=(0,S.c)(17),t=c(V),n;e[0]===t?n=e[1]:(n=u(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=_(B),a=_(z),o;e[2]===r.showRawToolDataTitle?o=e[3]:(o=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[2]=r.showRawToolDataTitle,e[3]=o);let s;e[4]===r.showRawToolDataDescription?s=e[5]:(s=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[4]=r.showRawToolDataDescription,e[5]=s);let l;e[6]!==o||e[7]!==s?(l=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),e[6]=o,e[7]=s,e[8]=l):l=e[8];let d;e[9]===a?d=e[10]:(d=e=>a(e.target.checked),e[9]=a,e[10]=d);let f;e[11]!==i||e[12]!==d?(f=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:d}),e[11]=i,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==l||e[15]!==f?(p=(0,E.jsx)(`div`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[l,f]})}),e[14]=l,e[15]=f,e[16]=p):p=e[16],p}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(12),t=c(U),n;e[0]===t?n=e[1]:(n=u(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]===r.pageTitle?i=e[3]:(i=(0,E.jsx)(v,{title:r.pageTitle}),e[2]=r.pageTitle,e[3]=i);let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,E.jsx)(D,{children:(0,E.jsx)(h,{variant:`page`,sections:[`language`]})}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsxs)(D,{children:[(0,E.jsx)(h,{variant:`page`,sections:[`theme`,`font`]}),(0,E.jsx)(M,{}),(0,E.jsx)(I,{})]}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsx)(R,{}),e[6]=s):s=e[6];let l;e[7]===r.developerGroupTitle?l=e[8]:(l=(0,E.jsx)(b,{children:(0,E.jsx)(D,{title:r.developerGroupTitle,children:s})}),e[7]=r.developerGroupTitle,e[8]=l);let d;return e[9]!==i||e[10]!==l?(d=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,a,o,l]}),e[9]=i,e[10]=l,e[11]=d):d=e[11],d}function U(e){return e.language}export{H as AppearanceSettingsPanel};
@@ -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{h as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./external-link-DjqjBmc3.js";import{t as c}from"./markdown-view-B1q2w6W_.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-JdwAhgNB.js";import{a as p,c as m,i as h,n as g,r as _}from"./locale-store-DuG-kbsP.js";import{t as v}from"./messages-BYbx4OuI.js";import{a as y,i as b,o as x,r as S,s as C,t as w}from"./dist-BGTk37IG.js";import{a as T,i as E}from"./vendor-swr-BIWyz7Rc.js";import{t as D}from"./button-CGlRPNzi.js";import{t as O}from"./skeleton-BwbyijEw.js";import{$u as k,Dc as A,Qa as ee,So as j,Tc as te,Vu as M,ac as ne,ca as N,el as P,eo as F,jc as I,ju as L,no as R,oc as re,oo as z,ro as B,to as V}from"./index-54o0AGdj.js";import{t as H}from"./page-tabs-B_I0YuTK.js";var U=e(t(),1),W=n();function G(e){return e===`builtin`||e===`user`?e:`marketplace`}async function K(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ie(e){let t=await h(_(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await h(_(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await h(_(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function Y(e){let t=await h(_(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var X=r();function ae(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function Q({className:e}){let t=v(g(e=>e.language)).extensionsPage,n=m(e=>!!e.conversationId),r=F(),{mutate:i}=T(),[a,o]=(0,U.useReducer)(N,Z),{q:s,debounced:c,detailPkg:u,rowBusy:d,actionError:h,restartHint:y}=a,b=n?`marketplace-${c}`:null;(0,U.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:s.trim()}}),300);return()=>window.clearTimeout(e)},[s]);let{data:x,isLoading:S,error:C}=E(b,async()=>p(c.length>0?_(`/api/marketplace?q=${encodeURIComponent(c)}`):_(`/api/marketplace`)),{revalidateOnFocus:!1}),w=(0,U.useCallback)(()=>{i(`gateway-extensions-list`),z()},[i]),D=(0,U.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await q({name:e,overwrite:n});w(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,w]),k=(0,U.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await Y(e);w(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,w]),A=x?.extensions??[];return(0,X.jsxs)(`div`,{className:f(`flex flex-col gap-4`,e),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(I,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:s,onChange:e=>o({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),C?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C instanceof Error?C.message:t.marketplaceLoadFailed}):null,h?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:h}):null,y?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y}):null,S&&!x?(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,X.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,X.jsx)(O,{className:`h-5 w-40`}),(0,X.jsx)(O,{className:`h-4 w-full max-w-xl`}),(0,X.jsx)(O,{className:`h-4 w-2/3 max-w-md`})]}),(0,X.jsx)(O,{className:`h-8 w-20`})]})},e))}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,children:A.length===0?(0,X.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):A.map(e=>{let n=ae(r,e.id),i=d===e.id;return(0,X.jsx)(`li`,{className:`list-none`,children:(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:f(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,X.jsx)(L,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,X.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,X.jsx)(P,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,X.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,X.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&k(e.id).catch(()=>{})},className:f(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,X.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(re,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:f(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:t.marketplaceReview})})]})},e.id)})}),u?(0,X.jsx)($,{packageName:u,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:D,onUninstall:k}):null]})}function $(e){let t=(0,W.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:s,onUninstall:u}=e,[p,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1),v=m(ue)?`ext-mp-detail-${n}`:null,b;t[0]===n?b=t[1]:(b=async()=>ie(n),t[0]=n,t[1]=b);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},t[2]=T):T=t[2];let{data:D,error:A,isLoading:ee}=E(v,b,T),j;t[3]!==i||t[4]!==n?(j=ae(i,n),t[3]=i,t[4]=n,t[5]=j):j=t[5];let M=j,N=M===`user`,P=D?.manifest?.permissions,F,I,L,R,z,B,V,H,G,K,q;if(t[6]!==r.detailBack||t[7]!==r.detailClose||t[8]!==r.marketplaceAuthor||t[9]!==r.marketplaceCodeRisk||t[10]!==r.marketplaceDependencies||t[11]!==r.marketplaceDetailLoadFailed||t[12]!==r.marketplaceDetailReadmeHeading||t[13]!==r.marketplaceDetailTitle||t[14]!==r.marketplaceDownloads||t[15]!==r.marketplaceIntegrity||t[16]!==r.marketplaceIntegrityVerified||t[17]!==r.marketplaceLifecycleScripts||t[18]!==r.marketplaceLoadFailed||t[19]!==r.marketplaceLoading||t[20]!==r.marketplaceNoReadme||t[21]!==r.marketplacePermissions||t[22]!==r.marketplacePermissionsNone||t[23]!==r.marketplaceRiskConfirm||t[24]!==r.marketplaceRiskTitle||t[25]!==r.marketplaceUnavailableBody||t[26]!==r.marketplaceUnavailableTitle||t[27]!==r.marketplaceVersion||t[28]!==D||t[29]!==A||t[30]!==M||t[31]!==ee||t[32]!==o||t[33]!==P||t[34]!==g){let e=P&&typeof P==`object`&&!Array.isArray(P)?Object.entries(P):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==D?(n=D?.readme?.trim()||(D?.description?.trim()?`### ${D.name}\n\n${D.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=D,t[48]=n):n=t[48];let i=n;L=w,R=!0,t[49]===o?z=t[50]:(z=e=>!e&&o(),t[49]=o,t[50]=z),I=x,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=q):q=t[51],F=S,H=`fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,G=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(k,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,X.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:a}),t[53]=r.detailBack,t[54]=o,t[55]=s):s=t[55];let l;t[56]===r.marketplaceDetailTitle?l=t[57]:(l=(0,X.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=l);let u;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(d,{className:`size-5`}),t[58]=u):u=t[58];let f;t[59]!==r.detailClose||t[60]!==o?(f=(0,X.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:u}),t[59]=r.detailClose,t[60]=o,t[61]=f):f=t[61],t[62]!==s||t[63]!==l||t[64]!==f?(K=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,l,f]}),t[62]=s,t[63]=l,t[64]=f,t[65]=K):K=t[65],B=`min-h-0 flex-1 overflow-y-auto p-5`,V=ee&&!D?(0,X.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,X.jsx)(O,{className:`h-6 w-48`}),(0,X.jsx)(O,{className:`h-4 w-28`}),(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)(O,{className:`h-12`}),(0,X.jsx)(O,{className:`h-12`})]}),(0,X.jsx)(O,{className:`h-28 w-full`}),(0,X.jsx)(O,{className:`h-36 w-full`})]}):A?(0,X.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,X.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:A instanceof Error?A.message:r.marketplaceLoadFailed})]}):D?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:D.name}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:D.id})}),(0,X.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,X.jsx)(`dd`,{children:D.author.username})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,X.jsx)(`dd`,{children:D.latestVersion.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,X.jsx)(`dd`,{children:D.downloads})]})]}),M===`bundled`?null:(0,X.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[D.installability.available?(0,X.jsx)(te,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,X.jsx)(ne,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:D.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:D.installability.available?r.marketplaceCodeRisk:D.installability.reason??r.marketplaceUnavailableBody})]})]}),D.installability.available?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,X.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,X.jsx)(`dd`,{children:D.packageSummary?.dependencyCount??0})]})]}),(0,X.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,X.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,X.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(D.packageSummary?.lifecycleScripts.length??0)>0?(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,D.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),D.readme?.trim()?(0,X.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,X.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,X.jsx)(c,{content:i})})]}):null,t[6]=r.detailBack,t[7]=r.detailClose,t[8]=r.marketplaceAuthor,t[9]=r.marketplaceCodeRisk,t[10]=r.marketplaceDependencies,t[11]=r.marketplaceDetailLoadFailed,t[12]=r.marketplaceDetailReadmeHeading,t[13]=r.marketplaceDetailTitle,t[14]=r.marketplaceDownloads,t[15]=r.marketplaceIntegrity,t[16]=r.marketplaceIntegrityVerified,t[17]=r.marketplaceLifecycleScripts,t[18]=r.marketplaceLoadFailed,t[19]=r.marketplaceLoading,t[20]=r.marketplaceNoReadme,t[21]=r.marketplacePermissions,t[22]=r.marketplacePermissionsNone,t[23]=r.marketplaceRiskConfirm,t[24]=r.marketplaceRiskTitle,t[25]=r.marketplaceUnavailableBody,t[26]=r.marketplaceUnavailableTitle,t[27]=r.marketplaceVersion,t[28]=D,t[29]=A,t[30]=M,t[31]=ee,t[32]=o,t[33]=P,t[34]=g,t[35]=F,t[36]=I,t[37]=L,t[38]=R,t[39]=z,t[40]=B,t[41]=V,t[42]=H,t[43]=G,t[44]=K,t[45]=q}else F=t[35],I=t[36],L=t[37],R=t[38],z=t[39],B=t[40],V=t[41],H=t[42],G=t[43],K=t[44],q=t[45];let J;t[66]!==B||t[67]!==V?(J=(0,X.jsx)(`div`,{className:B,children:V}),t[66]=B,t[67]=V,t[68]=J):J=t[68];let Y;t[69]!==p||t[70]!==r.marketplaceBuiltinGoBuiltin||t[71]!==r.marketplaceBuiltinManageHint||t[72]!==r.marketplaceInstall||t[73]!==r.marketplaceReinstall||t[74]!==r.marketplaceReinstallConfirm||t[75]!==r.marketplaceUninstall||t[76]!==r.marketplaceUninstallConfirm||t[77]!==D||t[78]!==M||t[79]!==o||t[80]!==s||t[81]!==u||t[82]!==n||t[83]!==g||t[84]!==N?(Y=D?(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:M===`bundled`?(0,X.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,X.jsx)(a,{to:`/extensions?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,disabled:p||!D.installability.available||!g,onClick:()=>{N&&!window.confirm(r.marketplaceReinstallConfirm)||(h(!0),s(n,N).catch(se).finally(()=>h(!1)))},className:f(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[p?(0,X.jsx)(l,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,N?r.marketplaceReinstall:r.marketplaceInstall]}),N?(0,X.jsxs)(`button`,{type:`button`,disabled:p,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(h(!0),u(n).then(()=>o()).catch(oe).finally(()=>h(!1)))},className:f(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,X.jsx)(re,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=p,t[70]=r.marketplaceBuiltinGoBuiltin,t[71]=r.marketplaceBuiltinManageHint,t[72]=r.marketplaceInstall,t[73]=r.marketplaceReinstall,t[74]=r.marketplaceReinstallConfirm,t[75]=r.marketplaceUninstall,t[76]=r.marketplaceUninstallConfirm,t[77]=D,t[78]=M,t[79]=o,t[80]=s,t[81]=u,t[82]=n,t[83]=g,t[84]=N,t[85]=Y):Y=t[85];let Z;t[86]!==F||t[87]!==J||t[88]!==Y||t[89]!==H||t[90]!==G||t[91]!==K?(Z=(0,X.jsxs)(F,{className:H,onOpenAutoFocus:G,children:[K,J,Y]}),t[86]=F,t[87]=J,t[88]=Y,t[89]=H,t[90]=G,t[91]=K,t[92]=Z):Z=t[92];let Q;t[93]!==I||t[94]!==Z||t[95]!==q?(Q=(0,X.jsxs)(I,{children:[q,Z]}),t[93]=I,t[94]=Z,t[95]=q,t[96]=Q):Q=t[96];let $;return t[97]!==L||t[98]!==R||t[99]!==z||t[100]!==Q?($=(0,X.jsx)(L,{defaultOpen:R,onOpenChange:z,children:Q}),t[97]=L,t[98]=R,t[99]=z,t[100]=Q,t[101]=$):$=t[101],$}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,X.jsxs)(`li`,{className:`break-words`,children:[(0,X.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.conversationId}function de(){let e=g(e=>e.language),t=v(e),n=j(e=>e.setPageHeader),r=j(e=>e.clearPageHeader),o=F(),s=V(),[c,l]=i(),d=G(c.get(`tab`)),f=c.get(`q`)??``,[p,m]=(0,U.useState)(d),[h,_]=(0,U.useState)(f),[y,b]=(0,U.useState)(null),x=c.toString(),S=(0,U.useRef)(x);if(S.current!==x){S.current=x;let e=G(c.get(`tab`)),t=c.get(`q`)??``;m(t=>t===e?t:e),_(e=>e===t?e:t)}(0,U.useEffect)(()=>{l(e=>{let t=new URLSearchParams(e),n=h.trim();return n?t.set(`q`,n):t.delete(`q`),p===`marketplace`?t.delete(`tab`):t.set(`tab`,p),t.toString()===e.toString()?e:t},{replace:!0})},[p,h,l]);let C=(0,U.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),w=(0,U.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),T=p===`builtin`?C:w,E=(0,U.useMemo)(()=>{let t=h.trim().toLowerCase(),n=T;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[T,h,e]);if((0,U.useEffect)(()=>{b(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?fe(e)===fe(t)&&e.active===t.active?e:t:null})},[o]),(0,U.useLayoutEffect)(()=>(n({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(D,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,X.jsx)(M,{className:`size-4`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,X.jsx)(D,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps/new`,children:[(0,X.jsx)(u,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&p!==`marketplace`)return(0,X.jsx)(ye,{});let O=p!==`marketplace`&&T.length>0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,X.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,X.jsxs)(`div`,{className:`mb-6 flex flex-col gap-3 border-b border-edge-subtle pb-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsx)(H,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:C.length},{id:`user`,label:t.extensionsPage.tabUser,count:w.length}],activeTab:p,onChange:m,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),O?(0,X.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,X.jsx)(I,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:h,onChange:e=>_(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),p===`marketplace`?(0,X.jsx)(Q,{}):p===`builtin`&&C.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):p===`user`&&w.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyUser}):E.length===0?(0,X.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:E.map(e=>(0,X.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:p===`user`,onOpen:()=>b(e)},e.id))})]}),y?(0,X.jsx)(_e,{extension:y,copy:t.extensionsPage,onClose:()=>b(null)},y.id):null]})}function fe(e){return e.activationEligible??e.active}function pe(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function me(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function he(e,t){let n=fe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function ge(e){let t=(0,W.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=fe(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=f(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=d):d=t[2];let p=n.name||n.id,m;t[3]===p?m=t[4]:(m=p.charAt(0).toUpperCase(),t[3]=p,t[4]=m);let h;t[5]===m?h=t[6]:(h=(0,X.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:m}),t[5]=m,t[6]=h);let g;t[7]===n.name?g=t[8]:(g=(0,X.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=g);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,X.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==g||t[12]!==_?(v=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==c?(y=c?(0,X.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,X.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,X.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,X.jsx)(u,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==r.cardNoDescription||t[21]!==n.description?(x=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=x):x=t[22];let S;t[23]===x?S=t[24]:(S=(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:x}),t[23]=x,t[24]=S);let C=n.hasUi?r.badgeKindUi:r.badgeKindBackend,w;t[25]!==C||t[26]!==l?(w=(0,X.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:C}),t[25]=C,t[26]=l,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,X.jsx)(`span`,{title:pe(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:me(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==w||t[33]!==T?(E=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[w,T]}),t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==b||t[36]!==S||t[37]!==E?(D=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S,E]}),t[35]=b,t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==h?(O=(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[h,D]}),t[39]=D,t[40]=h,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,X.jsx)(`button`,{type:`button`,onClick:a,className:d,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=T(),[i,o]=(0,U.useState)(!1),[c,u]=(0,U.useState)(null),[p,m]=(0,U.useState)(!1),h=e.activationEligible===!0,g=(0,U.useCallback)(async()=>{if(e.source===`bundled`){u(null),m(!1),o(!0);try{let{requiresGatewayRestart:t}=await J({extensionId:e.id,enabled:!h});await r(`gateway-extensions-list`),z(),m(t)}catch(e){u(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[h,t.builtinToggleFailed,e.id,e.source,r]),_=e.ui?.contributions?.pages??[],v=e.ui?.contributions?.settingsPanels??[],E=e.ui?.contributions?.chatWidgets??[],O=e.ui?.contributions?.sidebarPanels??[],j=_.find(e=>e.showInNav)??_[0],te=v[0],M=j?ee(e.id,j):null,ne=te?`/settings/ext/${e.id}/${te.id}`:e.hasConfigSchema||R(e)?`/settings/ext/${e.id}`:null;return(0,X.jsx)(w,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(x,{children:[(0,X.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,X.jsxs)(S,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,X.jsx)(k,{className:`size-5`})}),(0,X.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,X.jsxs)(b,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,X.jsx)(d,{className:`size-5`})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,X.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,X.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,X.jsx)(D,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void g(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(l,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):h?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,p?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,X.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(_.length>0||v.length>0||E.length>0)?(0,X.jsxs)(`section`,{className:`mt-8`,children:[(0,X.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,X.jsx)(ve,{template:t.badgePages,count:_.length,hidden:_.length===0}),(0,X.jsx)(ve,{template:t.badgeSettings,count:v.length,hidden:v.length===0}),(0,X.jsx)(ve,{template:t.badgeWidgets,count:E.length,hidden:E.length===0}),(0,X.jsx)(ve,{template:t.badgeSidebar,count:O.length,hidden:O.length===0})]})]}):null,B(e)&&(M||ne)?(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[M?(0,X.jsxs)(a,{to:M,onClick:n,className:f(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(s,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,ne?(0,X.jsxs)(a,{to:ne,onClick:n,className:f(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,X.jsx)(A,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,X.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,W.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,X.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function ye(){let e=(0,W.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,X.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,X.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,X.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(be)})]})}),e[4]=a):a=e[4],a}function be(e){return(0,X.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function xe(e){let t=(0,W.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de as ExtensionsPage};
@@ -1,3 +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{d as i,h as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./popover-select-DldSX8GX.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./download-Dk-ZjtO6.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{a as d,c as f,n as p,r as m}from"./locale-store-DuG-kbsP.js";import{t as h}from"./messages-BYbx4OuI.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./button-CGlRPNzi.js";import{n as v,r as y}from"./gateway-config-swr-COJzzscc.js";import{t as b}from"./skeleton-BwbyijEw.js";import{$r as x,Gc as S,Ic as C,Ql as w,Qr as ee,Yl as T,Zr as E,_l as te,ac as ne,cu as D,ei as O,il as re,ni as k,oa as ie,pu as ae,sa as A,ti as j}from"./index-54o0AGdj.js";import{n as oe,r as M}from"./settings-page-layout-CsUQKRq0.js";import{n as se}from"./settings-loading-skeleton-CAmWMaOT.js";import{n as N,t as P}from"./use-autosave-DSrlXbBg.js";import{t as ce}from"./settings-advanced-gate-BG4EILeB.js";var F=n(),I=e(t(),1);function le(e){let[t,n]=(0,I.useState)(!1),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(null),l=(0,I.useRef)(null);return{running:t,cancelling:r,progress:a,error:s,install:(0,I.useCallback)(async()=>{if(l.current)return;let t=new AbortController;l.current=t,n(!0),o(null),c(null);try{let n=await O(o,t.signal);if(!n.ok){n.error!==`cancelled`&&c(n.message??n.error);return}e()}catch(e){t.signal.aborted||c(e instanceof Error?e.message:String(e))}finally{l.current===t&&(l.current=null),n(!1),i(!1)}},[e]),cancel:(0,I.useCallback)(async()=>{l.current&&(i(!0),await E().catch(()=>{}),l.current.abort())},[])}}var L=r(),R={extension:`Chrome extension`,playwright:`Playwright Chromium`,cdp:`CDP`,remote:`Remote browser`};function z(e){let{enabled:t,driverKind:n,autosaveStatus:r,zh:a}=e,o=i(),c=g(t?[`browser-control-status`,n]:null,ee,{revalidateOnFocus:!0,refreshInterval:n===`extension`?3e3:0}),[l,d]=(0,I.useState)(null),[f,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(null),v=r===`dirty`||r===`saving`;(0,I.useEffect)(()=>{r===`saved`&&c.mutate()},[r,c.mutate]);let y=(0,I.useCallback)(async(e,t,n)=>{d(e),p(null),h(null);try{await t(),h(n),await c.mutate()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(null)}},[c.mutate]),x=le((0,I.useCallback)(()=>{h(a?`Chromium 已安装,可以开始连接测试。`:`Chromium is installed and ready to test.`),c.mutate()},[c.mutate,a])),w=c.data?.payload,T=w?.driverKind===n,E=t?v||!T?`syncing`:w?.state:`disabled`;return(0,L.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(E===`ready`?s:E===`syncing`?u:ne,{className:`size-4 shrink-0 ${E===`ready`?`text-success`:E===`syncing`?`animate-spin text-fg-muted`:E===`disabled`?`text-fg-subtle`:`text-warning`}`}),(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a?`浏览器就绪状态`:`Browser readiness`}),(0,L.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs ${E===`ready`?`bg-success-soft text-success`:E===`disabled`?`bg-surface-hover text-fg-muted`:`bg-warning-soft text-warning`}`,children:E===`ready`?a?`已就绪`:`Ready`:E===`disabled`?a?`未启用`:`Disabled`:E===`syncing`?a?`正在应用配置`:`Applying configuration`:a?`需要处理`:`Needs attention`})]}),(0,L.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[R[n],w?.detail&&T?` · ${w.detail}`:``]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsxs)(_,{variant:`ghost`,className:`h-9`,onClick:()=>void c.mutate(),disabled:c.isValidating,children:[(0,L.jsx)(C,{className:`size-3.5 ${c.isValidating?`animate-spin`:``}`}),a?`刷新`:`Refresh`]}),(0,L.jsxs)(_,{variant:`secondary`,className:`h-9`,disabled:!t||v||l!==null||x.running,onClick:()=>void y(`test`,k,a?`连接测试成功。`:`Connection test passed.`),children:[l===`test`?(0,L.jsx)(u,{className:`size-3.5 animate-spin`}):(0,L.jsx)(S,{className:`size-3.5`}),a?`测试连接`:`Test connection`]})]})]}),t&&c.isLoading?(0,L.jsxs)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-3`,children:[(0,L.jsx)(b,{className:`h-12`}),(0,L.jsx)(b,{className:`h-12`}),(0,L.jsx)(b,{className:`h-12`})]}):null,t&&c.error?(0,L.jsx)(H,{tone:`error`,children:c.error instanceof Error?c.error.message:String(c.error)}):null,f||x.error?(0,L.jsx)(H,{tone:`error`,children:f??x.error}):null,m?(0,L.jsx)(H,{tone:`success`,children:m}):null,t&&n===`extension`&&T?(0,L.jsx)(ue,{status:w?.driverStatus,zh:a,busy:l,run:y,onConnectRemote:()=>o(`/settings/devices?startDevicePairing=browser`)}):null,t&&n===`playwright`&&T?(0,L.jsx)(B,{status:w?.driverStatus,zh:a,installer:x}):null,t&&n===`cdp`?(0,L.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-subtle px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会验证已保存的 CDP 地址,并复用浏览器中现有的标签页和登录状态。`:`The connection test verifies the saved CDP endpoint and reuses that browser’s existing tabs and signed-in state.`}):null,t&&n===`remote`?(0,L.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-subtle px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会在服务商侧创建一个临时浏览器会话,并在测试结束后立即关闭。`:`The connection test creates a temporary provider session and closes it immediately after the test.`}):null]})}function ue(e){let t=(0,F.c)(70),{status:n,zh:r,busy:i,run:a,onConnectRemote:o}=e,s=n?.artifacts,d=r?`扩展文件`:`Extension files`,f=s?.installed===!0,p=s?.installed?r?`已安装`:`Installed`:r?`未安装或需更新`:`Install or update required`,m;t[0]!==d||t[1]!==f||t[2]!==p?(m=(0,L.jsx)(V,{label:d,ok:f,value:p}),t[0]=d,t[1]=f,t[2]=p,t[3]=m):m=t[3];let h=r?`本机自动发现`:`Local auto-discovery`,g=s?.nativeHost?.installed===!0,v=s?.nativeHost?.installed?r?`已就绪`:`Ready`:s?.nativeHost?.reason??(r?`需要修复`:`Repair required`),y;t[4]!==h||t[5]!==g||t[6]!==v?(y=(0,L.jsx)(V,{label:h,ok:g,value:v}),t[4]=h,t[5]=g,t[6]=v,t[7]=y):y=t[7];let b=r?`安全通道`:`Secure channel`,C=n?.transport===`gateway-realtime`,ee=n?.transport===`gateway-realtime`?`Gateway Realtime`:r?`不可用`:`Unavailable`,T;t[8]!==ee||t[9]!==b||t[10]!==C?(T=(0,L.jsx)(V,{label:b,ok:C,value:ee}),t[8]=ee,t[9]=b,t[10]=C,t[11]=T):T=t[11];let E=r?`Chrome 连接`:`Chrome connection`,te=n?.connected===!0,ne=n?.connected?r?`已连接`:`Connected`:n?.socketConnected?r?`需要重新加载扩展`:`Reload extension`:r?`等待扩展连接`:`Waiting for extension`,D;t[12]!==E||t[13]!==te||t[14]!==ne?(D=(0,L.jsx)(V,{label:E,ok:te,value:ne}),t[12]=E,t[13]=te,t[14]=ne,t[15]=D):D=t[15];let O;t[16]!==T||t[17]!==D||t[18]!==m||t[19]!==y?(O=(0,L.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[m,y,T,D]}),t[16]=T,t[17]=D,t[18]=m,t[19]=y,t[20]=O):O=t[20];let re=s?.extensionDir??`Gateway Realtime`,k;t[21]===re?k=t[22]:(k=(0,L.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:re}),t[21]=re,t[22]=k);let ie=s?.installed?`secondary`:`primary`,ae=i!==null,A;t[23]!==s?.installed||t[24]!==a||t[25]!==r?(A=()=>void a(`extension-install`,()=>x(!!s?.installed),r?`扩展文件已准备好。`:`Extension files are ready.`),t[23]=s?.installed,t[24]=a,t[25]=r,t[26]=A):A=t[26];let j;t[27]===i?j=t[28]:(j=i===`extension-install`?(0,L.jsx)(u,{className:`size-3.5 animate-spin`}):(0,L.jsx)(c,{className:`size-3.5`}),t[27]=i,t[28]=j);let oe=s?.installed?r?`刷新扩展文件`:`Refresh files`:r?`安装扩展文件`:`Install extension`,M;t[29]!==ie||t[30]!==ae||t[31]!==A||t[32]!==j||t[33]!==oe?(M=(0,L.jsxs)(_,{className:`h-9`,variant:ie,disabled:ae,onClick:A,children:[j,oe]}),t[29]=ie,t[30]=ae,t[31]=A,t[32]=j,t[33]=oe,t[34]=M):M=t[34];let se=!s?.installed||i!==null,N;t[35]!==a||t[36]!==r?(N=()=>void a(`extension-open`,fe,r?`已打开 Chrome 扩展页。`:`Chrome extensions opened.`),t[35]=a,t[36]=r,t[37]=N):N=t[37];let P;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,L.jsx)(l,{className:`size-3.5`}),t[38]=P):P=t[38];let ce=r?`打开扩展页`:`Open extensions`,I;t[39]!==se||t[40]!==N||t[41]!==ce?(I=(0,L.jsxs)(_,{className:`h-9`,variant:`secondary`,disabled:se,onClick:N,children:[P,ce]}),t[39]=se,t[40]=N,t[41]=ce,t[42]=I):I=t[42];let le=!s?.installed||i!==null,R;t[43]!==a||t[44]!==r?(R=()=>void a(`extension-folder`,de,r?`已打开扩展目录。`:`Extension folder opened.`),t[43]=a,t[44]=r,t[45]=R):R=t[45];let z;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,L.jsx)(w,{className:`size-3.5`}),t[46]=z):z=t[46];let ue=r?`打开扩展目录`:`Open folder`,B;t[47]!==le||t[48]!==R||t[49]!==ue?(B=(0,L.jsxs)(_,{className:`h-9`,variant:`ghost`,disabled:le,onClick:R,children:[z,ue]}),t[47]=le,t[48]=R,t[49]=ue,t[50]=B):B=t[50];let H=i!==null,U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,L.jsx)(S,{className:`size-3.5`}),t[51]=U):U=t[51];let pe=r?`连接远程 Chrome`:`Connect remote Chrome`,W;t[52]!==o||t[53]!==H||t[54]!==pe?(W=(0,L.jsxs)(_,{className:`h-9`,variant:`secondary`,disabled:H,onClick:o,children:[U,pe]}),t[52]=o,t[53]=H,t[54]=pe,t[55]=W):W=t[55];let G;t[56]!==M||t[57]!==I||t[58]!==B||t[59]!==W?(G=(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[M,I,B,W]}),t[56]=M,t[57]=I,t[58]=B,t[59]=W,t[60]=G):G=t[60];let K;t[61]!==n?.connected||t[62]!==n?.socketConnected||t[63]!==r?(K=n?.connected?null:(0,L.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-muted`,children:n?.socketConnected?r?`扩展仍在运行旧协议。请打开 Chrome 扩展页,找到 xopc 并点击“重新加载”,然后刷新状态。`:`The extension is still running an older protocol. Open Chrome Extensions, find xopc, click Reload, then refresh status.`:r?`打开 xopc Chrome 扩展后,它会自动发现并安全连接本机 Gateway;只有连接另一台电脑时才需要一次性邀请和手动确认。`:`Open the xopc Chrome extension to discover and securely connect to a local Gateway automatically. A one-time invitation and explicit approval are only required for Chrome on another computer.`}),t[61]=n?.connected,t[62]=n?.socketConnected,t[63]=r,t[64]=K):K=t[64];let q;return t[65]!==O||t[66]!==k||t[67]!==G||t[68]!==K?(q=(0,L.jsxs)(`div`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[O,k,G,K]}),t[65]=O,t[66]=k,t[67]=G,t[68]=K,t[69]=q):q=t[69],q}function de(){return j(`folder`)}function fe(){return j(`chrome`)}function B(e){let t=(0,F.c)(28),{status:n,zh:r,installer:i}=e,a=n?.installed===!0,o=n?.installed?r?`已安装`:`Installed`:n?.reason??(r?`未安装`:`Not installed`),s;t[0]!==a||t[1]!==o?(s=(0,L.jsx)(V,{label:`Chromium`,ok:a,value:o}),t[0]=a,t[1]=o,t[2]=s):s=t[2];let l;t[3]===n?l=t[4]:(l=n?.executablePath?(0,L.jsx)(`p`,{className:`mt-2 break-all text-xs text-fg-subtle`,children:n.executablePath}):null,t[3]=n,t[4]=l);let d;t[5]===i.progress?d=t[6]:(d=i.progress?(0,L.jsxs)(`div`,{className:`mt-3`,children:[(0,L.jsxs)(`div`,{className:`flex justify-between text-xs text-fg-muted`,children:[(0,L.jsx)(`span`,{children:i.progress.message??i.progress.phase}),(0,L.jsx)(`span`,{children:i.progress.percent==null?``:`${Math.round(i.progress.percent)}%`})]}),(0,L.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,L.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width]`,style:{width:`${i.progress.percent??8}%`}})})]}):null,t[5]=i.progress,t[6]=d);let f=n?.installed?`secondary`:`primary`,p;t[7]===i?p=t[8]:(p=()=>void i.install(),t[7]=i,t[8]=p);let m;t[9]===i.running?m=t[10]:(m=i.running?(0,L.jsx)(u,{className:`size-3.5 animate-spin`}):(0,L.jsx)(c,{className:`size-3.5`}),t[9]=i.running,t[10]=m);let h=n?.installed?r?`重新安装 Chromium`:`Reinstall Chromium`:r?`安装 Chromium`:`Install Chromium`,g;t[11]!==i.running||t[12]!==f||t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,L.jsxs)(_,{variant:f,className:`h-9`,disabled:i.running,onClick:p,children:[m,h]}),t[11]=i.running,t[12]=f,t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let v;t[17]!==i||t[18]!==r?(v=i.running?(0,L.jsx)(_,{variant:`ghost`,className:`h-9`,disabled:i.cancelling,onClick:()=>void i.cancel(),children:i.cancelling?r?`正在取消…`:`Cancelling…`:r?`取消`:`Cancel`}):null,t[17]=i,t[18]=r,t[19]=v):v=t[19];let y;t[20]!==v||t[21]!==g?(y=(0,L.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[g,v]}),t[20]=v,t[21]=g,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==l||t[26]!==d?(b=(0,L.jsxs)(`div`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[s,l,d,y]}),t[23]=y,t[24]=s,t[25]=l,t[26]=d,t[27]=b):b=t[27],b}function V(e){let t=(0,F.c)(11),{label:n,ok:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,L.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=a);let o=`mt-1 flex items-center gap-1.5 text-sm ${r?`text-success`:`text-fg-muted`}`,s=`size-1.5 rounded-full ${r?`bg-success`:`bg-warning`}`,c;t[2]===s?c=t[3]:(c=(0,L.jsx)(`span`,{className:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c||t[6]!==i?(l=(0,L.jsxs)(`p`,{className:o,children:[c,i]}),t[4]=o,t[5]=c,t[6]=i,t[7]=l):l=t[7];let u;return t[8]!==a||t[9]!==l?(u=(0,L.jsxs)(`div`,{className:`rounded-lg bg-surface-subtle px-3 py-2`,children:[a,l]}),t[8]=a,t[9]=l,t[10]=u):u=t[10],u}function H(e){let t=(0,F.c)(4),{tone:n,children:r}=e,i=`mt-3 rounded-lg px-3 py-2 text-xs ${n===`success`?`bg-success-soft text-success`:`bg-danger-soft text-danger`}`,a=n===`error`?`alert`:`status`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,L.jsx)(`p`,{className:i,role:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function U(e){let t=(0,F.c)(36),{sectionId:n,vm:r,children:i}=e,a=p(pe),o;t[0]===a?o=t[1]:(o=h(a),t[0]=a,t[1]=o);let s=o,c=s.agentSettings,l=s.settingsSections[n]??n;if(!r.hasToken){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(ae,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75}),t[2]=e):e=t[2];let n;t[3]===l?n=t[4]:(n=(0,L.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:l}),t[3]=l,t[4]=n);let r;t[5]===c.needToken?r=t[6]:(r=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:c.needToken}),t[5]=c.needToken,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,L.jsx)(M,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:(0,L.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[e,(0,L.jsxs)(`div`,{children:[n,r]})]})}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}if(r.loading){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(M,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,L.jsx)(se,{sections:1})}),t[10]=e):e=t[10],e}if(!r.form){let e=r.error??r.fetchError??c.loadError,n;t[11]===e?n=t[12]:(n=(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[11]=e,t[12]=n);let i;t[13]===r?i=t[14]:(i=()=>void r.mutate(),t[13]=r,t[14]=i);let a;t[15]!==s.logs.refresh||t[16]!==i?(a=(0,L.jsx)(_,{type:`button`,variant:`secondary`,onClick:i,children:s.logs.refresh}),t[15]=s.logs.refresh,t[16]=i,t[17]=a):a=t[17];let o;return t[18]!==n||t[19]!==a?(o=(0,L.jsxs)(M,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:[n,a]}),t[18]=n,t[19]=a,t[20]=o):o=t[20],o}let u;t[21]!==r.autosaveStatus||t[22]!==r.error?(u=(0,L.jsx)(N,{status:r.autosaveStatus,error:r.error}),t[21]=r.autosaveStatus,t[22]=r.error,t[23]=u):u=t[23];let d;t[24]!==l||t[25]!==u?(d=(0,L.jsx)(oe,{title:l,actions:u}),t[24]=l,t[25]=u,t[26]=d):d=t[26];let f;t[27]===r.error?f=t[28]:(f=r.error?(0,L.jsx)(`div`,{className:`rounded-md border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950/50 dark:text-red-400`,role:`alert`,children:r.error}):null,t[27]=r.error,t[28]=f);let m;t[29]===i?m=t[30]:(m=(0,L.jsx)(`div`,{className:`flex min-w-0 flex-col gap-5 pb-8`,children:i}),t[29]=i,t[30]=m);let g;return t[31]!==d||t[32]!==f||t[33]!==m||t[34]!==r.onBlurCapture?(g=(0,L.jsxs)(M,{gap:`gap-6`,onBlurCapture:r.onBlurCapture,children:[d,f,m]}),t[31]=d,t[32]=f,t[33]=m,t[34]=r.onBlurCapture,t[35]=g):g=t[35],g}function pe(e){return e.language}var W={enabled:!0,driverKind:`extension`,headless:!1,executablePath:``,cdpEndpoint:`http://127.0.0.1:9222`,remoteProvider:`browserbase`,remoteApiKey:``,remoteProjectId:``,remoteRegion:``,maxNodes:180,maxCharacters:12e3,visualFallback:!0,actionTimeoutMs:3e4,sessionTimeoutMs:9e5,maxSequenceLength:5,allowedPrivateHosts:``,crossDomainNavigation:`ask`,uploads:`ask`,consequentialActions:`ask`};function G(e){let t=J(J(e).browser),n=J(t.driver),r=J(t.observation),i=J(t.limits),a=J(t.security),o=n.kind;return{...W,enabled:t.enabled!==!1,driverKind:o===`playwright`||o===`cdp`||o===`remote`?o:`extension`,headless:n.headless===!0,executablePath:Y(n.executablePath,``),cdpEndpoint:Y(n.endpoint,W.cdpEndpoint),remoteProvider:n.provider===`browser-use`?`browser-use`:`browserbase`,remoteApiKey:Y(n.apiKey,``),remoteProjectId:Y(n.projectId,``),remoteRegion:Y(n.region,``),maxNodes:X(r.maxNodes,W.maxNodes),maxCharacters:X(r.maxCharacters,W.maxCharacters),visualFallback:r.visualFallback!==!1,actionTimeoutMs:X(i.actionTimeoutMs,W.actionTimeoutMs),sessionTimeoutMs:X(i.sessionTimeoutMs,W.sessionTimeoutMs),maxSequenceLength:X(i.maxSequenceLength,W.maxSequenceLength),allowedPrivateHosts:Array.isArray(a.allowedPrivateHosts)?a.allowedPrivateHosts.filter(e=>typeof e==`string`).join(`
2
- `):``,crossDomainNavigation:he(a.crossDomainNavigation),uploads:he(a.uploads),consequentialActions:he(a.consequentialActions)}}function K(e){let t=e.driverKind===`extension`?{kind:`extension`}:e.driverKind===`playwright`?{kind:`playwright`,headless:e.headless,...e.executablePath.trim()?{executablePath:e.executablePath.trim()}:{}}:e.driverKind===`cdp`?{kind:`cdp`,endpoint:e.cdpEndpoint.trim()}:{kind:`remote`,provider:e.remoteProvider,...e.remoteApiKey.trim()?{apiKey:e.remoteApiKey.trim()}:{},...e.remoteProjectId.trim()?{projectId:e.remoteProjectId.trim()}:{},...e.remoteRegion.trim()?{region:e.remoteRegion.trim()}:{}};return{enabled:e.enabled,driver:t,observation:{maxNodes:e.maxNodes,maxCharacters:e.maxCharacters,visualFallback:e.visualFallback},limits:{actionTimeoutMs:e.actionTimeoutMs,sessionTimeoutMs:e.sessionTimeoutMs,maxSequenceLength:e.maxSequenceLength},security:{privateNetworks:`deny`,allowedPrivateHosts:e.allowedPrivateHosts.split(`
3
- `).map(e=>e.trim()).filter(Boolean),crossDomainNavigation:e.crossDomainNavigation,uploads:e.uploads,consequentialActions:e.consequentialActions}}}function q(e){if(e.driverKind===`cdp`)try{let t=new URL(e.cdpEndpoint);if(t.protocol!==`http:`&&t.protocol!==`https:`&&t.protocol!==`ws:`&&t.protocol!==`wss:`)return`CDP endpoint must use http, https, ws, or wss.`}catch{return`Enter a valid CDP endpoint URL.`}return!Number.isInteger(e.maxNodes)||e.maxNodes<20||e.maxNodes>500?`Max nodes must be between 20 and 500.`:!Number.isInteger(e.maxCharacters)||e.maxCharacters<1e3||e.maxCharacters>5e4?`Max characters must be between 1,000 and 50,000.`:!Number.isInteger(e.actionTimeoutMs)||e.actionTimeoutMs<1e3||e.actionTimeoutMs>12e4?`Action timeout must be between 1,000 and 120,000 ms.`:!Number.isInteger(e.sessionTimeoutMs)||e.sessionTimeoutMs<6e4||e.sessionTimeoutMs>36e5?`Session timeout must be between 60,000 and 3,600,000 ms.`:!Number.isInteger(e.maxSequenceLength)||e.maxSequenceLength<1||e.maxSequenceLength>10?`Sequence length must be between 1 and 10.`:null}async function me(e){await d(m(`/api/config`),{method:`PATCH`,body:JSON.stringify({browser:K(e)})}),v()}function J(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Y(e,t){return typeof e==`string`?e:t}function X(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function he(e){return e===`allow`||e===`deny`?e:`ask`}var ge=ie();function _e(e){let t=!!f(e=>e.conversationId),[n,r]=(0,I.useReducer)(ge,{form:null,baseline:null}),i=n.form,a=n.baseline,o=(0,I.useRef)(!1),s=(0,I.useRef)(i);s.current=i;let c=(0,I.useRef)(null),{data:l,error:u,isLoading:d,mutate:p}=y(t);A({enabled:t,parsed:(0,I.useMemo)(()=>l?.payload?.config===void 0?null:G(l.payload.config),[l]),dirty:o.current,trackedParsedRef:c,dispatch:r,onResetDirty:()=>{o.current=!1}});let m=!!(t&&d&&l===void 0&&!u),h=u instanceof Error?u.message:u?String(u):null,g=(0,I.useMemo)(()=>!i||!a?!1:JSON.stringify(i)!==JSON.stringify(a),[i,a]),_=(0,I.useCallback)(e=>{o.current=!0,r({type:`patch`,patch:e})},[]),v=P({value:i,dirty:g,onSave:(0,I.useCallback)(async t=>{try{await me(t),r({type:`saved`,value:t}),o.current=!!(s.current&&JSON.stringify(s.current)!==JSON.stringify(t))}catch(t){throw Error(t instanceof Error?t.message:e.saveError)}},[e.saveError]),validate:q});return{hasToken:t,loading:m,fetchError:h,form:i,update:_,autosaveStatus:v.status,error:v.error,onBlurCapture:v.onBlurCapture,mutate:p}}var ve=[`extension`,`playwright`,`cdp`,`remote`];function ye(){let e=(0,F.c)(29),t=p(be),n;e[0]===t?n=e[1]:(n=h(t),e[0]=t,e[1]=n);let r=_e(n.agentSettings),i=r.form,s=t===`zh`,[c]=a(),l=(0,I.useRef)(!1),u;e[2]!==i||e[3]!==c||e[4]!==r?(u=()=>{if(!i||l.current)return;l.current=!0;let e=c.get(`driver`);ve.includes(e)&&e!==i.driverKind&&r.update({driverKind:e})},e[2]=i,e[3]=c,e[4]=r,e[5]=u):u=e[5];let d;e[6]!==i||e[7]!==c||e[8]!==r.update?(d=[i,c,r.update],e[6]=i,e[7]=c,e[8]=r.update,e[9]=d):d=e[9],(0,I.useEffect)(u,d);let f=s?`Chrome 扩展(推荐)`:`Chrome extension (recommended)`,m;e[10]===f?m=e[11]:(m={value:`extension`,label:f},e[10]=f,e[11]=m);let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g={value:`playwright`,label:`Playwright Chromium`},e[12]=g):g=e[12];let _=s?`CDP 已有浏览器`:`Existing browser over CDP`,v;e[13]===_?v=e[14]:(v={value:`cdp`,label:_},e[13]=_,e[14]=v);let y=s?`远程浏览器`:`Remote browser`,b;e[15]===y?b=e[16]:(b={value:`remote`,label:y},e[15]=y,e[16]=b);let x;e[17]!==m||e[18]!==v||e[19]!==b?(x=[m,g,v,b],e[17]=m,e[18]=v,e[19]=b,e[20]=x):x=e[20];let S=x,C;e[21]!==S||e[22]!==i||e[23]!==r||e[24]!==s?(C=i?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z,{enabled:i.enabled,driverKind:i.driverKind,autosaveStatus:r.autosaveStatus,zh:s}),(0,L.jsxs)(Se,{title:s?`运行方式`:`Connection`,icon:(0,L.jsx)(re,{className:`size-4`}),children:[(0,L.jsx)(Ce,{label:s?`启用浏览器控制`:`Enable browser control`,checked:i.enabled,onChange:e=>r.update({enabled:e})}),(0,L.jsx)(Z,{label:s?`浏览器连接`:`Browser connection`,children:(0,L.jsx)(o,{value:i.driverKind,options:S,placeholder:s?`选择连接方式`:`Choose a connection`,allowEmpty:!1,onChange:e=>r.update({driverKind:e})})}),(0,L.jsx)(xe,{kind:i.driverKind,zh:s}),i.driverKind===`playwright`?(0,L.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-subtle p-4`,children:[(0,L.jsx)(Ce,{label:s?`无头模式`:`Headless mode`,description:s?`后台运行,不显示浏览器窗口。关闭后可观察智能体的操作过程。`:`Run in the background without a visible window. Turn off to watch the agent work.`,checked:i.headless,onChange:e=>r.update({headless:e})}),(0,L.jsx)(Q,{label:s?`Chromium 可执行文件(可选)`:`Chromium executable (optional)`,description:s?`留空时使用由 xopc 安装的 Chromium。`:`Leave empty to use Chromium installed by xopc.`,value:i.executablePath,onChange:e=>r.update({executablePath:e})})]}):null,i.driverKind===`cdp`?(0,L.jsx)(`div`,{className:`rounded-lg bg-surface-subtle p-4`,children:(0,L.jsx)(Q,{label:`CDP endpoint`,description:s?`例如 http://127.0.0.1:9222。Chrome 需要开启 remote debugging。`:`For example http://127.0.0.1:9222. Chrome must be started with remote debugging enabled.`,value:i.cdpEndpoint,onChange:e=>r.update({cdpEndpoint:e})})}):null,i.driverKind===`remote`?(0,L.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-subtle p-4`,children:[(0,L.jsx)(Z,{label:s?`服务商`:`Provider`,children:(0,L.jsx)(o,{value:i.remoteProvider,options:[{value:`browserbase`,label:`Browserbase`},{value:`browser-use`,label:`Browser Use`}],placeholder:s?`选择服务商`:`Choose a provider`,allowEmpty:!1,onChange:e=>r.update({remoteProvider:e})})}),(0,L.jsx)(Q,{label:`API key`,type:`password`,autoComplete:`off`,value:i.remoteApiKey,onChange:e=>r.update({remoteApiKey:e})}),(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,L.jsx)(Q,{label:`Project ID`,value:i.remoteProjectId,onChange:e=>r.update({remoteProjectId:e})}),(0,L.jsx)(Q,{label:`Region`,value:i.remoteRegion,onChange:e=>r.update({remoteRegion:e})})]})]}):null]}),(0,L.jsx)(ce,{children:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Se,{title:s?`页面理解`:`Page understanding`,icon:(0,L.jsx)(D,{className:`size-4`}),children:[(0,L.jsx)(Ce,{label:s?`需要时附加截图`:`Attach screenshots when needed`,checked:i.visualFallback,onChange:e=>r.update({visualFallback:e})}),(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,L.jsx)($,{label:s?`语义节点上限`:`Semantic node limit`,description:`20–500`,min:20,max:500,value:i.maxNodes,onChange:e=>r.update({maxNodes:e})}),(0,L.jsx)($,{label:s?`文本字符上限`:`Text character limit`,description:`1,000–50,000`,min:1e3,max:5e4,step:1e3,value:i.maxCharacters,onChange:e=>r.update({maxCharacters:e})})]})]}),(0,L.jsx)(Se,{title:s?`执行限制`:`Execution limits`,icon:(0,L.jsx)(T,{className:`size-4`}),children:(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,L.jsx)($,{label:s?`操作超时(毫秒)`:`Action timeout (ms)`,min:1e3,max:12e4,step:1e3,value:i.actionTimeoutMs,onChange:e=>r.update({actionTimeoutMs:e})}),(0,L.jsx)($,{label:s?`会话超时(毫秒)`:`Session timeout (ms)`,min:6e4,max:36e5,step:6e4,value:i.sessionTimeoutMs,onChange:e=>r.update({sessionTimeoutMs:e})}),(0,L.jsx)($,{label:s?`批量步骤上限`:`Sequence step limit`,min:1,max:10,value:i.maxSequenceLength,onChange:e=>r.update({maxSequenceLength:e})})]})}),(0,L.jsxs)(Se,{title:s?`安全与审批`:`Safety and approvals`,icon:(0,L.jsx)(te,{className:`size-4`}),children:[(0,L.jsx)(Q,{label:s?`允许访问的私网主机`:`Allowed private hosts`,description:s?`每行一个主机名或 IP,不支持通配符。`:`One hostname or IP per line. Wildcards are not supported.`,multiline:!0,value:i.allowedPrivateHosts,onChange:e=>r.update({allowedPrivateHosts:e})}),(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,L.jsx)(we,{zh:s,label:s?`跨域导航`:`Cross-domain navigation`,value:i.crossDomainNavigation,onChange:e=>r.update({crossDomainNavigation:e})}),(0,L.jsx)(we,{zh:s,label:s?`高影响动作`:`Consequential actions`,value:i.consequentialActions,onChange:e=>r.update({consequentialActions:e})}),(0,L.jsx)(we,{zh:s,label:s?`文件上传`:`File uploads`,value:i.uploads,onChange:e=>r.update({uploads:e})})]})]})]})})]}):null,e[21]=S,e[22]=i,e[23]=r,e[24]=s,e[25]=C):C=e[25];let w;return e[26]!==C||e[27]!==r?(w=(0,L.jsx)(U,{sectionId:`agent-browser`,vm:r,children:C}),e[26]=C,e[27]=r,e[28]=w):w=e[28],w}function be(e){return e.language}function xe(e){let t=(0,F.c)(7),{kind:n,zh:r}=e,i=r?`直接操作你正在使用的 Chrome,保留登录状态和现有标签页;最适合日常协作。`:`Operate your current Chrome with its signed-in state and existing tabs; best for daily collaboration.`,a=r?`由 xopc 启动独立 Chromium,环境隔离、自动化稳定,适合无人值守任务。`:`Let xopc launch an isolated Chromium; stable for unattended automation.`,o=r?`连接已开启远程调试的 Chrome 或 Chromium,适合自定义浏览器启动方式。`:`Connect to Chrome or Chromium already running with remote debugging.`,s=r?`使用 Browserbase 或 Browser Use 的云端浏览器,适合服务器环境和长任务。`:`Use a Browserbase or Browser Use cloud browser for servers and long-running tasks.`,c;t[0]!==i||t[1]!==a||t[2]!==o||t[3]!==s?(c={extension:i,playwright:a,cdp:o,remote:s},t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c):c=t[4];let l=c[n],u;return t[5]===l?u=t[6]:(u=(0,L.jsx)(`p`,{className:`rounded-lg bg-surface-subtle px-3 py-2 text-xs leading-5 text-fg-muted`,children:l}),t[5]=l,t[6]=u),u}function Se(e){let t=(0,F.c)(17),{title:n,description:r,icon:i,children:a}=e,o;t[0]===i?o=t[1]:(o=(0,L.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:i}),t[0]=i,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=r?(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[4]=r,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,L.jsxs)(`div`,{children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==o||t[10]!==l?(u=(0,L.jsxs)(`div`,{className:`mb-4 flex items-start gap-2`,children:[o,l]}),t[9]=o,t[10]=l,t[11]=u):u=t[11];let d;t[12]===a?d=t[13]:(d=(0,L.jsx)(`div`,{className:`space-y-4`,children:a}),t[12]=a,t[13]=d);let f;return t[14]!==u||t[15]!==d?(f=(0,L.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-5`,children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function Z(e){let t=(0,F.c)(8),{label:n,description:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,L.jsx)(`span`,{className:`mb-1.5 block font-medium`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,L.jsx)(`span`,{className:`mt-1.5 block text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,L.jsxs)(`label`,{className:`block text-sm text-fg`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Q(e){let t=(0,F.c)(10),{label:n,description:r,value:i,onChange:a,type:o,multiline:s,autoComplete:c}=e,l=o===void 0?`text`:o,u=s===void 0?!1:s,d;t[0]!==c||t[1]!==u||t[2]!==a||t[3]!==l||t[4]!==i?(d=u?(0,L.jsx)(`textarea`,{rows:3,value:i,onChange:e=>a(e.target.value),className:`w-full rounded-lg border border-edge bg-surface-subtle px-3 py-2 text-sm text-fg outline-none focus:border-accent`}):(0,L.jsx)(`input`,{type:l,autoComplete:c,value:i,onChange:e=>a(e.target.value),className:`w-full rounded-lg border border-edge bg-surface-subtle px-3 py-2 text-sm text-fg outline-none focus:border-accent`}),t[0]=c,t[1]=u,t[2]=a,t[3]=l,t[4]=i,t[5]=d):d=t[5];let f;return t[6]!==r||t[7]!==n||t[8]!==d?(f=(0,L.jsx)(Z,{label:n,description:r,children:d}),t[6]=r,t[7]=n,t[8]=d,t[9]=f):f=t[9],f}function $(e){let t=(0,F.c)(12),{label:n,description:r,value:i,onChange:a,min:o,max:s,step:c}=e,l=c===void 0?1:c,u;t[0]===a?u=t[1]:(u=e=>{let t=Number(e.target.value);Number.isFinite(t)&&a(t)},t[0]=a,t[1]=u);let d;t[2]!==s||t[3]!==o||t[4]!==l||t[5]!==u||t[6]!==i?(d=(0,L.jsx)(`input`,{type:`number`,min:o,max:s,step:l,value:i,onChange:u,className:`h-10 w-full rounded-lg border border-edge bg-surface-subtle px-3 text-sm text-fg outline-none focus:border-accent`}),t[2]=s,t[3]=o,t[4]=l,t[5]=u,t[6]=i,t[7]=d):d=t[7];let f;return t[8]!==r||t[9]!==n||t[10]!==d?(f=(0,L.jsx)(Z,{label:n,description:r,children:d}),t[8]=r,t[9]=n,t[10]=d,t[11]=f):f=t[11],f}function Ce(e){let t=(0,F.c)(15),{label:n,description:r,checked:i,onChange:a}=e,o;t[0]===a?o=t[1]:(o=e=>a(e.target.checked),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==o?(s=(0,L.jsx)(`input`,{type:`checkbox`,checked:i,onChange:o,className:`mt-0.5 size-4 accent-accent`}),t[2]=i,t[3]=o,t[4]=s):s=t[4];let c;t[5]===n?c=t[6]:(c=(0,L.jsx)(`span`,{className:`block font-medium`,children:n}),t[5]=n,t[6]=c);let l;t[7]===r?l=t[8]:(l=r?(0,L.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-subtle`,children:r}):null,t[7]=r,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,L.jsxs)(`span`,{children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==s||t[13]!==u?(d=(0,L.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[s,u]}),t[12]=s,t[13]=u,t[14]=d):d=t[14],d}function we(e){let t=(0,F.c)(20),{zh:n,label:r,value:i,onChange:a}=e,s=n?`每次询问`:`Ask each time`,c;t[0]===s?c=t[1]:(c={value:`ask`,label:s},t[0]=s,t[1]=c);let l=n?`允许`:`Allow`,u;t[2]===l?u=t[3]:(u={value:`allow`,label:l},t[2]=l,t[3]=u);let d=n?`拒绝`:`Deny`,f;t[4]===d?f=t[5]:(f={value:`deny`,label:d},t[4]=d,t[5]=f);let p;t[6]!==c||t[7]!==u||t[8]!==f?(p=[c,u,f],t[6]=c,t[7]=u,t[8]=f,t[9]=p):p=t[9];let m=p,h=n?`选择策略`:`Choose a policy`,g;t[10]===a?g=t[11]:(g=e=>a(e),t[10]=a,t[11]=g);let _;t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==i?(_=(0,L.jsx)(o,{value:i,options:m,placeholder:h,allowEmpty:!1,onChange:g}),t[12]=m,t[13]=h,t[14]=g,t[15]=i,t[16]=_):_=t[16];let v;return t[17]!==r||t[18]!==_?(v=(0,L.jsx)(Z,{label:r,children:_}),t[17]=r,t[18]=_,t[19]=v):v=t[19],v}export{ye as AgentBrowserSettingsPage};