@xopcai/xopc 0.0.392 → 0.0.393
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CZmaQbC9.js → agent-avatar-dicebear-1AF2KGju.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CPJr7NRR.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-cjJXJj_3.js +1 -0
- package/dist/gateway/static/root/assets/agents-DW3TlnIg.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-znm6_dW_.js → agents-admin-api-B5aykqg_.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-B_MFhXXU.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-TYGidVnd.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-DOkyvOF0.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-dSkmoISk.js → archive-plugin-BrFfEp0u.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DhWRn0dZ.js → automations-page-B7OofUPF.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DIod-bfm.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BJlZrYym.js → binary-plugins-BfAWnYG8.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-OHBssIfN.js → block-editor-_Y-QwZ-3.js} +5 -5
- package/dist/gateway/static/root/assets/browser-automation-inputs-DH9QHI9m.js +1 -0
- package/dist/gateway/static/root/assets/browser-automations-page-B_SnD9B0.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-BPlqYpMM.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-page-BtzZvMIK.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-CgDteXZH.js → capabilities-pt2M56-E.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-WzoG3oBb.js +8 -0
- package/dist/gateway/static/root/assets/capability-header-actions-CFVx3iaZ.js +1 -0
- package/dist/gateway/static/root/assets/channels-BXA55GY2.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-D3GuiG3N.js +36 -0
- package/dist/gateway/static/root/assets/computer-settings-page-CIbHDlp8.js +1 -0
- package/dist/gateway/static/root/assets/connector-service-page-CDyCHkpK.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-DA2b6cJu.js +1 -0
- package/dist/gateway/static/root/assets/date-picker-C424c_g9.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-BVJh9sYc.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-Q52A8vjp.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-CZr1CXxu.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-sprite-Bd-aOI7N.js +30 -0
- package/dist/gateway/static/root/assets/desktop-pet-sprite-BuB0g8zv.css +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-D_WWTsze.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-C6cUgrvg.js +1 -0
- package/dist/gateway/static/root/assets/extension-debug-page-DyyfC4gA.js +1 -0
- package/dist/gateway/static/root/assets/extension-page-Dho9o3ZZ.js +1 -0
- package/dist/gateway/static/root/assets/extension-settings-page-CdnIGyCH.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-BM__9Fws.js → gateway-config-swr-BEePO3Wl.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DS_GDx-x.js → gateway-realtime-Dng_VOvI.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DtlBf7oH.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-D0KSQRNZ.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DosoyMIH.js → gateway-startup-retry-CDCiy7Cd.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BYHXWIfK.js → highlighted-body-KQOG7T2V-BNpj_mIM.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-CH_A0W29.js +2 -0
- package/dist/gateway/static/root/assets/image-generation-api-DwkO2y46.js +1 -0
- package/dist/gateway/static/root/assets/imports-page-BrYvomnU.js +1 -0
- package/dist/gateway/static/root/assets/index-CKdOZoVu.js +260 -0
- package/dist/gateway/static/root/assets/index-Rxjt-jc3.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BveDYfYk.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-CcIi1BhT.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-page-B1a69mlV.js +1 -0
- package/dist/gateway/static/root/assets/{local-session-drafts-Bye3ZtsW.js → local-session-drafts-CYEDUPH7.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BKyOF23r.js → locale-store-CE7L6MlS.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Us1jv3C4.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-C9RAM7-s.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-D_7clISS.js → markdown-view-PrKvVpRh.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-B_4o8hac.js → media-plugins-CR1fp6IL.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DQdcaMiu.js +1 -0
- package/dist/gateway/static/root/assets/messages-CaeL_miw.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-Q4yRx9iZ.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-C9qu16IN.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-Cn_WK68Y.js +1 -0
- package/dist/gateway/static/root/assets/personal-page-DrP6hEcg.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-3NbiWGRG.js +1 -0
- package/dist/gateway/static/root/assets/product-open-page-KKE5-V8k.js +1 -0
- package/dist/gateway/static/root/assets/product-preview-content-BM0oqNxi.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-CPZrwf8n.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Besfx_07.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-DLHHYP_v.js → registry-api-BO2Ck3aA.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CTDghL5L.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-Dq_50s27.js → runtime-tools-api-B1sb8nlw.js} +1 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-W0X_Fy7b.js +1 -0
- package/dist/gateway/static/root/assets/schema-form-DNM2Zdyr.js +1 -0
- package/dist/gateway/static/root/assets/{session-api-Br11ih_M.js → session-api-CaAUJvu1.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-DoFTlgNz.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-Dxtablvd.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C7zklouD.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-DCSHPFAN.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-4odCW0_2.js → settings-page-B18UbbaJ.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-JoSfluza.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-BLnS3hoH.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-DcIuPJK3.js +1 -0
- package/dist/gateway/static/root/assets/skill-api-CcYGkRPL.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-PnUZjoPK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-D3JAw62U.js +2 -0
- package/dist/gateway/static/root/assets/style-BQqU-1pP.js +7 -0
- package/dist/gateway/static/root/assets/system-settings-panel-C974myUM.js +1 -0
- package/dist/gateway/static/root/assets/tab-completion-input-CxtEp0aP.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-CiljFekC.js +2 -0
- package/dist/gateway/static/root/assets/{task-expandable-content-CmQt5uxa.js → task-expandable-content-DTEVoNrM.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-DEE75MUn.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-DWyI3uA3.js +1 -0
- package/dist/gateway/static/root/assets/usage-page-DJYvbxk7.js +1 -0
- package/dist/gateway/static/root/assets/use-autosave-CY0YuljR.js +1 -0
- package/dist/gateway/static/root/assets/user-model-page-eHZJD6Fw.js +2 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-BNG4ixJE.js +1 -0
- package/dist/gateway/static/root/assets/{voice-config-api-CmDtDA4g.js → voice-config-api-D0Wscn9W.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-CohIoAre.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Czfs5XFH.js → workflow-run-setup-panel-BXI8eyYh.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CVti0u-l.js +6 -0
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-C_COnY_B.js +1 -0
- package/dist/gateway/static/root/index.html +19 -69
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/agent-manager.js +11 -20
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/child-agent-factory.d.ts +2 -1
- package/dist/src/agent/child-agent-factory.js +2 -1
- package/dist/src/agent/coding/projectEvidence.d.ts +9 -0
- package/dist/src/agent/coding/projectEvidence.js +177 -0
- package/dist/src/agent/coding/repository-instructions.d.ts +8 -1
- package/dist/src/agent/coding/repository-instructions.js +9 -4
- package/dist/src/agent/coding/run-verification.d.ts +17 -2
- package/dist/src/agent/coding/run-verification.js +82 -12
- package/dist/src/agent/embedded/codemode-extension.js +1 -1
- package/dist/src/agent/embedded/execution-context.d.ts +1 -0
- package/dist/src/agent/embedded/execution-context.js +4 -1
- package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -0
- package/dist/src/agent/embedded/run-turn.js +41 -5
- package/dist/src/agent/embedded/session-runner.js +1 -1
- package/dist/src/agent/embedded/session-tool-result-guard.js +5 -0
- package/dist/src/agent/embedded/types.d.ts +2 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +2 -1
- package/dist/src/agent/external-tools/cliProvider.js +2 -2
- package/dist/src/agent/external-tools/composio-provider.js +2 -2
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/extension-provider.js +1 -1
- package/dist/src/agent/external-tools/gateway-tools.js +1 -1
- package/dist/src/agent/external-tools/memory-provider.js +1 -1
- package/dist/src/agent/independent-execution.d.ts +2 -0
- package/dist/src/agent/independent-execution.js +12 -0
- package/dist/src/agent/memory/compaction.js +1 -1
- package/dist/src/agent/orchestration/delegation-scope.d.ts +1 -0
- package/dist/src/agent/orchestration/delegation-scope.js +4 -1
- package/dist/src/agent/orchestration/loop-guard.js +6 -2
- package/dist/src/agent/prompt/sections/agent-identity.js +4 -6
- package/dist/src/agent/prompt/sections/behavior.d.ts +3 -2
- package/dist/src/agent/prompt/sections/behavior.js +34 -27
- package/dist/src/agent/prompt/sections/memory-skills.d.ts +1 -1
- package/dist/src/agent/prompt/sections/memory-skills.js +10 -11
- package/dist/src/agent/prompt/sections/messaging-runtime.d.ts +3 -2
- package/dist/src/agent/prompt/sections/messaging-runtime.js +21 -24
- package/dist/src/agent/prompt/sections/response-language.js +7 -6
- package/dist/src/agent/prompt/sections/tooling.js +11 -10
- package/dist/src/agent/prompt/service-prompt-builder.js +3 -1
- package/dist/src/agent/prompt/system-prompt-params.d.ts +2 -1
- package/dist/src/agent/prompt/system-prompt-params.js +2 -0
- package/dist/src/agent/prompt/system-prompt.d.ts +2 -1
- package/dist/src/agent/prompt/system-prompt.js +21 -18
- package/dist/src/agent/prompt/types.d.ts +2 -0
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/service.js +3 -2
- package/dist/src/agent/skills/format-skills-prompt.js +5 -2
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +5 -0
- package/dist/src/agent/tools/dataBatch.d.ts +1 -0
- package/dist/src/agent/tools/dataBatch.js +4 -1
- package/dist/src/agent/tools/delegate-tool.d.ts +1 -0
- package/dist/src/agent/tools/delegate-tool.js +1 -0
- package/dist/src/agent/tools/error-tracker.js +4 -2
- package/dist/src/agent/tools/exec-command.js +4 -3
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +20 -21
- package/dist/src/agent/tools/{delegation-parent-policy.d.ts → noninteractive-tool-policy.d.ts} +1 -1
- package/dist/src/agent/tools/{delegation-parent-policy.js → noninteractive-tool-policy.js} +4 -4
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.js +1 -1
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/search/cache.d.ts +3 -1
- package/dist/src/agent/tools/search/cache.js +4 -1
- package/dist/src/agent/tools/search/providers/deepseek-protocol.d.ts +9 -0
- package/dist/src/agent/tools/search/providers/deepseek-protocol.js +84 -0
- package/dist/src/agent/tools/search/providers/deepseek.d.ts +9 -0
- package/dist/src/agent/tools/search/providers/deepseek.js +55 -0
- package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +2 -1
- package/dist/src/agent/tools/search/providers/xopc-cloud.js +36 -1
- package/dist/src/agent/tools/search/registry.d.ts +1 -0
- package/dist/src/agent/tools/search/registry.js +32 -6
- package/dist/src/agent/tools/search/request-gate.d.ts +13 -0
- package/dist/src/agent/tools/search/request-gate.js +41 -0
- package/dist/src/agent/tools/search/resolve-config.js +1 -1
- package/dist/src/agent/tools/search/search-info.d.ts +8 -0
- package/dist/src/agent/tools/search/search-info.js +34 -0
- package/dist/src/agent/tools/search/types.d.ts +19 -1
- package/dist/src/agent/tools/toolExposure.d.ts +3 -0
- package/dist/src/agent/tools/toolExposure.js +25 -0
- package/dist/src/agent/tools/web.js +8 -1
- package/dist/src/agent/tools/xopc-use-tool.js +7 -3
- package/dist/src/agent/workflow/subagent-runner.d.ts +1 -0
- package/dist/src/agent/workflow/subagent-runner.js +3 -3
- package/dist/src/agent/workflow/workflow-child-tools.js +13 -8
- package/dist/src/agent/workspace-runtime/registry.js +1 -1
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/service/action-executor.js +2 -2
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/commands/search.d.ts +2 -2
- package/dist/src/cli/commands/search.js +8 -6
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/computer/model-adapter.d.ts +3 -0
- package/dist/src/computer/model-adapter.js +120 -3
- package/dist/src/computer/model-policy.d.ts +1 -1
- package/dist/src/computer/model-policy.js +13 -6
- package/dist/src/computer/runtime.js +1 -0
- package/dist/src/config/agent-model-intents.js +1 -1
- package/dist/src/config/agent-profile.js +2 -2
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.d.ts +14 -8
- package/dist/src/config/models-json.js +3 -1
- package/dist/src/config/outbound-proxy.d.ts +11 -0
- package/dist/src/config/outbound-proxy.js +30 -0
- package/dist/src/config/rules.js +5 -0
- package/dist/src/config/schema.d.ts +29 -6
- package/dist/src/config/schema.js +21 -4
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/config-tools-web.js +15 -4
- package/dist/src/gateway/gateway-workflow-host.types.d.ts +3 -0
- package/dist/src/gateway/hono/lib/config-payload.d.ts +5 -0
- package/dist/src/gateway/hono/lib/config-payload.js +6 -1
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +7 -0
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +5 -2
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +8 -3
- package/dist/src/gateway/service.js +5 -3
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/infra/http-proxy-env.d.ts +3 -0
- package/dist/src/infra/http-proxy-env.js +22 -2
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/personal-agent/communication.d.ts +2 -1
- package/dist/src/personal-agent/communication.js +11 -2
- package/dist/src/personal-agent/persona.d.ts +2 -1
- package/dist/src/personal-agent/persona.js +3 -2
- package/dist/src/personal-agent/proactivity/service.js +1 -1
- package/dist/src/personal-agent/prompts.d.ts +2 -0
- package/dist/src/personal-agent/prompts.js +69 -7
- package/dist/src/personal-agent/reply-composer.js +2 -2
- package/dist/src/personal-agent/reply-style.d.ts +4 -2
- package/dist/src/personal-agent/reply-style.js +19 -3
- package/dist/src/personal-agent/request-service.js +14 -9
- package/dist/src/personal-agent/service.js +2 -2
- package/dist/src/pets/loopi-artwork.d.ts +2 -0
- package/dist/src/pets/loopi-artwork.js +36 -0
- package/dist/src/pets/pointer.d.ts +6 -0
- package/dist/src/pets/pointer.js +16 -0
- package/dist/src/project-trust/trust-store.d.ts +5 -0
- package/dist/src/project-trust/trust-store.js +7 -1
- package/dist/src/providers/index.js +3 -3
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/model-registry.js +2 -0
- package/dist/src/providers/model-supplements.d.ts +0 -2
- package/dist/src/providers/model-supplements.js +2 -18
- package/dist/src/providers/xopc-cloud-credit-budget.d.ts +1 -0
- package/dist/src/providers/xopc-cloud-credit-budget.js +4 -1
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/resolve-tui-session-key.js +1 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/task-allocation-service.js +51 -40
- package/dist/src/tasks/task-application-service.js +5 -1
- package/dist/src/tasks/task-contract-planner.js +21 -6
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-language.d.ts +2 -0
- package/dist/src/tasks/task-language.js +13 -2
- package/dist/src/tasks/task-run-coordinator.js +5 -1
- package/dist/src/tasks/task-run-dispatcher.js +2 -1
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +2 -3
- package/package.json +8 -4
- package/dist/gateway/static/root/assets/activity-YogQEteU.js +0 -1
- package/dist/gateway/static/root/assets/activity-store-DtTSRUyF.js +0 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-0GXoU7WL.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-BxDqL7uc.js +0 -1
- package/dist/gateway/static/root/assets/agents-CYmRcXr-.js +0 -77
- package/dist/gateway/static/root/assets/app-chrome-BeB4KgOf.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-FhWeowCY.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-DXin262V.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-2M_l4Naz.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CVIWgoTx.js +0 -6
- package/dist/gateway/static/root/assets/browser-automation-inputs-uVEhZWHz.js +0 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CEFnpvTO.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-sQpJic5b.js +0 -3
- package/dist/gateway/static/root/assets/button-aIC072nz.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-BSB93QBR.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-BKkN4sTh.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DCZTR8Hu.js +0 -8
- package/dist/gateway/static/root/assets/capability-header-actions-D0HwmxyW.js +0 -1
- package/dist/gateway/static/root/assets/channels-DRraXYSd.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-DpM489kK.js +0 -36
- package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +0 -1
- package/dist/gateway/static/root/assets/chevron-right-BweFrslA.js +0 -1
- package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
- package/dist/gateway/static/root/assets/circle-dashed-8qMD7gHf.js +0 -1
- package/dist/gateway/static/root/assets/circle-dot-BAseJTrF.js +0 -1
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-D0ir9aA1.js +0 -1
- package/dist/gateway/static/root/assets/connector-service-page-Y5SYaiJO.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DRSbj4gn.js +0 -1
- package/dist/gateway/static/root/assets/copy-text-row-C7egVuKr.js +0 -1
- package/dist/gateway/static/root/assets/date-formatters-CUZAyDEg.js +0 -1
- package/dist/gateway/static/root/assets/date-picker-DyUP-8hR.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-QF9qLWIG.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-Qfns4SO-.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-CuITd-Xa.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-sprite-BP6iMVw1.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-C8RPqM_F.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-DnD9eyoU.js +0 -1
- package/dist/gateway/static/root/assets/dist-C3DSFZCi.js +0 -1
- package/dist/gateway/static/root/assets/electron-env-Dit0bHgy.js +0 -1
- package/dist/gateway/static/root/assets/extension-debug-page-B5ikNsSj.js +0 -1
- package/dist/gateway/static/root/assets/extension-page-D-PBMAtT.js +0 -1
- package/dist/gateway/static/root/assets/extension-provider-CdlACvkE.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BPUYMNb0.js +0 -1
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-uEdmIROn.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BKj4PQs4.js +0 -1
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
- package/dist/gateway/static/root/assets/home-page-D1ZBF3me.js +0 -2
- package/dist/gateway/static/root/assets/image-generation-api-BB3D6OV1.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-BCcWIxOO.js +0 -1
- package/dist/gateway/static/root/assets/index-Bo70AuAq.js +0 -260
- package/dist/gateway/static/root/assets/index-BxoR4_xr.css +0 -1
- package/dist/gateway/static/root/assets/index.module-Cd9ENXfk.js +0 -1
- package/dist/gateway/static/root/assets/interaction-BdhHBbYa.js +0 -1
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-Bc9UWPqr.js +0 -1
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-jnK1j04U.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-page-DpN8UN_Y.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-DBR5mfxw.js +0 -2
- package/dist/gateway/static/root/assets/loopi-C09I2mNj.css +0 -1
- package/dist/gateway/static/root/assets/loopi-Djb8XU3l.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-rs2cdb5f.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-Bl4kOOZT.js +0 -1
- package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
- package/dist/gateway/static/root/assets/messages-B7VtMXec.js +0 -3
- package/dist/gateway/static/root/assets/mic-CuUb7zc-.js +0 -1
- package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-D0vR7vex.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-B7R-cZWE.js +0 -5
- package/dist/gateway/static/root/assets/notes-api-DZkezSIy.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-DY9MNatd.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-C-X8J1IO.js +0 -1
- package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-CIZWUoUh.js +0 -1
- package/dist/gateway/static/root/assets/popover-select-DGKUpVsz.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-BJU2fmPn.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-CYV_8zRl.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-content-DfQ9h_YX.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-B_fYXcAW.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CHdeAtpp.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CbJWGHW_.js +0 -1
- package/dist/gateway/static/root/assets/rotate-ccw-JM1TBLpp.js +0 -1
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-jqYXsCuk.js +0 -1
- package/dist/gateway/static/root/assets/schema-form-DNXZLVqh.js +0 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +0 -1
- package/dist/gateway/static/root/assets/secret-input-BxWHx6J6.js +0 -1
- package/dist/gateway/static/root/assets/send-session-input-NpLYu1ip.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-Bb9pevyM.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-DrGCnBhV.js +0 -1
- package/dist/gateway/static/root/assets/settings-2-D-csvaET.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B61Eh7eB.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-draft-Dy10ldo8.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-num14vSv.js +0 -1
- package/dist/gateway/static/root/assets/settings-shell-dialog-layer-BU3UuiJr.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DaU9o0Ll.js +0 -1
- package/dist/gateway/static/root/assets/share-link-dialog-BhjQPZbF.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-LERhIwgz.js +0 -2
- package/dist/gateway/static/root/assets/shares-api-CgsiMdCX.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DmvyqIyT.js +0 -1
- package/dist/gateway/static/root/assets/skeleton-BI5TyibZ.js +0 -1
- package/dist/gateway/static/root/assets/skill-api-plToSoFo.js +0 -1
- package/dist/gateway/static/root/assets/skill-api-utils-C7V4JVXM.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BFw81Ar6.js +0 -1
- package/dist/gateway/static/root/assets/skill-wire-pattern-BPpeIcCi.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BLUsxGOo.js +0 -2
- package/dist/gateway/static/root/assets/style-1FPsMO2E.js +0 -7
- package/dist/gateway/static/root/assets/system-settings-panel-DL3WXRnL.js +0 -1
- package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DWM5xGbe.js +0 -2
- package/dist/gateway/static/root/assets/theme-store-CPdeCbZI.js +0 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-m51enJFx.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-B5I53jzk.js +0 -1
- package/dist/gateway/static/root/assets/usage-page-B7qyfnMN.js +0 -1
- package/dist/gateway/static/root/assets/use-async-resource-GrnWNwMZ.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-C2__K1-y.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-61W-5Q6m.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-DZUWxdhm.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-DkIuYpuf.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-DB--pFJX.js +0 -1
- package/dist/gateway/static/root/assets/voice-transcribe-api-Cp2uDvFO.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-Blwp7T-_.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-RN_QXcGY.js +0 -6
- package/dist/gateway/static/root/assets/workspace-api-lHTRLje0.js +0 -2
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-D31rz9OQ.js +0 -1
- package/dist/src/agent/bootstrap/project-agents-context.d.ts +0 -2
- package/dist/src/agent/bootstrap/project-agents-context.js +0 -30
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]);export{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"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./globe-DSSGFWFn.js";import{t as s}from"./plus-Q2yW6OE7.js";import{t as c}from"./messages-B7VtMXec.js";import{a as l,n as u,r as d}from"./locale-store-BKyOF23r.js";import{i as f}from"./vendor-swr-BIWyz7Rc.js";import{t as p}from"./button-aIC072nz.js";import{t as m}from"./skeleton-BI5TyibZ.js";import{r as h}from"./gateway-config-swr-BM__9Fws.js";import{n as g,t as _}from"./registry-api-DLHHYP_v.js";import{t as v}from"./electron-env-Dit0bHgy.js";import{As as y,Go as b,Ln as x,Rn as S,es as C,gi as w,js as T}from"./index-Bo70AuAq.js";import{n as ee,r as te}from"./settings-page-layout-Dx5S-Msc.js";var E=n(),D=e(t(),1),O=r();function ne({zh:e}){let t=c(e?`zh`:`en`).computerSettings,n=f(`settings-agent-defaults`,x),r=f(_,g),a=n.data?.defaults.models.computerUse?.primary??``,[o,s]=(0,D.useState)(a),[l,u]=(0,D.useState)(!1),[d,h]=(0,D.useState)(``),[v,y]=(0,D.useState)(!1);(0,D.useEffect)(()=>{s(a)},[a]);let b=!o||r.data?.some(e=>e.id===o&&e.computerUse),C=async()=>{u(!0),h(``),y(!1);try{if(!b)throw Error(t.modelUnavailable);let e=await x(),r={...e.defaults.models};o?r.computerUse={primary:o,fallbacks:[]}:delete r.computerUse;let i=await S({...e.defaults,models:r});await n.mutate(i,!1),y(!0)}catch(e){h(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,O.jsxs)(`section`,{"aria-label":t.model,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.model}),!n.data&&!n.error?(0,O.jsx)(m,{className:`h-52 w-full rounded-xl`}):n.error?(0,O.jsxs)(`div`,{role:`alert`,className:`text-sm text-danger`,children:[String(n.error),(0,O.jsx)(p,{onClick:()=>{n.mutate().catch(()=>{})},children:t.retry})]}):(0,O.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,O.jsx)(`div`,{className:`min-w-0 flex-1`,children:r.isLoading?(0,O.jsx)(m,{className:`h-11 w-full rounded-lg`}):(0,O.jsx)(w,{value:o,onChange:e=>{s(e),y(!1)},disabled:l,capabilitiesFilter:`computer-use`,models:r.data??[],modelsError:r.error,placeholder:t.selectModel,searchPlaceholder:t.searchModel,noMatches:t.noModels,registryEmptyHint:t.noModels,allowEmpty:!0,emptyLabel:t.noModel,ariaLabel:t.modelLabel,className:`w-full`,contentAlign:`start`})}),(0,O.jsx)(p,{variant:`primary`,disabled:l||o===a||!b||!!r.error||r.isLoading,onClick:()=>{C()},children:t.saveModel})]}),(0,O.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[(0,O.jsx)(`span`,{children:t.modelDataUse}),(0,O.jsx)(p,{asChild:!0,variant:`ghost`,className:`h-auto p-0 text-xs`,children:(0,O.jsx)(i,{to:`/settings/capabilities/models?add=1`,children:t.manageModels})}),v&&(0,O.jsx)(`span`,{role:`status`,children:t.modelSaved})]}),!b&&!r.isLoading&&!r.error&&(0,O.jsx)(`p`,{role:`status`,className:`mt-3 text-sm text-warning`,children:t.modelUnavailable}),r.error&&(0,O.jsxs)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:[String(r.error),(0,O.jsx)(p,{onClick:()=>{r.mutate().catch(()=>{})},children:t.retry})]}),d&&(0,O.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:d})]})]})}function k(e){let t=(0,E.c)(15),{icon:n,title:r,description:i,children:a}=e,o;t[0]===n?o=t[1]:(o=n&&(0,O.jsx)(`div`,{className:`flex size-6 shrink-0 items-center justify-center text-fg-muted`,"aria-hidden":!0,children:n}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,O.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=i&&(0,O.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===a?u=t[10]:(u=a&&(0,O.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:a}),t[9]=a,t[10]=u);let d;return t[11]!==o||t[12]!==l||t[13]!==u?(d=(0,O.jsxs)(`div`,{className:`flex min-h-16 flex-wrap items-center gap-3 px-4 py-3 sm:flex-nowrap sm:px-5`,children:[o,l,u]}),t[11]=o,t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function A(){let e=(0,E.c)(2),t=u(j)===`zh`,n;return e[0]===t?n=e[1]:(n=(0,O.jsx)(M,{zh:t}),e[0]=t,e[1]=n),n}function j(e){return e.language}function M({zh:e}){let t=c(e?`zh`:`en`).computerSettings,{data:n,mutate:r,error:u}=h(!0),f=n?.payload?.config,[g,_]=(0,D.useState)(!1),[x,S]=(0,D.useState)(``),[w,E]=(0,D.useState)(!1),[A,j]=(0,D.useState)(null),[M,N]=(0,D.useState)(!1),[P,F]=(0,D.useState)(null),[re,I]=(0,D.useState)(!1),[L,R]=(0,D.useState)(``),[z,B]=(0,D.useState)(!1),[ie,V]=(0,D.useState)(!1),H=window.electronAPI?.platform===`darwin`?window.electronAPI.computer:void 0,U=window.electronAPI?.platform===`darwin`?window.electronAPI.system:void 0;(0,D.useEffect)(()=>{if(!H)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await H.status();e||(j(t),N(!1))}catch{e||(j(null),N(!0))}finally{t=!1}}};n();let r=window.setInterval(()=>{n()},2e3);return()=>{e=!0,window.clearInterval(r)}},[H]),(0,D.useEffect)(()=>{if(!H?.access)return;let e=!1;return H.access().then(t=>{e||(F(t),I(!1))}).catch(()=>{e||I(!0)}),()=>{e=!0}},[H]);let W=async e=>{_(!0),S(``);try{await e()}catch(e){S(e instanceof Error?e.message:String(e))}finally{_(!1)}},ae=e=>W(async()=>{v()&&(await l(d(`/api/config`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({computer:{enabled:e}})}),await r())}),G=async()=>{S(``),E(!1);try{await H?.stop(),E(!0),H&&j(await H.status())}catch(e){S(e instanceof Error?e.message:String(e))}},K=A?.session?.status??`idle`,q=t.states[K]??K,J=v()&&f?.computer?.enabled===!0,oe=A?.controlPaused?t.pausedNotice:J?A?.connected?`${t.connected} · ${q}`:A?t.disconnected:t.checking:t.disabled,Y=!H||M||A?.reenrollmentRequired===!0||!!(A?.error||A?.session?.errorCode)||A!=null&&(!A.permissions.accessibility||A.permissions.screenRecording!==`granted`),X=A?.permissions.accessibility===!0&&A.permissions.screenRecording===`granted`&&!A.reenrollmentRequired,Z=P?.apps.filter(e=>P.authorizedAppIds.includes(e.appId))??[],Q=P?.apps.filter(e=>!P.authorizedAppIds.includes(e.appId)&&`${e.name} ${e.appId}`.toLocaleLowerCase().includes(L.toLocaleLowerCase()))??[],$=(0,O.jsxs)(`section`,{"aria-labelledby":`computer-permissions-title`,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{id:`computer-permissions-title`,className:`text-sm font-semibold text-fg`,children:t.permissions}),H?M?(0,O.jsx)(`p`,{role:`alert`,className:`rounded-xl bg-danger-soft p-5 text-sm text-danger`,children:t.nativeError}):A?X&&!ie?(0,O.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:(0,O.jsx)(k,{icon:(0,O.jsx)(C,{className:`size-5`}),title:t.systemPermissions,description:t.granted,children:(0,O.jsx)(p,{onClick:()=>V(!0),children:t.viewDetails})})}):(0,O.jsxs)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[(0,O.jsx)(k,{icon:(0,O.jsx)(T,{className:`size-5`}),title:t.device,description:(0,O.jsxs)(`span`,{"aria-live":`polite`,children:[A.connected?t.connected:t.disconnected,` · `,q]}),children:A.reenrollmentRequired&&(0,O.jsx)(p,{disabled:g,onClick:()=>{W(async()=>{j(await H.reenroll())})},children:t.reenroll})}),U&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(k,{icon:(0,O.jsx)(C,{className:`size-5`}),title:t.accessibility,children:[(0,O.jsx)(`span`,{className:`text-xs text-fg-muted`,children:A.permissions.accessibility?t.granted:t.notGranted}),!A.permissions.accessibility&&(0,O.jsx)(p,{disabled:g,"aria-label":`${t.openSettings}: ${t.accessibility}`,onClick:()=>{W(()=>U.requestAccessibility())},children:t.openSettings})]}),(0,O.jsxs)(k,{icon:(0,O.jsx)(T,{className:`size-5`}),title:t.screen,children:[(0,O.jsx)(`span`,{className:`text-xs text-fg-muted`,children:A.permissions.screenRecording===`granted`?t.granted:t.notGranted}),A.permissions.screenRecording!==`granted`&&(0,O.jsx)(p,{disabled:g,"aria-label":`${t.openSettings}: ${t.screen}`,onClick:()=>{W(()=>U.requestScreen())},children:t.openSettings})]})]}),X&&(0,O.jsx)(`div`,{className:`flex justify-end px-4 py-2 sm:px-5`,children:(0,O.jsx)(p,{variant:`ghost`,onClick:()=>V(!1),children:t.hideDetails})})]}):(0,O.jsx)(`div`,{"aria-label":t.checking,children:(0,O.jsx)(m,{className:`h-20 w-full rounded-xl`})}):(0,O.jsx)(`p`,{className:`rounded-xl bg-surface-hover/20 p-5 text-sm leading-relaxed text-fg-muted`,children:window.electronAPI&&window.electronAPI.platform!==`darwin`?t.unsupportedPlatform:t.desktopRequired}),(A?.error||A?.session?.errorCode)&&(0,O.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-red-600`,children:A.error||A.session?.errorCode})]});return(0,O.jsxs)(te,{gap:`gap-7`,children:[(0,O.jsx)(ee,{title:t.title,subtitle:t.subtitle,meta:(0,O.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:t.preview}),actions:H&&(0,O.jsxs)(p,{onClick:()=>{G()},children:[(0,O.jsx)(b,{className:`size-3.5`}),t.stop]})}),x&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:x}),w&&(0,O.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:t.stoppedNotice}),(0,O.jsxs)(`section`,{"aria-labelledby":`computer-control-title`,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{id:`computer-control-title`,className:`text-sm font-semibold text-fg`,children:t.control}),!f&&!u?(0,O.jsx)(m,{className:`h-32 w-full rounded-xl`}):u?(0,O.jsxs)(`div`,{role:`alert`,className:`text-sm text-fg-muted`,children:[String(u),` `,(0,O.jsx)(p,{onClick:()=>{W(()=>r())},children:t.retry})]}):(0,O.jsxs)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[(0,O.jsx)(k,{icon:(0,O.jsx)(y,{className:`size-5`}),title:t.desktop,description:(0,O.jsx)(`span`,{"aria-live":`polite`,children:oe}),children:(0,O.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":t.desktop,"aria-checked":J,disabled:g||!v(),onClick:()=>{ae(f?.computer?.enabled!==!0)},className:`touch-target flex items-center rounded-lg px-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,O.jsx)(`span`,{className:`flex h-6 w-11 items-center rounded-full p-0.5 transition-colors ${J?`bg-accent`:`bg-fg-muted/30`}`,children:(0,O.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform ${J?`translate-x-5`:`translate-x-0`}`})})})}),A?.controlPaused&&(0,O.jsx)(`div`,{className:`flex justify-end border-t border-edge-subtle px-4 py-3 sm:px-5`,children:(0,O.jsx)(p,{disabled:g,onClick:()=>{W(async()=>{H&&j(await H.resume()),E(!1)})},children:t.resume})})]})]}),Y&&$,H?.access&&(0,O.jsxs)(`section`,{"aria-labelledby":`computer-app-access-title`,className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsx)(`h2`,{id:`computer-app-access-title`,className:`text-sm font-semibold text-fg`,children:t.appAccess}),!P?.allowAllApps&&(0,O.jsxs)(p,{disabled:g,"aria-expanded":z,"aria-controls":z?`computer-app-picker`:void 0,onClick:()=>{B(e=>!e),R(``)},children:[z?(0,O.jsx)(a,{className:`size-4`,"aria-hidden":!0}):(0,O.jsx)(s,{className:`size-4`,"aria-hidden":!0}),z?t.doneAdding:t.addApp]})]}),P?(0,O.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[(0,O.jsx)(k,{icon:(0,O.jsx)(y,{className:`size-5`}),title:t.anyApp,description:t.anyAppDescription,children:(0,O.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":t.anyApp,"aria-checked":P.allowAllApps===!0,disabled:g,onClick:()=>{W(async()=>{F(await H.setAllAppAccess(!P.allowAllApps)),B(!1)})},className:`touch-target flex items-center rounded-lg px-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,O.jsx)(`span`,{className:`flex h-6 w-11 items-center rounded-full p-0.5 transition-colors ${P.allowAllApps?`bg-accent`:`bg-fg-muted/30`}`,children:(0,O.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform ${P.allowAllApps?`translate-x-5`:`translate-x-0`}`})})})}),!P.allowAllApps&&(0,O.jsx)(`div`,{className:`border-t border-edge-subtle`,children:Z.length?Z.map(e=>(0,O.jsxs)(`div`,{className:`flex min-h-16 items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3 last:border-b-0 sm:px-5`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),(0,O.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:e.appId})]}),(0,O.jsx)(p,{disabled:g,variant:`ghost`,onClick:()=>{W(async()=>{let t=await H.setAppAccess(e.appId,!1);F(e=>e&&{...e,authorizedAppIds:t.authorizedAppIds})})},children:t.revokeApp})]},e.appId)):(0,O.jsx)(`p`,{className:`px-5 py-6 text-center text-sm text-fg-muted`,children:t.noAuthorizedApps})})]}):re?(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t.appListError}):(0,O.jsx)(m,{className:`h-20 w-full rounded-xl`}),z&&!P?.allowAllApps&&(0,O.jsxs)(`div`,{id:`computer-app-picker`,className:`space-y-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`input`,{"aria-label":t.searchApps,value:L,onChange:e=>R(e.target.value),placeholder:t.searchApps,className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,O.jsx)(p,{disabled:g,onClick:()=>{W(async()=>{F(await H.access()),I(!1)})},children:t.refreshApps})]}),P&&(0,O.jsx)(`div`,{className:`max-h-64 overflow-y-auto rounded-xl border border-edge`,children:Q.length?Q.map(e=>(0,O.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-3 border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),(0,O.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:e.appId})]}),(0,O.jsx)(p,{disabled:g,variant:`secondary`,onClick:()=>{W(async()=>{let t=await H.setAppAccess(e.appId,!0);F(e=>e&&{...e,authorizedAppIds:t.authorizedAppIds})})},children:t.authorizeApp})]},e.appId)):(0,O.jsx)(`p`,{className:`px-3 py-5 text-center text-sm text-fg-muted`,children:P.appsBusy?t.appsBusy:P.appsUnavailable?t.appListError:t.noMatchingApps})})]})]}),(0,O.jsx)(ne,{zh:e}),!Y&&$,(0,O.jsxs)(`section`,{"aria-labelledby":`computer-browser-title`,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{id:`computer-browser-title`,className:`text-sm font-semibold text-fg`,children:t.otherControl}),(0,O.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:(0,O.jsx)(k,{icon:(0,O.jsx)(o,{className:`size-5`}),title:t.browser,description:f?f.browser?.enabled?t.browserEnabled:t.browserDisabled:t.checking,children:(0,O.jsx)(p,{asChild:!0,children:(0,O.jsx)(i,{to:`/settings/agent-browser`,children:t.manage})})})})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.previewFootnote})]})}export{A as ComputerSettingsPage,M as ComputerSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{t as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./secret-input-BxWHx6J6.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./messages-B7VtMXec.js";import{n as l}from"./locale-store-BKyOF23r.js";import{a as u,c as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-aIC072nz.js";import{t as b}from"./skeleton-BI5TyibZ.js";import{$a as x,Ai as S,Ga as C,Pa as w,no as T,ns as E,zt as D}from"./index-Bo70AuAq.js";var O=t({ConnectorServiceDialog:()=>I,ConnectorServicePage:()=>M}),k=r(),A=e(n(),1),j=i();function M(){let e=(0,k.c)(11),t=l(N),n;e[0]===t?n=e[1]:(n=c(t),e[0]=t,e[1]=n);let r=n.connectorsSettings,i=t===`zh`,o;e[2]===r.title?o=e[3]:(o=(0,j.jsx)(a,{to:`/capabilities/connectors`,className:`text-sm text-accent-fg`,children:r.title}),e[2]=r.title,e[3]=o);let s=i?`应用连接服务`:`App connection service`,u;e[4]===s?u=e[5]:(u=(0,j.jsx)(`h1`,{className:`text-xl font-semibold`,children:s}),e[4]=s,e[5]=u);let d,f;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,j.jsx)(`p`,{className:`text-sm text-fg-muted`,children:(0,j.jsx)(P,{})}),f=(0,j.jsx)(R,{}),e[6]=d,e[7]=f):(d=e[6],f=e[7]);let p;return e[8]!==o||e[9]!==u?(p=(0,j.jsxs)(`main`,{className:`mx-auto w-full max-w-2xl space-y-6 p-6`,children:[o,u,d,f]}),e[8]=o,e[9]=u,e[10]=p):p=e[10],p}function N(e){return e.language}function P(){let e=(0,k.c)(2),t=l(F)===`zh`?`此设置决定新账号通过哪个服务连接。已有账号继续使用其原来的连接服务。`:`Choose the service for new accounts. Existing accounts keep their original service.`,n;return e[0]===t?n=e[1]:(n=(0,j.jsx)(j.Fragment,{children:t}),e[0]=t,e[1]=n),n}function F(e){return e.language}function I(e){let t=(0,k.c)(27),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{open:r,onOpenChange:i,hideTrigger:a}=n,o=a===void 0?!1:a,v=l(L),b;t[2]===v?b=t[3]:(b=c(v),t[2]=v,t[3]=b);let x=b.connectorsSettings,S=v===`zh`,C;t[4]!==o||t[5]!==S?(C=o?null:(0,j.jsx)(d,{asChild:!0,children:(0,j.jsxs)(y,{type:`button`,variant:`secondary`,className:`shrink-0`,"aria-label":S?`应用连接服务`:`Connection service`,children:[(0,j.jsx)(E,{className:`size-4`,"aria-hidden":!0}),(0,j.jsx)(`span`,{className:`hidden sm:inline`,children:S?`应用连接服务`:`Connection service`})]})}),t[4]=o,t[5]=S,t[6]=C):C=t[6];let w;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,j.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[7]=w):w=t[7];let T=S?`应用连接服务`:`App connection service`,D;t[8]===T?D=t[9]:(D=(0,j.jsx)(g,{className:`text-base font-semibold text-fg`,children:T}),t[8]=T,t[9]=D);let O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,j.jsx)(f,{className:`mt-1 text-sm text-fg-muted`,children:(0,j.jsx)(P,{})}),t[10]=O):O=t[10];let A;t[11]===D?A=t[12]:(A=(0,j.jsxs)(`div`,{className:`min-w-0`,children:[D,O]}),t[11]=D,t[12]=A);let M;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,j.jsx)(s,{className:`size-5`,"aria-hidden":!0}),t[13]=M):M=t[13];let N;t[14]===x.modalClose?N=t[15]:(N=(0,j.jsx)(p,{asChild:!0,children:(0,j.jsx)(y,{variant:`ghost`,className:`shrink-0 p-1.5`,"aria-label":x.modalClose,children:M})}),t[14]=x.modalClose,t[15]=N);let F;t[16]!==N||t[17]!==A?(F=(0,j.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[A,N]}),t[16]=N,t[17]=A,t[18]=F):F=t[18];let I;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,j.jsx)(R,{})}),t[19]=I):I=t[19];let z;t[20]===F?z=t[21]:(z=(0,j.jsxs)(m,{children:[w,(0,j.jsxs)(h,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100dvh-2rem,42rem)] w-[min(100%-2rem,42rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-float`,children:[F,I]})]}),t[20]=F,t[21]=z);let B;return t[22]!==i||t[23]!==r||t[24]!==z||t[25]!==C?(B=(0,j.jsxs)(_,{open:r,onOpenChange:i,children:[C,z]}),t[22]=i,t[23]=r,t[24]=z,t[25]=C,t[26]=B):B=t[26],B}function L(e){return e.language}function R(){let e=l(e=>e.language),t=c(e).connectorsSettings,n=e===`zh`,{data:r,error:i,mutate:a}=v(`connector-service`,C),[s,u]=(0,A.useState)(``),[d,f]=(0,A.useState)(!1),[p,m]=(0,A.useState)(),[h,g]=(0,A.useState)();async function _(e){f(!0),m(void 0);try{await e(),u(``),await a()}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}}return(0,j.jsxs)(`div`,{className:`space-y-6`,children:[!r&&!i?(0,j.jsx)(b,{className:`h-40 w-full`}):null,r?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4`,children:[(0,j.jsx)(`h2`,{className:`font-medium`,children:`XOPC Cloud`}),(0,j.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.composioSetupHint}),(0,j.jsx)(D,{providerId:`xopc-cloud`,displayName:`XOPC Cloud`,connected:r.mode===`managed`&&r.configured,onConnected:()=>{a()}}),(0,j.jsx)(y,{variant:`secondary`,disabled:d||r.mode===`managed`&&r.configured,onClick:()=>void _(()=>T({mode:`managed`})),children:r.mode===`managed`?n?`当前服务`:`Current service`:n?`使用 XOPC Cloud`:`Use XOPC Cloud`})]}),(0,j.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,j.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:t.composioSetupByok}),(0,j.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,j.jsxs)(`ol`,{className:`list-inside list-decimal text-sm text-fg-muted`,children:[(0,j.jsx)(`li`,{children:t.composioSetupStepProject}),(0,j.jsx)(`li`,{children:t.composioSetupStepKey}),(0,j.jsx)(`li`,{children:t.composioSetupStepPaste})]}),(0,j.jsx)(`a`,{href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,className:`text-sm text-accent-fg`,children:t.composioSetupOpenDashboard}),(0,j.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,j.jsx)(`span`,{children:`Composio API key`}),(0,j.jsx)(o,{value:s,onChange:u,labels:t.secretInputLabels,placeholder:t.composioSetupKeyPlaceholder})]}),(0,j.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.composioSetupStorageHint}),(0,j.jsx)(y,{disabled:d||!s.trim(),onClick:()=>void _(()=>w(s)),children:n?`验证并使用新项目`:`Verify and use new project`}),(0,j.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n?`验证只检查连接服务和现有账号访问,不执行写入。工具权限在实际使用时检查。环境变量密钥需在运行环境中修改。`:`Verification checks service and existing account access without writes. Tool permissions are checked on use. Environment keys must be updated in the gateway environment.`}),(0,j.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.composioSessionWritePermissionHint}),r.backends?.filter(e=>e.mode===`byok`).map(e=>(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 text-sm`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{children:e.label}),(0,j.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.credentialSource===`environment`?n?`环境变量`:`Environment`:n?`本地保存`:`Stored locally`,e.verifiedAt&&` · ${new Date(e.verifiedAt).toLocaleString()}`]})]}),(0,j.jsx)(y,{variant:`ghost`,disabled:d||!s.trim()||e.credentialSource===`environment`,onClick:()=>void _(()=>w(s,e.id)),children:n?`用上方密钥更新`:`Update with key above`}),(0,j.jsx)(y,{variant:`ghost`,disabled:d||e.id===r.backendId,onClick:()=>void _(()=>T({backendId:e.id})),children:e.id===r.backendId?n?`当前服务`:`Current service`:n?`使用`:`Use`}),(0,j.jsx)(y,{variant:`ghost`,disabled:d||e.id===r.backendId,onClick:()=>g(e.id),children:n?`移除`:`Remove`})]},e.id))]})]})]}):null,p||i?(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:p??String(i)}):null,(0,j.jsx)(S,{open:!!h,title:n?`移除连接服务`:`Remove connection service`,description:n?`移除此服务及其本地保存的密钥,不修改环境变量。需要先切换服务并断开该项目的账号,已有数据不会删除。`:`Remove this service and its saved key, without changing environment variables. Switch services and disconnect this project’s accounts first. Existing data is retained.`,confirmLabel:n?`移除`:`Remove`,cancelLabel:t.modalCancel,destructive:!0,onCancel:()=>g(void 0),onConfirm:()=>{let e=h;g(void 0),e&&_(()=>x(e))}})]})}export{O as n,I 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{f as i,g as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./chevron-right-BweFrslA.js";import{n as s,r as c,t as l}from"./popover-select-DGKUpVsz.js";import{t as u}from"./circle-alert-BEjgurr2.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./ellipsis-0k4rZLoy.js";import{t as p}from"./external-link-DjqjBmc3.js";import{n as m}from"./secret-input-BxWHx6J6.js";import{t as h}from"./eye-CABVeTq0.js";import{t as g}from"./loader-circle-CifKLtgG.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./messages-B7VtMXec.js";import{t as b}from"./cn-0WouolD0.js";import{a as x,c as S,n as C,r as w}from"./locale-store-BKyOF23r.js";import{a as T,i as E,n as D,o as O,r as k,s as A,t as ee}from"./dist-BGTk37IG.js";import{r as j}from"./extension-provider-CdlACvkE.js";import{n as M}from"./copy-to-clipboard-HOJ79TWv.js";import{t as N}from"./button-aIC072nz.js";import{t as P}from"./skeleton-BI5TyibZ.js";import{n as F}from"./interaction-BdhHBbYa.js";import{n as I,r as L}from"./gateway-config-swr-BM__9Fws.js";import{s as R}from"./form-field-width-DJw_jULe.js";import{n as z}from"./electron-env-Dit0bHgy.js";import{$ as B,Ai as V,Ba as H,Ca as U,Co as W,Es as G,Fa as te,Ha as K,Ia as q,Ja as ne,Ka as J,La as re,Lc as ie,Oc as ae,Po as Y,Q as oe,Qa as se,Qn as X,Ra as ce,Ua as le,Va as ue,Vo as de,Wa as fe,Xa as pe,Xn as me,Ya as he,Yn as ge,Z,Za as _e,Zn as ve,ao as ye,co as be,do as xe,eo as Se,et as Ce,fo as we,io as Te,ir as Ee,lo as De,nr as Oe,ns as ke,nt as Ae,oo as je,or as Me,os as Ne,po as Pe,qa as Fe,qc as Ie,ro as Le,rr as Re,rs as ze,rt as Be,so as Ve,ss as He,tc as Ue,to as We,tr as Ge,tt as Ke,ua as qe,uo as Je,za as Ye,zc as Xe}from"./index-Bo70AuAq.js";import{n as Ze,t as Qe}from"./capability-header-actions-D0HwmxyW.js";import{t as $e}from"./connector-service-page-Y5SYaiJO.js";import{n as et}from"./agent-plugin-dialog-BxDqL7uc.js";import{t as tt}from"./number-input-DDeqHK-G.js";var Q=e(t(),1),nt=n(),$=r();function rt(e){let t=(0,nt.c)(57),{connector:n,installed:r,onInstall:i,onOpenDetails:a,t:o}=e,s,c,l,u,f,p;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o){let e=n.capabilities.filter(it),m=e.slice(0,2),h=Math.max(0,e.length-m.length),g=o.connect,_;t[11]!==n||t[12]!==o?(_=Ce(n,o),t[11]=n,t[12]=o,t[13]=_):_=t[13];let v=_,y=n.verificationLevel===`verified`?o.connectorVerified:n.verificationLevel===`beta`?o.connectorBeta:n.verificationLevel===`experimental`?o.connectorExperimental:null,x;t[14]!==g||t[15]!==n||t[16]!==i?(x=e=>(0,$.jsxs)(N,{type:`button`,variant:`primary`,className:b(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:()=>i(n),children:[(0,$.jsx)(G,{className:`size-4`}),g]}),t[14]=g,t[15]=n,t[16]=i,t[17]=x):x=t[17],s=x,p=`group flex min-h-[8.75rem] flex-col rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`,c=`flex min-w-0 flex-1 flex-col`;let S;t[18]===n?S=t[19]:(S=(0,$.jsx)(Be,{connector:n}),t[18]=n,t[19]=S);let C;t[20]!==n||t[21]!==a?(C=a?(0,$.jsx)(`button`,{type:`button`,className:`block max-w-full truncate text-left text-sm font-semibold text-fg hover:underline`,onClick:()=>a(n),children:n.displayName}):(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.displayName}),t[20]=n,t[21]=a,t[22]=C):C=t[22];let w;t[23]===y?w=t[24]:(w=y?(0,$.jsx)(`span`,{className:`mt-1 inline-flex rounded-full border border-edge px-1.5 py-0.5 text-[10px] font-medium text-fg-subtle`,children:y}):null,t[23]=y,t[24]=w);let T;t[25]!==w||t[26]!==C?(T=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[C,w]}),t[25]=w,t[26]=C,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==S?(E=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[S,T]}),t[28]=T,t[29]=S,t[30]=E):E=t[30];let D;t[31]!==r||t[32]!==s?(D=r?null:(0,$.jsx)(`div`,{className:`hidden shrink-0 items-center gap-1 sm:flex`,children:s()}),t[31]=r,t[32]=s,t[33]=D):D=t[33];let O;t[34]!==r||t[35]!==o.connectedBadge?(O=r?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,$.jsx)(d,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}):null,t[34]=r,t[35]=o.connectedBadge,t[36]=O):O=t[36];let k;t[37]!==D||t[38]!==O?(k=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[D,O]}),t[37]=D,t[38]=O,t[39]=k):k=t[39],t[40]!==E||t[41]!==k?(l=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[E,k]}),t[40]=E,t[41]=k,t[42]=l):l=t[42],t[43]===v?u=t[44]:(u=(0,$.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-6 text-fg-muted`,title:v,children:v}),t[43]=v,t[44]=u),f=m.length>0?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[m.map(e=>(0,$.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:o.connectorCapabilityLabels[e]??e},e)),h>0?(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-subtle`,children:[`+`,h]}):null]}):null,t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=f,t[10]=p}else s=t[5],c=t[6],l=t[7],u=t[8],f=t[9],p=t[10];let m;t[45]!==c||t[46]!==l||t[47]!==u||t[48]!==f?(m=(0,$.jsxs)(`div`,{className:c,children:[l,u,f]}),t[45]=c,t[46]=l,t[47]=u,t[48]=f,t[49]=m):m=t[49];let h;t[50]!==r||t[51]!==s?(h=r?null:(0,$.jsx)(`div`,{className:`mt-4 flex flex-col gap-2 border-t border-edge pt-3 sm:hidden`,children:s(`w-full`)}),t[50]=r,t[51]=s,t[52]=h):h=t[52];let g;return t[53]!==p||t[54]!==m||t[55]!==h?(g=(0,$.jsxs)(`div`,{className:p,children:[m,h]}),t[53]=p,t[54]=m,t[55]=h,t[56]=g):g=t[56],g}function it(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}var at=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function ot(e,t){return t.some(t=>t.connectorId===e.id)}var st=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ct(){let e=(0,nt.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:b(`size-10 shrink-0 rounded-xl`,st)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`div`,{className:`flex h-full min-h-[9.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:b(`h-4 min-w-0 flex-1`,st)}),(0,$.jsx)(`div`,{className:b(`h-8 w-[4.5rem] shrink-0 rounded-lg`,st)})]}),(0,$.jsx)(`div`,{className:b(`h-3 w-full`,st)}),(0,$.jsx)(`div`,{className:b(`h-3 w-[88%]`,st)})]})]})}),e[1]=n):n=e[1],n}var lt=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ut(){let e=(0,nt.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:b(`size-10 shrink-0 rounded-xl`,lt)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,$.jsx)(`div`,{className:b(`h-4 w-48 max-w-full`,lt)}),(0,$.jsx)(`div`,{className:b(`h-3 w-72 max-w-full`,lt)})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-start justify-between gap-3`,children:[n,(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,$.jsx)(`div`,{className:b(`h-9 w-20 rounded-lg`,lt)}),(0,$.jsx)(`div`,{className:b(`h-9 w-20 rounded-lg`,lt)})]})]})]}),e[2]=r):r=e[2];let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:[r,(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,$.jsx)(`div`,{className:b(`h-8 w-20 rounded-md`,lt)}),(0,$.jsx)(`div`,{className:b(`h-8 w-24 rounded-md`,lt)}),(0,$.jsx)(`div`,{className:b(`h-8 w-28 rounded-md`,lt)})]}),(0,$.jsx)(`div`,{className:b(`mt-3 h-20 rounded-xl`,lt)})]}),e[3]=i):i=e[3],i}var dt=[`understand`,`act`,`reach`];function ft(e){if(e.benefits?.length)return[...new Set(e.benefits)];let t=new Set(e.capabilities),n=[e.id,e.displayName,...e.tags??[]].join(` `).toLowerCase(),r=[];return(t.has(`context`)||t.has(`memory_source`)||t.has(`resources`)||e.category===`docs`||e.category===`data`||/notion|drive|document|confluence|airtable|database|knowledge|wiki/.test(n))&&r.push(`understand`),t.has(`tools`)&&r.push(`act`),(t.has(`channel`)||/slack|telegram|discord|teams|mail|message|wechat|weixin/.test(n))&&r.push(`reach`),r.length?[...new Set(r)]:[`act`]}function pt(e){return ft(e)[0]??`act`}function mt(e,t){let n=t?pt(t):`act`,r=e.connectionStatus===`connected`||e.status===`connected`||e.usage.lastHealthStatus===`ok`,i=e.status===`not_configured`||e.status===`failed`||e.status===`degraded`||e.status===`unauthorized`||e.connectionStatus===`unauthorized`||e.connectionStatus===`error`,a=n===`understand`?e.usage.lastResourceCount:n===`act`?e.usage.lastToolCount:void 0;return{benefit:n,state:r?`ready`:i?`needs_setup`:`checking`,availableCount:a}}function ht(e,t){return t.connectorCapabilityLabels[e]??e}function gt(e,t){if(e.runtime.type===`mcp`)return Ke(t.connectorRuntimeMcp,{serverId:e.runtime.serverId});let n=e.runtime.type===`composio`?e.runtime.toolkit:e.runtime.type===`cli`?e.runtime.adapterId:e.runtime.sourceKind;return Ke(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function _t(e,t){return e.auth.mode===`cli`?t.connectorAuthCli:e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function vt(e){let t=(0,nt.c)(133),{connector:n,installed:r,onClose:i,onInstall:a,t:o}=e,s;t[0]!==n||t[1]!==o?(s=Ce(n,o),t[0]=n,t[1]=o,t[2]=s):s=t[2];let c=s,l,u,f,p,m,h,g,_,y,x,S,C,w,j,M,P;if(t[3]!==n||t[4]!==c||t[5]!==r||t[6]!==i||t[7]!==o){let e=ft(n),a;t[24]!==n.setup.config||t[25]!==n.setup.secrets?(a=[...(n.setup.secrets??[]).filter(xt),...(n.setup.config??[]).filter(bt)],t[24]=n.setup.config,t[25]=n.setup.secrets,t[26]=a):a=t[26];let s=a,N=n.capabilities.filter(yt);f=ee,g=!0,t[27]===i?_=t[28]:(_=e=>{e||i()},t[27]=i,t[28]=_),u=O,t[29]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[29]=h):h=t[29],l=k,t[30]===Symbol.for(`react.memo_cache_sentinel`)?(p=b(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,42rem)] w-[min(100%-2rem,min(92vw,44rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-overlay shadow-float outline-none dark:border-edge`),t[30]=p):p=t[30];let I;t[31]===n?I=t[32]:(I=(0,$.jsx)(Be,{connector:n,size:`lg`}),t[31]=n,t[32]=I);let L;t[33]===n.displayName?L=t[34]:(L=(0,$.jsx)(A,{className:`text-base font-semibold text-fg`,children:n.displayName}),t[33]=n.displayName,t[34]=L);let R;t[35]!==r||t[36]!==o.connectedBadge?(R=r?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,$.jsx)(d,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}):null,t[35]=r,t[36]=o.connectedBadge,t[37]=R):R=t[37];let z;t[38]!==L||t[39]!==R?(z=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[L,R]}),t[38]=L,t[39]=R,t[40]=z):z=t[40];let B;t[41]===c?B=t[42]:(B=(0,$.jsx)(E,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:c}),t[41]=c,t[42]=B);let V;t[43]!==z||t[44]!==B?(V=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[z,B]}),t[43]=z,t[44]=B,t[45]=V):V=t[45];let H;t[46]!==I||t[47]!==V?(H=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[I,V]}),t[46]=I,t[47]=V,t[48]=H):H=t[48];let U;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(U=b(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,F.focusRingPanel),t[49]=U):U=t[49];let W;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(v,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[50]=W):W=t[50];let G;t[51]===o.modalClose?G=t[52]:(G=(0,$.jsx)(D,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:U,"aria-label":o.modalClose,children:W})}),t[51]=o.modalClose,t[52]=G),t[53]!==H||t[54]!==G?(m=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-5 sm:px-6`,children:[H,G]}),t[53]=H,t[54]=G,t[55]=m):m=t[55],j=`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-5 sm:px-6`,M=e.length?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:o.connectorWhyConnect}),(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.connectorBenefitHeadings[e]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.connectorBenefitHints[e]})]},e))})]}):null;let te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(Ue,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[56]=te):te=t[56];let K;t[57]===o.detailPermissions?K=t[58]:(K=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.detailPermissions}),t[57]=o.detailPermissions,t[58]=K);let q;t[59]!==n||t[60]!==o?(q=_t(n,o),t[59]=n,t[60]=o,t[61]=q):q=t[61];let ne;t[62]===q?ne=t[63]:(ne=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:q}),t[62]=q,t[63]=ne);let J;t[64]!==K||t[65]!==ne?(J=(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3`,children:[te,(0,$.jsxs)(`div`,{children:[K,ne]})]}),t[64]=K,t[65]=ne,t[66]=J):J=t[66];let re;t[67]===o.connectorSetupTitle?re=t[68]:(re=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.connectorSetupTitle}),t[67]=o.connectorSetupTitle,t[68]=re);let ie;t[69]!==s.length||t[70]!==o.connectorRequiredInputsCount||t[71]!==o.connectorSetupNone?(ie=s.length?Ke(o.connectorRequiredInputsCount,{count:String(s.length)}):o.connectorSetupNone,t[69]=s.length,t[70]=o.connectorRequiredInputsCount,t[71]=o.connectorSetupNone,t[72]=ie):ie=t[72];let ae;t[73]===ie?ae=t[74]:(ae=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:ie}),t[73]=ie,t[74]=ae);let Y;t[75]!==re||t[76]!==ae?(Y=(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[re,ae]}),t[75]=re,t[76]=ae,t[77]=Y):Y=t[77],t[78]!==J||t[79]!==Y?(P=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[J,Y]}),t[78]=J,t[79]=Y,t[80]=P):P=t[80],C=`rounded-xl border border-edge bg-surface-base`,t[81]===o.connectorTechnicalDetails?w=t[82]:(w=(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-fg`,children:o.connectorTechnicalDetails}),t[81]=o.connectorTechnicalDetails,t[82]=w),y=`space-y-5 border-t border-edge-subtle px-4 py-4`;let oe;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(ze,{className:`size-3.5`,"aria-hidden":!0}),t[83]=oe):oe=t[83];let se;t[84]===o.connectorRuntimeTitle?se=t[85]:(se=(0,$.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[oe,o.connectorRuntimeTitle]}),t[84]=o.connectorRuntimeTitle,t[85]=se);let X;t[86]!==n||t[87]!==o?(X=gt(n,o),t[86]=n,t[87]=o,t[88]=X):X=t[88];let ce;t[89]===X?ce=t[90]:(ce=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-subtle`,children:X}),t[89]=X,t[90]=ce),t[91]!==se||t[92]!==ce?(x=(0,$.jsxs)(`div`,{children:[se,ce]}),t[91]=se,t[92]=ce,t[93]=x):x=t[93],S=N.length?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:N.map(e=>(0,$.jsx)(`span`,{className:`rounded-md bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:ht(e,o)},e))}):null,t[3]=n,t[4]=c,t[5]=r,t[6]=i,t[7]=o,t[8]=l,t[9]=u,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=y,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=j,t[22]=M,t[23]=P}else l=t[8],u=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],y=t[16],x=t[17],S=t[18],C=t[19],w=t[20],j=t[21],M=t[22],P=t[23];let I;t[94]!==y||t[95]!==x||t[96]!==S?(I=(0,$.jsxs)(`div`,{className:y,children:[x,S]}),t[94]=y,t[95]=x,t[96]=S,t[97]=I):I=t[97];let L;t[98]!==I||t[99]!==C||t[100]!==w?(L=(0,$.jsxs)(`details`,{className:C,children:[w,I]}),t[98]=I,t[99]=C,t[100]=w,t[101]=L):L=t[101];let R;t[102]!==L||t[103]!==j||t[104]!==M||t[105]!==P?(R=(0,$.jsxs)(`div`,{className:j,children:[M,P,L]}),t[102]=L,t[103]=j,t[104]=M,t[105]=P,t[106]=R):R=t[106];let z;t[107]===o.modalClose?z=t[108]:(z=(0,$.jsx)(D,{asChild:!0,children:(0,$.jsx)(N,{variant:`secondary`,children:o.modalClose})}),t[107]=o.modalClose,t[108]=z);let B;t[109]!==n||t[110]!==r||t[111]!==i||t[112]!==a||t[113]!==o.connect?(B=r?null:(0,$.jsxs)(N,{variant:`primary`,onClick:()=>{a(n),i()},children:[(0,$.jsx)(G,{className:`size-4`}),o.connect]}),t[109]=n,t[110]=r,t[111]=i,t[112]=a,t[113]=o.connect,t[114]=B):B=t[114];let V;t[115]!==z||t[116]!==B?(V=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[z,B]}),t[115]=z,t[116]=B,t[117]=V):V=t[117];let H;t[118]!==l||t[119]!==p||t[120]!==m||t[121]!==R||t[122]!==V?(H=(0,$.jsxs)(l,{className:p,children:[m,R,V]}),t[118]=l,t[119]=p,t[120]=m,t[121]=R,t[122]=V,t[123]=H):H=t[123];let U;t[124]!==u||t[125]!==h||t[126]!==H?(U=(0,$.jsxs)(u,{children:[h,H]}),t[124]=u,t[125]=h,t[126]=H,t[127]=U):U=t[127];let W;return t[128]!==f||t[129]!==g||t[130]!==_||t[131]!==U?(W=(0,$.jsx)(f,{open:g,onOpenChange:_,children:U}),t[128]=f,t[129]=g,t[130]=_,t[131]=U,t[132]=W):W=t[132],W}function yt(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}function bt(e){return e.required}function xt(e){return e.required}var St=(0,Q.memo)(function(e){let t=(0,nt.c)(45),{onRefresh:n,refreshing:r,refreshLabel:i,onBrowseCatalog:a,onAddCustomServer:o,addLabel:s,browseLabel:c,customLabel:l,serviceLabel:u,moreActionsLabel:d}=e,[p,m]=(0,Q.useState)(!1),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=b(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[highlighted]:bg-surface-hover`,F.transition),t[0]=h):h=t[0];let v=h,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(_,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[1]=y):y=t[1];let x;t[2]===s?x=t[3]:(x=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:s}),t[2]=s,t[3]=x);let S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(Ie,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[4]=S):S=t[4];let C;t[5]!==s||t[6]!==x?(C=(0,$.jsx)(Me,{asChild:!0,children:(0,$.jsxs)(N,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":s,children:[y,x,S]})}),t[5]=s,t[6]=x,t[7]=C):C=t[7];let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(de,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[8]=w):w=t[8];let T;t[9]!==c||t[10]!==a?(T=(0,$.jsxs)(Oe,{className:v,onSelect:a,children:[w,c]}),t[9]=c,t[10]=a,t[11]=T):T=t[11];let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(W,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[12]=E):E=t[12];let D;t[13]!==l||t[14]!==o?(D=(0,$.jsxs)(Oe,{className:v,onSelect:o,children:[E,l]}),t[13]=l,t[14]=o,t[15]=D):D=t[15];let O;t[16]!==T||t[17]!==D?(O=(0,$.jsx)(Re,{children:(0,$.jsxs)(Ge,{className:`z-50 min-w-[14rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[T,D]})}),t[16]=T,t[17]=D,t[18]=O):O=t[18];let k;t[19]!==O||t[20]!==C?(k=(0,$.jsxs)(Ee,{children:[C,O]}),t[19]=O,t[20]=C,t[21]=k):k=t[21];let A;t[22]===p?A=t[23]:(A=(0,$.jsx)($e,{open:p,onOpenChange:m,hideTrigger:!0}),t[22]=p,t[23]=A);let ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(f,{className:`size-4`,"aria-hidden":!0}),t[24]=ee):ee=t[24];let j;t[25]===d?j=t[26]:(j=(0,$.jsx)(Me,{asChild:!0,children:(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":d,title:d,children:ee})}),t[25]=d,t[26]=j);let M;t[27]!==n||t[28]!==i||t[29]!==r?(M=n?(0,$.jsxs)(Oe,{className:v,disabled:r,onSelect:n,children:[r?(0,$.jsx)(g,{className:`size-4 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,$.jsx)(He,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,t[27]=n,t[28]=i,t[29]=r,t[30]=M):M=t[30];let P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>m(!0),I=(0,$.jsx)(ke,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t[31]=P,t[32]=I):(P=t[31],I=t[32]);let L;t[33]===u?L=t[34]:(L=(0,$.jsxs)(Oe,{className:v,onSelect:P,children:[I,u]}),t[33]=u,t[34]=L);let R;t[35]!==M||t[36]!==L?(R=(0,$.jsx)(Re,{children:(0,$.jsxs)(Ge,{className:`z-50 min-w-[14rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[M,L]})}),t[35]=M,t[36]=L,t[37]=R):R=t[37];let z;t[38]!==j||t[39]!==R?(z=(0,$.jsxs)(Ee,{children:[j,R]}),t[38]=j,t[39]=R,t[40]=z):z=t[40];let B;return t[41]!==k||t[42]!==A||t[43]!==z?(B=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2`,children:[k,A,z]}),t[41]=k,t[42]=A,t[43]=z,t[44]=B):B=t[44],B});function Ct(e=``,t=``){return{clientKey:crypto.randomUUID(),key:e,value:t}}var wt=/^([^:=]+)[:=](.*)$/;function Tt(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Dt(e)}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=wt.exec(t);r&&n.push(Ct(r[1].trim(),r[2].trim()))}return n.length>0?n:null}function Et(e){let t=Object.create(null);for(let n of e){let e=n.key.trim();e&&(t[e]=n.reference??n.value)}return Object.keys(t).length>0?t:void 0}function Dt(e){if(!e||typeof e!=`object`)return[Ct()];let t=Object.entries(e).map(([e,t])=>typeof t==`object`&&t&&!Array.isArray(t)?{...Ct(e),reference:t}:Ct(e,t==null?``:String(t)));return t.length>0?t:[Ct()]}function Ot(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.xopcConnector;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.managed===!0)}function kt(e){let t=e.trim();if(!t)return;if(t.startsWith(`[`)){let e=JSON.parse(t);if(!Array.isArray(e)||e.some(e=>typeof e!=`string`))throw Error(`Command arguments must be a JSON array of strings.`);return e}let n=[],r=``,i=``,a=!1;for(let e=0;e<t.length;e++){let o=t[e];o===`\\`&&t[e+1]&&i!==`'`&&/[\s"'\\]/.test(t[e+1])?(r+=t[++e],a=!0):i?o===i?i=``:r+=o:o===`"`||o===`'`?(i=o,a=!0):/\s/.test(o)?a&&=(n.push(r),r=``,!1):(r+=o,a=!0)}if(i)throw Error(`Command arguments contain an unclosed quote.`);return a&&n.push(r),n}function At(e){let t=e.trim();if(!t)return;let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Expected a JSON object`);return n}function jt(e){let t={...e.extra,exposure:e.exposure};if(e.displayName?.trim()?t.displayName=e.displayName.trim():delete t.displayName,delete t.command,delete t.args,delete t.env,delete t.cwd,delete t.url,delete t.headers,delete t.type,e.transport===`stdio`){t.type=`stdio`,t.command=e.command.trim();let n=kt(e.argsText);if(n&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envEntries){let n=new Set;for(let t of e.envEntries)if(!(!t.key.trim()&&!t.value&&!t.reference)){if(!t.key.trim()||n.has(t.key.trim()))throw Error(`Environment variable names must be non-empty and unique.`);n.add(t.key.trim())}let r=Et(e.envEntries);r&&(t.env=r)}else e.envJson.trim()&&(t.env=At(e.envJson));delete t.oauth,delete t.auth}else{t.type=`http`,t.url=e.url.trim();let n=Et(e.headers);n&&(t.headers=n);let r={...t.oauth??{}};e.oauthClientId.trim()?r.clientId=e.oauthClientId.trim():delete r.clientId,Object.keys(r).length?t.oauth=r:delete t.oauth}return e.timeout===void 0?delete t.timeout:t.timeout=e.timeout,t}function Mt(e,t){let n=t.oauth;return{clientKey:e,id:e,displayName:typeof t.displayName==`string`?t.displayName:``,transport:typeof t.url==`string`?`streamable-http`:`stdio`,command:typeof t.command==`string`?t.command:``,argsText:Array.isArray(t.args)?JSON.stringify(t.args):``,envJson:t.env?JSON.stringify(t.env,null,2):``,cwd:typeof t.cwd==`string`?t.cwd:``,url:typeof t.url==`string`?t.url:``,headers:Dt(t.headers),oauthClientId:typeof n?.clientId==`string`?n.clientId:``,timeout:typeof t.timeout==`number`?t.timeout:void 0,exposure:t.exposure??`codemode`,extra:t}}function Nt(e,t){let n=`mcp`;try{n=e.transport===`streamable-http`?new URL(e.url).hostname:e.command.split(/[\\/]/).pop()||n}catch{}let r=n.replace(/[^a-zA-Z0-9_-]+/g,`_`).replace(/^_+|_+$/g,``)||`mcp`,i=new Set([...t].map(e=>e.replace(/-/g,`_`))),a=r;for(let e=2;i.has(a.replace(/-/g,`_`));e++)a=`${r}_${e}`;return a}function Pt(e){let t=e.trim(),n=new URL(/^[a-z][a-z\d+.-]*:/i.test(t)&&!/^[^/]+:\d+(?:[/?#]|$)/.test(t)?t:`${/^(localhost|127\.0\.0\.1)(:|\/|$)/i.test(t)?`http`:`https`}://${t}`);if(![`http:`,`https:`].includes(n.protocol)||n.username||n.password)throw Error(`Use an HTTP or HTTPS MCP address without embedded credentials.`);return n.href}function Ft(e){let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Expected a JSON object.`);let n=t.mcpServers??t.mcp?.servers??t.servers;if(n!==void 0&&(!n||typeof n!=`object`||Array.isArray(n)))throw Error(`Expected a server configuration object.`);let r=n?Object.entries(n):[[``,t]];if(!r.length)throw Error(`No MCP servers found.`);return r.map(([e,t])=>{if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Invalid MCP server configuration.`);let n=t;if(typeof n.url!=`string`&&typeof n.command!=`string`)throw Error(`The configuration needs an MCP URL or command.`);if(n.args!==void 0&&(!Array.isArray(n.args)||n.args.some(e=>typeof e!=`string`)))throw Error(`Command arguments must be strings.`);let r=Mt(e,n);return r.clientKey=crypto.randomUUID(),r.url&&=Pt(r.url),r})}function It(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`streamable-http`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[],oauthClientId:``,timeout:void 0,exposure:`codemode`,extra:{}}}function Lt(e){let t=e?.mcp?.servers??{};return{servers:Object.entries(t).filter(([,e])=>!Ot(e)).map(([e,t])=>Mt(e,t)).sort((e,t)=>e.id.localeCompare(t.id))}}function Rt(e){return jt(e)}async function zt(e,t){return(await x(w(`/api/mcp/servers/${encodeURIComponent(e)}/tools`),{method:`POST`,signal:AbortSignal.any([t,AbortSignal.timeout(95e3)])})).payload.tools}async function Bt(e,t,n,r){return(await x(w(`/api/mcp/drafts`),{method:`POST`,signal:r,body:JSON.stringify({serverId:e.id,sourceServerId:t,expectedServer:n,server:jt(e)})})).payload}async function Vt(e,t){return(await x(w(`/api/mcp/drafts/${encodeURIComponent(e)}/probe`),{method:`POST`,signal:AbortSignal.any([t,AbortSignal.timeout(95e3)])})).payload}async function Ht(e){await x(w(`/api/mcp/drafts/${encodeURIComponent(e)}`),{method:`DELETE`})}async function Ut(e,t=!1){let n=await x(w(`/api/mcp/drafts/${encodeURIComponent(e)}/commit`),{method:`POST`,body:JSON.stringify({enable:t})});return I(),n.payload}async function Wt(e){return(await x(w(`/api/mcp/drafts/${encodeURIComponent(e)}/auth`),{method:`POST`})).payload}async function Gt(e,t){return(await x(w(`/api/mcp/drafts/${encodeURIComponent(e)}/auth`),{signal:t})).payload}async function Kt(e){await x(w(`/api/mcp/drafts/${encodeURIComponent(e)}/auth`),{method:`DELETE`})}async function qt(e,t){await x(w(`/api/mcp/drafts/${encodeURIComponent(e)}/auth/redirect`),{method:`POST`,body:JSON.stringify({url:t})})}async function Jt(e,t){return(await x(w(`/api/mcp/drafts/${encodeURIComponent(e)}/tools`),{signal:t})).payload.tools}async function Yt(e){let t=await x(w(`/api/mcp/servers`),{signal:e});return Object.fromEntries(t.payload.servers.filter(e=>e.lastCheck&&Number.isFinite(Date.parse(e.lastCheck.checkedAt))).map(e=>[e.id,e.lastCheck]))}async function Xt(e){let t=await x(w(`/api/mcp/servers/${encodeURIComponent(e.id)}`),{method:`DELETE`,body:JSON.stringify({expectedServer:e.extra})});return I(),t.payload}function Zt(e){let t=(0,nt.c)(111),{serverId:n,displayName:r,returnFocusTo:i,draftId:a,t:o,onClose:s,onConfigure:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(!0),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(0),b=(0,Q.useRef)(!1),x;t[1]!==a||t[2]!==n||t[3]!==o.setupAccessDenied||t[4]!==o.setupConflict||t[5]!==o.setupGatewayUnauthorized||t[6]!==o.setupRateLimited||t[7]!==o.toolsLoadFailed?(x=()=>{let e=new AbortController,t=!0;return p(!0),h(``),d([]),(a?Jt(a,e.signal):zt(n,e.signal)).then(e=>{t&&d(e)}).catch(e=>{let n=e?.status;t&&h(n===401?o.setupGatewayUnauthorized:n===403?o.setupAccessDenied:n===429?o.setupRateLimited:n===404||n===409?o.setupConflict:o.toolsLoadFailed)}).finally(()=>{t&&p(!1)}),()=>{t=!1,e.abort()}},t[1]=a,t[2]=n,t[3]=o.setupAccessDenied,t[4]=o.setupConflict,t[5]=o.setupGatewayUnauthorized,t[6]=o.setupRateLimited,t[7]=o.toolsLoadFailed,t[8]=x):x=t[8];let S;t[9]!==a||t[10]!==v||t[11]!==n||t[12]!==o?(S=[n,a,v,o],t[9]=a,t[10]=v,t[11]=n,t[12]=o,t[13]=S):S=t[13],(0,Q.useEffect)(x,S);let C,w,j,M,P,F,I,L,R,z,B,V,H;if(t[14]!==r||t[15]!==m||t[16]!==f||t[17]!==s||t[18]!==c||t[19]!==g||t[20]!==i||t[21]!==n||t[22]!==o.exposureLabels||t[23]!==o.setupConfigure||t[24]!==o.toolDetails||t[25]!==o.toolsClearSearch||t[26]!==o.toolsDialogSearchEmpty||t[27]!==o.toolsDialogSearchPlaceholder||t[28]!==o.toolsDialogSubtitle||t[29]!==o.toolsDialogTitle||t[30]!==o.toolsEmpty||t[31]!==o.toolsLoading||t[32]!==o.toolsRetryHint||t[33]!==o.toolsSearchSummary||t[34]!==o.toolsTitle||t[35]!==u){let e=g.trim().toLowerCase(),a;if(t[49]!==n){let e;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(e=/-/g,t[51]=e):e=t[51],a=n.replace(e,`_`),t[49]=n,t[50]=a}else a=t[50];let l=`mcp__${a}__`,d=u.filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e));j=ee,F=!0,t[52]===s?I=t[53]:(I=e=>{e||s()},t[52]=s,t[53]=I),w=O,t[54]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(T,{className:`fixed inset-0 z-[60] bg-scrim`}),t[54]=P):P=t[54],C=k,t[55]===i?V=t[56]:(V=e=>{(b.current||i)&&e.preventDefault(),!b.current&&i?.isConnected&&i.focus()},t[55]=i,t[56]=V),H=`fixed left-1/2 top-1/2 z-[60] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay`;let p;t[57]===o.toolsDialogTitle?p=t[58]:(p=(0,$.jsx)(A,{className:`font-semibold`,children:o.toolsDialogTitle}),t[57]=o.toolsDialogTitle,t[58]=p);let h;t[59]!==r||t[60]!==m||t[61]!==f||t[62]!==n||t[63]!==o.toolsDialogSubtitle||t[64]!==u.length?(h=f||m?r||n:o.toolsDialogSubtitle.replace(`{{serverId}}`,r||n).replace(`{{count}}`,String(u.length)),t[59]=r,t[60]=m,t[61]=f,t[62]=n,t[63]=o.toolsDialogSubtitle,t[64]=u.length,t[65]=h):h=t[65];let v;t[66]===h?v=t[67]:(v=(0,$.jsx)(E,{className:`mt-1 break-words text-sm text-fg-muted`,children:h}),t[66]=h,t[67]=v);let y;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>_(e.target.value),t[68]=y):y=t[68];let x;t[69]!==g||t[70]!==o.toolsDialogSearchPlaceholder?(x=(0,$.jsx)(`input`,{className:`mt-4 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,value:g,onChange:y,placeholder:o.toolsDialogSearchPlaceholder,"aria-label":o.toolsDialogSearchPlaceholder}),t[69]=g,t[70]=o.toolsDialogSearchPlaceholder,t[71]=x):x=t[71];let S=e&&!f&&!m?(0,$.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-fg-muted`,children:o.toolsSearchSummary.replace(`{{visible}}`,String(d.length)).replace(`{{count}}`,String(u.length))}):null;t[72]!==p||t[73]!==v||t[74]!==x||t[75]!==S?(M=(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge p-5`,children:[p,v,x,S]}),t[72]=p,t[73]=v,t[74]=x,t[75]=S,t[76]=M):M=t[76],L=`min-h-0 flex-1 overflow-y-auto p-5`,R=f,t[77]!==o.toolsTitle||t[78]!==u.length?(z=o.toolsTitle.replace(`{{count}}`,String(u.length)),t[77]=o.toolsTitle,t[78]=u.length,t[79]=z):z=t[79],B=f?(0,$.jsx)(`div`,{role:`status`,"aria-label":o.toolsLoading,className:`space-y-3`,children:[0,1,2].map($t)}):m?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm text-danger`,children:m}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.toolsRetryHint}),c?(0,$.jsx)(N,{variant:`secondary`,onClick:()=>{b.current=!0,c()},children:o.setupConfigure}):null]}):d.length?(0,$.jsx)(`div`,{className:`space-y-3`,children:d.map(e=>(0,$.jsxs)(`article`,{className:`rounded-lg border border-edge p-4`,children:[(0,$.jsx)(`h3`,{className:`break-all font-mono text-sm font-semibold text-fg`,children:e.name.startsWith(l)?e.name.slice(l.length):e.name}),e.exposure&&Object.hasOwn(o.exposureLabels,e.exposure)?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:o.exposureLabels[e.exposure]}):null,e.description?(0,$.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-fg-muted`,children:e.description}):null,(0,$.jsxs)(`details`,{className:`mt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm text-accent-fg`,children:o.toolDetails}),(0,$.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-fg-muted`,children:e.name}),(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded-md bg-surface-panel p-3 text-xs text-fg`,children:JSON.stringify(e.inputSchema,null,2)})]})]},e.name))}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.length?o.toolsDialogSearchEmpty:o.toolsEmpty}),e?(0,$.jsx)(N,{variant:`secondary`,onClick:()=>_(``),children:o.toolsClearSearch}):null]}),t[14]=r,t[15]=m,t[16]=f,t[17]=s,t[18]=c,t[19]=g,t[20]=i,t[21]=n,t[22]=o.exposureLabels,t[23]=o.setupConfigure,t[24]=o.toolDetails,t[25]=o.toolsClearSearch,t[26]=o.toolsDialogSearchEmpty,t[27]=o.toolsDialogSearchPlaceholder,t[28]=o.toolsDialogSubtitle,t[29]=o.toolsDialogTitle,t[30]=o.toolsEmpty,t[31]=o.toolsLoading,t[32]=o.toolsRetryHint,t[33]=o.toolsSearchSummary,t[34]=o.toolsTitle,t[35]=u,t[36]=C,t[37]=w,t[38]=j,t[39]=M,t[40]=P,t[41]=F,t[42]=I,t[43]=L,t[44]=R,t[45]=z,t[46]=B,t[47]=V,t[48]=H}else C=t[36],w=t[37],j=t[38],M=t[39],P=t[40],F=t[41],I=t[42],L=t[43],R=t[44],z=t[45],B=t[46],V=t[47],H=t[48];let U;t[80]!==L||t[81]!==R||t[82]!==z||t[83]!==B?(U=(0,$.jsx)(`div`,{className:L,"aria-busy":R,"aria-label":z,children:B}),t[80]=L,t[81]=R,t[82]=z,t[83]=B,t[84]=U):U=t[84];let W;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>y(Qt),t[85]=W):W=t[85];let G;t[86]!==f||t[87]!==o.refreshTools?(G=(0,$.jsx)(N,{variant:`secondary`,disabled:f,onClick:W,children:o.refreshTools}),t[86]=f,t[87]=o.refreshTools,t[88]=G):G=t[88];let te;t[89]!==s||t[90]!==o.toolsDialogClose?(te=(0,$.jsx)(D,{asChild:!0,children:(0,$.jsx)(N,{onClick:s,children:o.toolsDialogClose})}),t[89]=s,t[90]=o.toolsDialogClose,t[91]=te):te=t[91];let K;t[92]!==G||t[93]!==te?(K=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge p-4`,children:[G,te]}),t[92]=G,t[93]=te,t[94]=K):K=t[94];let q;t[95]!==C||t[96]!==M||t[97]!==U||t[98]!==K||t[99]!==V||t[100]!==H?(q=(0,$.jsxs)(C,{onCloseAutoFocus:V,className:H,children:[M,U,K]}),t[95]=C,t[96]=M,t[97]=U,t[98]=K,t[99]=V,t[100]=H,t[101]=q):q=t[101];let ne;t[102]!==w||t[103]!==P||t[104]!==q?(ne=(0,$.jsxs)(w,{children:[P,q]}),t[102]=w,t[103]=P,t[104]=q,t[105]=ne):ne=t[105];let J;return t[106]!==j||t[107]!==F||t[108]!==I||t[109]!==ne?(J=(0,$.jsx)(j,{open:F,onOpenChange:I,children:ne}),t[106]=j,t[107]=F,t[108]=I,t[109]=ne,t[110]=J):J=t[110],J}function Qt(e){return e+1}function $t(e){return(0,$.jsx)(P,{className:`h-24 w-full`},e)}function en(e){if(e.transport===`stdio`)return e.command.trim();try{let t=new URL(e.url);return`${t.protocol}//${t.host}${t.pathname}`}catch{return e.url.trim().split(/[?#]/,1)[0].replace(/\/\/[^/]*@/,`//`)}}function tn({row:e,lastCheck:t,t:n,cs:r,onEdit:i,onRemove:a}){let[o,s]=(0,Q.useState)(!1),c=(0,Q.useRef)(null),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``);return(0,$.jsxs)(`div`,{className:`px-4 py-3.5`,children:[(0,$.jsxs)(`button`,{className:`block w-full text-left`,onClick:i,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.displayName||e.id}),(0,$.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-fg-muted`,children:en(e)})]}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:e.extra.enabled===!1?n.setupDisabled:t?n.setupLastCheck.replace(`{{count}}`,String(t.toolCount)):n.setupUnverified}),t?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`time`,{dateTime:t.checkedAt,children:new Intl.DateTimeFormat(void 0,{dateStyle:`short`,timeStyle:`short`}).format(new Date(t.checkedAt))})}):null,d?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:d}):null,(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(N,{variant:`ghost`,onClick:i,children:n.setupConfigure}),(0,$.jsx)(N,{ref:c,variant:`secondary`,disabled:e.extra.enabled===!1,onClick:()=>s(!0),children:n.viewTools}),(0,$.jsx)(N,{variant:`ghost`,onClick:()=>u(!0),children:n.removeServer})]}),o?(0,$.jsx)(Zt,{serverId:e.id,displayName:e.displayName,returnFocusTo:c.current,t:n,onClose:()=>s(!1),onConfigure:()=>{s(!1),i()}}):null,(0,$.jsx)(V,{open:l,title:r.removeConfirmTitle.replace(`{{name}}`,e.displayName||e.id),description:r.removeConfirmDescription,confirmLabel:n.removeServer,cancelLabel:r.modalCancel,destructive:!0,onCancel:()=>u(!1),onConfirm:()=>{u(!1),f(``),a().catch(()=>f(n.setupRemoveFailed))}})]})}function nn(e){let t=e.connectedAt?Date.parse(e.connectedAt):0;return Number.isFinite(t)?t:0}function rn(e,t){return e.status===`active`&&t.status!==`active`?-1:e.status!==`active`&&t.status===`active`?1:e.isCurrentAuthorization===t.isCurrentAuthorization?nn(t)-nn(e):e.isCurrentAuthorization?-1:1}function an(e){let t=new Map;for(let n of e){let e=n.accountId??n.identityKey??`authorization:${n.id}`;t.set(e,[...t.get(e)??[],n])}return[...t.entries()].map(([e,t])=>{let n=[...t].sort(rn);return{key:e,primary:n[0],authorizations:n}}).sort((e,t)=>rn(e.primary,t.primary))}var on=b(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,R);function sn(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function cn(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function ln(e,t,n){return e.status===`connected`?Ke(n.composioHealthConnected,{count:String(t)}):e.status===`reauthorization_required`?n.composioHealthReconnect:e.status===`disconnected`?n.composioHealthDisconnected:e.errorCode===`missing_credential`?n.composioHealthMissingCredential:e.errorCode===`unauthorized`?n.composioHealthUnauthorized:e.errorCode===`forbidden`?n.composioHealthForbidden:e.errorCode===`network`?n.composioHealthNetwork:e.errorCode===`timeout`?n.composioHealthTimeout:n.composioHealthDegraded}function un(e,t){return e===`active`?t.composioConnectionHealthy:e===`pending`?t.composioConnectionPending:e===`expired`?t.composioConnectionExpired:e===`failed`?t.composioConnectionFailed:e===`revoked`||e===`disabled`?t.composioConnectionRevoked:t.composioConnectionUnknown}function dn(e,t,n){return e.status===`paused`?t?.scanEnabled===!1?n.connectorLearningPausedByPolicy:n.connectorLearningPausedByFailure:e.status===`queued`?n.connectorLearningQueued:e.status===`running`?n.connectorLearningRunning:e.status===`completed`?n.connectorLearningCompleted:n.connectorLearningFailed}function fn({instance:e,t,onChanged:n}){let r=sn(e),i=C(e=>e.language)===`zh`,[a,o]=(0,Q.useState)([]),[l,f]=(0,Q.useState)([]),[p,m]=(0,Q.useState)([]),[h,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)([]),[x,S]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)([]),[O,k]=(0,Q.useState)({}),[A,ee]=(0,Q.useState)(`read`),[j,M]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(null),[q,re]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)(!1),[oe,X]=(0,Q.useState)(!1),ce=(0,Q.useRef)(0),de=(0,Q.useRef)(0),me=(0,Q.useMemo)(()=>an(a),[a]),ge=(0,Q.useCallback)(e=>new Promise((t,n)=>{let r=window.setTimeout(()=>n(Error(i?`连接服务响应超时,请重试。`:`The connection service timed out. Please retry.`)),15e3);e.then(t,n).finally(()=>window.clearTimeout(r))}),[i]),Z=(0,Q.useCallback)(async()=>{if(!r||e.materialized.type!==`composio`||e.materialized.role===`credential`)return;M(!0),I(null);let t=++ce.current;try{let e=(await Promise.allSettled([ge(ne()).then(e=>{t===ce.current&&(o(e.filter(e=>e.toolkit.toLowerCase()===r.toLowerCase())),re(!0))}),ge(fe(r)).then(e=>{t===ce.current&&ee(e)}),ge(le(r)).then(e=>{t===ce.current&&(_(e.policy),y(e.agents))})])).find(e=>e.status===`rejected`);t===ce.current&&e?.status===`rejected`&&I(String(e.reason instanceof Error?e.reason.message:e.reason))}finally{t===ce.current&&M(!1)}},[e.materialized,r,ge]);(0,Q.useEffect)(()=>(Z(),()=>{ce.current++}),[Z]);let ve=(0,Q.useCallback)(async()=>{if(!r)return;let e=++de.current;X(!0),R(!1);let t=t=>n=>{e===de.current&&t(n)},n=await Promise.allSettled([ge(he(r)).then(t(f)),ge(pe(20)).then(t(e=>m(e.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===r.toLowerCase())))),ge(J(r)).then(t(T)),ge(K(r)).then(t(S))]);e===de.current&&(R(n.some(e=>e.status===`rejected`)),X(!1))},[r,ge]);(0,Q.useEffect)(()=>(ie&&ve(),()=>{de.current++}),[ie,ve]),(0,Q.useEffect)(()=>{let e=!1,t=an(a).map(e=>e.primary).filter(e=>e.supportsLearning&&e.accountId);if(t.length)return ge(_e()).then(t=>{e||D(t)}).catch(()=>{}),Promise.allSettled(t.map(async e=>[e.accountId,await ge(Fe(e.accountId))])).then(t=>{e||k(Object.fromEntries(t.flatMap(e=>e.status===`fulfilled`?[e.value]:[])))}),()=>{e=!0}},[a,ge]);let Se=(0,Q.useCallback)(async i=>{if(!r)return;let a=z()?null:window.open(`about:blank`,`_blank`);a&&(a.opener=null),M(!0),I(null);try{if(!z()&&!a)throw Error(`Allow popups to open the authorization page.`);let t=await ye(e.connectorId,i);if(!t.authorizationUrl)throw Error(`The authorization provider did not return an authorization URL.`);if(z()){let e=await window.electronAPI?.shell?.openExternalUrl(t.authorizationUrl);if(!e?.ok)throw Error(e?.error??`Could not open the system browser.`)}else a.location.href=t.authorizationUrl;let o=await Pe(r,t.connectionId,12e4,t.attemptId);if(i&&o.accountId!==i)throw Error(`A different account was authorized. The original account and its task bindings were not changed.`);await Promise.all([n?.(),Z()])}catch(e){I(B(e,t))}finally{a?.close(),M(!1)}},[e.connectorId,Z,n,t,r]),Ce=(0,Q.useCallback)(async t=>{M(!0),I(null);try{await xe(e.instanceId,{config:{...e.config??{},authConfigId:t||void 0}}),await Promise.all([n?.(),Z()])}catch(e){I(e instanceof Error?e.message:String(e))}finally{M(!1)}},[e.config,e.instanceId,Z,n]),Ee=async e=>{let t=z()?null:window.open(`about:blank`,`_blank`);t&&(t.opener=null),I(null);try{let n=await ue(e.id);if(n.authorizationUrl)if(z())await window.electronAPI?.shell?.openExternalUrl(n.authorizationUrl);else if(t)t.location.href=n.authorizationUrl;else throw Error(`Allow popups to reopen authorization.`);else t?.close(),await Z()}catch(e){t?.close(),I(e instanceof Error?e.message:String(e))}},Oe=(0,Q.useCallback)(async e=>{if(r){ee(e),I(null);try{await Le(r,e)}catch(e){I(e instanceof Error?e.message:String(e)),await Z()}}},[Z,r]),ke=(0,Q.useCallback)(async e=>{if(r){I(null);try{_(await Je(r,e))}catch(e){I(e instanceof Error?e.message:String(e))}}},[r]),Ae=(0,Q.useCallback)(e=>{if(!h)return;let t=h.allowedAgentIds.includes(e);t&&h.allowedAgentIds.length===1||ke({allowedAgentIds:t?h.allowedAgentIds.filter(t=>t!==e):[...h.allowedAgentIds,e]})},[ke,h]),je=(0,Q.useCallback)(async e=>{M(!0),I(null);try{await e(),await Z()}catch(e){I(e instanceof Error?e.message:String(e))}finally{M(!1)}},[Z]);if(!r)return null;if(e.materialized.type===`composio`&&e.materialized.role===`credential`)return(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.composioApiKeyStored});let Me=me.filter(e=>e.primary.status===`active`).length,Ne=Me>0?t.composioAddAccount:t.composioConnectAccount,Ie=q&&Me>0,Re=w?.requiresCustomAuthConfig===!0,ze=w?.authConfigs.filter(e=>e.status===`ENABLED`&&e.isEnabledForToolRouter)??[];return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`section`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,Ie?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:[Ie?(0,$.jsx)(d,{className:`size-3.5`}):(0,$.jsx)(u,{className:`size-3.5`}),Ie?t.connectionReady:q||F?t.connectionNeedsSetup:t.connectionChecking]}),q&&(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:Ke(t.composioAccountCount,{count:String(me.length)})})]}),(0,$.jsxs)(N,{variant:`primary`,className:`shrink-0`,disabled:j,onClick:()=>void Se(),children:[j?(0,$.jsx)(g,{className:`size-4 animate-spin`}):(0,$.jsx)(Ue,{className:`size-4`}),Ne]})]}),F?(0,$.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center justify-between gap-2 rounded-xl border border-danger/20 bg-danger/5 px-3 py-2 text-sm text-danger`,children:[(0,$.jsx)(`p`,{children:F}),(0,$.jsx)(N,{variant:`secondary`,disabled:j,onClick:()=>void Z(),children:t.composioRetry})]}):null,x&&!Ie?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-amber-500/25 bg-amber-500/5 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:ln(x,Me,t)}),x.recovery===`none`?null:(0,$.jsx)(N,{variant:`secondary`,disabled:j,onClick:()=>void(x.recovery===`retry`?Z():Se()),children:x.recovery===`retry`?t.composioRetry:t.composioReconnectAccount})]}):null,Re&&ze.length===0?(0,$.jsx)(`p`,{className:`rounded-xl border border-amber-500/25 bg-amber-500/5 px-4 py-3 text-sm text-amber-800 dark:text-amber-200`,children:t.composioAuthConfigEmpty}):null,h?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle px-4 py-4 sm:grid-cols-[minmax(0,1fr)_15rem] sm:items-start`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioAccessTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:A===`read`?t.composioAccessReadHint:A===`admin`?t.composioAccessAdminHint:t.composioAccessWriteHint})]}),(0,$.jsxs)(s,{value:A,onChange:e=>void Oe(e.currentTarget.value),children:[(0,$.jsx)(c,{value:`read`,children:t.composioAccessReadOnly}),(0,$.jsx)(c,{value:`write`,children:t.composioAccessReadWrite}),A===`admin`?(0,$.jsx)(c,{value:`admin`,children:t.composioAccessAdminCurrent}):null]})]}),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm text-fg-muted`,children:t.composioAdvancedSettings}),(0,$.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle px-4 py-4 sm:grid-cols-[minmax(0,1fr)_15rem] sm:items-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioConfirmationPolicy}),(0,$.jsxs)(s,{value:h.confirmationPolicy,onChange:e=>void ke({confirmationPolicy:e.currentTarget.value}),children:[(0,$.jsx)(c,{value:`writes`,children:t.composioConfirmWrites}),(0,$.jsx)(c,{value:`always`,children:t.composioConfirmAlways}),h.confirmationPolicy===`never`?(0,$.jsx)(c,{value:`never`,children:t.composioConfirmNever}):null]})]}),(0,$.jsxs)(`div`,{className:`px-4 py-4`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioAllowedAgents}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.allowedAgentIds.length?t.composioAllowedAgentsSelected:t.composioAllowedAgentsAll}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,className:b(`rounded-full border px-2.5 py-1 text-xs transition-colors`,h.allowedAgentIds.length===0?`border-accent bg-accent/10 text-accent`:`border-edge bg-surface-panel text-fg-muted hover:text-fg`),onClick:()=>void ke({allowedAgentIds:[]}),children:t.composioAllowedAgentsAllOption}),v.map(e=>(0,$.jsx)(`button`,{type:`button`,className:b(`rounded-full border px-2.5 py-1 text-xs transition-colors`,h.allowedAgentIds.includes(e.id)?`border-accent bg-accent/10 text-accent`:`border-edge bg-surface-panel text-fg-muted hover:text-fg`),onClick:()=>Ae(e.id),children:e.name},e.id))]})]}),(0,$.jsxs)(`fieldset`,{className:`space-y-2 border-t border-edge-subtle p-4 text-xs text-fg-muted`,children:[(0,$.jsx)(`legend`,{children:i?`可用账号范围`:`Available accounts`}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:h.selectedAccountIds===null,disabled:j,onChange:e=>void ke({selectedAccountIds:e.currentTarget.checked?null:[]})}),i?`所有账号(包括以后新增)`:`All accounts, including new ones`]}),h.selectedAccountIds!==null&&me.map(({primary:e})=>e.accountId&&(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:j,checked:h.selectedAccountIds.includes(e.accountId),onChange:t=>void ke({selectedAccountIds:t.currentTarget.checked?[...h.selectedAccountIds,e.accountId]:h.selectedAccountIds.filter(t=>t!==e.accountId)})}),e.alias??e.accountEmail??e.accountId]},e.accountId)),h.selectedAccountIds?.length===0&&(0,$.jsx)(`p`,{children:i?`未选择账号,Agent 无法使用此应用。`:`No accounts selected. Agents cannot use this app.`})]})]})]}):null,(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.composioConnectedAccounts}),q&&(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:Ke(t.composioAccountCount,{count:String(me.length)})})]}),(0,$.jsxs)(N,{variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:j,onClick:()=>void Z(),children:[(0,$.jsx)(He,{className:b(`size-3.5`,j&&`animate-spin`)}),t.refresh]})]}),me.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:me.map(e=>{let r=e.primary,a=E.find(e=>r.accountId?e.accountId===r.accountId:e.connectionId===r.id),o=r.accountId?O[r.accountId]:void 0;return(0,$.jsxs)(`article`,{className:`px-4 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col items-start justify-between gap-3 sm:flex-row`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:r.alias??r.workspace??r.accountEmail??r.username??t.composioUnnamedAuthorization})}),(0,$.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:r.accountEmail??r.username??r.workspace??r.accountId}),r.backendLabel&&(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:r.backendLabel}),(0,$.jsx)(`p`,{className:b(`mt-1 text-xs`,r.status===`active`?`text-emerald-700 dark:text-emerald-300`:`text-amber-700 dark:text-amber-300`),children:r.accountEnabled===!1?i?`已暂停`:`Paused`:un(r.status,t)}),a?(0,$.jsx)(`p`,{className:b(`mt-1 text-xs`,a.status===`failed`?`text-red-600`:`text-fg-subtle`),children:Ke(t.connectorLearningStatus,{status:dn(a,o,t),count:String(a.candidatesCreated)})}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[r.status===`pending`&&(0,$.jsx)(N,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,onClick:()=>void Ee(r),children:i?`继续授权`:`Continue authorization`}),r.accountId&&(0,$.jsx)(N,{variant:`ghost`,className:`h-8 px-2.5 text-xs text-danger`,disabled:j,onClick:()=>G(r.accountId),children:i?`断开`:`Disconnect`}),r.accountId&&r.status!==`active`&&(0,$.jsx)(N,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,disabled:j,onClick:()=>void Se(r.accountId),children:t.composioReconnectAccount}),r.accountId&&(0,$.jsx)(N,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,disabled:j,onClick:()=>void je(()=>be(r.accountId,{enabled:r.accountEnabled===!1})),children:r.accountEnabled===!1?i?`启用`:`Enable`:i?`暂停`:`Pause`}),r.supportsLearning&&r.status===`active`&&r.accountEnabled!==!1?(0,$.jsxs)(N,{variant:`secondary`,className:`h-8 shrink-0 px-2.5 text-xs`,disabled:j,onClick:()=>void je(async()=>{if(!r.accountId)throw Error(`Connector account is unavailable.`);await Te(r.accountId),await n?.()}),children:[(0,$.jsx)(He,{className:`size-3.5`}),t.composioSyncNow]}):null]})]}),(0,$.jsxs)(`details`,{className:`mt-3 text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`w-fit cursor-pointer font-medium hover:text-fg`,children:t.composioAccountSettings}),(0,$.jsxs)(`div`,{className:`mt-3 space-y-4 rounded-lg bg-surface-panel p-3`,children:[r.accountId&&(0,$.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,$.jsx)(`legend`,{className:`mb-2 font-medium`,children:t.composioAllowedAgents}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:j,checked:r.allowedAgentIds==null,onChange:e=>void je(()=>be(r.accountId,{allowedAgentIds:e.currentTarget.checked?null:[]}))}),t.composioAllowedAgentsAllOption]}),r.allowedAgentIds!=null&&v.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:j,checked:r.allowedAgentIds.includes(e.id),onChange:t=>{let n=t.currentTarget.checked;je(()=>be(r.accountId,{allowedAgentIds:n?[...r.allowedAgentIds,e.id]:r.allowedAgentIds.filter(t=>t!==e.id)}))}}),e.name]},e.id)),r.allowedAgentIds?.length===0&&(0,$.jsx)(`p`,{children:i?`未选择 Agent:任何 Agent 都不能使用此账号。`:`No agents selected: this account is unavailable to all agents.`})]}),r.supportsLearning&&o?(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:o.scanEnabled,disabled:j,onChange:e=>void je(()=>we(r.accountId,{scanEnabled:e.currentTarget.checked}))}),t.connectorScheduledScan]}),o.scanEnabled?(0,$.jsxs)(`label`,{className:`sm:col-span-2`,children:[t.connectorScanInterval,(0,$.jsxs)(s,{className:`mt-1`,value:String(o.intervalMinutes??30),disabled:j,onChange:e=>void je(()=>we(r.accountId,{intervalMinutes:Number(e.currentTarget.value)})),children:[(0,$.jsxs)(c,{value:`5`,children:[`5 `,t.connectorMinutes]}),(0,$.jsxs)(c,{value:`15`,children:[`15 `,t.connectorMinutes]}),(0,$.jsxs)(c,{value:`30`,children:[`30 `,t.connectorMinutes]}),(0,$.jsxs)(c,{value:`60`,children:[`60 `,t.connectorMinutes]})]})]}):null]}):null,(0,$.jsxs)(`label`,{className:`block`,children:[t.composioAccountAlias,(0,$.jsx)(`input`,{className:b(on,`mt-1 h-8 py-1 text-xs`),defaultValue:r.alias??``,onBlur:e=>{e.currentTarget.value!==(r.alias??``)&&je(()=>De(r.id,{alias:e.currentTarget.value}))}})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:e.authorizations.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`p`,{className:`min-w-0 break-all font-mono text-fg-subtle`,children:[t.composioAuthorizationId,`: `,e.providerConnectionId]}),(0,$.jsx)(N,{variant:`ghost`,className:`size-7 shrink-0 p-0 text-danger`,title:t.composioRevoke,disabled:j,onClick:()=>U(e.id),children:(0,$.jsx)(Y,{className:`size-3.5`})})]},e.id))}),(0,$.jsx)(`div`,{className:`flex justify-end gap-1`,children:(0,$.jsx)(N,{variant:`ghost`,className:`size-8 p-0`,title:t.refresh,disabled:j,onClick:()=>void je(()=>se(r.id)),children:(0,$.jsx)(He,{className:`size-4`})})})]})]})]},e.key)})}):j&&!q?(0,$.jsxs)(`div`,{"aria-busy":`true`,"aria-label":t.connectionChecking,className:`space-y-3`,children:[(0,$.jsx)(P,{className:`h-16 w-full`}),(0,$.jsx)(P,{className:`h-16 w-full`})]}):q?(0,$.jsx)(`div`,{className:`rounded-xl border border-dashed border-edge px-4 py-8 text-center`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.composioConnectionsEmpty})}):null]}),(0,$.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-base`,onToggle:e=>ae(e.currentTarget.open),children:[(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-fg`,children:t.composioAdvancedSettings}),(0,$.jsxs)(`div`,{className:`space-y-5 border-t border-edge-subtle px-4 py-4`,children:[oe?(0,$.jsx)(P,{"aria-label":t.connectionChecking,className:`h-16 w-full`}):null,L?(0,$.jsxs)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:[t.composioDiagnosticsUnavailable,(0,$.jsx)(N,{variant:`ghost`,disabled:oe,onClick:()=>void ve(),children:t.composioRetry})]}):null,w?.mode===`byok`?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioAuthConfigTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:Re?t.composioAuthConfigRequiredHint:t.composioAuthConfigOptionalHint})]}),(0,$.jsx)(`a`,{className:`text-xs font-medium text-accent-fg hover:underline`,href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,children:t.composioAuthConfigManage})]}),(0,$.jsxs)(s,{className:`mt-3`,value:typeof e.config?.authConfigId==`string`?e.config.authConfigId:``,disabled:j,onChange:e=>void Ce(e.currentTarget.value),children:[Re?null:(0,$.jsx)(c,{value:``,children:t.composioAuthConfigManaged}),Re&&typeof e.config?.authConfigId!=`string`?(0,$.jsx)(c,{value:``,disabled:!0,children:t.composioAuthConfigSelect}):null,ze.map(e=>(0,$.jsxs)(c,{value:e.id,children:[e.name,` · `,e.authScheme??`OAuth`]},e.id))]})]}):null,(0,$.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioAgentTools}),(0,$.jsx)(`div`,{className:`space-y-2`,children:l.length?l.slice(0,8).map(e=>(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.slug}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[cn(e.scope,t),e.curated?``:` ${t.composioUncuratedSuffix}`]})]},e.slug)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioToolsEmpty})})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioRecentTriggers}),(0,$.jsx)(`div`,{className:`space-y-2`,children:p.length?p.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`p`,{className:`truncate text-xs text-fg`,children:e.trigger??e.id}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:new Date(e.at).toLocaleString()})]},`${e.id}-${e.at}`)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioTriggersEmpty})})]})]})]})]}),(0,$.jsx)(V,{open:W!==null,title:i?`断开账号`:`Disconnect account`,description:i?`停止此账号的工具使用和学习,并撤销其全部授权。已保存的数据不会删除。`:`Stop tool access and learning for this account and revoke all its authorizations. Saved data will not be deleted.`,confirmLabel:i?`断开`:`Disconnect`,cancelLabel:t.modalCancel,destructive:!0,onConfirm:()=>{let e=W;G(null),e&&je(()=>te(e))},onCancel:()=>G(null)}),(0,$.jsx)(V,{open:H!==null,title:t.composioRevoke,description:t.composioRevokeConfirm,confirmLabel:t.composioRevoke,cancelLabel:t.modalCancel,destructive:!0,onConfirm:()=>{let e=H;U(null),e&&je(()=>We(e))},onCancel:()=>U(null)})]})}var pn=b(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,R);function mn(e,t){let n={};for(let r of e?.setup.config??[]){let e=t.config?.[r.key]??r.defaultValue??``;n[r.key]=typeof e==`string`?e:JSON.stringify(e,null,2)}return n}function hn(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function gn({instance:e,definition:t,onClose:n,onChanged:r,t:i}){let[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,_]=(0,Q.useState)(()=>mn(t,e)),[y,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,j]=(0,Q.useState)(null),M=t?.setup.config??[],P=(e.materialized.type===`mcp`||e.materialized.type===`memorySource`)&&M.length>0&&(t?.setup.secrets??[]).length===0,I=e.materialized.type===`mcp`,L=e.materialized.type===`composio`,R=e.materialized.type===`memorySource`,z=t?Ce(t,i):null,B=(0,Q.useCallback)(async()=>{C(!0),x(null);try{let t=await Ve(e.instanceId);j(t),t.ok||x(t.error??t.action??i.healthStatusLabels[t.status]),await r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{C(!1)}},[e.instanceId,r,i.healthStatusLabels]),H=(0,Q.useCallback)(async()=>{o(!0),x(null);try{await Se(e.instanceId),await r(),n()}catch(e){x(e instanceof Error?e.message:String(e)),o(!1)}},[e.instanceId,r,n]),U=(0,Q.useCallback)(async()=>{if(!(!t||!P)){u(!0),x(null);try{let n={};for(let e of t.setup.config??[]){let t=hn(e.type,h[e.key]??``);t!==void 0&&(n[e.key]=t)}await xe(e.instanceId,{config:n}),await r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{u(!1)}}},[h,t,e.instanceId,r,P]),W=(0,Q.useCallback)(async()=>{f(!0),m(null),x(null);try{m((await je(e.connectorId)).recordIds.length),await r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{f(!1)}},[e.connectorId,r]);return(0,$.jsxs)(ee,{open:!0,onOpenChange:e=>{e||n()},children:[(0,$.jsxs)(O,{children:[(0,$.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(k,{className:b(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,L?`h-[min(100dvh-2rem,36rem)] w-[min(100%-2rem,40rem)]`:`h-[min(100dvh-2rem,44rem)] w-[min(100%-2rem,min(92vw,54rem))]`,`rounded-2xl border border-edge bg-surface-overlay shadow-float outline-none dark:border-edge`),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(Be,{connector:t,size:`lg`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(A,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,$.jsx)(E,{className:`mt-1 text-sm text-fg-muted`,children:z??(e.materialized.type===`mcp`?Ke(i.mcpServerRuntime,{serverId:e.materialized.serverId}):Ke(i.runtimeLabel,{runtime:e.materialized.type}))})]})]}),(0,$.jsx)(D,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:b(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,F.focusRingPanel),"aria-label":i.modalClose,children:[(0,$.jsx)(v,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[y?(0,$.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:y}):null,I?(0,$.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsx)(`p`,{className:`text-fg-muted`,role:`status`,children:w?.ok?Ke(i.toolsAvailable,{count:String(w.toolCount)}):w?i.healthStatusLabels[w.status]:e.usage.lastHealthStatus?i.healthStatusLabels[e.usage.lastHealthStatus]:i.healthNotTested}),(0,$.jsxs)(N,{variant:`secondary`,"aria-busy":S,disabled:S||!e.enabled,onClick:()=>void B(),children:[S?(0,$.jsx)(g,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(He,{className:`size-4`,"aria-hidden":!0}),i.test]})]}),P?M.map(e=>(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:e.label}),e.description?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,$.jsx)(`input`,{className:pn,value:h[e.key]??``,placeholder:e.placeholder,onChange:t=>_(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key)):null]}):null,L?(0,$.jsx)(fn,{instance:e,t:i,onChanged:r}):null,R?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-edge bg-surface-base p-4 text-sm`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.connectedSourceSync}),z?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:z}):null,p===null?null:(0,$.jsx)(`p`,{className:`mt-1 text-xs text-emerald-600`,children:Ke(i.connectedSourceSynced,{count:String(p)})})]}),(0,$.jsxs)(N,{disabled:d,onClick:()=>void W(),children:[d?(0,$.jsx)(g,{className:`size-4 animate-spin`}):(0,$.jsx)(ae,{className:`size-4`}),i.composioSyncNow]})]}),P?(0,$.jsx)(`div`,{className:`grid gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:M.map(e=>(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,$.jsx)(`input`,{className:pn,value:h[e.key]??``,placeholder:e.placeholder,onChange:t=>_(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}):null,!I&&!L&&!R?(0,$.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:(0,$.jsx)(`p`,{children:i.connectorPolicyHint})}):null,(0,$.jsxs)(`details`,{className:`mt-5 rounded-xl border border-edge`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-danger`,children:i.dangerZone}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-danger/15 px-4 py-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i.removeConnectorHint}),(0,$.jsxs)(N,{variant:`secondary`,className:`shrink-0 border-danger/30 text-danger hover:bg-danger/10`,disabled:a,onClick:()=>c(!0),children:[a?(0,$.jsx)(g,{className:`size-4 animate-spin`}):(0,$.jsx)(Y,{className:`size-4`}),i.remove]})]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,$.jsx)(N,{variant:`secondary`,onClick:n,children:i.modalClose}),(I||R)&&P?(0,$.jsxs)(N,{variant:`primary`,disabled:l,onClick:()=>void U(),children:[l?(0,$.jsx)(g,{className:`size-4 animate-spin`}):(0,$.jsx)(Ne,{className:`size-4`}),i.modalSave]}):null]})]})]}),(0,$.jsx)(V,{open:s,title:Ke(i.removeConfirmTitle,{name:e.displayName}),description:i.removeConfirmDescription,confirmLabel:i.removeConfirmAction,cancelLabel:i.modalCancel,destructive:!0,onConfirm:()=>{c(!1),H()},onCancel:()=>{a||c(!1)}})]})}function _n(e){let t=(0,nt.c)(2),n;return t[0]===e?n=t[1]:(n=e.instance.materialized.type===`cli`&&e.definition?(0,$.jsx)(Ae,{definition:e.definition,instance:e.instance,onClose:e.onClose,onChanged:e.onChanged}):(0,$.jsx)(gn,{...e}),t[0]=e,t[1]=n),n}function vn(e){let t=(0,nt.c)(55),{instance:n,definition:r,highlighted:i,onOpenDetails:a,t:s}=e,c=i===void 0?!1:i,l;t[0]!==r||t[1]!==n?(l=mt(n,r),t[0]=r,t[1]=n,t[2]=l):l=t[2];let f=l.state,p;t[3]!==r||t[4]!==s?(p=r?Ce(r,s):null,t[3]=r,t[4]=s,t[5]=p):p=t[5];let m=p,h,g,_,v,y,x,S,C,w;if(t[6]!==f||t[7]!==r||t[8]!==c||t[9]!==n||t[10]!==a||t[11]!==s.connectionChecking||t[12]!==s.connectionNeedsSetup||t[13]!==s.connectionReady){h=f===`ready`?{label:s.connectionReady,Icon:d,className:`text-emerald-700 dark:text-emerald-300`}:f===`needs_setup`?{label:s.connectionNeedsSetup,Icon:u,className:`text-amber-700 dark:text-amber-300`}:{label:s.connectionChecking,Icon:ie,className:`text-fg-muted`},C=`button`;let e=c&&`bg-accent-soft`;t[23]===e?w=t[24]:(w=b(`flex w-full items-center gap-3 px-4 py-3.5 text-left hover:bg-surface-hover/60`,`rounded-none first:rounded-t-[calc(var(--radius-xl)-1px)] last:rounded-b-[calc(var(--radius-xl)-1px)]`,F.transition,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,e),t[23]=e,t[24]=w),t[25]!==n||t[26]!==a?(g=()=>a(n),t[25]=n,t[26]=a,t[27]=g):g=t[27],t[28]===r?_=t[29]:(_=(0,$.jsx)(Be,{connector:r}),t[28]=r,t[29]=_),S=`min-w-0 flex-1`,y=`flex min-w-0 items-center gap-2`,t[30]===n.displayName?x=t[31]:(x=(0,$.jsx)(`h3`,{className:`truncate text-sm font-medium text-fg`,children:n.displayName}),t[30]=n.displayName,t[31]=x),v=b(`inline-flex shrink-0 items-center gap-1 text-xs font-medium`,h.className),t[6]=f,t[7]=r,t[8]=c,t[9]=n,t[10]=a,t[11]=s.connectionChecking,t[12]=s.connectionNeedsSetup,t[13]=s.connectionReady,t[14]=h,t[15]=g,t[16]=_,t[17]=v,t[18]=y,t[19]=x,t[20]=S,t[21]=C,t[22]=w}else h=t[14],g=t[15],_=t[16],v=t[17],y=t[18],x=t[19],S=t[20],C=t[21],w=t[22];let T;t[32]===h.Icon?T=t[33]:(T=(0,$.jsx)(h.Icon,{className:`size-3.5`,"aria-hidden":!0}),t[32]=h.Icon,t[33]=T);let E;t[34]!==h.label||t[35]!==T||t[36]!==v?(E=(0,$.jsxs)(`span`,{className:v,children:[T,h.label]}),t[34]=h.label,t[35]=T,t[36]=v,t[37]=E):E=t[37];let D;t[38]!==E||t[39]!==y||t[40]!==x?(D=(0,$.jsxs)(`div`,{className:y,children:[x,E]}),t[38]=E,t[39]=y,t[40]=x,t[41]=D):D=t[41];let O;t[42]===m?O=t[43]:(O=m?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:m}):null,t[42]=m,t[43]=O);let k;t[44]!==D||t[45]!==O||t[46]!==S?(k=(0,$.jsxs)(`div`,{className:S,children:[D,O]}),t[44]=D,t[45]=O,t[46]=S,t[47]=k):k=t[47];let A;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(o,{className:`size-4 shrink-0 text-fg-disabled`,"aria-hidden":!0}),t[48]=A):A=t[48];let ee;return t[49]!==g||t[50]!==_||t[51]!==k||t[52]!==C||t[53]!==w?(ee=(0,$.jsxs)(`button`,{type:C,className:w,onClick:g,children:[_,k,A]}),t[49]=g,t[50]=_,t[51]=k,t[52]=C,t[53]=w,t[54]=ee):ee=t[54],ee}function yn(e,t){return It()}function bn(e){let t=e.headers.filter(e=>e.key.trim()),n=t.find(e=>e.key.toLowerCase()===`authorization`&&!e.reference&&/^Bearer\s/i.test(e.value)),r=e.extra.auth||t.some(e=>e.reference)||e.extra.oauth&&t.some(e=>e.key.toLowerCase()===`authorization`)?`existing`:e.extra.oauth?`oauth`:n?`bearer`:t.length?`headers`:`auto`;return{mode:r,token:n?.value.replace(/^Bearer\s+/i,``)??``,apiKey:``,headerName:``,customHeaders:t.length?t:[Ct()],additionalHeaders:r===`bearer`?t.filter(e=>e!==n):r===`oauth`?t:[]}}function xn(e,t){if(e.transport===`stdio`||t.mode===`existing`)return{...e,extra:{...e.extra}};let n={...e.extra};delete n.auth,t.mode!==`oauth`&&delete n.oauth;let r=t.mode===`headers`?t.customHeaders:t.additionalHeaders;if(t.mode===`bearer`){let e=t.token.trim().replace(/^Bearer\s+/i,``);r=[...r,Ct(`Authorization`,`Bearer ${e}`)]}return t.mode===`apiKey`&&(r=[...r,Ct(t.headerName.trim(),t.apiKey.trim())]),{...e,extra:n,headers:r,oauthClientId:t.mode===`oauth`?e.oauthClientId:``}}function Sn(e){let t=new Set;return e.findIndex(e=>{let n=e.key.trim();if(!n&&!e.value&&!e.reference)return!1;if(!/^[!#$%&'*+.^_`|~\da-z-]+$/i.test(n)||/[\r\n]/.test(e.value))return!0;let r=n.toLowerCase();return t.has(r)?!0:(t.add(r),!1)})}function Cn(){return b(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,R)}function wn({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:i,pasteFailed:a,pasteFailedTitle:o,dismissLabel:s,keyPlaceholder:c,valuePlaceholder:l,headers:u,onChange:d,referenceLabel:f=`Existing credential reference`,showValueLabel:p=`Show value`,hideValueLabel:g=`Hide value`,allowPaste:_=!0}){let[v,y]=(0,Q.useState)(new Set),[x,S]=(0,Q.useState)(!1),C=(e,t)=>{d(u.map((n,r)=>r===e?{...n,...t}:n))},w=()=>{d([...u,Ct()])},T=e=>{let t=u.filter((t,n)=>n!==e);d(t.length>0?t:[Ct()])},E=async()=>{try{let e=await M();if(!e){S(!0);return}let t=Tt(e);if(!t?.length){S(!0);return}d(t)}catch{S(!0)}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 md:col-span-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:e}),t?(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:t}):null]}),_?(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void E(),children:[(0,$.jsx)(Xe,{className:`size-3.5`,"aria-hidden":!0}),i]}):null]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>(0,$.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)_auto_auto]`,children:[(0,$.jsx)(`input`,{className:b(Cn(),`col-span-3 min-w-0 font-mono text-xs sm:col-span-1`),"aria-label":`${c} ${t+1}`,value:e.key,placeholder:c,onChange:e=>C(t,{key:e.target.value})}),(0,$.jsx)(`input`,{className:b(Cn(),`min-w-0 font-mono text-xs`),type:v.has(e.clientKey)?`text`:`password`,autoComplete:`off`,"aria-label":`${l} ${t+1}`,readOnly:!!e.reference,value:e.reference?f:e.value,placeholder:e.reference?f:l,onChange:e=>C(t,{value:e.target.value})}),(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-10 shrink-0 px-0`,disabled:!!e.reference,"aria-label":v.has(e.clientKey)?g:p,onClick:()=>y(t=>{let n=new Set(t);return n.has(e.clientKey)?n.delete(e.clientKey):n.add(e.clientKey),n}),children:v.has(e.clientKey)?(0,$.jsx)(m,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(h,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:u.length<=1&&!e.key&&!e.value,onClick:()=>T(t),"aria-label":r,children:(0,$.jsx)(Y,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})}),e.reference?(0,$.jsx)(`p`,{className:`col-span-3 break-words text-xs text-fg-muted sm:col-span-4`,children:f}):null]},e.clientKey))}),(0,$.jsx)(V,{open:x,title:o,description:a,confirmLabel:s,onConfirm:()=>S(!1),onCancel:()=>S(!1)}),(0,$.jsxs)(`button`,{type:`button`,className:b(`self-start text-sm text-accent hover:underline`,F.press),onClick:w,children:[`+ `,n]})]})}var Tn=b(`w-full min-w-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,R);function En(e){let t=(0,nt.c)(20),{value:n,onChange:r,label:i,t:a,required:o}=e,s=o===void 0?!1:o,[c,l]=(0,Q.useState)(!1),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=b(Tn,`mt-1.5`),t[0]=u):u=t[0];let d=c?`text`:`password`,f;t[1]===r?f=t[2]:(f=e=>r(e.target.value),t[1]=r,t[2]=f);let p;t[3]!==s||t[4]!==d||t[5]!==f||t[6]!==n?(p=(0,$.jsx)(`input`,{className:u,type:d,value:n,required:s,autoComplete:`off`,onChange:f}),t[3]=s,t[4]=d,t[5]=f,t[6]=n,t[7]=p):p=t[7];let g;t[8]!==i||t[9]!==p?(g=(0,$.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[i,p]}),t[8]=i,t[9]=p,t[10]=g):g=t[10];let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>l(Dn),t[11]=_):_=t[11];let v;t[12]===c?v=t[13]:(v=c?(0,$.jsx)(m,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[12]=c,t[13]=v);let y=c?a.setupHideValue:a.setupShowValue,x;t[14]!==v||t[15]!==y?(x=(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`gap-1.5 text-xs`,onClick:_,children:[v,y]}),t[14]=v,t[15]=y,t[16]=x):x=t[16];let S;return t[17]!==x||t[18]!==g?(S=(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[g,x]}),t[17]=x,t[18]=g,t[19]=S):S=t[19],S}function Dn(e){return!e}function On(e){let t=(0,nt.c)(17),{headers:n,onChange:r,t:i,additional:a,environment:o}=e,s=a===void 0?!1:a,c=o===void 0?!1:o,l=c?i.envLabel:s?i.setupAdditionalHeaders:i.headersLabel,u=c?i.setupAddEnv:i.addHeader,d=c?i.setupRemoveEnv:i.removeHeader,f=c?i.setupEnvName:i.headerKeyPlaceholder,p=c?i.setupEnvValue:i.headerValuePlaceholder,m=!c,h;return t[0]!==n||t[1]!==r||t[2]!==i.optionalSuffix||t[3]!==i.pasteHeaders||t[4]!==i.pasteHeadersDismiss||t[5]!==i.pasteHeadersFailed||t[6]!==i.pasteHeadersFailedTitle||t[7]!==i.setupHideValue||t[8]!==i.setupReference||t[9]!==i.setupShowValue||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==f||t[14]!==p||t[15]!==m?(h=(0,$.jsx)(wn,{label:l,optionalLabel:i.optionalSuffix,addLabel:u,removeHeaderAria:d,pasteLabel:i.pasteHeaders,pasteFailed:i.pasteHeadersFailed,pasteFailedTitle:i.pasteHeadersFailedTitle,dismissLabel:i.pasteHeadersDismiss,keyPlaceholder:f,valuePlaceholder:p,headers:n,onChange:r,referenceLabel:i.setupReference,showValueLabel:i.setupShowValue,hideValueLabel:i.setupHideValue,allowPaste:m}),t[0]=n,t[1]=r,t[2]=i.optionalSuffix,t[3]=i.pasteHeaders,t[4]=i.pasteHeadersDismiss,t[5]=i.pasteHeadersFailed,t[6]=i.pasteHeadersFailedTitle,t[7]=i.setupHideValue,t[8]=i.setupReference,t[9]=i.setupShowValue,t[10]=l,t[11]=u,t[12]=d,t[13]=f,t[14]=p,t[15]=m,t[16]=h):h=t[16],h}function kn(e){let t=(0,nt.c)(52),{draft:n,onChange:r,t:i,allowExisting:a}=e,o=i.setupAuthLabel,l=i.setupAuthLabel,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=b(Tn,`mt-1.5`),t[0]=u):u=t[0];let d=n.mode,f;t[1]===r?f=t[2]:(f=e=>r({mode:e.target.value}),t[1]=r,t[2]=f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=[`auto`,`oauth`,`bearer`,`apiKey`,`headers`,`none`],t[3]=p):p=t[3];let m;t[4]===i.setupAuthModes?m=t[5]:(m=p.map(e=>(0,$.jsx)(c,{value:e,children:i.setupAuthModes[e]},e)),t[4]=i.setupAuthModes,t[5]=m);let h;t[6]!==a||t[7]!==n.mode||t[8]!==i.setupAuthModes?(h=a||n.mode===`existing`?(0,$.jsx)(c,{value:`existing`,children:i.setupAuthModes.existing}):null,t[6]=a,t[7]=n.mode,t[8]=i.setupAuthModes,t[9]=h):h=t[9];let g;t[10]!==n.mode||t[11]!==i.setupAuthLabel||t[12]!==f||t[13]!==m||t[14]!==h?(g=(0,$.jsxs)(s,{"aria-label":l,className:u,value:d,onChange:f,children:[m,h]}),t[10]=n.mode,t[11]=i.setupAuthLabel,t[12]=f,t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]!==i.setupAuthLabel||t[17]!==g?(_=(0,$.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[o,g]}),t[16]=i.setupAuthLabel,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==n.mode||t[20]!==i.setupAuthAutoHint?(v=n.mode===`auto`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupAuthAutoHint}):null,t[19]=n.mode,t[20]=i.setupAuthAutoHint,t[21]=v):v=t[21];let y;t[22]!==n.mode||t[23]!==i.setupAuthOAuthHint?(y=n.mode===`oauth`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupAuthOAuthHint}):null,t[22]=n.mode,t[23]=i.setupAuthOAuthHint,t[24]=y):y=t[24];let x;t[25]!==n.mode||t[26]!==i.setupExistingHint?(x=n.mode===`existing`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupExistingHint}):null,t[25]=n.mode,t[26]=i.setupExistingHint,t[27]=x):x=t[27];let S;t[28]!==n.mode||t[29]!==n.token||t[30]!==r||t[31]!==i?(S=n.mode===`bearer`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(En,{value:n.token,onChange:e=>r({token:e}),label:i.setupTokenLabel,t:i,required:!0}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupTokenHint})]}):null,t[28]=n.mode,t[29]=n.token,t[30]=r,t[31]=i,t[32]=S):S=t[32];let C;t[33]!==n.apiKey||t[34]!==n.headerName||t[35]!==n.mode||t[36]!==r||t[37]!==i?(C=n.mode===`apiKey`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[i.setupApiKeyHeader,(0,$.jsx)(`input`,{className:b(Tn,`mt-1.5`),placeholder:`x-api-key`,value:n.headerName,required:!0,onChange:e=>r({headerName:e.target.value})})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.setupApiKeyHint}),(0,$.jsx)(En,{value:n.apiKey,onChange:e=>r({apiKey:e}),label:`API Key`,t:i,required:!0})]}):null,t[33]=n.apiKey,t[34]=n.headerName,t[35]=n.mode,t[36]=r,t[37]=i,t[38]=C):C=t[38];let w;t[39]!==n.customHeaders||t[40]!==n.mode||t[41]!==r||t[42]!==i?(w=n.mode===`headers`?(0,$.jsx)(On,{headers:n.customHeaders,onChange:e=>r({customHeaders:e}),t:i}):null,t[39]=n.customHeaders,t[40]=n.mode,t[41]=r,t[42]=i,t[43]=w):w=t[43];let T;return t[44]!==_||t[45]!==v||t[46]!==y||t[47]!==x||t[48]!==S||t[49]!==C||t[50]!==w?(T=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[_,v,y,x,S,C,w]}),t[44]=_,t[45]=v,t[46]=y,t[47]=x,t[48]=S,t[49]=C,t[50]=w,t[51]=T):T=t[51],T}function An(e){let t=(0,nt.c)(8),{label:n,children:r,hint:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`span`,{children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i?(0,$.jsx)(`span`,{className:`block text-xs font-normal text-fg-muted`,children:i}):null,t[2]=i,t[3]=o);let s;return t[4]!==r||t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm font-medium text-fg`,children:[a,r,o]}),t[4]=r,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function jn({row:e,t,onUpdate:n}){let[r,i]=(0,Q.useState)(()=>Dt(e.envJson?JSON.parse(e.envJson):void 0)),[a,o]=(0,Q.useState)(!1),s=[];try{s=kt(e.argsText)??[]}catch{}let c=e=>n({argsText:JSON.stringify(e)});return(0,$.jsxs)(`div`,{"data-field":`commandOptions`,className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.argsLabel}),(0,$.jsx)(N,{type:`button`,variant:`ghost`,onClick:()=>o(e=>!e),children:a?t.setupArgsRows:t.setupArgsPaste})]}),a?(0,$.jsx)(An,{label:t.setupArgsPaste,hint:t.argsHint,children:(0,$.jsx)(`input`,{className:Tn,value:e.argsText,onChange:e=>n({argsText:e.target.value})})}):s.map((e,n)=>(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`input`,{className:Tn,"aria-label":`${t.argsLabel} ${n+1}`,value:e,onChange:e=>c(s.map((t,r)=>r===n?e.target.value:t))}),(0,$.jsx)(N,{type:`button`,variant:`ghost`,"aria-label":t.setupRemoveArg,onClick:()=>c(s.filter((e,t)=>t!==n)),children:(0,$.jsx)(Y,{className:`size-4`,"aria-hidden":!0})})]},n)),a?null:(0,$.jsxs)(N,{type:`button`,variant:`ghost`,onClick:()=>c([...s,``]),children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t.setupAddArg]})]}),(0,$.jsx)(On,{environment:!0,headers:r,t,onChange:e=>{i(e),n({envEntries:e,envJson:JSON.stringify(Et(e)??{})})}})]})}function Mn(e){let t=(0,nt.c)(15),{row:n,t:r,onUpdate:i,variant:a,showOAuth:o,idReadOnly:l}=e,u=a===void 0?`all`:a,d=o===void 0?!1:o,f=l===void 0?!1:l,p=u!==`advanced`,m=u!==`basic`,h;t[0]!==p||t[1]!==i||t[2]!==n||t[3]!==r?(h=p?(0,$.jsxs)($.Fragment,{children:[n.transport===`stdio`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(An,{label:`${r.commandLabel} *`,children:(0,$.jsx)(`input`,{"data-field":`command`,className:Tn,value:n.command,required:!0,onChange:e=>i({command:e.target.value})})}),(0,$.jsx)(jn,{row:n,t:r,onUpdate:i})]}):(0,$.jsx)(An,{label:`${r.urlLabel} *`,children:(0,$.jsx)(`input`,{"data-field":`url`,className:Tn,value:n.url,placeholder:`https://example.com/mcp`,required:!0,onChange:e=>i({url:e.target.value})})}),(0,$.jsx)(An,{label:r.setupNameLabel,hint:r.setupNameHint,children:(0,$.jsx)(`input`,{className:Tn,value:n.displayName??``,placeholder:r.setupNamePlaceholder,onChange:e=>i({displayName:e.target.value})})})]}):null,t[0]=p,t[1]=i,t[2]=n,t[3]=r,t[4]=h):h=t[4];let g;t[5]!==m||t[6]!==f||t[7]!==i||t[8]!==n||t[9]!==d||t[10]!==r?(g=m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(An,{label:r.serverIdLabel,hint:r.setupIdHint,children:(0,$.jsx)(`input`,{className:Tn,readOnly:f,value:n.id,onChange:e=>i({id:e.target.value}),placeholder:r.serverIdPlaceholder})}),n.transport===`stdio`?(0,$.jsx)(An,{label:r.cwdLabel,children:(0,$.jsx)(`input`,{className:Tn,value:n.cwd,onChange:e=>i({cwd:e.target.value})})}):null,n.transport!==`stdio`&&d?(0,$.jsx)(An,{label:r.oauthClientIdLabel,hint:r.oauthClientIdHint,children:(0,$.jsx)(`input`,{className:Tn,value:n.oauthClientId,onChange:e=>i({oauthClientId:e.target.value})})}):null,(0,$.jsx)(An,{label:r.exposureLabel,hint:r.setupExposureHint,children:(0,$.jsx)(s,{"aria-label":r.exposureLabel,className:Tn,value:n.exposure,onChange:e=>i({exposure:e.target.value}),children:[`codemode`,`deferred`,`direct`,`hidden`].map(e=>(0,$.jsx)(c,{value:e,children:r.exposureLabels[e]},e))})}),(0,$.jsx)(An,{label:r.requestTimeoutLabel,children:(0,$.jsx)(tt,{allowEmpty:!0,type:`number`,min:1,className:Tn,value:n.timeout??``,placeholder:r.setupDefaultTimeout,onChange:e=>i({timeout:e.target.value?Number(e.target.value):void 0})})})]}):null,t[5]=m,t[6]=f,t[7]=i,t[8]=n,t[9]=d,t[10]=r,t[11]=g):g=t[11];let _;return t[12]!==h||t[13]!==g?(_=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14],_}function Nn(e,t){let n=e;if(n?.status===429)return t.setupRateLimited;if(n?.status===401)return t.setupGatewayUnauthorized;if(n?.status===404||n?.status===409)return t.setupConflict;if(n?.status&&n.status>=500)return t.setupGatewayCheckFailed;let r={command_missing:t.setupCommandMissing,connection_refused:t.setupConnectionRefused,host_not_found:t.setupHostNotFound,timeout:t.setupTimedOut,access_denied:t.setupAccessDenied,network:t.setupServiceNetworkFailed,tls:t.setupTlsFailed,invalid_response:t.setupInvalidResponse,not_found:t.setupEndpointNotFound,rate_limited:t.setupServiceRateLimited,configuration:t.setupInvalidConfig};if(n?.errorCode&&Object.hasOwn(r,n.errorCode))return r[n.errorCode];let i=e instanceof Error?e.message:typeof e==`string`?e:n?.error??``;return/ENOENT|command not found|executable.{0,30}not found/i.test(i)?t.setupCommandMissing:/ECONNREFUSED|connection refused/i.test(i)?t.setupConnectionRefused:/ENOTFOUND|EAI_AGAIN|could not resolve/i.test(i)?t.setupHostNotFound:/timeout|timed out/i.test(i)?t.setupTimedOut:/fetch failed|failed to fetch|network error|NetworkError/i.test(i)?n?.error===void 0?t.setupGatewayNetworkFailed:t.setupServiceNetworkFailed:/\b(?:401|403)\b|unauthorized|forbidden|permission denied/i.test(i)?t.setupAccessDenied:t.setupCheckFailed}function Pn(e,t){return JSON.stringify({id:e.id,config:Rt(xn(e,t))})}function Fn(e,t){try{return Pn(e,t)}catch{return JSON.stringify({row:e,auth:t})}}function In(e){let{t,cs:n}=e,r=(0,Q.useId)(),[i,a]=(0,Q.useState)(e.initialRow),[o,l]=(0,Q.useState)(()=>bn(e.initialRow)),[u,f]=(0,Q.useState)(`idle`),[m,h]=(0,Q.useState)(``),[_,y]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(),[C,w]=(0,Q.useState)(),[D,j]=(0,Q.useState)(),[M,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(``),[z,B]=(0,Q.useState)(``),[H,U]=(0,Q.useState)([]),[W,G]=(0,Q.useState)(`0`),[te,K]=(0,Q.useState)(0),[q,ne]=(0,Q.useState)(``),[J,re]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)(!1),Y=e.mode===`edit`,[oe,se]=(0,Q.useState)(``),X=(0,Q.useRef)(void 0),[ce]=(0,Q.useState)(()=>Fn(e.initialRow,bn(e.initialRow))),le=(0,Q.useRef)(e.mode===`edit`?e.initialRow.id:``),ue=(0,Q.useRef)(void 0),de=(0,Q.useRef)(void 0),fe=(0,Q.useRef)(void 0),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(``),he=(0,Q.useRef)(!0),ge=(0,Q.useRef)(null),Z=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),ve=(0,Q.useRef)(null),ye=(0,Q.useRef)(e.onSaved);ye.current=e.onSaved;let be=D?.state===`starting`||D?.state===`authorizing`,xe=u!==`idle`||be,Se=ce!==Fn(i,o),Ce=i.extra.enabled===!1,we=!_&&(Se||!!L.trim());(0,Q.useEffect)(()=>(he.current=!0,()=>{he.current=!1,ue.current?.abort(),pe.current?.close(),X.current&&Ht(X.current).catch(()=>{})}),[]),(0,Q.useEffect)(()=>{if(!we)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[we]),(0,Q.useEffect)(()=>{if(!x)return;let e=_e.current?.querySelector(`[data-field="${x.field}"]`),t=e?.closest(`details`);t&&(t.open=!0);let n=e?.querySelector(`input,button,textarea`)??e;return n?.setAttribute(`aria-invalid`,`true`),n?.setAttribute(`aria-describedby`,r),x.focus!==!1&&(n??ve.current)?.focus(),()=>{n?.removeAttribute(`aria-invalid`),n?.removeAttribute(`aria-describedby`)}},[x,r]),(0,Q.useEffect)(()=>{if(!D||!be)return;let e=new AbortController;de.current=e;let n;async function r(){try{let n=await Gt(X.current,e.signal);if(e.signal.aborted||(j(n),n.authorizationUrl&&me.current!==n.authorizationUrl&&(me.current=n.authorizationUrl,window.electronAPI?.shell?.openExternalUrl?!(await window.electronAPI.shell.openExternalUrl(n.authorizationUrl)).ok&&!e.signal.aborted&&h(t.oauthOpenFailed):pe.current&&!pe.current.closed&&pe.current.location.replace(n.authorizationUrl)),e.signal.aborted))return;if(n.state===`connected`){fe.current=void 0,pe.current?.close(),w({state:`connected`,toolCount:n.toolCount}),h(``);return}if(n.state===`error`||n.state===`cancelled`){fe.current=void 0,pe.current?.close(),h(n.state===`cancelled`?t.setupCancelled:t.setupAuthFailed),/client.{0,20}(id|registration)|register|registration/i.test(n.error??``)&&P(!0);return}}catch{if(e.signal.aborted)return;Te(),pe.current?.close(),h(t.setupAuthFailed);return}n=setTimeout(()=>void r(),1200)}return r(),()=>{e.abort(),clearTimeout(n)}},[D?.id,be,t.oauthOpenFailed,t.setupCancelled,t.setupAuthFailed]);function Te(){ue.current?.abort(),de.current?.abort(),X.current&&Ht(X.current).catch(()=>{}),X.current=void 0,se(``),re(!1),w(void 0),j(void 0),h(``),S(void 0)}function Ee(e){a(t=>({...t,...e})),Te()}function De(e){l(t=>({...t,...e})),Te()}function Oe(){u===`saving`||be||(u===`checking`&&(Te(),f(`idle`)),we?ae(!0):e.onClose())}function ke(){try{U(Ft(L)),G(`0`),B(``)}catch{B(t.setupImportError),U([])}}function Ae(){let t=H[Number(W)];if(!t)return;let n={...t,id:le.current||t.id,clientKey:e.initialRow.clientKey,extra:{...t.extra,...le.current?{enabled:i.extra.enabled}:{}}};a(n),l(bn(n)),Te(),K(e=>e+1),I(!1),R(``),U([])}function je(e){function n(e,t){return S({field:e,message:t}),!1}if(e.transport===`streamable-http`){try{e.url=Pt(e.url)}catch{return n(`url`,t.setupAddressInvalid)}if(o.mode===`bearer`&&!o.token.trim().replace(/^Bearer\s*/i,``)||o.mode===`apiKey`&&(!o.apiKey.trim()||!o.headerName.trim()))return n(`auth`,t.setupCredentialRequired);if(Sn(e.headers)>=0)return n(`auth`,t.setupHeaderInvalid);if(o.mode===`oauth`&&e.headers.some(e=>e.key.trim().toLowerCase()===`authorization`))return n(`auth`,t.setupOAuthHeaderConflict);if(o.mode===`headers`&&!e.headers.some(e=>e.key.trim()&&(e.value.trim()||e.reference)))return n(`auth`,t.setupCredentialRequired)}else if(!e.command.trim())return n(`command`,t.setupCommandRequired);if(e.timeout!==void 0&&(!Number.isFinite(e.timeout)||e.timeout<=0))return n(`advanced`,t.setupInvalidConfig);try{Rt(e)}catch(r){return n(e.transport===`stdio`?`commandOptions`:`advanced`,r instanceof Error&&r.message.startsWith(`Environment`)?t.setupEnvInvalid:t.setupInvalidConfig)}return!0}async function Me(){h(``),f(`checking`),me.current=``,window.electronAPI?.shell?.openExternalUrl||(pe.current=window.open(`about:blank`,`_blank`),pe.current&&(pe.current.opener=null));try{let e=await Wt(X.current);if(!he.current){pe.current?.close(),X.current&&Ht(X.current).catch(()=>{});return}fe.current=e.id,j(e)}catch{pe.current?.close(),he.current&&h(t.setupAuthFailed)}finally{he.current&&f(`idle`)}}async function Ne(){let r=xn(i,o);if(!je(r))return;let s=e.existingCustomServers.filter(t=>t.clientKey!==e.initialRow.clientKey&&t.id!==le.current),c=new Set([...e.managedServerIds,...s.map(e=>e.id)]);if(r.id=le.current||r.id.trim()||Nt(r,c),!/^[a-zA-Z0-9_-]+$/.test(r.id)||[...c].some(e=>e.replace(/-/g,`_`)===r.id.replace(/-/g,`_`))){S({field:`advanced`,message:n.duplicateServerId});return}Te(),f(`checking`);let l=new AbortController;ue.current=l;try{let n=await Bt(r,le.current||void 0,e.initialRow.extra,l.signal);if(!he.current||l.signal.aborted){Ht(n.id).catch(()=>{});return}X.current=n.id,a(r),se(Fn(r,o));let i=await Vt(n.id,l.signal);if(!he.current||l.signal.aborted)return;w(i),i.state===`error`&&h(Nn(i,t))}catch(e){he.current&&!l.signal.aborted&&h(e.status===409?t.setupConflict:Nn(e,t))}finally{he.current&&ue.current===l&&f(`idle`)}}async function Pe(n=!1){if(!(!X.current||C?.state!==`connected`||oe!==Fn(i,o))){f(`saving`),h(``);try{let t=await Ut(X.current,n);X.current=void 0,await ye.current().catch(()=>{}),t?.reloadRequired?y(!0):e.onClose()}catch(e){let n=e.status;n===404||n===409?(Te(),h(t.setupConflict)):h(t.setupSaveFailed)}finally{he.current&&f(`idle`)}}}async function Fe(){de.current?.abort();let e=X.current;fe.current=void 0,j(void 0),pe.current?.close(),h(t.setupCancelled),f(`checking`);try{e&&await Kt(e)}catch{he.current&&(Te(),h(t.setupCancelled))}finally{he.current&&f(`idle`)}}async function Ie(){D?.authorizationUrl&&(window.electronAPI?.shell?.openExternalUrl?(await window.electronAPI.shell.openExternalUrl(D.authorizationUrl)).ok||h(t.oauthOpenFailed):window.open(D.authorizationUrl,`_blank`,`noopener,noreferrer`))}async function Le(){if(D)try{await qt(X.current,q),ne(``),h(``)}catch{h(t.setupRedirectInvalid)}}let Re=!!X.current&&oe===Fn(i,o)&&(o.mode===`oauth`||o.mode===`auto`&&C?.state===`oauth_required`)&&C?.state!==`connected`,ze=/^(?:https?:\/\/)?(?:localhost|127\.0\.0\.1|\[::1\])(?=[:/]|$)/i.test(i.url.trim()),Be=H[Number(W)];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ee,{open:e.open,onOpenChange:e=>{e||Oe()},children:(0,$.jsxs)(O,{children:[(0,$.jsx)(T,{className:`fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(k,{ref:ge,tabIndex:-1,className:`fixed left-1/2 top-1/2 z-[60] flex h-[min(44rem,calc(100dvh-2rem))] w-[min(42rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay`,onOpenAutoFocus:e=>{e.preventDefault(),ge.current?.focus()},children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge p-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(A,{className:`font-semibold`,children:e.mode===`edit`?t.setupEditTitle:t.setupTitle}),(0,$.jsx)(E,{className:`mt-1 text-sm text-fg-muted`,children:t.setupHint})]}),(0,$.jsx)(`button`,{type:`button`,disabled:u===`saving`||be,onClick:Oe,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover disabled:opacity-50`,"aria-label":n.modalClose,children:(0,$.jsx)(v,{className:`size-5`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-5`,children:[F?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(N,{variant:`ghost`,onClick:()=>I(!1),children:t.setupImportBack}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.setupImportEmpty}),(0,$.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[t.setupImport,(0,$.jsx)(`textarea`,{className:b(Tn,`mt-1.5 min-h-40 font-mono text-xs`),value:L,placeholder:`{"mcpServers": {"docs": {"url": "https://example.com/mcp"}}}`,onChange:e=>{R(e.target.value),U([]),B(``)}})]}),(0,$.jsx)(N,{variant:`secondary`,disabled:!L.trim(),onClick:ke,children:t.setupImportPreview}),z?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:z}):null,Be?(0,$.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.setupImportScope}),(0,$.jsxs)(`label`,{className:`block text-sm font-medium`,children:[t.setupImportChoose,(0,$.jsx)(s,{"aria-label":t.setupImportChoose,className:b(Tn,`mt-1.5`),value:W,onChange:e=>G(e.target.value),children:H.map((e,t)=>(0,$.jsx)(c,{value:String(t),children:e.displayName||e.id||en(e)},t))})]}),(0,$.jsxs)(`p`,{className:`break-all text-sm text-fg-muted`,children:[Be.transport===`stdio`?t.setupUseCommand:t.setupUseUrl,` · `,en(Be)]})]}):null]}):(0,$.jsxs)(`form`,{ref:_e,noValidate:!0,onBlurCapture:e=>{if(e.target instanceof HTMLInputElement&&e.target.dataset.field===`url`&&i.url.trim())try{Pt(i.url)}catch{S({field:`url`,message:t.setupAddressInvalid,focus:!1})}},onSubmit:e=>{e.preventDefault(),Ne()},children:[(0,$.jsxs)(`fieldset`,{disabled:xe||_,className:`min-w-0 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`flex gap-1`,role:`group`,"aria-label":t.transportLabel,children:[`streamable-http`,`stdio`].map(e=>(0,$.jsx)(N,{type:`button`,variant:i.transport===e?`secondary`:`ghost`,"aria-pressed":i.transport===e,onClick:()=>Ee({transport:e}),children:e===`stdio`?t.setupUseCommand:t.setupUseUrl},e))}),(0,$.jsx)(N,{type:`button`,variant:`ghost`,onClick:()=>I(!0),children:t.setupImport})]}),(0,$.jsx)(`div`,{children:(0,$.jsx)(Mn,{row:i,t,variant:`basic`,onUpdate:Ee},`${i.transport}-${te}`)}),i.transport===`streamable-http`?(0,$.jsx)(`div`,{"data-field":`auth`,children:(0,$.jsx)(kn,{allowExisting:!!i.extra.auth||i.headers.some(e=>!!e.reference),draft:o,onChange:De,t})}):null,x?(0,$.jsx)(`p`,{id:r,ref:ve,tabIndex:-1,role:`alert`,className:`text-sm text-danger`,children:x.message}):null,(0,$.jsxs)(`details`,{"data-field":`advanced`,className:`rounded-lg border border-edge p-3`,open:M,onToggle:e=>P(e.currentTarget.open),children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:t.setupAdvanced}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsx)(Mn,{row:i,t,variant:`advanced`,idReadOnly:Y,showOAuth:o.mode===`oauth`,onUpdate:Ee}),i.transport===`streamable-http`&&o.mode!==`headers`&&o.mode!==`existing`?(0,$.jsx)(On,{additional:!0,headers:o.additionalHeaders,onChange:e=>De({additionalHeaders:e}),t}):null]})]}),(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:i.transport===`stdio`?t.setupCommandHostHint:ze?t.setupLocalhostHint:t.setupGatewayHint}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.setupTestNotice})]}),(0,$.jsx)(`button`,{type:`submit`,hidden:!0})]}),_?(0,$.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-fg`,children:t.setupReloadRequired}):null,!F&&!_?(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,"aria-live":`polite`,children:[u===`idle`?null:(0,$.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(g,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),u===`saving`?t.setupSaving:t.setupChecking]}),u===`idle`&&Y&&!Se&&!C&&!m&&!be?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:Ce?t.setupDisabled:e.lastCheck?t.setupLastCheck.replace(`{{count}}`,String(e.lastCheck.toolCount)):t.setupSavedUnchecked}):null,C?.state===`connected`?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-success`,children:[(0,$.jsx)(d,{className:`size-4 shrink-0`,"aria-hidden":!0}),C.toolCount?t.setupConnected.replace(`{{count}}`,String(C.toolCount)):t.setupZeroTools]}),(0,$.jsx)(N,{ref:Z,variant:`secondary`,onClick:()=>re(!0),children:t.viewTools})]}):null,C?.state===`token_required`?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:t.setupNeedsAuth}):null,C?.state===`oauth_required`&&!be?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.setupOAuthRequired}):null,be?(0,$.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-4`,children:[(0,$.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(g,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),t.setupAuthorizing]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[D?.authorizationUrl?(0,$.jsxs)(N,{variant:`secondary`,onClick:()=>void Ie(),children:[(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t.oauthOpenAuthorization]}):null,(0,$.jsx)(N,{variant:`ghost`,onClick:()=>void Fe(),children:t.setupCancelAuth})]}),D?.acceptsRedirect?(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm text-accent-fg`,children:t.setupRemoteFallback}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.setupRedirectHint}),(0,$.jsxs)(`label`,{className:`mt-2 block text-sm`,children:[t.setupRedirectLabel,(0,$.jsx)(`input`,{className:Tn,value:q,onChange:e=>ne(e.target.value)})]}),(0,$.jsx)(N,{className:`mt-2`,disabled:!q.trim(),onClick:()=>void Le(),children:t.setupContinue})]}):null]}):null,m?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-1 text-sm`,children:[(0,$.jsx)(`p`,{className:`text-danger`,children:m}),m!==t.setupSaveFailed&&u!==`saving`?(0,$.jsx)(`p`,{className:`text-fg-muted`,children:t.setupTestFailure}):null]}):null]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge p-4`,children:[(0,$.jsx)(N,{variant:`secondary`,disabled:u===`saving`||be,onClick:Oe,children:Y||_?t.setupClose:n.modalCancel}),_?null:F?(0,$.jsx)(N,{variant:`primary`,disabled:!Be,onClick:Ae,children:t.setupImportApply}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(N,{variant:C?.state===`connected`?`secondary`:`primary`,disabled:xe,onClick:()=>Re?void Me():void Ne(),children:Re?t.setupSignIn:t.setupTestConnection}),C?.state===`connected`&&oe===Fn(i,o)?(0,$.jsxs)($.Fragment,{children:[Ce?(0,$.jsx)(N,{variant:`secondary`,disabled:xe,onClick:()=>void Pe(!0),children:t.setupEnableSave}):null,(0,$.jsx)(N,{variant:`primary`,disabled:xe,"aria-busy":xe,onClick:()=>void Pe(),children:Y?t.setupSaveOnly:t.setupAddConnection})]}):null]})]})]})]})}),(0,$.jsx)(V,{open:ie,title:t.setupUnsavedTitle,description:t.setupUnsavedHint,confirmLabel:t.setupDiscard,cancelLabel:t.setupKeepEditing,onCancel:()=>ae(!1),onConfirm:e.onClose,overlayClassName:`z-[70]`,contentClassName:`z-[70]`}),J?(0,$.jsx)(Zt,{draftId:X.current,serverId:i.id,displayName:i.displayName,returnFocusTo:Z.current,t,onClose:()=>re(!1)}):null]})}var Ln=`builtin`,Rn=`composio`,zn=`xopc-store`;function Bn(e){return Ln}function Vn(e){let t=e.connectorManifest;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;if(n.contractVersion!==1||n.id!==e.name)return null;let r=n.runtime,i=n.auth;if(!r||typeof r!=`object`||Array.isArray(r)||!i||typeof i!=`object`||Array.isArray(i))return null;let a=r,o=i;if(a.type!==`mcp`||typeof a.serverId!=`string`)return null;let s=[`code`,`docs`,`browser`,`data`,`automation`,`custom`].includes(String(n.category??``))?n.category:`custom`,c=o.mode===`oauth`?{mode:`oauth`,...typeof o.clientId==`string`?{clientId:o.clientId}:{}}:o.mode===`apiKey`?{mode:`apiKey`}:{mode:`none`};return{id:e.name,version:e.latestVersion??`store`,displayName:typeof n.displayName==`string`?n.displayName:e.name,description:typeof n.description==`string`?n.description:e.description,category:s,kind:`mcp`,source:`store`,...e.branding?.iconUrl?{branding:{logoUrl:e.branding.iconUrl,source:`registry`}}:{},capabilities:Array.isArray(n.capabilities)?n.capabilities.filter(e=>typeof e==`string`):[],tags:Array.isArray(n.tags)?n.tags.filter(e=>typeof e==`string`):[`store`],auth:c,setup:n.setup&&typeof n.setup==`object`&&!Array.isArray(n.setup)?n.setup:{},runtime:{type:`mcp`,serverId:a.serverId}}}function Hn(e){return e.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t)}function Un(e){return e?.startsWith(`/`)&&!e.startsWith(`//`)?e:`/user-model`}function Wn({embedded:e=!1,onHeaderActionChange:t}){let n=j().filter(e=>e.format===`agent-plugin`),r=C(e=>e.language),o=y(r),s=o.connectorsSettings,c=o.mcpSettings,u=S(e=>e.conversationId),d=!!u,f=i(),[p,m]=a(),h=p.get(`understanding`)===`1`,_=Un(p.get(`returnTo`)),v=!!p.get(`returnTo`)&&!h,x=p.get(`tab`),[w,T]=(0,Q.useState)(!h&&x===`connected`?`connected`:`discover`),E=(0,Q.useRef)(!1),[D,O]=(0,Q.useState)({catalog:[],registryCatalog:[],instances:[],loading:!0,error:null}),[k,A]=(0,Q.useState)(!1),[ee,M]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(1),[I,R]=(0,Q.useState)(void 0),[z,B]=(0,Q.useState)(``),[V,W]=(0,Q.useState)(h||v?p.get(`connector`)??``:``),[G,te]=(0,Q.useState)(Bn(h?`understanding`:`default`)),[K,ne]=(0,Q.useState)(`name`),[J,ie]=(0,Q.useState)(h?`understand`:`all`),[ae,Y]=(0,Q.useState)(null),[se,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(null),[he,_e]=(0,Q.useState)(null),[ye,be]=(0,Q.useState)(null),{data:xe,mutate:Se}=L(d),Ce=xe?.payload?.config,we=(0,Q.useMemo)(()=>Ce===void 0?null:Lt(Ce),[Ce]),Te=we?.servers??[],Ee=D.instances.length+Te.length+n.reduce((e,t)=>e+(t.components?.mcp.length??0),0),[De,Oe]=(0,Q.useState)({});(0,Q.useEffect)(()=>{if(Oe({}),!d||!Ce)return;let e=new AbortController;return Yt(e.signal).then(t=>{e.signal.aborted||Oe(t)}).catch(()=>{}),()=>e.abort()},[d,Ce]);let ke=(0,Q.useCallback)(async()=>{if(!u){O({catalog:[],registryCatalog:[],instances:[],loading:!1,error:null});return}O(e=>({...e,loading:!0,error:null}));try{let[e,t]=await Promise.all([re(),ce()]);O(n=>({catalog:e,registryCatalog:n.registryCatalog,instances:t,loading:!1,error:null}))}catch(e){O({catalog:[],registryCatalog:[],instances:[],loading:!1,error:e instanceof Error?e.message:String(e)})}},[u]);(0,Q.useEffect)(()=>{ke()},[ke]),(0,Q.useEffect)(()=>{E.current||D.loading||d&&!we||(T(h?`discover`:Ee>0?`connected`:`discover`),E.current=!0)},[d,Ee,we,h,D.loading]);let Ae=(0,Q.useCallback)(e=>{E.current=!0,T(e)},[]),je=(0,Q.useMemo)(()=>[{id:Rn,displayName:s.composioSourceName},{id:zn,displayName:s.storeSourceName}],[s.composioSourceName,s.storeSourceName]),Me=(0,Q.useCallback)(async e=>{if(!d||G===`builtin`){O(e=>({...e,registryCatalog:[]})),F(1),R(void 0);return}let t=V.trim(),n=Math.max(e?.page??1,1),r=e?.append??!1,i=G===`all`?je:je.filter(e=>e.id===G);if(i.length!==0){A(!0),r?O(e=>({...e,error:null})):(F(1),R(void 0),O(e=>({...e,registryCatalog:[],error:null})));try{let e=await Promise.all(i.map(async e=>{if(e.id===`composio`){let e=await q({q:t||void 0,page:n,pageSize:24,verification:`experimental`});return{connectors:e.connectors,totalPages:e.meta.totalPages}}let r=await Ye({q:t||void 0,page:n,pageSize:24,sort:K===`source`?`newest`:`downloads`});return{connectors:r.items.flatMap(e=>{let t=Vn(e);return t?[t]:[]}),totalPages:r.meta.totalPages}})),a=Hn(e.flatMap(e=>e.connectors)),o=Math.max(1,...e.map(e=>e.totalPages??1));F(n),R(o),O(e=>({...e,registryCatalog:r?Hn([...e.registryCatalog,...a]):a}))}catch(e){O(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{A(!1)}}},[K,V,G,d,je]);(0,Q.useEffect)(()=>{if(w!==`discover`||D.loading)return;if(G===`builtin`){O(e=>({...e,registryCatalog:[]})),F(1),R(void 0);return}let e=window.setTimeout(()=>{Me()},V.trim()?350:0);return()=>window.clearTimeout(e)},[V,G,Me,D.loading,w]);let Ne=(0,Q.useMemo)(()=>new Set(D.instances.map(e=>e.connectorId)),[D.instances]),Pe=(0,Q.useMemo)(()=>new Map([...D.catalog,...D.registryCatalog].map(e=>[e.id,e])),[D.catalog,D.registryCatalog]);(0,Q.useEffect)(()=>{if(D.loading)return;let e=p.get(`connector`),t=p.get(`instance`);if(!e&&!t)return;let n=D.instances.find(n=>t?n.instanceId===t:n.connectorId===e);if(n)E.current=!0,B(``),de(n.instanceId),pe(n),T(`connected`);else if(e){let t=Pe.get(e);if(!t)return;E.current=!0,te(Bn(h?`understanding`:`default`)),W(``),le(t),T(`discover`)}let r=new URLSearchParams(p);r.delete(`connector`),r.delete(`instance`),r.set(`tab`,n?`connected`:`discover`),m(r,{replace:!0})},[Pe,h,p,m,D.instances,D.loading]);let Fe=(0,Q.useCallback)(async e=>{M(!0),O(e=>({...e,error:null}));try{let t=await H(e);Y(Z(t.definition,{packageName:t.packageName,version:t.version,reviewHash:t.reviewHash,permissions:t.permissions}))}catch(e){O(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{M(!1)}},[]),Ie=(0,Q.useMemo)(()=>new Set(D.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[D.instances]),Le=(0,Q.useCallback)(async e=>{let t=await Xt(e);await Se(),await ke(),t.reloadRequired&&O(e=>({...e,error:c.setupReloadRequired}))},[ke,Se,c.setupReloadRequired]),Re=(0,Q.useCallback)(()=>{be({mode:`add`,row:yn(Te,Ie)})},[Te,Ie]),ze=qe(e=>e.setPageHeader),Be=qe(e=>e.clearPageHeader),Ve=(0,Q.useMemo)(()=>({searchLabel:w===`connected`?s.connectedSearchPlaceholder:s.discoverSearchPlaceholder,search:(0,$.jsx)(Ze,{value:w===`connected`?z:V,onChange:w===`connected`?B:W,placeholder:w===`connected`?s.connectedSearchPlaceholder:s.discoverSearchPlaceholder}),secondary:(0,$.jsx)(St,{onRefresh:w===`connected`&&d?ke:void 0,refreshing:D.loading,refreshLabel:s.refreshConnections,onBrowseCatalog:()=>Ae(`discover`),onAddCustomServer:Re,addLabel:s.addConnection,browseLabel:s.addFromCatalog,customLabel:s.addCustomServerAdvanced,serviceLabel:r.startsWith(`zh`)?`应用连接服务`:`Connection service`,moreActionsLabel:o.capabilitiesHub.moreActions})}),[z,s,V,d,r,ke,o.capabilitiesHub.moreActions,Re,Ae,D.loading,w]);(0,Q.useLayoutEffect)(()=>e?(t?.(Ve),()=>t?.(null)):(ze({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:s.title})}),end:(0,$.jsx)(Qe,{contribution:Ve})}),()=>Be()),[Be,s.title,e,Ve,t,ze]);let He=(0,Q.useMemo)(()=>D.instances.map(e=>({instance:e,value:mt(e,Pe.get(e.connectorId))})),[Pe,D.instances]),Ue=(0,Q.useMemo)(()=>new Map(He.map(({instance:e,value:t})=>[e.instanceId,t])),[He]),We=(0,Q.useMemo)(()=>D.instances.filter(e=>ve(e,z)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=Ue.get(e.instanceId)?.state??`checking`,i=Ue.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[z,Ue,D.instances]),Ge=(0,Q.useMemo)(()=>We.filter(e=>Ue.get(e.instanceId)?.state===`needs_setup`),[Ue,We]),Ke=(0,Q.useMemo)(()=>We.filter(e=>Ue.get(e.instanceId)?.state!==`needs_setup`),[Ue,We]),Je=(0,Q.useMemo)(()=>Te.filter(e=>ge(e,z)),[z,Te]),Xe=(0,Q.useMemo)(()=>{let e=z.trim().toLowerCase();return n.flatMap(t=>(t.components?.mcp??[]).filter(n=>`${t.name} ${n.name}`.toLowerCase().includes(e)).map(e=>({extension:t,server:e})))},[z,n]),$e=We.length+Je.length+Xe.length,tt=(0,Q.useMemo)(()=>D.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1&&X(e)),[D.catalog]),nt=(0,Q.useMemo)(()=>G===`builtin`?tt:G===`all`?Hn([...tt,...D.registryCatalog]):D.registryCatalog,[tt,G,D.registryCatalog]),it=(0,Q.useMemo)(()=>{let e=h?nt.filter(e=>e.understanding?.mode===`activity`):nt;return me(J===`all`?e:e.filter(e=>ft(e).includes(J)),V,K)},[K,V,nt,h,J]),st=(0,Q.useMemo)(()=>dt.filter(e=>nt.some(t=>ft(t).includes(e))),[nt]);(0,Q.useEffect)(()=>{J!==`all`&&!st.includes(J)&&ie(`all`)},[st,J]);let lt=w===`discover`&&G!==`builtin`&&!!(I&&P<I),pt=(0,Q.useMemo)(()=>D.instances.find(e=>e.instanceId===ue)??fe,[ue,fe,D.instances]),ht=(0,Q.useMemo)(()=>[{value:`all`,label:s.discoverSourceAll},{value:Ln,label:s.discoverSourceBuiltin},...je.map(e=>({value:e.id,label:e.displayName}))],[s.discoverSourceAll,s.discoverSourceBuiltin,je]),gt=[{id:`connected`,label:s.tabConnected,count:Ee},{id:`discover`,label:s.tabDiscover}];return(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:b(`mx-auto flex w-full max-w-7xl flex-col gap-6 px-4 sm:px-6 lg:px-8`,e?`pb-7 pt-3 lg:pb-9 lg:pt-4`:`py-7 lg:py-9`),children:[d?null:(0,$.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel px-4 py-3 text-sm text-fg-muted`,children:s.tokenHint}),h?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:s.understandingSetupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.understandingSetupHint})]}),(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`shrink-0`,onClick:()=>f(_),children:s.understandingSetupDone})]}):null,v?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:s.recoverySetupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.recoverySetupHint})]}),(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`min-h-11 shrink-0`,onClick:()=>f(_),children:s.recoverySetupDone})]}):null,(0,$.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,$.jsx)(U,{items:gt,activeTab:w,onChange:Ae,ariaLabel:s.navAria,tabIdPrefix:`connectors-tab`,panelIdPrefix:`connectors-panel`,className:`flex-wrap`})}),D.error?(0,$.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:D.error}):null,w===`connected`&&d?(0,$.jsx)(`div`,{className:`flex flex-col gap-6`,children:D.loading?(0,$.jsx)(`div`,{className:`grid gap-3`,"aria-busy":`true`,"aria-label":s.loading,children:at.slice(0,3).map(e=>(0,$.jsx)(ut,{},e))}):Ee===0?(0,$.jsxs)(`div`,{className:`py-14 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.connectionsEmpty}),(0,$.jsx)(N,{type:`button`,variant:`primary`,className:`mt-4`,onClick:()=>Ae(`discover`),children:s.addFromCatalog})]}):$e===0?(0,$.jsx)(`div`,{className:`py-14 text-center text-sm text-fg-muted`,children:s.connectionsSearchEmpty}):(0,$.jsxs)(`div`,{className:`space-y-6`,children:[Ge.length?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:s.needsAttentionTitle}),(0,$.jsx)(`span`,{className:`text-xs tabular-nums text-amber-700 dark:text-amber-300`,children:Ge.length})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-amber-500/25 bg-amber-500/5`,children:Ge.map(e=>(0,$.jsx)(vn,{instance:e,definition:Pe.get(e.connectorId),highlighted:e.instanceId===he,onOpenDetails:e=>{_e(null),de(e.instanceId),pe(e)},t:s},e.instanceId))})]}):null,Ke.length?(0,$.jsx)(`section`,{children:(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:Ke.map(e=>(0,$.jsx)(vn,{instance:e,definition:Pe.get(e.connectorId),highlighted:e.instanceId===he,onOpenDetails:e=>{_e(null),de(e.instanceId),pe(e)},t:s},e.instanceId))})}):null,Xe.map(({extension:e,server:t})=>(0,$.jsx)(et,{pluginId:e.pluginId,server:t,enabled:e.active},t.id)),Je.length||!z.trim()?(0,$.jsxs)(`section`,{"aria-label":s.customIntegrationsTitle,className:`rounded-xl border border-edge bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,$.jsx)(`h2`,{className:`inline text-sm font-medium text-fg`,children:s.customIntegrationsTitle}),(0,$.jsx)(`span`,{className:`ml-2 text-xs tabular-nums text-fg-subtle`,children:Je.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:s.customIntegrationsHint})]}),(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2 px-4 py-3`,children:(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 text-xs`,onClick:Re,children:s.addCustomServerAdvanced})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Je.map(e=>(0,$.jsx)(tn,{row:e,lastCheck:De[e.id],t:c,cs:s,onEdit:()=>be({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>Le(e)},e.clientKey))})]})]}):null]})}):null,w===`discover`&&d?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[h?null:(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 basis-80 flex-wrap gap-2`,role:`group`,"aria-label":s.taskFilterAria,children:[`all`,...st].map(e=>(0,$.jsx)(`button`,{type:`button`,className:b(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,J===e?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":J===e,onClick:()=>ie(e),children:e===`all`?s.taskAll:s.connectorBenefitHeadings[e]},e))}),(0,$.jsxs)(`div`,{className:b(`ml-auto grid w-full gap-2 sm:flex sm:w-auto sm:justify-end`,h?`grid-cols-1`:`grid-cols-2`),children:[h?null:(0,$.jsx)(`div`,{className:`min-w-0 sm:w-40`,children:(0,$.jsx)(l,{value:G,options:ht,placeholder:s.discoverSourceAll,allowEmpty:!1,ariaLabel:s.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:te})}),(0,$.jsx)(`div`,{className:`min-w-0 sm:w-40`,children:(0,$.jsx)(l,{value:K,options:[{value:`name`,label:s.sortName},{value:`source`,label:s.sortSource}],placeholder:s.sortName,allowEmpty:!1,ariaLabel:s.sortAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:e=>ne(e)})})]})]}),(D.loading||k)&&it.length===0?(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":s.loading,children:at.map(e=>(0,$.jsx)(ct,{},e))}):it.length===0?(0,$.jsx)(`div`,{className:`py-14 text-center text-sm text-fg-muted`,children:s.discoverEmpty}):(0,$.jsxs)(`div`,{className:`relative`,children:[k?(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":s.loading,children:(0,$.jsx)(g,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:it.map(e=>(0,$.jsx)(rt,{connector:e,installed:Ne.has(e.id)||ot(e,D.instances),onInstall:e=>{if(e.source===`store`){Fe(e.id);return}Y(Z(e))},onOpenDetails:e.source===`store`?void 0:le,t:s},e.id))}),lt?(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsxs)(N,{type:`button`,variant:`secondary`,disabled:k||ee,onClick:()=>void Me({page:P+1,append:!0}),children:[k?(0,$.jsx)(g,{className:`size-4 animate-spin`}):null,s.loadMore]})}):null]})]}):null]}),ae?(0,$.jsx)(oe,{draft:ae,onChange:Y,onClose:()=>Y(null),t:s,onInstalled:async e=>{await ke(),await Se(),_e(e.instanceId),Ae(`connected`)}}):null,se?(0,$.jsx)(vt,{connector:se,installed:Ne.has(se.id)||ot(se,D.instances),onClose:()=>le(null),onInstall:e=>Y(Z(e)),t:s}):null,pt?(0,$.jsx)(_n,{instance:pt,definition:Pe.get(pt.connectorId),onClose:()=>{de(null),pe(null)},onChanged:ke,t:s,mcp:c}):null,ye?(0,$.jsx)(In,{open:!0,mode:ye.mode,initialRow:ye.row,lastCheck:ye.mode===`edit`?De[ye.row.id]:void 0,existingCustomServers:Te,config:Ce,managedServerIds:Ie,t:c,cs:s,onClose:()=>be(null),onSaved:async()=>{await Se(),await ke(),Ae(`connected`)}},`${ye.mode}-${ye.row.clientKey}`):null]})})}export{Wn as ConnectorsPage};
|
|
@@ -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"./check-DUBLcKHA.js";import{t as a}from"./copy-Dv6d4Dvw.js";import{t as o}from"./cn-0WouolD0.js";import{a as s,f as c,g as l,h as u,i as d,p as f,s as p,u as m}from"./es2015-DBLcMg5B.js";import{i as h,r as g}from"./dist-CxGUk8J-.js";import{r as _,t as v}from"./copy-to-clipboard-HOJ79TWv.js";import{t as y}from"./button-aIC072nz.js";import{a as b,i as x,n as S,r as C,t as w}from"./dist-CI_fqRk-.js";var T=n(),E=e(t(),1),D=r(),O=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),k=`VisuallyHidden`,A=E.forwardRef((e,t)=>(0,D.jsx)(m.span,{...e,ref:t,style:{...O,...e.style}}));A.displayName=k;var j=A,[M,N]=u(`Tooltip`,[b]),P=b(),F=`TooltipProvider`,I=700,L=`tooltip.open`,[R,z]=M(F),B=e=>{let{__scopeTooltip:t,delayDuration:n=I,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=E.useRef(!0),s=E.useRef(!1),c=E.useRef(0);return E.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,D.jsx)(R,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:E.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:E.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:E.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};B.displayName=F;var V=`Tooltip`,[ee,H]=M(V),U=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,l=z(V,e.__scopeTooltip),u=P(t),[d,p]=E.useState(null),m=f(),h=E.useRef(0),g=o??l.disableHoverableContent,_=s??l.delayDuration,v=E.useRef(!1),[y,b]=c({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(L))):l.onClose(),a?.(e)},caller:V}),S=E.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),C=E.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),w=E.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),T=E.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);return E.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,D.jsx)(x,{...u,children:(0,D.jsx)(ee,{scope:t,contentId:m,open:y,stateAttribute:S,trigger:d,onTriggerChange:p,onTriggerEnter:E.useCallback(()=>{l.isOpenDelayedRef.current?T():C()},[l.isOpenDelayedRef,T,C]),onTriggerLeave:E.useCallback(()=>{g?w():(window.clearTimeout(h.current),h.current=0)},[w,g]),onOpen:C,onClose:w,disableHoverableContent:g,children:n})})};U.displayName=V;var W=`TooltipTrigger`,G=E.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=H(W,n),a=z(W,n),o=P(n),s=h(t,E.useRef(null),i.onTriggerChange),c=E.useRef(!1),u=E.useRef(!1),d=E.useCallback(()=>c.current=!1,[]);return E.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,D.jsx)(w,{asChild:!0,...o,children:(0,D.jsx)(m.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:l(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:l(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:l(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:l(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:l(e.onBlur,i.onClose),onClick:l(e.onClick,i.onClose)})})});G.displayName=W;var K=`TooltipPortal`,[te,ne]=M(K,{forceMount:void 0}),q=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=H(K,t);return(0,D.jsx)(te,{scope:t,forceMount:n,children:(0,D.jsx)(d,{present:n||a.open,children:(0,D.jsx)(s,{asChild:!0,container:i,children:r})})})};q.displayName=K;var J=`TooltipContent`,Y=E.forwardRef((e,t)=>{let n=ne(J,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=H(J,e.__scopeTooltip);return(0,D.jsx)(d,{present:r||o.open,children:o.disableHoverableContent?(0,D.jsx)(X,{side:i,...a,ref:t}):(0,D.jsx)(re,{side:i,...a,ref:t})})}),re=E.forwardRef((e,t)=>{let n=H(J,e.__scopeTooltip),r=z(J,e.__scopeTooltip),i=E.useRef(null),a=h(t,i),[o,s]=E.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=E.useCallback(()=>{s(null),d(!1)},[d]),p=E.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=le(r,ce(r,n.getBoundingClientRect())),a=ue(t.getBoundingClientRect());s(fe([...i,...a])),d(!0)},[d]);return E.useEffect(()=>()=>f(),[f]),E.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),E.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!de(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,D.jsx)(X,{...e,ref:a})}),[ie,ae]=M(V,{isInside:!1}),oe=g(`TooltipContent`),X=E.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=H(J,n),l=P(n),{onClose:u}=c;return E.useEffect(()=>(document.addEventListener(L,u),()=>document.removeEventListener(L,u)),[u]),E.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,D.jsx)(p,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,D.jsxs)(C,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,D.jsx)(oe,{children:r}),(0,D.jsx)(ie,{scope:n,isInside:!0,children:(0,D.jsx)(j,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Y.displayName=J;var Z=`TooltipArrow`,se=E.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=P(n);return ae(Z,n).isInside?null:(0,D.jsx)(S,{...i,...r,ref:t})});se.displayName=Z;function ce(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function le(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ue(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function de(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function fe(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),pe(t)}function pe(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Q=B,$=U,me=G,he=q,ge=Y,_e=`!z-[10000] max-w-[min(28rem,90vw)] rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-snug text-fg shadow-lg`,ve=`block w-full min-w-0 truncate rounded border border-transparent bg-surface-hover px-2 py-1.5 font-mono text-xs text-fg focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`,ye=`inline-flex w-[5.25rem] shrink-0 items-center justify-center gap-1 px-2 py-1 text-xs`;function be(e){let t=(0,T.c)(38),{label:n,text:r,compact:s,labels:c,monospace:l}=e,u=l===void 0?!0:l,d=(0,E.useRef)(null),[f,p]=(0,E.useState)(!1),[m,h]=(0,E.useState)(!1),g;t[0]===r?g=t[1]:(g=async()=>{if(h(!1),await v(r)){p(!0),window.setTimeout(()=>p(!1),2e3);return}_(d.current),h(!0),window.setTimeout(()=>h(!1),2500)},t[0]=r,t[1]=g);let b=g,x=s&&`gap-0.5`,S;t[2]===x?S=t[3]:(S=o(`flex min-w-0 flex-col gap-1`,x),t[2]=x,t[3]=S);let C;t[4]===n?C=t[5]:(C=n?(0,D.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n}):null,t[4]=n,t[5]=C);let w=n??c.copy,O=!u&&`font-sans`,k;t[6]===O?k=t[7]:(k=o(ve,O),t[6]=O,t[7]=k);let A;t[8]!==w||t[9]!==k||t[10]!==r?(A=(0,D.jsx)(me,{asChild:!0,children:(0,D.jsx)(`input`,{ref:d,readOnly:!0,type:`text`,value:r,"aria-label":w,className:k,onFocus:xe})}),t[8]=w,t[9]=k,t[10]=r,t[11]=A):A=t[11];let j;t[12]===r?j=t[13]:(j=(0,D.jsx)(he,{children:(0,D.jsx)(ge,{side:`top`,sideOffset:6,collisionPadding:12,className:_e,children:(0,D.jsx)(`span`,{className:`break-all`,children:r})})}),t[12]=r,t[13]=j);let M;t[14]!==j||t[15]!==A?(M=(0,D.jsx)(`div`,{className:`min-w-0 overflow-hidden`,children:(0,D.jsxs)($,{children:[A,j]})}),t[14]=j,t[15]=A,t[16]=M):M=t[16];let N;t[17]===b?N=t[18]:(N=()=>void b(),t[17]=b,t[18]=N);let P;t[19]===f?P=t[20]:(P=f?(0,D.jsx)(i,{className:`size-3.5 shrink-0`}):(0,D.jsx)(a,{className:`size-3.5 shrink-0`}),t[19]=f,t[20]=P);let F=f?c.copied:c.copy,I;t[21]===F?I=t[22]:(I=(0,D.jsx)(`span`,{className:`truncate`,children:F}),t[21]=F,t[22]=I);let L;t[23]!==N||t[24]!==P||t[25]!==I?(L=(0,D.jsxs)(y,{type:`button`,variant:`secondary`,className:ye,onClick:N,children:[P,I]}),t[23]=N,t[24]=P,t[25]=I,t[26]=L):L=t[26];let R;t[27]!==M||t[28]!==L?(R=(0,D.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_5.25rem] items-center gap-2`,children:[M,L]}),t[27]=M,t[28]=L,t[29]=R):R=t[29];let z;t[30]!==m||t[31]!==c.copyFailed?(z=m?(0,D.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:c.copyFailed}):null,t[30]=m,t[31]=c.copyFailed,t[32]=z):z=t[32];let B;return t[33]!==R||t[34]!==z||t[35]!==S||t[36]!==C?(B=(0,D.jsx)(Q,{delayDuration:300,children:(0,D.jsxs)(`div`,{className:S,children:[C,R,z]})}),t[33]=R,t[34]=z,t[35]=S,t[36]=C,t[37]=B):B=t[37],B}function xe(e){return e.currentTarget.select()}function Se(e){let t=(0,T.c)(12),{rows:n,compact:r,labels:i}=e,a=r&&`gap-1.5`,s;t[0]===a?s=t[1]:(s=o(`flex min-w-0 flex-col gap-2`,a),t[0]=a,t[1]=s);let c;if(t[2]!==r||t[3]!==i||t[4]!==n){let e;t[6]!==r||t[7]!==i?(e=e=>(0,D.jsx)(be,{label:e.label,text:e.text,compact:r,labels:i},e.key),t[6]=r,t[7]=i,t[8]=e):e=t[8],c=n.map(e),t[2]=r,t[3]=i,t[4]=n,t[5]=c}else c=t[5];let l;return t[9]!==s||t[10]!==c?(l=(0,D.jsx)(`div`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}export{Q as a,he as i,Se as n,$ as o,ge as r,me as s,be as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){return e?e.toLowerCase().startsWith(`zh`)?`zh`:`en`:`default`}var t={default:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}),en:new Intl.DateTimeFormat(`en-US`,{dateStyle:`medium`,timeStyle:`short`}),zh:new Intl.DateTimeFormat(`zh-CN`,{dateStyle:`medium`,timeStyle:`short`})},n={default:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}),en:new Intl.DateTimeFormat(`en-US`,{dateStyle:`medium`}),zh:new Intl.DateTimeFormat(`zh-CN`,{dateStyle:`medium`})},r={default:new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),en:new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})},i={default:new Intl.DateTimeFormat(void 0,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}),en:new Intl.DateTimeFormat(`en-US`,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})},a={en:new Intl.RelativeTimeFormat(`en-US`,{numeric:`auto`}),zh:new Intl.RelativeTimeFormat(`zh-CN`,{numeric:`auto`})};function o(n,r){return t[e(r)].format(n)}function s(t,r){return n[e(r)].format(t)}function c(t,n){return r[e(n)].format(t)}function l(t,n){return i[e(n)].format(t)}function u(t,n,r){return a[e(r)===`zh`?`zh`:`en`].format(t,n)}export{c as a,u as i,o as n,l as r,s 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"./chevron-left-DqFhpbvK.js";import{t as a}from"./chevron-right-BweFrslA.js";import{c as ee,l as te,u as ne}from"./popover-select-DGKUpVsz.js";import{t as re}from"./cn-0WouolD0.js";import{n as ie}from"./locale-store-BKyOF23r.js";import{c as ae,n as oe,s as se}from"./dist-C3DSFZCi.js";import{Jc as ce}from"./index-Bo70AuAq.js";var o=e(t(),1),le=n();function s(e){return String(e).padStart(2,`0`)}function ue(e){return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`}function de(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2])-1,i=Number(t[3]),a=new Date(n,r,i,12);return a.getFullYear()===n&&a.getMonth()===r&&a.getDate()===i?a:null}function fe(e,t){let n=de(e);return n?t===`zh`?`${n.getFullYear()}/${s(n.getMonth()+1)}/${s(n.getDate())}`:new Intl.DateTimeFormat(`en`,{year:`numeric`,month:`short`,day:`numeric`}).format(n):``}var c=r();function pe(e,t){let n=new Date(e.getFullYear(),e.getMonth(),1,12),r=(n.getDay()-t+7)%7;return Array.from({length:42},(e,t)=>new Date(n.getFullYear(),n.getMonth(),1-r+t,12))}function l(e){let t=(0,le.c)(105),{value:n,onChange:r,disabled:s,className:l,ariaLabel:ve,placeholder:ye,min:u,max:d}=e,f=ie(_e),p=f===`zh`?`zh-CN`:`en`,be;t[0]===n?be=t[1]:(be=de(n),t[0]=n,t[1]=be);let m=be,[h,xe]=(0,o.useState)(!1),[Se,Ce]=(0,o.useState)(null),g;t[2]===m?g=t[3]:(g=()=>m??new Date,t[2]=m,t[3]=g);let[_,we]=(0,o.useState)(g),Te=ee(Se),Ee=ne(te(),Te!==null),v=+(f===`zh`),y,b;t[4]!==h||t[5]!==n?(y=()=>{if(!h)return;let e=de(n);e&&we(e)},b=[h,n],t[4]=h,t[5]=n,t[6]=y,t[7]=b):(y=t[6],b=t[7]),(0,o.useEffect)(y,b);let x;t[8]!==_||t[9]!==v?(x=pe(_,v),t[8]=_,t[9]=v,t[10]=x):x=t[10];let De=x,S;if(t[11]!==p||t[12]!==v){let e=new Date(2026,7,23,12);S=Array.from({length:7},(t,n)=>{let r=new Date(e);return r.setDate(e.getDate()+v+n),new Intl.DateTimeFormat(p,{weekday:`narrow`}).format(r)}),t[11]=p,t[12]=v,t[13]=S}else S=t[13];let Oe=S,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=ue(new Date),t[14]=C):C=t[14];let w=C,T;t[15]===m?T=t[16]:(T=m?ue(m):``,t[15]=m,t[16]=T);let E=T,D;t[17]!==p||t[18]!==_?(D=new Intl.DateTimeFormat(p,{year:`numeric`,month:`long`}).format(_),t[17]=p,t[18]=_,t[19]=D):D=t[19];let ke=D,O;t[20]===r?O=t[21]:(O=e=>{r(e),xe(!1)},t[20]=r,t[21]=O);let k=O,Ae=ae,je=s&&`cursor-not-allowed opacity-50`,A;t[22]!==l||t[23]!==je?(A=re(`flex h-10 w-full min-w-0 items-center justify-between gap-3 rounded-lg bg-surface-hover px-3 text-left text-sm text-fg outline-none transition-colors`,`hover:bg-surface-active focus-visible:ring-2 focus-visible:ring-accent/40`,je,l),t[22]=l,t[23]=je,t[24]=A):A=t[24];let Me=!n&&`text-fg-subtle`,j;t[25]===Me?j=t[26]:(j=re(`min-w-0 truncate tabular-nums`,Me),t[25]=Me,t[26]=j);let M;t[27]!==f||t[28]!==ye||t[29]!==n?(M=fe(n,f)||ye||(f===`zh`?`选择日期`:`Select date`),t[27]=f,t[28]=ye,t[29]=n,t[30]=M):M=t[30];let N;t[31]!==j||t[32]!==M?(N=(0,c.jsx)(`span`,{className:j,children:M}),t[31]=j,t[32]=M,t[33]=N):N=t[33];let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,c.jsx)(ce,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[34]=P):P=t[34];let F;t[35]!==ve||t[36]!==s||t[37]!==A||t[38]!==N?(F=(0,c.jsx)(se,{asChild:!0,children:(0,c.jsxs)(`button`,{ref:Ce,type:`button`,disabled:s,"aria-label":ve,className:A,children:[N,P]})}),t[35]=ve,t[36]=s,t[37]=A,t[38]=N,t[39]=F):F=t[39];let Ne=ae,Pe=Te??void 0,Fe=ae,Ie=re(Ee,`w-[19rem] rounded-2xl border border-edge bg-surface-overlay p-3 shadow-float outline-none`),Le=f===`zh`?`上个月`:`Previous month`,I,L;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>we(ge),L=(0,c.jsx)(i,{className:`size-4`,"aria-hidden":!0}),t[40]=I,t[41]=L):(I=t[40],L=t[41]);let R;t[42]===Le?R=t[43]:(R=(0,c.jsx)(`button`,{type:`button`,className:`flex size-8 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/40`,"aria-label":Le,onClick:I,children:L}),t[42]=Le,t[43]=R);let z;t[44]===ke?z=t[45]:(z=(0,c.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:ke}),t[44]=ke,t[45]=z);let Re=f===`zh`?`下个月`:`Next month`,B,V;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>we(he),V=(0,c.jsx)(a,{className:`size-4`,"aria-hidden":!0}),t[46]=B,t[47]=V):(B=t[46],V=t[47]);let H;t[48]===Re?H=t[49]:(H=(0,c.jsx)(`button`,{type:`button`,className:`flex size-8 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/40`,"aria-label":Re,onClick:B,children:V}),t[48]=Re,t[49]=H);let U;t[50]!==R||t[51]!==z||t[52]!==H?(U=(0,c.jsxs)(`div`,{className:`flex h-10 items-center justify-between gap-2 px-1`,children:[R,z,H]}),t[50]=R,t[51]=z,t[52]=H,t[53]=U):U=t[53];let W;t[54]===Oe?W=t[55]:(W=(0,c.jsx)(`div`,{className:`mt-2 grid grid-cols-7`,"aria-hidden":!0,children:Oe.map(me)}),t[54]=Oe,t[55]=W);let G;if(t[56]!==De||t[57]!==p||t[58]!==d||t[59]!==u||t[60]!==k||t[61]!==E||t[62]!==_){let e;t[64]!==p||t[65]!==d||t[66]!==u||t[67]!==k||t[68]!==E||t[69]!==_?(e=e=>{let t=ue(e),n=t===E,r=t===w,i=e.getMonth()!==_.getMonth(),a=!!(u&&t<u||d&&t>d);return(0,c.jsx)(`button`,{type:`button`,role:`gridcell`,"aria-selected":n,"aria-disabled":a,disabled:a,"aria-label":new Intl.DateTimeFormat(p,{dateStyle:`full`}).format(e),className:re(`mx-auto flex size-9 items-center justify-center rounded-xl text-sm tabular-nums text-fg transition-colors`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,i&&`text-fg-disabled`,a&&`cursor-not-allowed opacity-35 hover:bg-transparent`,r&&!n&&`bg-accent-soft font-semibold text-accent-fg`,n&&`bg-accent font-semibold text-on-accent hover:bg-accent-hover`),onClick:()=>k(t),children:e.getDate()},t)},t[64]=p,t[65]=d,t[66]=u,t[67]=k,t[68]=E,t[69]=_,t[70]=e):e=t[70],G=De.map(e),t[56]=De,t[57]=p,t[58]=d,t[59]=u,t[60]=k,t[61]=E,t[62]=_,t[63]=G}else G=t[63];let K;t[71]===G?K=t[72]:(K=(0,c.jsx)(`div`,{className:`grid grid-cols-7 gap-y-1`,role:`grid`,children:G}),t[71]=G,t[72]=K);let ze=!n,q;t[73]===k?q=t[74]:(q=()=>k(``),t[73]=k,t[74]=q);let Be=f===`zh`?`清除`:`Clear`,J;t[75]!==ze||t[76]!==q||t[77]!==Be?(J=(0,c.jsx)(`button`,{type:`button`,disabled:ze,className:`rounded-lg px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg disabled:pointer-events-none disabled:opacity-35`,onClick:q,children:Be}),t[75]=ze,t[76]=q,t[77]=Be,t[78]=J):J=t[78];let Ve=!!(u&&w<u||d&&w>d),Y;t[79]===k?Y=t[80]:(Y=()=>k(w),t[79]=k,t[80]=Y);let He=f===`zh`?`今天`:`Today`,X;t[81]!==Ve||t[82]!==Y||t[83]!==He?(X=(0,c.jsx)(`button`,{type:`button`,disabled:Ve,className:`rounded-lg bg-accent-soft px-2.5 py-1.5 text-xs font-medium text-accent-fg hover:bg-accent-soft/80 disabled:pointer-events-none disabled:opacity-35`,onClick:Y,children:He}),t[81]=Ve,t[82]=Y,t[83]=He,t[84]=X):X=t[84];let Z;t[85]!==J||t[86]!==X?(Z=(0,c.jsxs)(`div`,{className:`mt-2 flex items-center justify-between px-1 pt-1`,children:[J,X]}),t[85]=J,t[86]=X,t[87]=Z):Z=t[87];let Ue;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,c.jsx)(oe,{className:`fill-surface-overlay`}),t[88]=Ue):Ue=t[88];let Q;t[89]!==Fe.Content||t[90]!==Ie||t[91]!==U||t[92]!==W||t[93]!==K||t[94]!==Z?(Q=(0,c.jsxs)(Fe.Content,{align:`start`,sideOffset:6,collisionPadding:12,className:Ie,children:[U,W,K,Z,Ue]}),t[89]=Fe.Content,t[90]=Ie,t[91]=U,t[92]=W,t[93]=K,t[94]=Z,t[95]=Q):Q=t[95];let $;t[96]!==Ne.Portal||t[97]!==Pe||t[98]!==Q?($=(0,c.jsx)(Ne.Portal,{container:Pe,children:Q}),t[96]=Ne.Portal,t[97]=Pe,t[98]=Q,t[99]=$):$=t[99];let We;return t[100]!==h||t[101]!==Ae.Root||t[102]!==F||t[103]!==$?(We=(0,c.jsxs)(Ae.Root,{open:h,onOpenChange:xe,children:[F,$]}),t[100]=h,t[101]=Ae.Root,t[102]=F,t[103]=$,t[104]=We):We=t[104],We}function me(e,t){return(0,c.jsx)(`div`,{className:`flex h-8 items-center justify-center text-[11px] font-medium text-fg-subtle`,children:e},`${e}-${t}`)}function he(e){return new Date(e.getFullYear(),e.getMonth()+1,1,12)}function ge(e){return new Date(e.getFullYear(),e.getMonth()-1,1,12)}function _e(e){return e.language}export{l 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"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./check-DUBLcKHA.js";import{v as o}from"./use-file-preview-expanded-DZUWxdhm.js";import{t as s}from"./search-DA7gz22f.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./cn-0WouolD0.js";import{t as u}from"./button-aIC072nz.js";import{a as d,i as f,o as p,r as m,s as h}from"./copy-text-row-C7egVuKr.js";import{qc as g}from"./index-Bo70AuAq.js";var _=n(),v=e(t(),1),y=r(),b=`!z-[10000] max-w-[min(28rem,90vw)] rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-relaxed text-fg shadow-lg`;function x(e){let t=(0,_.c)(31),{candidates:n,selectedIds:r,labels:x,disabled:C,borderless:w,getTaskHref:T,onChange:E}=e,D=w===void 0?!1:w,[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(``),M;t[0]===A?M=t[1]:(M=A.trim().toLocaleLowerCase(),t[0]=A,t[1]=M);let N=M,P;if(t[2]!==n||t[3]!==N){let e;t[5]===N?e=t[6]:(e=e=>!N||e.title.toLocaleLowerCase().includes(N),t[5]=N,t[6]=e),P=n.filter(e).slice(0,20),t[2]=n,t[3]=N,t[4]=P}else P=t[4];let F=P,I;t[7]!==n||t[8]!==C||t[9]!==T||t[10]!==x.remove||t[11]!==E||t[12]!==r?(I=r.length>0?(0,y.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-2`,children:r.map(e=>{let t=n.find(t=>t.id===e);return t?(0,y.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-lg bg-surface-hover px-2.5 py-1.5 text-xs text-fg-muted`,children:[(0,y.jsxs)(p,{children:[(0,y.jsx)(h,{asChild:!0,children:T?(0,y.jsx)(i,{to:T(t.id),className:`min-w-0 whitespace-normal break-words [overflow-wrap:anywhere] rounded-sm outline-none transition-colors hover:text-fg hover:underline focus-visible:ring-2 focus-visible:ring-accent/50`,children:t.title}):(0,y.jsx)(`span`,{className:`min-w-0 whitespace-normal break-words [overflow-wrap:anywhere]`,children:t.title})}),(0,y.jsx)(f,{children:(0,y.jsx)(m,{side:`top`,sideOffset:6,collisionPadding:12,className:b,children:(0,y.jsx)(`span`,{className:`break-words`,children:t.title})})})]}),(0,y.jsx)(`button`,{type:`button`,className:`shrink-0 rounded text-fg-subtle transition-colors hover:text-fg`,"aria-label":x.remove.replace(`{{task}}`,t.title),disabled:C,onClick:()=>E(r.filter(e=>e!==t.id)),children:(0,y.jsx)(c,{className:`size-3.5`,"aria-hidden":!0})})]},t.id):null})}):null,t[7]=n,t[8]=C,t[9]=T,t[10]=x.remove,t[11]=E,t[12]=r,t[13]=I):I=t[13];let L;t[14]!==D||t[15]!==n.length||t[16]!==C||t[17]!==x.link||t[18]!==x.linked||t[19]!==x.noCandidates||t[20]!==x.noMatches||t[21]!==x.searchPlaceholder||t[22]!==F||t[23]!==E||t[24]!==O||t[25]!==A||t[26]!==r?(L=n.length>0?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(u,{type:`button`,variant:`secondary`,className:l(`w-fit rounded-lg`,D&&`border-0 bg-surface-hover shadow-none`),disabled:C,"aria-expanded":O,onClick:()=>k(S),children:[(0,y.jsx)(o,{className:`size-4`,"aria-hidden":!0}),r.length>0?x.linked.replace(`{{count}}`,String(r.length)):x.link,(0,y.jsx)(g,{className:l(`size-3.5 transition-transform`,O&&`rotate-180`),"aria-hidden":!0})]}),O?(0,y.jsxs)(`div`,{className:l(`grid gap-2 rounded-lg p-2`,D?`bg-surface-hover`:`border border-edge bg-surface-base`),children:[(0,y.jsxs)(`label`,{className:`relative block`,children:[(0,y.jsx)(s,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,y.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),placeholder:x.searchPlaceholder,className:l(`h-9 w-full rounded-md bg-surface-panel pl-8 pr-3 text-sm text-fg outline-none placeholder:text-fg-subtle`,D?`focus:ring-2 focus:ring-accent/30`:`border border-edge focus:border-accent`),autoFocus:!0})]}),F.length>0?(0,y.jsx)(`div`,{className:`grid max-h-52 gap-1 overflow-y-auto`,children:F.map(e=>{let t=r.includes(e.id);return(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":t,disabled:C,onClick:()=>E(t?r.filter(t=>t!==e.id):[...r,e.id]),className:l(`flex items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm transition-colors`,t?`bg-accent-soft text-accent-fg`:`text-fg hover:bg-surface-hover`),children:[(0,y.jsx)(`span`,{className:l(`flex size-4 shrink-0 items-center justify-center rounded`,D?t?`bg-accent text-on-accent`:`bg-surface-active`:t?`border border-accent bg-accent text-on-accent`:`border border-edge`),children:t?(0,y.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-normal break-words [overflow-wrap:anywhere]`,children:e.title})]},e.id)})}):(0,y.jsx)(`p`,{className:`px-2 py-3 text-center text-sm text-fg-subtle`,children:x.noMatches})]}):null]}):(0,y.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:x.noCandidates}),t[14]=D,t[15]=n.length,t[16]=C,t[17]=x.link,t[18]=x.linked,t[19]=x.noCandidates,t[20]=x.noMatches,t[21]=x.searchPlaceholder,t[22]=F,t[23]=E,t[24]=O,t[25]=A,t[26]=r,t[27]=L):L=t[27];let R;return t[28]!==I||t[29]!==L?(R=(0,y.jsx)(d,{delayDuration:300,children:(0,y.jsxs)(`div`,{className:`min-w-0 grid gap-2`,children:[I,L]})}),t[28]=I,t[29]=L,t[30]=R):R=t[30],R}function S(e){return!e}export{x 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"./x-B_N4OPjy.js";import{t as a}from"./messages-B7VtMXec.js";import{n as o}from"./locale-store-BKyOF23r.js";import{qc as s,t as c}from"./index-Bo70AuAq.js";import{t as l}from"./desktop-pet-sprite-BP6iMVw1.js";var u=e(t(),1),d=n(),f=9e4,p=3e4,m=20*6e4,h=45e3,g=45*6e4,_=58;function v(e,t){return e.state===`running`&&t-(e.startedAt??e.timestamp)>=f}function y(e,t){return e.state===`running`&&t-e.timestamp>=p}function b(e,t,n){if(e.progress){let t=`${e.progress.completed}/${e.progress.total}`;return e.action.includes(t)?``:` · ${t}`}return e.detail&&!e.action.includes(e.detail)?n.replace(/\{\{detail\}\}/g,e.detail):e.state===`running`?` · ${Math.max(1,Math.floor((t-e.timestamp)/1e3))}s`:``}function x(e,t){if(e.state!==`success`||!e.publicSummary)return;let n=e.publicSummary.replace(/\s+/g,` `).trim(),r=n.length>_?`${n.slice(0,_-1)}…`:n;return t.replace(/\{\{summary\}\}/g,r)}function S(e,t,n){if(y(e,t))return n.stale;if(v(e,t))return n.longRunning}function ee(e,t){let n=e.feedback?.reassurance;return n?t[n]:void 0}function te(e){let t=e.now-e.lastActivityAt,n=t>=m?(t-m)%g:1/0;return e.bubbleEnabled&&e.behaviorMode!==`focus`&&e.proactiveTipsEnabled&&(!e.remindersPausedUntil||e.now>=e.remindersPausedUntil)&&!e.collapsed&&e.queuedCount===0&&e.activeCount===0&&n<=h&&e.now>=e.dismissedUntil}function C(e,t,n){return e.state===`waiting`||e.state===`error`?`action_required`:e.state===`success`?t===`focus`?`ambient`:`notice`:y(e,n)||t===`playful`||t===`companion`&&v(e,n)?`notice`:`ambient`}function w(e,t,n,r){let i=C(e,t,n);return i===`action_required`?!0:r&&n<r?!1:i===`notice`}var T=8e3;function E(e,t){let n=e?.runId===t.runId,r=t.feedback?.sensitivity===`private`;return{...n?e:void 0,...t,startedAt:n?e.startedAt??e.timestamp:t.timestamp,publicSummary:r?void 0:t.publicSummary??(n?e.publicSummary:void 0),feedback:t.feedback??(n?e.feedback:void 0),expiresAt:t.state===`success`?t.timestamp+T:void 0}}function D(e,t){let n={...e};for(let e of t){let t=n[e.conversationId];t?.runId===e.runId&&e.sequence<=t.sequence||(n[e.conversationId]=E(t,e))}return n}function O(e,t){return t?.runId===e.runId&&t.state===e.state}function k(e,t){let n={error:0,waiting:1,running:2,success:3};return e.filter(e=>!e.expiresAt||e.expiresAt>t).sort((e,t)=>n[e.state]-n[t.state]||t.timestamp-e.timestamp).slice(0,3)}function A(e){return e?`/chat/${e.conversationId}`:void 0}var j=r();function M(e){return e?e.state===`error`?`concern`:e.state===`success`?`success`:e.animation??c(e.phase):`idle`}function N(e,t){if(!e?.length)return;let n=t.sequence;for(let e of`${t.conversationId}:${t.runId}`)n=n*31+e.charCodeAt(0)>>>0;return e[n%e.length]}function P(e,t,n){let r=e.persona?.phrases??n;if(t.state===`success`)return N(r?.success,t);if(t.state===`waiting`)return N(r?.waiting,t);if(t.state===`error`)return N(r?.error,t)}function F(e,t,n){return e?n?`${e} · ${t}`:e:t}function I(e,t){let n=e.feedback?.nextAction?.type;if(n===`confirm`)return t.needsInput;if(n===`review_error`)return t.reviewIssue;if(n===`open_session`)return t.open;if(e.state===`waiting`)return t.needsInput;if(e.state===`error`)return t.reviewIssue;if(e.state===`success`)return t.open}function ne(){let e=Date.now();return{prefs:{enabled:!0,showOnStartup:!1,selectedPetId:`ember`,alwaysOnTop:!0,bubbleEnabled:!0,clickThroughWhenIdle:!1,muted:!1,behaviorMode:`companion`,proactiveTipsEnabled:!0,interactionEnabled:!0,reducedMotion:!1,sizePercent:100,collapsed:!1},relationship:{firstMetAt:e,lastSeenAt:e,completedTaskCount:0,unlockedReactions:[],recentCompletedRunIds:[]},pets:[],visible:!0,customPetsDir:``,petIssues:[],activities:[]}}function L(){let e=a(o(e=>e.language)).desktopPet,[t,n]=(0,u.useState)(ne),[r,c]=(0,u.useState)({}),[d,f]=(0,u.useState)({}),[p,m]=(0,u.useState)(Date.now()),[h,_]=(0,u.useState)(()=>Date.now()),[v,y]=(0,u.useState)(0),[C,T]=(0,u.useState)(null),E=(0,u.useRef)(null),L=(0,u.useRef)(!1),R=(0,u.useRef)(null),z=(0,u.useRef)(null),B=(0,u.useRef)(null),V=(0,u.useMemo)(()=>t.pets.find(e=>e.id===t.prefs.selectedPetId)??t.pets[0],[t]),H=Math.min(1.4,Math.max(.7,t.prefs.sizePercent/100)),U=(0,u.useMemo)(()=>k(Object.values(r),p),[r,p]),W=(0,u.useMemo)(()=>t.prefs.bubbleEnabled?U.filter(e=>!O(e,d[e.conversationId])&&w(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)):[],[U,d,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),G=(0,u.useMemo)(()=>t.prefs.bubbleEnabled?U.filter(e=>O(e,d[e.conversationId])&&w(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)).length:0,[U,d,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),K=W[0]??U[0],q=p-h>20*6e4&&(new Date(p).getHours()>=23||new Date(p).getHours()<7)?`sleep`:`idle`,J=C??(K?M(K):q),Y=e.personaPhrases[V?.persona?.tone??`calm`],X=te({bubbleEnabled:t.prefs.bubbleEnabled,behaviorMode:t.prefs.behaviorMode,proactiveTipsEnabled:t.prefs.proactiveTipsEnabled,remindersPausedUntil:t.prefs.remindersPausedUntil,collapsed:t.prefs.collapsed,queuedCount:W.length,activeCount:U.length,now:p,lastActivityAt:h,dismissedUntil:v});(0,u.useEffect)(()=>{document.documentElement.dataset.desktopPet=`true`;let e=window.electronAPI?.pet;if(!e)return;let t=e=>{n(e),c(t=>D(t,e.activities))};e.getState().then(t).catch(()=>{});let r=e.onStateChanged(t),i=e.onEvent(e=>c(t=>(_(Date.now()),D(t,[e])))),a=window.setInterval(()=>m(Date.now()),1e3);return()=>{delete document.documentElement.dataset.desktopPet,r(),i(),window.clearInterval(a)}},[]),(0,u.useEffect)(()=>{if(!t.relationshipMoment)return;T(t.relationshipMoment===`first_meeting`?`wake`:`greet`);let e=window.setTimeout(()=>T(null),1400);return()=>window.clearTimeout(e)},[t.relationshipMoment]),(0,u.useLayoutEffect)(()=>{let e=R.current,t=window.electronAPI?.pet;if(!e||!t)return;let n=()=>{let e=[z.current,B.current].filter(e=>e!==null).map(e=>e.getBoundingClientRect());if(!e.length)return;let n=Math.min(...e.map(e=>e.left)),r=Math.min(...e.map(e=>e.top)),i=Math.max(...e.map(e=>e.right)),a=Math.max(...e.map(e=>e.bottom));t.setContentSize({width:Math.ceil(i-n),height:Math.ceil(a-r)})},r=new ResizeObserver(n);return r.observe(e),z.current&&r.observe(z.current),B.current&&r.observe(B.current),n(),()=>r.disconnect()},[X,W.length,t.prefs.collapsed,H]);let Z=(e=K)=>{e&&e.state!==`running`&&(window.electronAPI?.pet?.acknowledgeEvent(e.conversationId,e.runId),c(t=>{let{[e.conversationId]:n,...r}=t;return r})),window.electronAPI?.pet?.openMainWindow(A(e))},re=async()=>{if(Object.keys(d).length>0&&(f({}),!t.prefs.collapsed))return;let e=await window.electronAPI?.pet?.setPrefs({collapsed:!t.prefs.collapsed});e&&n(e)},ie=(0,u.useCallback)(e=>{e.button===0&&(E.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),window.electronAPI?.pet?.startDrag({screenX:e.screenX,screenY:e.screenY}))},[]),ae=(0,u.useCallback)(e=>{let t=E.current;!t||t.pointerId!==e.pointerId||Math.abs(e.clientX-t.x)+Math.abs(e.clientY-t.y)>4&&(t.moved=!0,T(`pickedUp`),window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}))},[]),Q=(0,u.useCallback)(e=>{let t=E.current;!t||t.pointerId!==e.pointerId||(E.current=null,window.electronAPI?.pet?.endDrag(),t.moved&&(T(`released`),window.setTimeout(()=>T(null),700),L.current=!0,window.setTimeout(()=>{L.current=!1},0)))},[]),oe=()=>{L.current||Z()};if(!V)return null;let se={"--desktop-pet-stage-size":`${Math.round(132*H)}px`,"--desktop-pet-menu-size":`${Math.round(28*H)}px`,"--desktop-pet-menu-left":`0px`,"--desktop-pet-menu-bottom":`${Math.round(12*H)}px`},$=t.prefs.collapsed?W.length:G;return(0,j.jsxs)(`div`,{ref:R,className:`desktop-pet-window`,style:se,children:[!t.prefs.collapsed&&W.length>0?(0,j.jsx)(`div`,{ref:z,className:`desktop-pet-bubble desktop-pet-queue`,children:W.map(t=>{let n=S(t,p,{longRunning:e.tipLongRunning,stale:e.tipStaleSignal}),r=x(t,e.tipCompleteSummary),a=ee(t,{making_progress:e.petReassuranceMakingProgress,waiting_safely:e.petReassuranceWaitingSafely,completed:e.petReassuranceCompleted,work_preserved:e.petReassuranceWorkPreserved,details_available:e.petReassuranceDetailsAvailable}),o=r??n??a??t.action,s=F(P(V,t,Y),o,!!(r||n||a)),c=I(t,{open:e.viewSession,needsInput:e.petCtaNeedsInput,reviewIssue:e.petCtaReviewIssue});return(0,j.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--${t.state}${n?` desktop-pet-session--health`:``}`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(t),children:[(0,j.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,j.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,j.jsx)(`strong`,{children:t.sessionLabel}),(0,j.jsxs)(`span`,{children:[s,r||n?``:b(t,p,e.tipTargetSuffix)]})]}),c?(0,j.jsx)(`span`,{className:`desktop-pet-session-cta`,children:c}):null]}),(0,j.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>{window.electronAPI?.pet?.acknowledgeEvent(t.conversationId,t.runId),f(e=>({...e,[t.conversationId]:{runId:t.runId,state:t.state}}))},children:(0,j.jsx)(i,{size:12})})]},t.conversationId)})}):null,X?(0,j.jsx)(`div`,{ref:z,className:`desktop-pet-bubble desktop-pet-queue desktop-pet-idle-tip`,children:(0,j.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--idle`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(),children:[(0,j.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,j.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,j.jsx)(`strong`,{children:e.idleTipTitle}),(0,j.jsx)(`span`,{children:N(V.persona?.phrases?.greeting??Y.greeting,{conversationId:`idle`,runId:`idle`,sessionLabel:``,sequence:0,timestamp:h,state:`running`,phase:`waiting`,action:e.idleTipBody})??e.idleTipBody})]})]}),(0,j.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>y(p+g),children:(0,j.jsx)(i,{size:12})})]})}):null,(0,j.jsxs)(`div`,{ref:B,className:`desktop-pet-stage`,children:[(0,j.jsx)(`button`,{type:`button`,className:`desktop-pet-menu-button`,onClick:()=>void re(),"aria-label":e.menu,children:$>0?(0,j.jsx)(`span`,{className:`desktop-pet-tip-count`,children:Math.min(99,$)}):(0,j.jsx)(s,{className:`desktop-pet-menu-chevron size-4`})}),(0,j.jsx)(`button`,{type:`button`,className:`desktop-pet-hit-area`,onClick:oe,onPointerEnter:()=>{!K&&t.prefs.interactionEnabled&&t.prefs.behaviorMode===`playful`&&T(`greet`)},onPointerLeave:()=>{E.current||T(null)},onPointerDown:ie,onPointerMove:ae,onPointerUp:Q,onPointerCancel:Q,title:e.openApp,children:(0,j.jsx)(l,{pet:V,action:J,reducedMotion:t.prefs.reducedMotion,displayHeight:Math.round(112*H)})})]})]})}function R(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,j.jsx)(L,{}),e[0]=t):t=e[0],t}export{R as DesktopPetPage};
|
|
@@ -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{f as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{n as a,r as o}from"./popover-select-DGKUpVsz.js";import{t as s}from"./circle-alert-BEjgurr2.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./message-square-plus-XP0tGdlV.js";import{t as u}from"./rotate-ccw-JM1TBLpp.js";import{t as d}from"./messages-B7VtMXec.js";import{t as f}from"./cn-0WouolD0.js";import{n as p}from"./locale-store-BKyOF23r.js";import{t as m}from"./skeleton-BI5TyibZ.js";import{n as h}from"./interaction-BdhHBbYa.js";import{n as g}from"./electron-env-Dit0bHgy.js";import{bs as _,ki as v,wo as y}from"./index-Bo70AuAq.js";import{t as b}from"./desktop-pet-sprite-BP6iMVw1.js";import{n as x,r as S}from"./settings-page-layout-Dx5S-Msc.js";var C=n(),w=e(t(),1),T=r();function E(e){let t=(0,C.c)(16),{title:n,desc:r,checked:i,disabled:a,onChange:o}=e,s;t[0]===n?s=t[1]:(s=(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,T.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=e=>o(e.target.checked),t[7]=o,t[8]=u);let d;t[9]!==i||t[10]!==a||t[11]!==u?(d=(0,T.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:a,checked:i,onChange:u}),t[9]=i,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==l||t[14]!==d?(f=(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function D(){let e=d(p(e=>e.language)).desktopPetSettings,t=i(),[n,r]=(0,w.useState)(null),[C,D]=(0,w.useState)(!1),[O,k]=(0,w.useState)(null),A=typeof window<`u`?window.electronAPI?.pet:void 0,j=(0,w.useMemo)(()=>n?.pets.find(e=>e.id===n.prefs.selectedPetId)??n?.pets[0],[n]),M=(0,w.useCallback)(async()=>{if(A){D(!0);try{r(await A.getState())}finally{D(!1)}}},[A]);if((0,w.useEffect)(()=>{if(A)return M(),A.onStateChanged(r)},[A,M]),!g()||!A)return null;if(!n)return(0,T.jsxs)(S,{gap:`gap-4`,children:[(0,T.jsx)(x,{title:e.title,subtitle:e.subtitle}),(0,T.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":!0,"aria-label":e.loading,children:(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsx)(m,{className:`h-14 rounded-xl`}),(0,T.jsx)(m,{className:`h-14 rounded-xl`}),(0,T.jsx)(m,{className:`h-24 rounded-xl`}),(0,T.jsx)(`div`,{className:`space-y-2 pt-2`,children:Array.from({length:3}).map((e,t)=>(0,T.jsx)(m,{className:`h-16 rounded-xl`},t))})]})})]});let N=async e=>{D(!0);try{r(await A.setPrefs(e))}finally{D(!1)}},P=async e=>{e?(await A.show(),r(await A.getState())):r(await A.setPrefs({enabled:!1}))},F=e=>{N({selectedPetId:e})},I=t=>{if(t.builtin&&t.i18nKey){let n=e.builtinPets[t.i18nKey];if(n)return n}return{name:t.name,description:t.description}},L=e=>{t({pathname:`/chat/new`,search:`?draft=${encodeURIComponent(e)}`})},R=e=>{if(e.sourcePrompt?.trim())return e.sourcePrompt.trim();let{description:t}=I(e);return t.replace(/^Custom pet generated from:\s*/i,``).trim()||t},z=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(n),e),B=()=>{L(e.createChatDraft)},V=t=>{L(z(e.optimizeChatDraft,{id:t.id,name:I(t).name,description:I(t).description,sourcePrompt:R(t)}))},H=t=>{L(z(e.fixChatDraft,{dir:t.dir,reason:t.reason,details:t.details?.join(`; `)||e.noIssueDetails}))},U=O??n.prefs.sizePercent,W=Math.max(1,Math.floor((Date.now()-n.relationship.firstMetAt)/864e5)+1),G=async(e=U)=>{let t=Math.min(140,Math.max(70,Math.round(e/5)*5));k(null),t!==n.prefs.sizePercent&&await N({sizePercent:t})};return(0,T.jsxs)(S,{gap:`gap-4`,children:[(0,T.jsx)(x,{title:e.title,subtitle:e.subtitle,actions:(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,T.jsx)(v,{className:`size-9 shrink-0 p-0`,disabled:C,label:e.refresh,onClick:M}),(0,T.jsxs)(`button`,{type:`button`,className:f(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,h.press),onClick:()=>void A.openCustomPetsDir(),children:[(0,T.jsx)(c,{className:`size-3.5`,strokeWidth:1.75}),e.openFolder]})]})}),(0,T.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(E,{title:e.enable,desc:e.enableDesc,checked:n.prefs.enabled,disabled:C,onChange:e=>void P(e)}),(0,T.jsx)(E,{title:e.showOnStartup,desc:e.showOnStartupDesc,checked:n.prefs.showOnStartup,disabled:C,onChange:e=>void N({showOnStartup:e})})]}),(0,T.jsx)(`div`,{className:`mt-5 rounded-xl bg-surface-base/55 p-3`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,T.jsx)(y,{className:`mt-0.5 size-4 text-accent-fg`,strokeWidth:1.8}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.createTitle}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.createDesc})]})]}),(0,T.jsxs)(`button`,{type:`button`,className:f(`inline-flex h-9 shrink-0 items-center justify-center gap-1.5 rounded-lg bg-accent px-3 text-xs font-semibold text-on-accent hover:bg-accent/90`,h.press),onClick:B,children:[(0,T.jsx)(l,{className:`size-3.5`,strokeWidth:1.75}),e.createInChat]})]})}),(0,T.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 rounded-xl bg-surface-base/55 p-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.bondTitle}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.bondDesc})]}),(0,T.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:e.bondSummary.replace(`{days}`,String(W)).replace(`{tasks}`,String(n.relationship.completedTaskCount))})]}),(0,T.jsxs)(`div`,{className:`mt-5`,children:[(0,T.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.petList}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.petListDesc})]}),j?(0,T.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:I(j).name}):null]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-xl bg-surface-base/45 p-1 [&>*]:rounded-lg [&>*]:bg-surface-panel/55`,children:[n.pets.map(t=>{let r=t.id===n.prefs.selectedPetId,i=I(t);return(0,T.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,T.jsx)(b,{pet:t,action:`idle`,size:`tiny`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:i.name}),t.builtin?null:(0,T.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.customBadge})]}),(0,T.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:i.description})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t.builtin?null:(0,T.jsxs)(`button`,{type:`button`,className:f(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,h.press),onClick:()=>V(t),children:[(0,T.jsx)(_,{className:`size-3.5`,strokeWidth:1.75}),e.optimizeInChat]}),(0,T.jsx)(`button`,{type:`button`,className:f(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,r?`bg-surface-hover text-fg-muted`:`bg-surface-panel text-fg hover:bg-surface-hover`,h.press),disabled:r||C,onClick:()=>F(t.id),children:r?e.selected:e.select})]})]},t.id)}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-1 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:e.customPets}),(0,T.jsx)(`p`,{className:`font-mono text-xs text-fg-muted`,children:n.customPetsDir})]}),(0,T.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,onClick:()=>void A.openCustomPetsDir(),children:[e.openFolder,(0,T.jsx)(c,{className:`size-3.5`,strokeWidth:1.75})]})]})]}),n.petIssues.length>0?(0,T.jsxs)(`div`,{className:`mt-2 rounded-xl bg-danger/10 p-3`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-danger`,children:[(0,T.jsx)(s,{className:`size-3.5`,strokeWidth:1.8}),e.invalidPets]}),(0,T.jsx)(`div`,{className:`mt-2 space-y-2`,children:n.petIssues.map(t=>(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base/70 p-2 text-xs text-fg-muted sm:flex-row sm:items-start sm:justify-between`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`p`,{className:`truncate font-mono text-[11px] text-fg`,children:t.dir}),(0,T.jsx)(`p`,{children:t.reason}),t.details?.length?(0,T.jsx)(`p`,{className:`line-clamp-2`,children:t.details.join(`; `)}):null]}),(0,T.jsxs)(`button`,{type:`button`,className:f(`inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-danger/30 bg-surface-base px-2.5 text-xs font-medium text-danger hover:bg-danger/10`,h.press),onClick:()=>H(t),children:[(0,T.jsx)(l,{className:`size-3.5`,strokeWidth:1.75}),e.fixInChat]})]},`${t.dir}-${t.reason}`))})]}):null]}),(0,T.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[(0,T.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/50 p-3 dark:bg-surface-hover/35`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.size}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.sizeDesc})]}),(0,T.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[U,`%`]})]}),(0,T.jsx)(`input`,{type:`range`,min:70,max:140,step:5,className:`mt-3 w-full accent-accent`,value:U,onChange:e=>k(Number(e.target.value)),onBlur:()=>void G(),onKeyUp:e=>{(e.key===`Enter`||e.key===` `||e.key.startsWith(`Arrow`))&&G()},onPointerUp:()=>void G()})]}),(0,T.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,T.jsx)(E,{title:e.alwaysOnTop,desc:e.alwaysOnTopDesc,checked:n.prefs.alwaysOnTop,disabled:C,onChange:e=>void N({alwaysOnTop:e})}),(0,T.jsx)(E,{title:e.bubbles,desc:e.bubblesDesc,checked:n.prefs.bubbleEnabled,disabled:C,onChange:e=>void N({bubbleEnabled:e})}),(0,T.jsx)(E,{title:e.proactiveTips,desc:e.proactiveTipsDesc,checked:n.prefs.proactiveTipsEnabled,disabled:C,onChange:e=>void N({proactiveTipsEnabled:e})}),(0,T.jsx)(E,{title:e.interactions,desc:e.interactionsDesc,checked:n.prefs.interactionEnabled,disabled:C,onChange:e=>void N({interactionEnabled:e})}),(0,T.jsx)(E,{title:e.reducedMotion,desc:e.reducedMotionDesc,checked:n.prefs.reducedMotion,disabled:C,onChange:e=>void N({reducedMotion:e})}),(0,T.jsx)(E,{title:e.clickThrough,desc:e.clickThroughDesc,checked:n.prefs.clickThroughWhenIdle,disabled:C,onChange:e=>void N({clickThroughWhenIdle:e})})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-hover/50 p-3 dark:bg-surface-hover/35 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.behaviorMode}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.behaviorModeDesc})]}),(0,T.jsxs)(a,{className:`w-full sm:w-40`,triggerClassName:`h-9 bg-surface-panel`,value:n.prefs.behaviorMode,onChange:e=>void N({behaviorMode:e.target.value}),children:[(0,T.jsx)(o,{value:`focus`,children:e.behaviorFocus}),(0,T.jsx)(o,{value:`companion`,children:e.behaviorCompanion}),(0,T.jsx)(o,{value:`playful`,children:e.behaviorPlayful})]})]}),(0,T.jsxs)(`button`,{type:`button`,className:f(`inline-flex w-fit items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,h.press),disabled:C,onClick:()=>void A.resetPosition().then(r),children:[(0,T.jsx)(u,{className:`size-3.5`,strokeWidth:1.75}),e.resetPosition]})]})]})]})}export{D as DesktopPetSettings};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";var r=e(),i=t(),a=8;function o(e){let t=(0,r.c)(45),{pet:o,action:l,size:u,displayHeight:d,reducedMotion:f,className:p}=e,m=u===void 0?`normal`:u,h=f===void 0?!1:f,g=o.animations[l],_=m===`tiny`?40:m===`small`?54:112,v;t[0]!==_||t[1]!==d?(v=Math.round(d??_),t[0]=_,t[1]=d,t[2]=v):v=t[2];let y=Math.max(1,v)/g.frameHeight,b;t[3]!==g.frameWidth||t[4]!==y?(b=Math.round(g.frameWidth*y),t[3]=g.frameWidth,t[4]=y,t[5]=b):b=t[5];let x=b,S;t[6]===o.animations?S=t[7]:(S=Object.values(o.animations),t[6]=o.animations,t[7]=S);let C;t[8]!==g.imageDataUrl||t[9]!==S?(C=S.filter(e=>e.imageDataUrl===g.imageDataUrl).map(c),t[8]=g.imageDataUrl,t[9]=S,t[10]=C):C=t[10];let w=Math.max(g.sheetHeight??0,g.offsetY+g.frameHeight,...C),T;t[11]===o.animations?T=t[12]:(T=Object.values(o.animations),t[11]=o.animations,t[12]=T);let E;t[13]!==g.imageDataUrl||t[14]!==T?(E=T.filter(e=>e.imageDataUrl===g.imageDataUrl).map(s),t[13]=g.imageDataUrl,t[14]=T,t[15]=E):E=t[15];let D=Math.max(g.sheetWidth??0,g.offsetX+g.frameWidth*g.frameCount,...E),O=Math.min(g.frameHeight+a,w-g.offsetY),k;t[16]!==y||t[17]!==O?(k=Math.round(O*y),t[16]=y,t[17]=O,t[18]=k):k=t[18];let A=k,j=Math.max(.1,g.frameCount/g.fps),M=`${x}px`,N=`${A}px`,P;t[19]!==y||t[20]!==D?(P=Math.round(D*y),t[19]=y,t[20]=D,t[21]=P):P=t[21];let F;t[22]!==y||t[23]!==w?(F=Math.round(w*y),t[22]=y,t[23]=w,t[24]=F):F=t[24];let I=`${P}px ${F}px`,L=`${-g.offsetX*y}px`,R=`${-g.offsetY*y}px`,z=`${-(g.offsetX+g.frameWidth*g.frameCount)*y}px`,B=`${j}s`,V=`url("${g.imageDataUrl}")`,H;t[25]!==g.frameCount||t[26]!==M||t[27]!==N||t[28]!==I||t[29]!==L||t[30]!==R||t[31]!==z||t[32]!==B||t[33]!==V?(H={width:M,height:N,backgroundSize:I,"--pet-frame-count":g.frameCount,"--pet-frame-start-x":L,"--pet-frame-start-y":R,"--pet-frame-end-x":z,"--pet-animation-duration":B,backgroundImage:V},t[25]=g.frameCount,t[26]=M,t[27]=N,t[28]=I,t[29]=L,t[30]=R,t[31]=z,t[32]=B,t[33]=V,t[34]=H):H=t[34];let U=H,W=`desktop-pet-sprite--${l}`,G=g.loop?`desktop-pet-sprite--loop`:`desktop-pet-sprite--once`,K=h&&`desktop-pet-sprite--reduced-motion`,q=m===`tiny`&&`desktop-pet-sprite--tiny`,J=m===`small`&&`desktop-pet-sprite--small`,Y;t[35]!==p||t[36]!==W||t[37]!==G||t[38]!==K||t[39]!==q||t[40]!==J?(Y=n(`desktop-pet-sprite`,W,G,K,q,J,p),t[35]=p,t[36]=W,t[37]=G,t[38]=K,t[39]=q,t[40]=J,t[41]=Y):Y=t[41];let X;return t[42]!==U||t[43]!==Y?(X=(0,i.jsx)(`span`,{className:Y,style:U,"aria-hidden":!0}),t[42]=U,t[43]=Y,t[44]=X):X=t[44],X}function s(e){return e.offsetX+e.frameWidth*e.frameCount}function c(e){return e.offsetY+e.frameHeight}export{o as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{f as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./chevron-right-BweFrslA.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"./x-B_N4OPjy.js";import{t as d}from"./messages-B7VtMXec.js";import{t as f}from"./cn-0WouolD0.js";import{n as p}from"./locale-store-BKyOF23r.js";import{a as m,i as h,o as g,r as _,s as v,t as y}from"./dist-BGTk37IG.js";import{n as b}from"./app-link-BV_eGr7l.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{t as S}from"./button-aIC072nz.js";import{t as C}from"./skeleton-BI5TyibZ.js";import{i as w,o as T}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as E}from"./use-async-resource-GrnWNwMZ.js";import{t as D}from"./copy-text-row-C7egVuKr.js";import{$s as O,B as k,Cs as A,Ht as j,Lc as M,R as N,Vt as P,Wt as F,Xo as I,z as L}from"./index-Bo70AuAq.js";import{_ as ee,a as te,d as ne,f as re,g as ie,h as ae,i as oe,l as R,m as se,n as z,p as ce,r as B,s as V,t as H,u as le,v as ue}from"./tunnel-api-B5I53jzk.js";import{t as U}from"./browser-BLJWD7WI.js";var W=e(n(),1),G=r(),K=e(U(),1),q={width:240,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function de(e){let t=await K.toString(e,{...q,type:`svg`});return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}var J=i();function fe(){let e=d(p(e=>e.language)),t=e.endpointToolsSettings.deviceAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=x(`tunnel-status`,z,{refreshInterval:1500}),[o,s]=(0,W.useState)(!1),[c,u]=(0,W.useState)(!1),[f,m]=(0,W.useState)(!0),[h,g]=(0,W.useState)(`idle`),[_,v]=(0,W.useState)(null),[y,w]=(0,W.useState)(``),T=(0,W.useRef)(!0);(0,W.useEffect)(()=>(T.current=!0,()=>{T.current=!1}),[]);let E=async()=>{if(!r)return;if(r.consentRequired&&!o){u(!0);return}let e=r.registrationSecret?.configured?null:k(),t,n=!1;v(null);try{if(r.consentRequired&&await te(),!r.registrationSecret?.configured){g(`provisioning`);let r=!1;try{await oe()}catch(e){if(!le(e))throw e;r=!0}if(r){g(`authorizing`);let r=sessionStorage.getItem(`device-pairing-oauth`),i=r?JSON.parse(r):null;t=i&&i.expiresAt>Date.now()?i.sessionId:(await F(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`device-pairing-oauth`,JSON.stringify({sessionId:t,expiresAt:i&&i.expiresAt>Date.now()?i.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;T.current&&Date.now()<o;){let r=await j(t);if(r.authUrl&&r.authUrl!==a&&(a=r.authUrl,await L(a,e)||w(a)),r.status===`completed`){s=!0,n=!0;break}if(r.status===`failed`||r.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!T.current)return;if(!s)throw Error(`Authorization expired`);await oe()}await a()}if(!T.current)return;g(`starting`),await V(),f&&await B({autoStart:!0}),await a(),n=!0}catch(e){n=!0,T.current&&v(R(e)===`tunnel_key_limit_reached`?`key-limit`:`failed`)}finally{N(e),n&&(sessionStorage.removeItem(`device-pairing-oauth`),t&&P(t).catch(()=>{})),T.current&&(g(`idle`),w(``))}};if(!r&&!i)return(0,J.jsxs)(`div`,{className:`space-y-5`,children:[(0,J.jsx)(C,{className:`h-5 w-4/5`}),(0,J.jsx)(C,{className:`h-24 w-full`})]});let D=h===`provisioning`||h===`starting`||r?.state===`connecting`||r?.state===`reconnecting`;return(0,J.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:D?t.preparingHint:h===`authorizing`?t.authorizing:t.enableHint}),y&&h===`authorizing`?(0,J.jsx)(`a`,{href:y,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,D?(0,J.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,J.jsx)(C,{className:`h-2 w-full`}),(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(c||r?.consentRequired)&&h===`idle`?(0,J.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,J.jsxs)(`details`,{open:c,className:`text-sm text-fg-muted`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,J.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,J.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,J.jsx)(`li`,{children:e},e))})]}),(0,J.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,_===`key-limit`?(0,J.jsxs)(`div`,{role:`alert`,className:`mt-4 rounded-lg border border-warning/30 bg-warning/5 p-4`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.routeKeyLimitTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.routeKeyLimitHint}),(0,J.jsxs)(S,{variant:`secondary`,className:`mt-3`,onClick:()=>void b(H),children:[t.manageTunnelKeys,(0,J.jsx)(l,{className:`size-3`})]})]}):_||i||r?.state===`error`?(0,J.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.routeSetupFailed}):null,(0,J.jsx)(`div`,{className:`flex-1`}),(0,J.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:f,disabled:h!==`idle`,onChange:e=>m(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),(0,J.jsx)(S,{className:`w-full`,variant:`primary`,disabled:!r||h!==`idle`||D||c&&!o,onClick:()=>void E(),children:h===`authorizing`?t.authorizing:D?t.preparing:_?t.retry:t.enable}),i&&!r?(0,J.jsx)(S,{variant:`ghost`,onClick:()=>void a(),children:t.retry}):null]})}var Y=t({DevicePairingWizard:()=>X});function X(e){let t=(0,G.c)(16),{open:n,onOpenChange:r,onPaired:i,targetKind:o}=e,s=a(),[c,l]=(0,W.useState)(o),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{l(o)},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,W.useEffect)(u,d);let f;t[3]!==r||t[4]!==o?(f=e=>{e||l(o),r(e)},t[3]=r,t[4]=o,t[5]=f):f=t[5];let p=f,m;t[6]!==p||t[7]!==s||t[8]!==i||t[9]!==n||t[10]!==c?(m=n?c?(0,J.jsx)(he,{targetKind:c,onClose:()=>p(!1),onPaired:i}):(0,J.jsx)(pe,{onChoose:l,onChooseLocalBrowser:()=>{p(!1),s(`/settings/agent-browser?driver=extension`)},onClose:()=>p(!1)}):null,t[6]=p,t[7]=s,t[8]=i,t[9]=n,t[10]=c,t[11]=m):m=t[11];let h;return t[12]!==p||t[13]!==n||t[14]!==m?(h=(0,J.jsx)(y,{open:n,onOpenChange:p,children:m}),t[12]=p,t[13]=n,t[14]=m,t[15]=h):h=t[15],h}function Z(e){let t=(0,G.c)(14),{icon:n,title:r,hint:i,onClick:a}=e,s;t[0]===n?s=t[1]:(s=(0,J.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,J.jsx)(n,{className:`size-5`,"aria-hidden":`true`})}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,J.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,J.jsx)(o,{className:`size-4 shrink-0 text-fg-disabled transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":`true`}),t[9]=d):d=t[9];let f;return t[10]!==a||t[11]!==s||t[12]!==u?(f=(0,J.jsxs)(`button`,{type:`button`,className:`group flex min-h-18 w-full cursor-pointer items-center gap-4 rounded-xl border border-edge bg-surface-panel px-4 py-3.5 text-left shadow-surface transition-[background-color,border-color,box-shadow,transform] hover:border-edge-strong hover:bg-surface-active hover:shadow-elevated active:translate-y-px active:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel motion-reduce:active:translate-y-0`,onClick:a,children:[s,u,d]}),t[10]=a,t[11]=s,t[12]=u,t[13]=f):f=t[13],f}function pe(e){let t=(0,G.c)(40),{onChoose:n,onChooseLocalBrowser:r,onClose:i}=e,a=p(me),o;t[0]===a?o=t[1]:(o=d(a),t[0]=a,t[1]=o);let s=o.endpointToolsSettings.deviceAccess,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,J.jsx)(m,{className:f(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,T)}),t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=f(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(28rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,w),t[3]=l):l=t[3];let y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,J.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),t[4]=y):y=t[4];let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,J.jsx)(u,{className:`size-4`}),t[5]=b):b=t[5];let x;t[6]!==s.cancel||t[7]!==i?(x=(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[y,(0,J.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":s.cancel,onClick:i,children:b})]}),t[6]=s.cancel,t[7]=i,t[8]=x):x=t[8];let S;t[9]===s.chooseTitle?S=t[10]:(S=(0,J.jsx)(v,{className:`text-lg font-semibold tracking-tight text-fg sm:text-xl`,children:s.chooseTitle}),t[9]=s.chooseTitle,t[10]=S);let C;t[11]===s.chooseHint?C=t[12]:(C=(0,J.jsx)(h,{className:`mt-1.5 text-sm leading-6 text-fg-muted`,children:s.chooseHint}),t[11]=s.chooseHint,t[12]=C);let E;t[13]!==s.localBrowserHint||t[14]!==s.localBrowserTitle||t[15]!==r?(E=(0,J.jsx)(Z,{icon:O,title:s.localBrowserTitle,hint:s.localBrowserHint,onClick:r}),t[13]=s.localBrowserHint,t[14]=s.localBrowserTitle,t[15]=r,t[16]=E):E=t[16];let D;t[17]===n?D=t[18]:(D=()=>n(`mobile`),t[17]=n,t[18]=D);let k;t[19]!==s.mobileHint||t[20]!==s.mobileTitle||t[21]!==D?(k=(0,J.jsx)(Z,{icon:I,title:s.mobileTitle,hint:s.mobileHint,onClick:D}),t[19]=s.mobileHint,t[20]=s.mobileTitle,t[21]=D,t[22]=k):k=t[22];let j;t[23]===n?j=t[24]:(j=()=>n(`browser`),t[23]=n,t[24]=j);let M;t[25]!==s.remoteBrowserHint||t[26]!==s.remoteBrowserTitle||t[27]!==j?(M=(0,J.jsx)(Z,{icon:A,title:s.remoteBrowserTitle,hint:s.remoteBrowserHint,onClick:j}),t[25]=s.remoteBrowserHint,t[26]=s.remoteBrowserTitle,t[27]=j,t[28]=M):M=t[28];let N;t[29]!==k||t[30]!==M||t[31]!==E?(N=(0,J.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[E,k,M]}),t[29]=k,t[30]=M,t[31]=E,t[32]=N):N=t[32];let P;t[33]!==N||t[34]!==S||t[35]!==C?(P=(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-6 sm:px-8`,children:[S,C,N]}),t[33]=N,t[34]=S,t[35]=C,t[36]=P):P=t[36];let F;return t[37]!==P||t[38]!==x?(F=(0,J.jsxs)(g,{children:[c,(0,J.jsxs)(_,{className:l,children:[x,P]})]}),t[37]=P,t[38]=x,t[39]=F):F=t[39],F}function me(e){return e.language}function he({targetKind:e,onClose:t,onPaired:n}){let r=p(e=>e.language),i=d(r),a=i.endpointToolsSettings.deviceAccess,y=a.flow,[O,k]=(0,W.useState)(!1),A=x(O?`device-pairing-readiness`:null,ae,{refreshInterval:1500}),[j,N]=(0,W.useState)(),[P,F]=(0,W.useState)(null),[I,L]=(0,W.useState)(!1),[te,oe]=(0,W.useState)(Date.now()),[R,z]=(0,W.useState)(null),B=(0,W.useRef)(!0),V=(0,W.useRef)(null),H=(0,W.useRef)(!1),le=(0,W.useRef)(!1),U=x(j?[`device-pairing-setup`,j.id]:null,()=>ie(j.id),{refreshInterval:1500}),G=U.data?.request,K=G?.status===`completed`,q=K&&G.connectedAt!==void 0,Y=x(q&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),X=j?.targetKind===`mobile`?j.universalLink:``,Z=E(()=>de(X),[X],{enabled:!!X,initial:null,errorData:null}),pe=r===`zh`?`https://xopc.ai/zh#download`:`https://xopc.ai/en#download`,me=r===`zh`?`https://xopcai.github.io/xopc/zh/browser-extension`:`https://xopcai.github.io/xopc/browser-extension`,he=E(()=>de(pe),[pe],{enabled:!O&&e===`mobile`,initial:null,errorData:null});(0,W.useEffect)(()=>{B.current=!0;let e=setInterval(()=>oe(Date.now()),1e3);return()=>{B.current=!1,clearInterval(e),V.current&&ne(V.current).catch(()=>{})}},[]);let ge=(0,W.useCallback)(async()=>{if(!H.current){H.current=!0,L(!0),F(null);try{V.current&&await ne(V.current),V.current=null,N(void 0);let t=await re(e);if(t.kind===`ready`){if(!B.current){await ne(t.setup.id);return}V.current=t.setup.id,N(t.setup)}else await A.mutate()}catch{B.current&&F(`create`)}finally{H.current=!1,B.current&&L(!1)}}},[A,e]);(0,W.useEffect)(()=>{A.data?.ready&&!j&&P!==`create`&&!H.current&&ge()},[A.data,j,P,ge]),(0,W.useEffect)(()=>{q&&!le.current&&(le.current=!0,n?.())},[q,n]);let _e=async e=>{if(G){L(!0),F(null);try{await ce(G,e),await U.mutate()}catch{F(`decision`),await U.mutate()}finally{B.current&&L(!1)}}},ve=(0,W.useRef)(0);(0,W.useEffect)(()=>{U.data&&(ve.current=U.data.serverTime-Date.now())},[U.data]);let Q=te+ve.current,ye=j&&Q>=j.expiresAt&&!G,be=G&&[`expired`,`rejected`,`cancelled`].includes(G.status),xe=j?j.expiresAt-Q<6e4:!1,Se=j?xe?`${Math.max(0,Math.ceil((j.expiresAt-Q)/1e3))}s`:y.valid:``,$=e===`mobile`?{connect:a.mobileScan,connectHint:a.mobileScanHint,allowTitle:a.mobileAllowTitle,success:a.mobileSuccess,successHint:a.mobileSuccessHint}:{connect:a.browserConnect,connectHint:a.browserConnectHint,allowTitle:a.browserAllowTitle,success:a.browserSuccess,successHint:a.browserSuccessHint},Ce=e===`mobile`?a.mobilePrepareTitle:a.browserPrepareTitle,we=e===`mobile`?a.mobilePrepareHint:a.browserPrepareHint,Te=O?q?$.success:G?.status===`pending`?$.allowTitle:K||G?.status===`approved`?y.waiting:j?$.connect:y.title:Ce,Ee=P===`create`?y.createFailed:P===`decision`?y.decisionFailed:P===`background`?y.backgroundFailed:P===`download`?a.browserDownloadFailed:null,De=async()=>{L(!0),F(null);try{await se()}catch{F(`download`)}finally{B.current&&L(!1)}};return(0,J.jsxs)(g,{children:[(0,J.jsx)(m,{className:f(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,T)}),(0,J.jsxs)(_,{className:f(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,w),children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,J.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,J.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":y.cancel,onClick:t,children:(0,J.jsx)(u,{className:`size-4`})})]}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[q?(0,J.jsx)(s,{className:`mb-5 size-7 text-success`}):null,(0,J.jsx)(v,{className:`text-xl font-semibold tracking-tight text-fg`,children:Te}),(0,J.jsx)(h,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:O?q?$.successHint:K?y.waitingForDevice:G?G.displayName:j?$.connectHint:y.intro:we}),Ee?(0,J.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:Ee}):null,O&&A.error?(0,J.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:y.readinessFailed}):null,O&&U.error?(0,J.jsx)(`p`,{role:`status`,className:`mt-4 text-sm text-warning`,children:y.statusUnavailable}):null,O?A.data?q?(0,J.jsxs)(J.Fragment,{children:[Y.data?(0,J.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[a.background,(0,J.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":Y.data.runInBackground??!1,disabled:!Y.data.backgroundSupported,checked:Y.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>Y.mutate(e.behavior)).catch(()=>F(`background`))}})]}):null,(0,J.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:a.sleep})]}):be||ye?(0,J.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:ye||G?.status===`expired`?y.expired:y.declined}),(0,J.jsx)(S,{variant:`primary`,onClick:()=>void ge(),disabled:I,children:y.refresh})]}):G?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:y.scope}),(0,J.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[G.confirmationCode.slice(0,3),` `,G.confirmationCode.slice(3)]}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:y.compare}),(0,J.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer py-2`,children:y.access}),(0,J.jsx)(`p`,{children:y.accessHint})]})]}):j?.targetKind===`mobile`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`my-6 flex flex-col items-center`,children:[(0,J.jsx)(`div`,{className:`rounded-[1.75rem] border border-edge bg-surface-hover/55 p-2.5 shadow-surface`,children:(0,J.jsx)(`div`,{className:`rounded-[1.25rem] bg-white p-2 shadow-sm ring-1 ring-black/5`,children:Z.data?(0,J.jsx)(`img`,{src:Z.data,alt:a.qrAlt,width:240,height:240,className:`size-[240px] max-w-full rounded-xl bg-white`}):Z.error?null:(0,J.jsx)(C,{className:`size-[240px] rounded-xl`})})}),Z.error?null:(0,J.jsxs)(`p`,{className:f(`mt-4 inline-flex min-h-8 items-center gap-1.5 rounded-full px-3 text-xs font-medium`,xe?`bg-warning-soft text-warning`:`bg-surface-hover text-fg-muted`),"aria-live":`polite`,children:[(0,J.jsx)(M,{className:`size-3.5`,"aria-hidden":`true`}),Se]})]}),Z.error?(0,J.jsx)(`p`,{role:`status`,className:`text-center text-sm text-warning`,children:y.qrFailed}):null,Z.error?(0,J.jsx)(`div`,{className:`mt-5`,children:(0,J.jsx)(D,{text:j.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}):(0,J.jsxs)(`details`,{className:`group mx-auto mt-1 w-full max-w-sm rounded-xl border border-edge bg-surface-panel text-xs text-fg-muted`,children:[(0,J.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-xl px-3.5 transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,children:[(0,J.jsx)(`span`,{children:y.fallback}),(0,J.jsx)(o,{className:`size-3.5 shrink-0 transition-transform group-open:rotate-90`,"aria-hidden":`true`})]}),(0,J.jsx)(`div`,{className:`border-t border-edge-subtle p-3`,children:(0,J.jsx)(D,{text:j.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})})]})]}):j?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`ol`,{className:`mt-7 space-y-2 text-sm leading-6 text-fg-muted`,children:[(0,J.jsxs)(`li`,{children:[(0,J.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserConnectStep1]}),(0,J.jsxs)(`li`,{children:[(0,J.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserConnectStep2]}),(0,J.jsxs)(`li`,{children:[(0,J.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserConnectStep3]})]}),(0,J.jsx)(`div`,{className:`mt-6`,children:(0,J.jsx)(D,{text:j.browserInvitation,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}),(0,J.jsx)(`p`,{className:`mt-3 text-center text-xs text-fg-muted`,children:j.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((j.expiresAt-Q)/1e3))}s`:y.valid})]}):A.data.ready?(0,J.jsx)(`div`,{className:`mt-8`,children:(0,J.jsx)(C,{className:`mx-auto size-[216px]`})}):(0,J.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[R===`tailscale`?(0,J.jsx)(ue,{embedded:!0}):R===`https`?(0,J.jsx)(ee,{}):R===`choices`?(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsx)(S,{variant:`secondary`,className:`w-full`,onClick:()=>z(`tailscale`),children:a.useTailscale}),(0,J.jsx)(S,{variant:`secondary`,className:`w-full`,onClick:()=>z(`https`),children:a.useOwnHttps})]}):(0,J.jsx)(fe,{}),(0,J.jsx)(S,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>z(R?null:`choices`),children:R?y.back:y.existing})]}):(0,J.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,J.jsx)(C,{className:`h-5 w-3/4`}),(0,J.jsx)(C,{className:`h-40 w-full`})]}):e===`mobile`?(0,J.jsxs)(`div`,{className:`mt-7 flex flex-col items-center`,children:[he.data?(0,J.jsx)(`img`,{src:he.data,alt:a.mobileDownloadQrAlt,width:144,height:144,className:`size-36 rounded-lg bg-white`}):(0,J.jsx)(C,{className:`size-36`}),(0,J.jsxs)(S,{variant:`secondary`,className:`mt-5 w-full`,onClick:()=>void b(pe),children:[(0,J.jsx)(l,{className:`size-4`}),a.mobileDownload]}),(0,J.jsx)(`p`,{className:`mt-3 text-center text-xs leading-5 text-fg-muted`,children:a.mobileDownloadHint})]}):(0,J.jsxs)(`div`,{className:`mt-7`,children:[(0,J.jsxs)(S,{variant:`secondary`,className:`w-full`,disabled:I,onClick:()=>void De(),children:[(0,J.jsx)(c,{className:`size-4`}),a.browserDownload]}),(0,J.jsxs)(`ol`,{className:`mt-5 space-y-3 text-sm leading-6 text-fg-muted`,children:[(0,J.jsxs)(`li`,{children:[(0,J.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserInstallStep1]}),(0,J.jsxs)(`li`,{children:[(0,J.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserInstallStep2]}),(0,J.jsxs)(`li`,{children:[(0,J.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserInstallStep3]})]}),(0,J.jsxs)(`button`,{type:`button`,className:`mt-5 inline-flex items-center gap-1 text-xs text-accent hover:underline`,onClick:()=>void b(me),children:[a.browserInstallHelp,(0,J.jsx)(l,{className:`size-3`})]})]})]}),!O||A.error||q||G?.status===`pending`||P===`create`||P===`decision`?(0,J.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:O?q?(0,J.jsx)(S,{className:`w-full`,variant:`primary`,onClick:t,children:y.done}):G?.status===`pending`?(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(S,{className:`w-full`,variant:`primary`,disabled:I,onClick:()=>void _e(`approve`),children:y.allow}),(0,J.jsx)(S,{className:`w-full`,variant:`ghost`,disabled:I,onClick:()=>void _e(`reject`),children:y.cancel})]}):A.error?(0,J.jsx)(S,{className:`w-full`,variant:`primary`,onClick:()=>void A.mutate(),children:y.retry}):(0,J.jsx)(S,{className:`w-full`,variant:`primary`,disabled:I,onClick:()=>void ge(),children:y.retry}):(0,J.jsx)(S,{className:`w-full`,variant:`primary`,onClick:()=>{F(null),k(!0)},children:e===`mobile`?a.mobileReady:a.browserReady})}):null]})]})}export{Y as n,X as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import{n as r}from"./interaction-BdhHBbYa.js";import{Mi as i,Ni as a,ji as o,yc as s}from"./index-Bo70AuAq.js";var c=e(),l=t();function u(e){let t=(0,c.c)(27),{value:i,onPick:o,disabled:u,placeholder:d,title:f,className:p,maxWidthClass:m,compact:h,"aria-label":g}=e,_=m===void 0?`max-w-[min(12rem,40vw)]`:m,v=h===void 0?!1:h,y,b;t[0]!==d||t[1]!==i?(b=i.trim(),y=b?a(b):d??``,t[0]=d,t[1]=i,t[2]=y,t[3]=b):(y=t[2],b=t[3]);let x=y,S=f??(b||void 0),C=g??f??x,w=v?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,T=!v&&_,E=u&&`cursor-not-allowed opacity-60`,D;t[4]!==p||t[5]!==w||t[6]!==T||t[7]!==E?(D=n(w,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,r.transition,r.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,T,E,p),t[4]=p,t[5]=w,t[6]=T,t[7]=E,t[8]=D):D=t[8];let O;t[9]!==u||t[10]!==o?(O=e=>{e.stopPropagation(),u||o()},t[9]=u,t[10]=o,t[11]=O):O=t[11];let k=v?`size-4`:`size-3.5`,A;t[12]===k?A=t[13]:(A=n(`shrink-0 text-fg-muted`,k),t[12]=k,t[13]=A);let j;t[14]===A?j=t[15]:(j=(0,l.jsx)(s,{className:A,"aria-hidden":!0}),t[14]=A,t[15]=j);let M;t[16]!==v||t[17]!==x?(M=v?null:(0,l.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:x}),t[16]=v,t[17]=x,t[18]=M):M=t[18];let N;return t[19]!==u||t[20]!==O||t[21]!==j||t[22]!==M||t[23]!==S||t[24]!==C||t[25]!==D?(N=(0,l.jsxs)(`button`,{type:`button`,disabled:u,title:S,"aria-label":C,className:D,onClick:O,children:[j,M]}),t[19]=u,t[20]=O,t[21]=j,t[22]=M,t[23]=S,t[24]=C,t[25]=D,t[26]=N):N=t[26],N}function d(e){let t=(0,c.c)(39),{value:r,onChange:a,disabled:s,wd:d,placeholder:f,inputAriaLabel:p,inputClassName:m,autoFocus:h,trailing:g}=e,_;t[0]!==a||t[1]!==r?(_={initialPath:r,onPicked:a},t[0]=a,t[1]=r,t[2]=_):_=t[2];let v=i(_),y;t[3]===r?y=t[4]:(y=r.trim(),t[3]=r,t[4]=y);let b=y,x=b?`${b}\n${d.chooseFolder}`:`${f??d.notSet}\n${d.selectWorkingDirectory}`,S;t[5]===m?S=t[6]:(S=n(`min-w-0 flex-1`,m),t[5]=m,t[6]=S);let C=s||v.picking,w;t[7]===a?w=t[8]:(w=e=>void a(e.target.value),t[7]=a,t[8]=w);let T=f??d.pathInputPlaceholder,E;t[9]!==h||t[10]!==p||t[11]!==S||t[12]!==C||t[13]!==w||t[14]!==T||t[15]!==r?(E=(0,l.jsx)(`input`,{type:`text`,className:S,value:r,disabled:C,onChange:w,placeholder:T,"aria-label":p,autoFocus:h,autoComplete:`off`,spellCheck:!1}),t[9]=h,t[10]=p,t[11]=S,t[12]=C,t[13]=w,t[14]=T,t[15]=r,t[16]=E):E=t[16];let D=s||v.picking,O;t[17]!==x||t[18]!==v.pick||t[19]!==D||t[20]!==r||t[21]!==d.selectWorkingDirectory?(O=(0,l.jsx)(u,{compact:!0,value:r,onPick:v.pick,disabled:D,title:x,"aria-label":d.selectWorkingDirectory}),t[17]=x,t[18]=v.pick,t[19]=D,t[20]=r,t[21]=d.selectWorkingDirectory,t[22]=O):O=t[22];let k;t[23]!==O||t[24]!==g?(k=(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[O,g]}),t[23]=O,t[24]=g,t[25]=k):k=t[25];let A;t[26]!==k||t[27]!==E?(A=(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[E,k]}),t[26]=k,t[27]=E,t[28]=A):A=t[28];let j;t[29]!==v.confirmPick||t[30]!==v.hasNativePicker||t[31]!==v.modalOpen||t[32]!==v.setModalOpen||t[33]!==b||t[34]!==d?(j=v.hasNativePicker?null:(0,l.jsx)(o,{open:v.modalOpen,onOpenChange:v.setModalOpen,initialAbsolutePath:b||void 0,onConfirm:v.confirmPick,wd:d}),t[29]=v.confirmPick,t[30]=v.hasNativePicker,t[31]=v.modalOpen,t[32]=v.setModalOpen,t[33]=b,t[34]=d,t[35]=j):j=t[35];let M;return t[36]!==A||t[37]!==j?(M=(0,l.jsxs)(l.Fragment,{children:[A,j]}),t[36]=A,t[37]=j,t[38]=M):M=t[38],M}export{d as t};
|