@xopcai/xopc 0.0.387 → 0.0.388
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/feishu/src/adapters/cli-login.js +3 -3
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/src/inbound-processor.js +2 -2
- package/dist/extensions/telegram/src/outbound-sender.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +2 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +2 -2
- package/dist/extensions/weixin/src/auth/accounts.js +12 -12
- package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
- package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Bv8M5ygD.js → agent-avatar-dicebear-44LqtGte.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-UBy01-65.js → agent-defaults-settings-panel-2VA4eKPf.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-Q9guA8kU.js → agent-plugin-dialog-DRhTOw_O.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-yfJFubD0.js → agents-BemUH_Yf.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Cdyad8c1.js → app-management-settings-panel-CR_cc7rj.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DPPvnKH_.js → appearance-settings-CYofu-su.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Bn_jwaeA.js → apps-page-CHjWvDjk.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CAB2sLJ5.js → automations-page-BIF0skon.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CYRUhhH4.js → automations-workspace-DOwtT4sS.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B9DmMEa8.js → block-editor-C_RD603p.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BHAWpZE2.js → browser-automations-page-B-Ezk_8l.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BG_17NcQ.js → browser-settings-page-BSmmTBn4.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-BAnBYWlY.js → capabilities-page-xZgTYYDn.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-Ca-d6lXk.js → capabilities-settings-panel-oqkuOjcR.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-B3TL8TcF.js → capability-header-actions-Chuhscdb.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-BadpS-nq.js → channels-Dq2C2k9M.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-C_vntFpP.js → chat-terminal-dock-srB_M-aQ.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-B-5kxk70.js → computer-settings-page-Af00Kjc0.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DTnfpLHL.js → connector-service-page-3W0_7-4L.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-CmJV7gqj.js → connectors-page-BZk-Gou5.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-D5zYeC8q.js → date-picker-DBgZBmik.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-D72vT-tb.js → dependency-picker-BDJ406kH.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DvoeVPf_.js → desktop-pet-Do1XPn6U.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-Dfb392hs.js → desktop-pet-settings-LKeVh6OH.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-B06Sqn5D.js → device-pairing-wizard-CvZpnSVw.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CA3H3bc-.js → directory-picker-path-field-BMLHoL6g.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BeHiXhB1.js → extension-page-vR2r4uUB.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Q88-LFCJ.js → extension-settings-page-1tbWe5xQ.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-BXoPCvzq.js → fallback-models-CW6a1-GK.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-IICLMGDI.js → gateway-settings-vQWTUx2c.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-D336so8z.js → highlighted-body-KQOG7T2V-BM__yiMn.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page--MvqsFhQ.js → home-page-hfWuVtcG.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-muV1SduS.js → imports-page-CuR6RSUM.js} +1 -1
- package/dist/gateway/static/root/assets/{index-D0qMv3jf.js → index-CNH8vwcY.js} +7 -7
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-i1sDWcwl.js → keyboard-shortcuts-settings-DpyqH2cP.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DY9tXEO6.js → local-app-workbench-page-B4hIoxV8.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BHD73STy.js → local-apps-page-S7lUpENM.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DsPpe8Ws.js → logs-page-CSlZT1-L.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-Buwi2wQE.js → management-settings-BYCL5CwV.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-i9N5shss.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-D8n80Gbr.js → note-detail-panel-CJ5Earr_.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-Btf-jSS_.js → notes-page-CPGk8-n1.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-97RL8Gc7.js → page-context-capture-button-C2bSXVbz.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-B04L8Oz5.js → personal-page-BjTt5R3s.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-9zEDvZa7.js → product-open-page-Cn16lm5l.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-DynBrIXq.js → product-preview-content-CowgeuoG.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-BM7MsoVA.js → project-detail-page-CyKx4PyN.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-pcyeEJnz.js → projects-page--_hXxUMC.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-CphyTu22.js → remote-access-hub-Bq_eqQYf.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DPafoO0G.js → runtime-tools-settings-panel-BgCATci5.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-j97FrDRW.js → scenes-page-DxE3jRPR.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CuJNwKHO.js → schema-form-I6pzJJzg.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-D8t_8fMl.js → sessions-page-CQkGFnJM.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Dtlsvsci.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-DS9DMYUe.js → settings-page-Dy5oQDbx.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DRDvm9yZ.js → setup-status-panel-CrAazq4r.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DQTQZu6V.js → shares-settings-BNMhs-Vd.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-DzVa7G-O.js → skill-api-RIjxQs-Y.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CfJIjRdS.js → skills-page-XVOxILQn.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Bzhqed-a.js → system-settings-panel-C8aLy8T_.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BYQFC0-U.js → task-detail-page-o1O2IDVP.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-DrgpZ81I.js → tunnel-api-JkDu1wiC.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-Drk8FWnj.js → usage-page-B8K6Y4ro.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-07t2-nFE.js → user-model-page-C1QX47VR.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-TQ5bjVot.js → work-discovery-overlay-BshsEDRO.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C9HP2uGG.js → workflow-run-setup-panel-CRG3paWy.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DK01JRI1.js → workflows-page-c-AoSVzm.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-B-BhQdAf.js → xopc-cloud-account-card-PDSIicr1.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +17 -17
- package/dist/src/agent/agent-scope.js +2 -2
- package/dist/src/agent/background-review/prompts.js +1 -1
- package/dist/src/agent/background-review/run-background-review.js +10 -10
- package/dist/src/agent/child-agent-factory.js +1 -1
- package/dist/src/agent/coding/repository-instructions.js +1 -1
- package/dist/src/agent/context/coordinator.js +2 -2
- package/dist/src/agent/context/execution-context.js +4 -4
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/context/project-context.js +3 -3
- package/dist/src/agent/data-acquisition/service.js +1 -1
- package/dist/src/agent/embedded/codemode-extension.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +5 -5
- package/dist/src/agent/embedded/run-turn.js +13 -13
- package/dist/src/agent/embedded/session-runner.js +3 -3
- package/dist/src/agent/embedded/session-tool-result-guard.js +2 -2
- package/dist/src/agent/embedded/tool-result-truncation.js +1 -1
- package/dist/src/agent/embedded/xopc-tools-bridge.js +1 -1
- package/dist/src/agent/external-tools/cliProvider.js +4 -4
- package/dist/src/agent/external-tools/composio-provider.js +4 -4
- package/dist/src/agent/external-tools/endpoint-provider.js +6 -6
- package/dist/src/agent/external-tools/gateway-tools.js +2 -2
- package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/index.js +1 -1
- package/dist/src/agent/image/load-image-media.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +3 -3
- package/dist/src/agent/inbound/inbound-loop.js +2 -2
- package/dist/src/agent/index.js +3 -3
- package/dist/src/agent/memory/context-budget.js +1 -1
- package/dist/src/agent/memory/context-recovery.js +1 -1
- package/dist/src/agent/memory/index.js +1 -1
- package/dist/src/agent/orchestration/llm-turn-retry.js +1 -1
- package/dist/src/agent/prompt/response-language.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +3 -3
- package/dist/src/agent/sandbox/exec-policy.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +4 -4
- package/dist/src/agent/service/process-direct-streaming.js +7 -7
- package/dist/src/agent/service/webchat-tts.js +2 -2
- package/dist/src/agent/service.js +23 -23
- package/dist/src/agent/session/session-config-service.js +3 -3
- package/dist/src/agent/session/session-hydrator.js +1 -1
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/filesystem-watcher.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -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/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/source-context/index.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +7 -7
- package/dist/src/agent/tools/create-share-tool.js +3 -3
- package/dist/src/agent/tools/dataBatch.js +1 -1
- package/dist/src/agent/tools/delegate-tool.js +3 -3
- package/dist/src/agent/tools/executor.js +1 -1
- package/dist/src/agent/tools/factory.js +19 -19
- package/dist/src/agent/tools/image-generate-tool.js +3 -3
- package/dist/src/agent/tools/index.js +6 -6
- package/dist/src/agent/tools/list-dir.js +1 -1
- package/dist/src/agent/tools/personal-attention-tool.js +2 -2
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
- package/dist/src/agent/tools/personal-request-tool.js +4 -4
- package/dist/src/agent/tools/personal-result-tool.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.js +6 -6
- package/dist/src/agent/tools/publish-artifacts.js +2 -2
- package/dist/src/agent/tools/read.js +2 -2
- package/dist/src/agent/tools/review-workspace.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/skills-tools.js +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.js +3 -3
- package/dist/src/agent/tools/tts-tool.js +1 -1
- package/dist/src/agent/tools/user-context-tool.js +1 -1
- package/dist/src/agent/tools/write.js +2 -2
- package/dist/src/agent/tools/xopc-use-tool.js +6 -6
- package/dist/src/agent/transcript/index.js +2 -2
- package/dist/src/agent/transcript/transcript-hygiene.js +2 -2
- package/dist/src/agent/workflow/subagent-runner.js +1 -1
- package/dist/src/agent/workspace-runtime/registry.js +1 -1
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-matching/delegation-service.js +1 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/oauth/xopc-cloud.js +2 -2
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/domain/index.js +1 -1
- package/dist/src/automations/draft/automation-draft-service.js +1 -1
- package/dist/src/automations/index.js +2 -2
- package/dist/src/automations/service/action-executor.js +1 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/browser/native-messaging-host.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/capabilities/store-connector.js +2 -2
- package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
- package/dist/src/channels/index.js +2 -2
- package/dist/src/channels/outbound-sender.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +9 -9
- package/dist/src/channels/pairing/pairing-store.js +6 -6
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +4 -4
- package/dist/src/chat-commands/builtins/session.js +1 -1
- package/dist/src/chat-commands/builtins/thinking.js +1 -1
- package/dist/src/chat-commands/builtins/tts.js +1 -1
- package/dist/src/chat-commands/context.js +2 -2
- package/dist/src/chat-commands/index.js +3 -3
- package/dist/src/cli/commands/agent.js +8 -8
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
- package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension.js +2 -2
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/mcp.js +1 -1
- package/dist/src/cli/commands/models.js +3 -3
- package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/project.js +1 -1
- package/dist/src/cli/commands/skills.js +2 -2
- package/dist/src/cli/commands/tunnel.js +4 -4
- package/dist/src/cli/extension-cli-register.js +6 -6
- package/dist/src/cli/utils/gateway-client.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +2 -2
- package/dist/src/cli/utils/session.js +1 -1
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/agent-profile.js +2 -2
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.js +5 -5
- package/dist/src/connectors/cli/authorization.js +1 -1
- package/dist/src/connectors/cli/runtime.js +1 -1
- package/dist/src/connectors/composio-sessions.js +1 -1
- package/dist/src/connectors/composio.js +1 -1
- package/dist/src/connectors/connected-source-ingestion.js +4 -4
- package/dist/src/connectors/connected-source-understanding.js +4 -4
- package/dist/src/connectors/connection-recovery-service.js +4 -4
- package/dist/src/connectors/content-enrichment.js +1 -1
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/connectors/learning-coordinator.js +1 -1
- package/dist/src/discussions/live-worker.js +1 -1
- package/dist/src/discussions/sealer.js +1 -1
- package/dist/src/endpoint-tools/index.js +1 -1
- package/dist/src/endpoint-tools/runtime.js +2 -2
- package/dist/src/extensions/activation-context.js +3 -3
- package/dist/src/extensions/agent-plugins/auth.js +1 -1
- package/dist/src/extensions/agent-plugins/credentials.js +1 -1
- package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/api.js +4 -4
- package/dist/src/extensions/bundled-extension-activation.js +1 -1
- package/dist/src/extensions/index.js +3 -3
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/extensions/loader.js +2 -2
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/extensions/sdk/media.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/device-routes.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +2 -2
- package/dist/src/gateway/global-defaults-admin.js +1 -1
- package/dist/src/gateway/hono/app.js +3 -3
- package/dist/src/gateway/hono/lib/config-payload.js +4 -4
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +5 -5
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/context-sources.js +2 -2
- package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -1
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/memory-learning.js +3 -3
- package/dist/src/gateway/hono/routes/models.js +5 -5
- package/dist/src/gateway/hono/routes/notes.js +3 -3
- package/dist/src/gateway/hono/routes/personal-agent.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +4 -4
- package/dist/src/gateway/hono/routes/runtime-tools.js +1 -1
- package/dist/src/gateway/hono/routes/session-command-handler.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +5 -5
- package/dist/src/gateway/hono/routes/sessions.js +3 -3
- package/dist/src/gateway/hono/routes/shares.js +2 -2
- package/dist/src/gateway/hono/routes/side-chats.js +1 -1
- package/dist/src/gateway/hono/routes/site-shares.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
- package/dist/src/gateway/hono/routes/user-model.js +7 -7
- package/dist/src/gateway/hono/routes/voice.js +7 -7
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/lock.js +11 -11
- package/dist/src/gateway/media-access.js +1 -1
- package/dist/src/gateway/mobile-privacy.js +2 -2
- package/dist/src/gateway/ports.js +6 -6
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/scenes/mailContext.js +1 -1
- package/dist/src/gateway/scenes/slackThreadSource.js +1 -1
- package/dist/src/gateway/server.js +1 -1
- package/dist/src/gateway/service/agent-runner.js +3 -3
- package/dist/src/gateway/service/config-coordinator.js +2 -2
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +4 -4
- package/dist/src/gateway/service/session-command-service.js +2 -2
- package/dist/src/gateway/service.js +43 -43
- package/dist/src/gateway/session-context-summary.js +4 -4
- package/dist/src/gateway/workspace-editor-path.js +2 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/generator.js +2 -2
- package/dist/src/imports/compatibility.js +1 -1
- package/dist/src/imports/inventory.js +3 -3
- package/dist/src/imports/productImport.js +2 -2
- package/dist/src/imports/runtime.js +1 -1
- package/dist/src/infra/gateway-processes.js +2 -2
- package/dist/src/infra/path-env.js +3 -3
- package/dist/src/infra/update-global.js +9 -9
- package/dist/src/knowledge/connected-knowledge-pipeline.js +2 -2
- package/dist/src/knowledge/index.js +1 -1
- package/dist/src/knowledge-memory/repository.js +1 -1
- package/dist/src/local-apps/service.js +3 -3
- package/dist/src/mcp/gateway-http-client.js +1 -1
- package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
- package/dist/src/memory-learning/source-learning.js +4 -4
- package/dist/src/memory-learning/task-receipts.js +1 -1
- package/dist/src/notes/agent-context.js +4 -4
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/service.js +3 -3
- package/dist/src/personal-agent/capability-service.js +2 -2
- package/dist/src/personal-agent/proactivity/routes.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +7 -7
- package/dist/src/personal-agent/prompt-context.js +7 -7
- package/dist/src/personal-agent/prompts.js +1 -1
- package/dist/src/personal-agent/reply-composer.js +9 -9
- package/dist/src/personal-agent/request-delivery.js +2 -2
- package/dist/src/personal-agent/request-service.js +6 -6
- package/dist/src/personal-agent/result-reader.js +1 -1
- package/dist/src/personal-agent/service.js +3 -3
- package/dist/src/personal-agent/task-cancel.js +1 -1
- package/dist/src/platform/index.js +1 -1
- package/dist/src/projects/index.js +1 -1
- package/dist/src/projects/project-agent-suggestion.js +1 -1
- package/dist/src/projects/project-service.js +1 -1
- package/dist/src/projects/project-skill-service.js +2 -2
- package/dist/src/projects/workspace.js +1 -1
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/realtime/runtime.js +1 -1
- package/dist/src/remote-access/exposure-manager.js +1 -1
- package/dist/src/routing/agent-session-key.js +1 -1
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/resolve-tui-session-key.js +1 -1
- package/dist/src/scenes/taskFollowUp/agentExecutor.js +4 -4
- package/dist/src/scenes/taskFollowUp/resources.js +2 -2
- package/dist/src/scenes/taskFollowUp/service.js +6 -6
- package/dist/src/session/index.js +2 -2
- package/dist/src/session/init-session-turn.js +1 -1
- package/dist/src/session/resolve-session.js +1 -1
- package/dist/src/session/store.js +5 -5
- package/dist/src/session/thinking-resolve.js +1 -1
- package/dist/src/share/hosted-session-share.js +2 -2
- package/dist/src/share/session-share-service.js +1 -1
- package/dist/src/share/share-store.js +1 -1
- package/dist/src/share/share-thumbnail.js +1 -1
- package/dist/src/share/site-share-store.js +1 -1
- package/dist/src/storage/sqlite/connection.js +9 -9
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +2 -2
- package/dist/src/tasks/home-query-service.js +2 -2
- package/dist/src/tasks/index.js +4 -4
- package/dist/src/tasks/task-allocation-service.js +5 -5
- package/dist/src/tasks/task-application-service.js +6 -6
- package/dist/src/tasks/task-collaboration-delivery.js +1 -1
- package/dist/src/tasks/task-context-assembler.js +2 -2
- package/dist/src/tasks/task-handoff-service.js +2 -2
- package/dist/src/tasks/task-handoff.js +5 -5
- package/dist/src/tasks/task-main-update-decision-service.js +3 -3
- package/dist/src/tasks/task-model-call.js +1 -1
- package/dist/src/tasks/task-research-result.js +4 -4
- package/dist/src/tasks/task-result-delivery-repository.js +1 -1
- package/dist/src/tasks/task-result-delivery-service.js +2 -2
- package/dist/src/tasks/task-run-coordinator.js +4 -4
- package/dist/src/tasks/task-run-dispatcher.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +15 -15
- package/dist/src/tui/backends/gateway-realtime-backend.js +2 -2
- package/dist/src/tui/extension-host/load-extensions.js +2 -2
- package/dist/src/tui/tui-commands.js +5 -5
- package/dist/src/tui/tui-picker-overlay.js +1 -1
- package/dist/src/tui/tui-skills-autocomplete.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +4 -4
- package/dist/src/tui/tui.js +6 -6
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/user-context/access-policy.js +2 -2
- package/dist/src/user-model/bootstrap.js +1 -1
- package/dist/src/user-model/capture/executor.js +1 -1
- package/dist/src/user-model/index.js +2 -2
- package/dist/src/voice/realtime/memory-context.js +7 -7
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/voice/realtime/runtime.js +4 -4
- package/dist/src/voice/stt/index.js +2 -2
- package/dist/src/voice/stt/preflight.js +1 -1
- package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
- package/dist/src/voice/stt/transcribe-core.js +1 -1
- package/dist/src/voice/tts/index.js +3 -3
- package/dist/src/voice/tts/merge-config.js +1 -1
- package/dist/src/voice/tts/payload.js +1 -1
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
- package/dist/src/voice/tts/speak-core.js +1 -1
- package/dist/src/work-discovery/incremental-repository.js +1 -1
- package/dist/src/work-discovery/service.js +7 -7
- package/dist/src/workflows/context/workflow-context.js +1 -1
- package/dist/src/workflows/engine/workflow-engine.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +7 -7
- package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-D2mip-f9.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDkitNHA.js +0 -1
package/dist/gateway/static/root/assets/{connectors-page-CmJV7gqj.js → connectors-page-BZk-Gou5.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,p as a}from"./chunk-KS7C4IRE--EKdQGRF.js";import{t as o}from"./chevron-right-BweFrslA.js";import{n as s,r as c,t as l}from"./popover-select-DHC7J4lG.js";import{t as u}from"./circle-alert-BEjgurr2.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./clock-3-DnrAnuyZ.js";import{t as p}from"./ellipsis-0k4rZLoy.js";import{t as m}from"./external-link-DjqjBmc3.js";import{t as h}from"./loader-circle-CifKLtgG.js";import{t as g}from"./plus-Q2yW6OE7.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./messages-DTqbfje6.js";import{t as y}from"./cn-0WouolD0.js";import{a as b,c as x,n as S,r as C}from"./locale-store-uRu_DsWm.js";import{a as w,i as T,n as E,o as D,r as O,s as k,t as A}from"./dist-BGTk37IG.js";import{r as j}from"./extension-provider-CJZ5EVpQ.js";import{n as M}from"./copy-to-clipboard-HOJ79TWv.js";import{t as N}from"./button-aIC072nz.js";import{n as P}from"./interaction-BdhHBbYa.js";import{n as F,r as I}from"./gateway-config-swr-D0tBjSgj.js";import{s as L}from"./form-field-width-DJw_jULe.js";import{t as R}from"./skeleton-BI5TyibZ.js";import{n as z}from"./electron-env-Dit0bHgy.js";import{$ as B,$a as V,Aa as H,Ac as U,An as W,Ao as G,Ba as K,Bn as q,Cc as ee,Co as J,Da as te,Ea as ne,Fa as re,Fn as ie,Go as ae,Ia as oe,In as Y,J as se,Ja as ce,Jo as X,Ka as le,La as ue,Ln as de,Ma as fe,Mn as pe,Na as me,Oa as he,Q as ge,Qa as _e,Ra as ve,Rn as ye,Ta as be,Ua as xe,Va as Se,Vs as Ce,Wa as we,Wo as Te,X as Ee,Xa as De,Xo as Oe,Y as ke,Ya as Ae,Z as je,Za as Me,eo as Ne,fo as Pe,ja as Fe,jn as Ie,ka as Le,kn as Re,na as ze,no as Be,pc as Ve,ps as He,q as Ue,qa as We,to as Ge,ui as Ke,wa as qe,za as Je}from"./index-D0qMv3jf.js";import{n as Ye,t as Xe}from"./capability-header-actions-B3TL8TcF.js";import{t as Ze}from"./connector-service-page-DTnfpLHL.js";import{t as Qe}from"./page-tabs-HLrKIjXH.js";import{n as $e}from"./agent-plugin-dialog-Q9guA8kU.js";import{t as et}from"./number-input-DDeqHK-G.js";var Z=e(t(),1),Q=n(),$=r();function tt(e){let t=(0,Q.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(nt),m=e.slice(0,2),h=Math.max(0,e.length-m.length),g=o.connect,_;t[11]!==n||t[12]!==o?(_=Ee(n,o),t[11]=n,t[12]=o,t[13]=_):_=t[13];let v=_,b=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:y(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:()=>i(n),children:[(0,$.jsx)(He,{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)(B,{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]===b?w=t[24]:(w=b?(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:b}):null,t[23]=b,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 nt(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}var rt=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function it(e,t){return t.some(t=>t.connectorId===e.id)}var at=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ot(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:y(`size-10 shrink-0 rounded-xl`,at)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`div`,{className:`flex h-full min-h-[9.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:y(`h-4 min-w-0 flex-1`,at)}),(0,$.jsx)(`div`,{className:y(`h-8 w-[4.5rem] shrink-0 rounded-lg`,at)})]}),(0,$.jsx)(`div`,{className:y(`h-3 w-full`,at)}),(0,$.jsx)(`div`,{className:y(`h-3 w-[88%]`,at)})]})]})}),e[1]=n):n=e[1],n}var st=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ct(){let e=(0,Q.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:y(`size-10 shrink-0 rounded-xl`,st)}),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:y(`h-4 w-48 max-w-full`,st)}),(0,$.jsx)(`div`,{className:y(`h-3 w-72 max-w-full`,st)})]}),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:y(`h-9 w-20 rounded-lg`,st)}),(0,$.jsx)(`div`,{className:y(`h-9 w-20 rounded-lg`,st)})]})]})]}),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:y(`h-8 w-20 rounded-md`,st)}),(0,$.jsx)(`div`,{className:y(`h-8 w-24 rounded-md`,st)}),(0,$.jsx)(`div`,{className:y(`h-8 w-28 rounded-md`,st)})]}),(0,$.jsx)(`div`,{className:y(`mt-3 h-20 rounded-xl`,st)})]}),e[3]=i):i=e[3],i}var lt=[`understand`,`act`,`reach`];function ut(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 dt(e){return ut(e)[0]??`act`}function ft(e,t){let n=t?dt(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 pt(e,t){return t.connectorCapabilityLabels[e]??e}function mt(e,t){if(e.runtime.type===`mcp`)return je(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 je(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function ht(e,t){return e.auth.mode===`cli`?t.connectorAuthCli:e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function gt(e){let t=(0,Q.c)(133),{connector:n,installed:r,onClose:i,onInstall:a,t:o}=e,s;t[0]!==n||t[1]!==o?(s=Ee(n,o),t[0]=n,t[1]=o,t[2]=s):s=t[2];let c=s,l,u,f,p,m,h,g,v,b,x,S,C,j,M,F,I;if(t[3]!==n||t[4]!==c||t[5]!==r||t[6]!==i||t[7]!==o){let e=ut(n),a;t[24]!==n.setup.config||t[25]!==n.setup.secrets?(a=[...(n.setup.secrets??[]).filter(yt),...(n.setup.config??[]).filter(vt)],t[24]=n.setup.config,t[25]=n.setup.secrets,t[26]=a):a=t[26];let s=a,N=n.capabilities.filter(_t);f=A,g=!0,t[27]===i?v=t[28]:(v=e=>{e||i()},t[27]=i,t[28]=v),u=D,t[29]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(w,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[29]=h):h=t[29],l=O,t[30]===Symbol.for(`react.memo_cache_sentinel`)?(p=y(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,42rem)] w-[min(100%-2rem,min(92vw,44rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-overlay shadow-float outline-none dark:border-edge`),t[30]=p):p=t[30];let L;t[31]===n?L=t[32]:(L=(0,$.jsx)(B,{connector:n,size:`lg`}),t[31]=n,t[32]=L);let R;t[33]===n.displayName?R=t[34]:(R=(0,$.jsx)(k,{className:`text-base font-semibold text-fg`,children:n.displayName}),t[33]=n.displayName,t[34]=R);let z;t[35]!==r||t[36]!==o.connectedBadge?(z=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]=z):z=t[37];let V;t[38]!==R||t[39]!==z?(V=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[R,z]}),t[38]=R,t[39]=z,t[40]=V):V=t[40];let H;t[41]===c?H=t[42]:(H=(0,$.jsx)(T,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:c}),t[41]=c,t[42]=H);let U;t[43]!==V||t[44]!==H?(U=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[V,H]}),t[43]=V,t[44]=H,t[45]=U):U=t[45];let W;t[46]!==L||t[47]!==U?(W=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[L,U]}),t[46]=L,t[47]=U,t[48]=W):W=t[48];let G;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(G=y(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,P.focusRingPanel),t[49]=G):G=t[49];let K;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(_,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[50]=K):K=t[50];let q;t[51]===o.modalClose?q=t[52]:(q=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:G,"aria-label":o.modalClose,children:K})}),t[51]=o.modalClose,t[52]=q),t[53]!==W||t[54]!==q?(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:[W,q]}),t[53]=W,t[54]=q,t[55]=m):m=t[55],M=`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-5 sm:px-6`,F=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 ee;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(Ce,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[56]=ee):ee=t[56];let J;t[57]===o.detailPermissions?J=t[58]:(J=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.detailPermissions}),t[57]=o.detailPermissions,t[58]=J);let te;t[59]!==n||t[60]!==o?(te=ht(n,o),t[59]=n,t[60]=o,t[61]=te):te=t[61];let ne;t[62]===te?ne=t[63]:(ne=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:te}),t[62]=te,t[63]=ne);let re;t[64]!==J||t[65]!==ne?(re=(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3`,children:[ee,(0,$.jsxs)(`div`,{children:[J,ne]})]}),t[64]=J,t[65]=ne,t[66]=re):re=t[66];let ie;t[67]===o.connectorSetupTitle?ie=t[68]:(ie=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.connectorSetupTitle}),t[67]=o.connectorSetupTitle,t[68]=ie);let oe;t[69]!==s.length||t[70]!==o.connectorRequiredInputsCount||t[71]!==o.connectorSetupNone?(oe=s.length?je(o.connectorRequiredInputsCount,{count:String(s.length)}):o.connectorSetupNone,t[69]=s.length,t[70]=o.connectorRequiredInputsCount,t[71]=o.connectorSetupNone,t[72]=oe):oe=t[72];let Y;t[73]===oe?Y=t[74]:(Y=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:oe}),t[73]=oe,t[74]=Y);let se;t[75]!==ie||t[76]!==Y?(se=(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[ie,Y]}),t[75]=ie,t[76]=Y,t[77]=se):se=t[77],t[78]!==re||t[79]!==se?(I=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[re,se]}),t[78]=re,t[79]=se,t[80]=I):I=t[80],C=`rounded-xl border border-edge bg-surface-base`,t[81]===o.connectorTechnicalDetails?j=t[82]:(j=(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]=j),b=`space-y-5 border-t border-edge-subtle px-4 py-4`;let ce;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),t[83]=ce):ce=t[83];let X;t[84]===o.connectorRuntimeTitle?X=t[85]:(X=(0,$.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[ce,o.connectorRuntimeTitle]}),t[84]=o.connectorRuntimeTitle,t[85]=X);let le;t[86]!==n||t[87]!==o?(le=mt(n,o),t[86]=n,t[87]=o,t[88]=le):le=t[88];let ue;t[89]===le?ue=t[90]:(ue=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-subtle`,children:le}),t[89]=le,t[90]=ue),t[91]!==X||t[92]!==ue?(x=(0,$.jsxs)(`div`,{children:[X,ue]}),t[91]=X,t[92]=ue,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:pt(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]=v,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=j,t[21]=M,t[22]=F,t[23]=I}else l=t[8],u=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],v=t[15],b=t[16],x=t[17],S=t[18],C=t[19],j=t[20],M=t[21],F=t[22],I=t[23];let L;t[94]!==b||t[95]!==x||t[96]!==S?(L=(0,$.jsxs)(`div`,{className:b,children:[x,S]}),t[94]=b,t[95]=x,t[96]=S,t[97]=L):L=t[97];let R;t[98]!==L||t[99]!==C||t[100]!==j?(R=(0,$.jsxs)(`details`,{className:C,children:[j,L]}),t[98]=L,t[99]=C,t[100]=j,t[101]=R):R=t[101];let z;t[102]!==R||t[103]!==M||t[104]!==F||t[105]!==I?(z=(0,$.jsxs)(`div`,{className:M,children:[F,I,R]}),t[102]=R,t[103]=M,t[104]=F,t[105]=I,t[106]=z):z=t[106];let V;t[107]===o.modalClose?V=t[108]:(V=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(N,{variant:`secondary`,children:o.modalClose})}),t[107]=o.modalClose,t[108]=V);let H;t[109]!==n||t[110]!==r||t[111]!==i||t[112]!==a||t[113]!==o.connect?(H=r?null:(0,$.jsxs)(N,{variant:`primary`,onClick:()=>{a(n),i()},children:[(0,$.jsx)(He,{className:`size-4`}),o.connect]}),t[109]=n,t[110]=r,t[111]=i,t[112]=a,t[113]=o.connect,t[114]=H):H=t[114];let U;t[115]!==V||t[116]!==H?(U=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[V,H]}),t[115]=V,t[116]=H,t[117]=U):U=t[117];let W;t[118]!==l||t[119]!==p||t[120]!==m||t[121]!==z||t[122]!==U?(W=(0,$.jsxs)(l,{className:p,children:[m,z,U]}),t[118]=l,t[119]=p,t[120]=m,t[121]=z,t[122]=U,t[123]=W):W=t[123];let G;t[124]!==u||t[125]!==h||t[126]!==W?(G=(0,$.jsxs)(u,{children:[h,W]}),t[124]=u,t[125]=h,t[126]=W,t[127]=G):G=t[127];let K;return t[128]!==f||t[129]!==g||t[130]!==v||t[131]!==G?(K=(0,$.jsx)(f,{open:g,onOpenChange:v,children:G}),t[128]=f,t[129]=g,t[130]=v,t[131]=G,t[132]=K):K=t[132],K}function _t(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}function vt(e){return e.required}function yt(e){return e.required}var bt=(0,Z.memo)(function(e){let t=(0,Q.c)(45),{onRefresh:n,refreshing:r,refreshLabel:i,onBrowseCatalog:a,onAddCustomServer:o,addLabel:s,browseLabel:c,customLabel:l,serviceLabel:u,moreActionsLabel:d}=e,[f,m]=(0,Z.useState)(!1),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=y(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[highlighted]:bg-surface-hover`,P.transition),t[0]=_):_=t[0];let v=_,b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(g,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[1]=b):b=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)(U,{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)(q,{asChild:!0,children:(0,$.jsxs)(N,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":s,children:[b,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)(G,{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)(Y,{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)(Pe,{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)(Y,{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)(de,{children:(0,$.jsxs)(ie,{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)(ye,{children:[C,O]}),t[19]=O,t[20]=C,t[21]=k):k=t[21];let A;t[22]===f?A=t[23]:(A=(0,$.jsx)(Ze,{open:f,onOpenChange:m,hideTrigger:!0}),t[22]=f,t[23]=A);let j;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t[24]=j):j=t[24];let M;t[25]===d?M=t[26]:(M=(0,$.jsx)(q,{asChild:!0,children:(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":d,title:d,children:j})}),t[25]=d,t[26]=M);let F;t[27]!==n||t[28]!==i||t[29]!==r?(F=n?(0,$.jsxs)(Y,{className:v,disabled:r,onSelect:n,children:[r?(0,$.jsx)(h,{className:`size-4 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,$.jsx)(Oe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,t[27]=n,t[28]=i,t[29]=r,t[30]=F):F=t[30];let I,L;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>m(!0),L=(0,$.jsx)(Te,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t[31]=I,t[32]=L):(I=t[31],L=t[32]);let R;t[33]===u?R=t[34]:(R=(0,$.jsxs)(Y,{className:v,onSelect:I,children:[L,u]}),t[33]=u,t[34]=R);let z;t[35]!==F||t[36]!==R?(z=(0,$.jsx)(de,{children:(0,$.jsxs)(ie,{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:[F,R]})}),t[35]=F,t[36]=R,t[37]=z):z=t[37];let B;t[38]!==M||t[39]!==z?(B=(0,$.jsxs)(ye,{children:[M,z]}),t[38]=M,t[39]=z,t[40]=B):B=t[40];let V;return t[41]!==k||t[42]!==A||t[43]!==B?(V=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[k,A,B]}),t[41]=k,t[42]=A,t[43]=B,t[44]=V):V=t[44],V});function xt(e=``,t=``){return{clientKey:crypto.randomUUID(),key:e,value:t}}var St=/^([^:=]+)[:=](.*)$/;function Ct(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Object.entries(e).map(([e,t])=>xt(e,t==null?``:String(t)))}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=St.exec(t);r&&n.push(xt(r[1].trim(),r[2].trim()))}return n.length>0?n:null}function wt(e){let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return Object.keys(t).length>0?t:void 0}function Tt(e){if(!e||typeof e!=`object`)return[xt()];let t=Object.entries(e).map(([e,t])=>xt(e,t==null?``:String(t)));return t.length>0?t:[xt()]}function Et(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 Dt(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=(t&&typeof t==`object`?t:{}).servers,r={};if(!n||typeof n!=`object`||Array.isArray(n))return r;for(let[e,t]of Object.entries(n))!t||typeof t!=`object`||Array.isArray(t)||Et(t)&&(r[e]=t);return r}function Ot(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!==`'`?(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 kt(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 At(e){let t={...e.extra,exposure:e.exposure};if(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=Ot(e.argsText);n&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=kt(e.envJson)),delete t.oauth}else{t.type=`http`,t.url=e.url.trim();let n=wt(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 jt(e,t){let n=t.oauth;return{clientKey:e,id:e,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:Tt(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 Mt(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 Nt(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 Pt(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,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=jt(e,n);return r.clientKey=crypto.randomUUID(),r.url&&=Nt(r.url),r})}function Ft(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`streamable-http`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[],oauthClientId:``,timeout:void 0,exposure:`codemode`,extra:{}}}function It(e){let t=e?.mcp?.servers??{};return{servers:Object.entries(t).filter(([,e])=>!Et(e)).map(([e,t])=>jt(e,t)).sort((e,t)=>e.id.localeCompare(t.id))}}async function Lt(e,t={}){let n={...t};for(let r of e.servers){let e=r.id.trim();if(!/^[a-zA-Z0-9_-]+$/.test(e))throw Error(`MCP IDs require letters, digits, underscores or hyphens.`);if(t[e])throw Error(`Server id "${e}" is reserved by an installed connector.`);n[e]=At(r)}await b(C(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:{servers:n}})}),F()}async function Rt(e,t){return(await b(C(`/api/mcp/servers/${encodeURIComponent(e)}/tools`),{method:`POST`,signal:AbortSignal.any([t,AbortSignal.timeout(95e3)])})).payload.tools}async function zt(e,t){return(await b(C(`/api/mcp/servers/${encodeURIComponent(e)}/probe`),{method:`POST`,signal:AbortSignal.any([t,AbortSignal.timeout(95e3)])})).payload}async function Bt(e){return(await b(C(`/api/mcp/servers/${encodeURIComponent(e)}/auth`),{method:`POST`})).payload}async function Vt(e,t){return(await b(C(`/api/mcp/auth/${encodeURIComponent(e)}`),{signal:t})).payload}async function Ht(e){await b(C(`/api/mcp/auth/${encodeURIComponent(e)}`),{method:`DELETE`})}async function Ut(e,t){await b(C(`/api/mcp/auth/${encodeURIComponent(e)}/redirect`),{method:`POST`,body:JSON.stringify({url:t})})}function Wt(e){let t=(0,Q.c)(88),{serverId:n,t:r,onClose:i,onConfigure:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],t[0]=o):o=t[0];let[s,c]=(0,Z.useState)(o),[l,u]=(0,Z.useState)(!0),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(0),_;t[1]===n?_=t[2]:(_=()=>{let e=new AbortController,t=!0;return u(!0),f(``),c([]),Rt(n,e.signal).then(e=>{t&&c(e)}).catch(e=>{t&&f(e instanceof Error?e.message:String(e))}).finally(()=>{t&&u(!1)}),()=>{t=!1,e.abort()}},t[1]=n,t[2]=_);let v;t[3]!==h||t[4]!==n?(v=[n,h],t[3]=h,t[4]=n,t[5]=v):v=t[5],(0,Z.useEffect)(_,v);let y,b,x,S,C,j,M,P,F,I,L,R;if(t[6]!==d||t[7]!==l||t[8]!==i||t[9]!==a||t[10]!==p||t[11]!==n||t[12]!==r.setupConfigure||t[13]!==r.toolParameters||t[14]!==r.toolsAuthHint||t[15]!==r.toolsDialogSearchEmpty||t[16]!==r.toolsDialogSearchPlaceholder||t[17]!==r.toolsDialogSubtitle||t[18]!==r.toolsDialogTitle||t[19]!==r.toolsEmpty||t[20]!==r.toolsLoading||t[21]!==r.toolsTitle||t[22]!==s){let e=p.trim().toLowerCase(),o=s.filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e));x=A,C=!0,t[35]===i?j=t[36]:(j=e=>{e||i()},t[35]=i,t[36]=j),b=D,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(w,{className:`fixed inset-0 z-[60] bg-scrim`}),t[37]=S):S=t[37],y=O,L=`fixed left-1/2 top-1/2 z-[60] flex h-[min(42rem,calc(100vh-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 c;t[38]===r.toolsDialogTitle?c=t[39]:(c=(0,$.jsx)(k,{className:`font-semibold`,children:r.toolsDialogTitle}),t[38]=r.toolsDialogTitle,t[39]=c);let u;t[40]!==l||t[41]!==n||t[42]!==r.toolsDialogSubtitle||t[43]!==s.length?(u=l?n:r.toolsDialogSubtitle.replace(`{{serverId}}`,n).replace(`{{count}}`,String(s.length)),t[40]=l,t[41]=n,t[42]=r.toolsDialogSubtitle,t[43]=s.length,t[44]=u):u=t[44];let f;t[45]===u?f=t[46]:(f=(0,$.jsx)(T,{className:`mt-1 text-sm text-fg-muted`,children:u}),t[45]=u,t[46]=f);let h;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>m(e.target.value),t[47]=h):h=t[47];let g;t[48]!==p||t[49]!==r.toolsDialogSearchPlaceholder?(g=(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:p,onChange:h,placeholder:r.toolsDialogSearchPlaceholder,"aria-label":r.toolsDialogSearchPlaceholder}),t[48]=p,t[49]=r.toolsDialogSearchPlaceholder,t[50]=g):g=t[50],t[51]!==c||t[52]!==f||t[53]!==g?(R=(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge p-5`,children:[c,f,g]}),t[51]=c,t[52]=f,t[53]=g,t[54]=R):R=t[54],M=`min-h-0 flex-1 overflow-y-auto p-5`,P=l,t[55]!==r.toolsTitle||t[56]!==s.length?(F=r.toolsTitle.replace(`{{count}}`,String(s.length)),t[55]=r.toolsTitle,t[56]=s.length,t[57]=F):F=t[57],I=l?(0,$.jsx)(`div`,{role:`status`,"aria-label":r.toolsLoading,className:`space-y-3`,children:[0,1,2].map(Kt)}):d?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm text-danger`,children:d}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.toolsAuthHint.replace(`{{serverId}}`,n)}),a?(0,$.jsx)(N,{variant:`secondary`,onClick:a,children:r.setupConfigure}):null]}):o.length?(0,$.jsx)(`div`,{className:`space-y-3`,children:o.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}),e.exposure?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children: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:r.toolParameters}),(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,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.length?r.toolsDialogSearchEmpty:r.toolsEmpty}),t[6]=d,t[7]=l,t[8]=i,t[9]=a,t[10]=p,t[11]=n,t[12]=r.setupConfigure,t[13]=r.toolParameters,t[14]=r.toolsAuthHint,t[15]=r.toolsDialogSearchEmpty,t[16]=r.toolsDialogSearchPlaceholder,t[17]=r.toolsDialogSubtitle,t[18]=r.toolsDialogTitle,t[19]=r.toolsEmpty,t[20]=r.toolsLoading,t[21]=r.toolsTitle,t[22]=s,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=j,t[29]=M,t[30]=P,t[31]=F,t[32]=I,t[33]=L,t[34]=R}else y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],j=t[28],M=t[29],P=t[30],F=t[31],I=t[32],L=t[33],R=t[34];let z;t[58]!==M||t[59]!==P||t[60]!==F||t[61]!==I?(z=(0,$.jsx)(`div`,{className:M,"aria-busy":P,"aria-label":F,children:I}),t[58]=M,t[59]=P,t[60]=F,t[61]=I,t[62]=z):z=t[62];let B;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>g(Gt),t[63]=B):B=t[63];let V;t[64]!==l||t[65]!==r.refreshTools?(V=(0,$.jsx)(N,{variant:`secondary`,disabled:l,onClick:B,children:r.refreshTools}),t[64]=l,t[65]=r.refreshTools,t[66]=V):V=t[66];let H;t[67]!==i||t[68]!==r.toolsDialogClose?(H=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(N,{onClick:i,children:r.toolsDialogClose})}),t[67]=i,t[68]=r.toolsDialogClose,t[69]=H):H=t[69];let U;t[70]!==V||t[71]!==H?(U=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge p-4`,children:[V,H]}),t[70]=V,t[71]=H,t[72]=U):U=t[72];let W;t[73]!==y||t[74]!==z||t[75]!==U||t[76]!==L||t[77]!==R?(W=(0,$.jsxs)(y,{className:L,children:[R,z,U]}),t[73]=y,t[74]=z,t[75]=U,t[76]=L,t[77]=R,t[78]=W):W=t[78];let G;t[79]!==b||t[80]!==S||t[81]!==W?(G=(0,$.jsxs)(b,{children:[S,W]}),t[79]=b,t[80]=S,t[81]=W,t[82]=G):G=t[82];let K;return t[83]!==x||t[84]!==C||t[85]!==j||t[86]!==G?(K=(0,$.jsx)(x,{open:C,onOpenChange:j,children:G}),t[83]=x,t[84]=C,t[85]=j,t[86]=G,t[87]=K):K=t[87],K}function Gt(e){return e+1}function Kt(e){return(0,$.jsx)(R,{className:`h-24 w-full`},e)}function qt(e){if(e.transport===`stdio`){let t=e.command.trim();if(!t)return``;let n=e.argsText.trim();return n?`${t} ${n}`:t}return e.url.trim()}function Jt(e){let t=(0,Q.c)(48),{row:n,t:r,cs:i,onEdit:a,onRemove:o}=e,[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(``),p;t[0]===n.id?p=t[1]:(p=(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:n.id}),t[0]=n.id,t[1]=p);let m;t[2]===n?m=t[3]:(m=qt(n),t[2]=n,t[3]=m);let h;t[4]===m?h=t[5]:(h=(0,$.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-fg-muted`,children:m}),t[4]=m,t[5]=h);let g;t[6]!==a||t[7]!==p||t[8]!==h?(g=(0,$.jsxs)(`button`,{className:`block w-full text-left`,onClick:a,children:[p,h]}),t[6]=a,t[7]=p,t[8]=h,t[9]=g):g=t[9];let _;t[10]===r.setupEditHint?_=t[11]:(_=(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r.setupEditHint}),t[10]=r.setupEditHint,t[11]=_);let v;t[12]===d?v=t[13]:(v=d?(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:d}):null,t[12]=d,t[13]=v);let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>c(!0),t[14]=y):y=t[14];let b;t[15]===r.viewTools?b=t[16]:(b=(0,$.jsx)(N,{variant:`secondary`,onClick:y,children:r.viewTools}),t[15]=r.viewTools,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>u(!0),t[17]=x):x=t[17];let S;t[18]===r.removeServer?S=t[19]:(S=(0,$.jsx)(N,{variant:`ghost`,onClick:x,children:r.removeServer}),t[18]=r.removeServer,t[19]=S);let C;t[20]!==S||t[21]!==b?(C=(0,$.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[b,S]}),t[20]=S,t[21]=b,t[22]=C):C=t[22];let w;t[23]!==a||t[24]!==n.id||t[25]!==s||t[26]!==r?(w=s?(0,$.jsx)(Wt,{serverId:n.id,t:r,onClose:()=>c(!1),onConfigure:()=>{c(!1),a()}}):null,t[23]=a,t[24]=n.id,t[25]=s,t[26]=r,t[27]=w):w=t[27];let T;t[28]!==i.removeConfirmTitle||t[29]!==n.id?(T=i.removeConfirmTitle.replace(`{{name}}`,n.id),t[28]=i.removeConfirmTitle,t[29]=n.id,t[30]=T):T=t[30];let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>u(!1),t[31]=E):E=t[31];let D;t[32]===o?D=t[33]:(D=()=>{u(!1),o().catch(e=>f(String(e)))},t[32]=o,t[33]=D);let O;t[34]!==l||t[35]!==i.modalCancel||t[36]!==i.removeConfirmDescription||t[37]!==r.removeServer||t[38]!==T||t[39]!==D?(O=(0,$.jsx)(Ke,{open:l,title:T,description:i.removeConfirmDescription,confirmLabel:r.removeServer,cancelLabel:i.modalCancel,destructive:!0,onCancel:E,onConfirm:D}),t[34]=l,t[35]=i.modalCancel,t[36]=i.removeConfirmDescription,t[37]=r.removeServer,t[38]=T,t[39]=D,t[40]=O):O=t[40];let k;return t[41]!==C||t[42]!==w||t[43]!==O||t[44]!==g||t[45]!==_||t[46]!==v?(k=(0,$.jsxs)(`div`,{className:`px-4 py-3.5`,children:[g,_,v,C,w,O]}),t[41]=C,t[42]=w,t[43]=O,t[44]=g,t[45]=_,t[46]=v,t[47]=k):k=t[47],k}function Yt(e){let t=e.connectedAt?Date.parse(e.connectedAt):0;return Number.isFinite(t)?t:0}function Xt(e,t){return e.status===`active`&&t.status!==`active`?-1:e.status!==`active`&&t.status===`active`?1:e.isCurrentAuthorization===t.isCurrentAuthorization?Yt(t)-Yt(e):e.isCurrentAuthorization?-1:1}function Zt(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(Xt);return{key:e,primary:n[0],authorizations:n}}).sort((e,t)=>Xt(e.primary,t.primary))}var Qt=y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,L);function $t(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function en(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function tn(e,t,n){return e.status===`connected`?je(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 nn(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 rn(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 an({instance:e,t,onChanged:n}){let r=$t(e),i=S(e=>e.language)===`zh`,[a,o]=(0,Z.useState)([]),[l,f]=(0,Z.useState)([]),[p,m]=(0,Z.useState)([]),[g,_]=(0,Z.useState)(null),[v,b]=(0,Z.useState)([]),[x,C]=(0,Z.useState)(null),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)([]),[O,k]=(0,Z.useState)({}),[A,j]=(0,Z.useState)(`read`),[M,P]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(null),[L,B]=(0,Z.useState)(!1),[U,W]=(0,Z.useState)(null),[G,q]=(0,Z.useState)(null),[ee,te]=(0,Z.useState)(!1),[ne,ie]=(0,Z.useState)(!1),[ae,Y]=(0,Z.useState)(!1),se=(0,Z.useRef)(0),X=(0,Z.useRef)(0),de=(0,Z.useMemo)(()=>Zt(a),[a]),pe=(0,Z.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]),he=(0,Z.useCallback)(async()=>{if(!r||e.materialized.type!==`composio`||e.materialized.role===`credential`)return;P(!0),I(null);let t=++se.current;try{let e=(await Promise.allSettled([pe(ue()).then(e=>{t===se.current&&(o(e.filter(e=>e.toolkit.toLowerCase()===r.toLowerCase())),te(!0))}),pe(me(r)).then(e=>{t===se.current&&j(e)}),pe(fe(r)).then(e=>{t===se.current&&(_(e.policy),b(e.agents))})])).find(e=>e.status===`rejected`);t===se.current&&e?.status===`rejected`&&I(String(e.reason instanceof Error?e.reason.message:e.reason))}finally{t===se.current&&P(!1)}},[e.materialized,r,pe]);(0,Z.useEffect)(()=>(he(),()=>{se.current++}),[he]);let ge=(0,Z.useCallback)(async()=>{if(!r)return;let e=++X.current;Y(!0),B(!1);let t=t=>n=>{e===X.current&&t(n)},n=await Promise.allSettled([pe(ve(r)).then(t(f)),pe(Je(20)).then(t(e=>m(e.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===r.toLowerCase())))),pe(re(r)).then(t(T)),pe(Fe(r)).then(t(C))]);e===X.current&&(B(n.some(e=>e.status===`rejected`)),Y(!1))},[r,pe]);(0,Z.useEffect)(()=>(ne&&ge(),()=>{X.current++}),[ne,ge]),(0,Z.useEffect)(()=>{let e=!1,t=Zt(a).map(e=>e.primary).filter(e=>e.supportsLearning&&e.accountId);if(t.length)return pe(K()).then(t=>{e||D(t)}).catch(()=>{}),Promise.allSettled(t.map(async e=>[e.accountId,await pe(oe(e.accountId))])).then(t=>{e||k(Object.fromEntries(t.flatMap(e=>e.status===`fulfilled`?[e.value]:[])))}),()=>{e=!0}},[a,pe]);let ye=(0,Z.useCallback)(async i=>{if(!r)return;let a=z()?null:window.open(`about:blank`,`_blank`);a&&(a.opener=null),P(!0),I(null);try{if(!z()&&!a)throw Error(`Allow popups to open the authorization page.`);let t=await ce(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 Be(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?.(),he()])}catch(e){I(ke(e,t))}finally{a?.close(),P(!1)}},[e.connectorId,he,n,t,r]),be=(0,Z.useCallback)(async t=>{P(!0),I(null);try{await Ne(e.instanceId,{config:{...e.config??{},authConfigId:t||void 0}}),await Promise.all([n?.(),he()])}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}},[e.config,e.instanceId,he,n]),xe=async e=>{let t=z()?null:window.open(`about:blank`,`_blank`);t&&(t.opener=null),I(null);try{let n=await H(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 he()}catch(e){t?.close(),I(e instanceof Error?e.message:String(e))}},Te=(0,Z.useCallback)(async e=>{if(r){j(e),I(null);try{await le(r,e)}catch(e){I(e instanceof Error?e.message:String(e)),await he()}}},[he,r]),Ee=(0,Z.useCallback)(async e=>{if(r){I(null);try{_(await V(r,e))}catch(e){I(e instanceof Error?e.message:String(e))}}},[r]),De=(0,Z.useCallback)(e=>{if(!g)return;let t=g.allowedAgentIds.includes(e);t&&g.allowedAgentIds.length===1||Ee({allowedAgentIds:t?g.allowedAgentIds.filter(t=>t!==e):[...g.allowedAgentIds,e]})},[Ee,g]),Ae=(0,Z.useCallback)(async e=>{P(!0),I(null);try{await e(),await he()}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}},[he]);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 Pe=de.filter(e=>e.primary.status===`active`).length,Ie=Pe>0?t.composioAddAccount:t.composioConnectAccount,Le=ee&&Pe>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:y(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,Le?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:[Le?(0,$.jsx)(d,{className:`size-3.5`}):(0,$.jsx)(u,{className:`size-3.5`}),Le?t.connectionReady:ee||F?t.connectionNeedsSetup:t.connectionChecking]}),ee&&(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:je(t.composioAccountCount,{count:String(de.length)})})]}),(0,$.jsxs)(N,{variant:`primary`,className:`shrink-0`,disabled:M,onClick:()=>void ye(),children:[M?(0,$.jsx)(h,{className:`size-4 animate-spin`}):(0,$.jsx)(Ce,{className:`size-4`}),Ie]})]}),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:M,onClick:()=>void he(),children:t.composioRetry})]}):null,x&&!Le?(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:tn(x,Pe,t)}),x.recovery===`none`?null:(0,$.jsx)(N,{variant:`secondary`,disabled:M,onClick:()=>void(x.recovery===`retry`?he():ye()),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,g?(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 Te(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:g.confirmationPolicy,onChange:e=>void Ee({confirmationPolicy:e.currentTarget.value}),children:[(0,$.jsx)(c,{value:`writes`,children:t.composioConfirmWrites}),(0,$.jsx)(c,{value:`always`,children:t.composioConfirmAlways}),g.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:g.allowedAgentIds.length?t.composioAllowedAgentsSelected:t.composioAllowedAgentsAll}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,className:y(`rounded-full border px-2.5 py-1 text-xs transition-colors`,g.allowedAgentIds.length===0?`border-accent bg-accent/10 text-accent`:`border-edge bg-surface-panel text-fg-muted hover:text-fg`),onClick:()=>void Ee({allowedAgentIds:[]}),children:t.composioAllowedAgentsAllOption}),v.map(e=>(0,$.jsx)(`button`,{type:`button`,className:y(`rounded-full border px-2.5 py-1 text-xs transition-colors`,g.allowedAgentIds.includes(e.id)?`border-accent bg-accent/10 text-accent`:`border-edge bg-surface-panel text-fg-muted hover:text-fg`),onClick:()=>De(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:g.selectedAccountIds===null,disabled:M,onChange:e=>void Ee({selectedAccountIds:e.currentTarget.checked?null:[]})}),i?`所有账号(包括以后新增)`:`All accounts, including new ones`]}),g.selectedAccountIds!==null&&de.map(({primary:e})=>e.accountId&&(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:M,checked:g.selectedAccountIds.includes(e.accountId),onChange:t=>void Ee({selectedAccountIds:t.currentTarget.checked?[...g.selectedAccountIds,e.accountId]:g.selectedAccountIds.filter(t=>t!==e.accountId)})}),e.alias??e.accountEmail??e.accountId]},e.accountId)),g.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}),ee&&(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:je(t.composioAccountCount,{count:String(de.length)})})]}),(0,$.jsxs)(N,{variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:M,onClick:()=>void he(),children:[(0,$.jsx)(Oe,{className:y(`size-3.5`,M&&`animate-spin`)}),t.refresh]})]}),de.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:de.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:y(`mt-1 text-xs`,r.status===`active`?`text-emerald-700 dark:text-emerald-300`:`text-amber-700 dark:text-amber-300`),children:r.accountEnabled===!1?i?`已暂停`:`Paused`:nn(r.status,t)}),a?(0,$.jsx)(`p`,{className:y(`mt-1 text-xs`,a.status===`failed`?`text-red-600`:`text-fg-subtle`),children:je(t.connectorLearningStatus,{status:rn(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 xe(r),children:i?`继续授权`:`Continue authorization`}),r.accountId&&(0,$.jsx)(N,{variant:`ghost`,className:`h-8 px-2.5 text-xs text-danger`,disabled:M,onClick:()=>q(r.accountId),children:i?`断开`:`Disconnect`}),r.accountId&&r.status!==`active`&&(0,$.jsx)(N,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,disabled:M,onClick:()=>void ye(r.accountId),children:t.composioReconnectAccount}),r.accountId&&(0,$.jsx)(N,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,disabled:M,onClick:()=>void Ae(()=>Me(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:M,onClick:()=>void Ae(async()=>{if(!r.accountId)throw Error(`Connector account is unavailable.`);await We(r.accountId),await n?.()}),children:[(0,$.jsx)(Oe,{className:`size-3.5`}),t.composioSyncNow]}):null]})]}),(0,$.jsxs)(`details`,{className:`mt-3 text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`w-fit cursor-pointer font-medium hover:text-fg`,children:t.composioAccountSettings}),(0,$.jsxs)(`div`,{className:`mt-3 space-y-4 rounded-lg bg-surface-panel p-3`,children:[r.accountId&&(0,$.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,$.jsx)(`legend`,{className:`mb-2 font-medium`,children:t.composioAllowedAgents}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:M,checked:r.allowedAgentIds==null,onChange:e=>void Ae(()=>Me(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:M,checked:r.allowedAgentIds.includes(e.id),onChange:t=>{let n=t.currentTarget.checked;Ae(()=>Me(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:M,onChange:e=>void Ae(()=>Ge(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:M,onChange:e=>void Ae(()=>Ge(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:y(Qt,`mt-1 h-8 py-1 text-xs`),defaultValue:r.alias??``,onBlur:e=>{e.currentTarget.value!==(r.alias??``)&&Ae(()=>_e(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:M,onClick:()=>W(e.id),children:(0,$.jsx)(J,{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:M,onClick:()=>void Ae(()=>Se(r.id)),children:(0,$.jsx)(Oe,{className:`size-4`})})})]})]})]},e.key)})}):M&&!ee?(0,$.jsxs)(`div`,{"aria-busy":`true`,"aria-label":t.connectionChecking,className:`space-y-3`,children:[(0,$.jsx)(R,{className:`h-16 w-full`}),(0,$.jsx)(R,{className:`h-16 w-full`})]}):ee?(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=>ie(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:[ae?(0,$.jsx)(R,{"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:ae,onClick:()=>void ge(),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:M,onChange:e=>void be(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:[en(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)(Ke,{open:G!==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=G;q(null),e&&Ae(()=>qe(e))},onCancel:()=>q(null)}),(0,$.jsx)(Ke,{open:U!==null,title:t.composioRevoke,description:t.composioRevokeConfirm,confirmLabel:t.composioRevoke,cancelLabel:t.modalCancel,destructive:!0,onConfirm:()=>{let e=U;W(null),e&&Ae(()=>we(e))},onCancel:()=>W(null)})]})}var on=y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,L);function sn(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 cn(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 ln({instance:e,definition:t,onClose:n,onChanged:r,t:i}){let[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),[g,v]=(0,Z.useState)(()=>sn(t,e)),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(null),F=t?.setup.config??[],I=(e.materialized.type===`mcp`||e.materialized.type===`memorySource`)&&F.length>0&&(t?.setup.secrets??[]).length===0,L=e.materialized.type===`mcp`,R=e.materialized.type===`composio`,z=e.materialized.type===`memorySource`,V=t?Ee(t,i):null,H=(0,Z.useCallback)(async()=>{C(!0),x(null);try{let t=await De(e.instanceId);M(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]),U=(0,Z.useCallback)(async()=>{o(!0),x(null);try{await xe(e.instanceId),await r(),n()}catch(e){x(e instanceof Error?e.message:String(e)),o(!1)}},[e.instanceId,r,n]),W=(0,Z.useCallback)(async()=>{if(!(!t||!I)){u(!0),x(null);try{let n={};for(let e of t.setup.config??[]){let t=cn(e.type,g[e.key]??``);t!==void 0&&(n[e.key]=t)}await Ne(e.instanceId,{config:n}),await r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{u(!1)}}},[g,t,e.instanceId,r,I]),G=(0,Z.useCallback)(async()=>{f(!0),m(null),x(null);try{m((await Ae(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)(A,{open:!0,onOpenChange:e=>{e||n()},children:[(0,$.jsxs)(D,{children:[(0,$.jsx)(w,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(O,{className:y(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,R?`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)(B,{connector:t,size:`lg`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(k,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,$.jsx)(T,{className:`mt-1 text-sm text-fg-muted`,children:V??(e.materialized.type===`mcp`?je(i.mcpServerRuntime,{serverId:e.materialized.serverId}):je(i.runtimeLabel,{runtime:e.materialized.type}))})]})]}),(0,$.jsx)(E,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:y(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,P.focusRingPanel),"aria-label":i.modalClose,children:[(0,$.jsx)(_,{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:[b?(0,$.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:b}):null,L?(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:j?.ok?je(i.toolsAvailable,{count:String(j.toolCount)}):j?i.healthStatusLabels[j.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 H(),children:[S?(0,$.jsx)(h,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0}),i.test]})]}),I?F.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:on,value:g[e.key]??``,placeholder:e.placeholder,onChange:t=>v(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key)):null]}):null,R?(0,$.jsx)(an,{instance:e,t:i,onChanged:r}):null,z?(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}),V?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:V}):null,p===null?null:(0,$.jsx)(`p`,{className:`mt-1 text-xs text-emerald-600`,children:je(i.connectedSourceSynced,{count:String(p)})})]}),(0,$.jsxs)(N,{disabled:d,onClick:()=>void G(),children:[d?(0,$.jsx)(h,{className:`size-4 animate-spin`}):(0,$.jsx)(Ve,{className:`size-4`}),i.composioSyncNow]})]}),I?(0,$.jsx)(`div`,{className:`grid gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:F.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:on,value:g[e.key]??``,placeholder:e.placeholder,onChange:t=>v(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}):null,!L&&!R&&!z?(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)(h,{className:`size-4 animate-spin`}):(0,$.jsx)(J,{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}),(L||z)&&I?(0,$.jsxs)(N,{variant:`primary`,disabled:l,onClick:()=>void W(),children:[l?(0,$.jsx)(h,{className:`size-4 animate-spin`}):(0,$.jsx)(X,{className:`size-4`}),i.modalSave]}):null]})]})]}),(0,$.jsx)(Ke,{open:s,title:je(i.removeConfirmTitle,{name:e.displayName}),description:i.removeConfirmDescription,confirmLabel:i.removeConfirmAction,cancelLabel:i.modalCancel,destructive:!0,onConfirm:()=>{c(!1),U()},onCancel:()=>{a||c(!1)}})]})}function un(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=e.instance.materialized.type===`cli`&&e.definition?(0,$.jsx)(ge,{definition:e.definition,instance:e.instance,onClose:e.onClose,onChanged:e.onChanged}):(0,$.jsx)(ln,{...e}),t[0]=e,t[1]=n),n}function dn(e){let t=(0,Q.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=ft(n,r),t[0]=r,t[1]=n,t[2]=l):l=t[2];let p=l.state,m;t[3]!==r||t[4]!==s?(m=r?Ee(r,s):null,t[3]=r,t[4]=s,t[5]=m):m=t[5];let h=m,g,_,v,b,x,S,C,w,T;if(t[6]!==p||t[7]!==r||t[8]!==c||t[9]!==n||t[10]!==a||t[11]!==s.connectionChecking||t[12]!==s.connectionNeedsSetup||t[13]!==s.connectionReady){g=p===`ready`?{label:s.connectionReady,Icon:d,className:`text-emerald-700 dark:text-emerald-300`}:p===`needs_setup`?{label:s.connectionNeedsSetup,Icon:u,className:`text-amber-700 dark:text-amber-300`}:{label:s.connectionChecking,Icon:f,className:`text-fg-muted`},w=`button`;let e=c&&`bg-accent-soft`;t[23]===e?T=t[24]:(T=y(`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)]`,P.transition,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,e),t[23]=e,t[24]=T),t[25]!==n||t[26]!==a?(_=()=>a(n),t[25]=n,t[26]=a,t[27]=_):_=t[27],t[28]===r?v=t[29]:(v=(0,$.jsx)(B,{connector:r}),t[28]=r,t[29]=v),C=`min-w-0 flex-1`,x=`flex min-w-0 items-center gap-2`,t[30]===n.displayName?S=t[31]:(S=(0,$.jsx)(`h3`,{className:`truncate text-sm font-medium text-fg`,children:n.displayName}),t[30]=n.displayName,t[31]=S),b=y(`inline-flex shrink-0 items-center gap-1 text-xs font-medium`,g.className),t[6]=p,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]=g,t[15]=_,t[16]=v,t[17]=b,t[18]=x,t[19]=S,t[20]=C,t[21]=w,t[22]=T}else g=t[14],_=t[15],v=t[16],b=t[17],x=t[18],S=t[19],C=t[20],w=t[21],T=t[22];let E;t[32]===g.Icon?E=t[33]:(E=(0,$.jsx)(g.Icon,{className:`size-3.5`,"aria-hidden":!0}),t[32]=g.Icon,t[33]=E);let D;t[34]!==g.label||t[35]!==E||t[36]!==b?(D=(0,$.jsxs)(`span`,{className:b,children:[E,g.label]}),t[34]=g.label,t[35]=E,t[36]=b,t[37]=D):D=t[37];let O;t[38]!==D||t[39]!==x||t[40]!==S?(O=(0,$.jsxs)(`div`,{className:x,children:[S,D]}),t[38]=D,t[39]=x,t[40]=S,t[41]=O):O=t[41];let k;t[42]===h?k=t[43]:(k=h?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:h}):null,t[42]=h,t[43]=k);let A;t[44]!==O||t[45]!==k||t[46]!==C?(A=(0,$.jsxs)(`div`,{className:C,children:[O,k]}),t[44]=O,t[45]=k,t[46]=C,t[47]=A):A=t[47];let j;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(o,{className:`size-4 shrink-0 text-fg-disabled`,"aria-hidden":!0}),t[48]=j):j=t[48];let M;return t[49]!==_||t[50]!==v||t[51]!==A||t[52]!==w||t[53]!==T?(M=(0,$.jsxs)(`button`,{type:w,className:T,onClick:_,children:[v,A,j]}),t[49]=_,t[50]=v,t[51]=A,t[52]=w,t[53]=T,t[54]=M):M=t[54],M}function fn(e,t){let n=e.length+1,r=`server-${n}`,i=new Set([...e.map(e=>e.id.trim()),...t]);for(;i.has(r);)n+=1,r=`server-${n}`;return Ft(r)}function pn(){return y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,L)}function mn({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:i,pasteFailed:a,pasteFailedTitle:o,dismissLabel:s,keyPlaceholder:c,valuePlaceholder:l,headers:u,onChange:d}){let[f,p]=(0,Z.useState)(!1),m=(e,t)=>{d(u.map((n,r)=>r===e?{...n,...t}:n))},h=()=>{d([...u,xt()])},g=e=>{let t=u.filter((t,n)=>n!==e);d(t.length>0?t:[xt()])},_=async()=>{try{let e=await M();if(!e){p(!0);return}let t=Ct(e);if(!t?.length){p(!0);return}d(t)}catch{p(!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 _(),children:[(0,$.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),i]})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{className:y(pn(),`min-w-0 flex-1 font-mono text-xs`),value:e.key,placeholder:c,onChange:e=>m(t,{key:e.target.value})}),(0,$.jsx)(`input`,{className:y(pn(),`min-w-0 flex-[1.4] font-mono text-xs`),value:e.value,placeholder:l,onChange:e=>m(t,{value:e.target.value})}),(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:u.length<=1&&!e.key&&!e.value,onClick:()=>g(t),"aria-label":r,children:(0,$.jsx)(J,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})})]},e.clientKey))}),(0,$.jsx)(Ke,{open:f,title:o,description:a,confirmLabel:s,onConfirm:()=>p(!1),onCancel:()=>p(!1)}),(0,$.jsxs)(`button`,{type:`button`,className:y(`self-start text-sm text-accent hover:underline`,P.press),onClick:h,children:[`+ `,n]})]})}var hn=[`stdio`,`streamable-http`];function gn(e){let t=(0,Q.c)(11),{label:n,description:r,required:i,children:a}=e,o;t[0]===i?o=t[1]:(o=i?(0,$.jsx)(`span`,{className:`ml-0.5 text-danger`,children:`*`}):null,t[0]=i,t[1]=o);let s;t[2]!==n||t[3]!==o?(s=(0,$.jsxs)(`div`,{className:`text-sm font-medium text-fg`,children:[n,o]}),t[2]=n,t[3]=o,t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=r?(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:r}):null,t[5]=r,t[6]=c);let l;return t[7]!==a||t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[s,a,c]}),t[7]=a,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function _n(){return y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,L)}function vn(e){let t=(0,Q.c)(42),{row:n,t:r,onUpdate:i,idConflictMessage:a,variant:o,showTransport:l}=e,u=o===void 0?`all`:o,d=l===void 0?!0:l,f=u===`all`||u===`basic`,p=u===`all`||u===`advanced`,m;t[0]!==i||t[1]!==n.transport||t[2]!==f||t[3]!==d||t[4]!==r?(m=f&&d?(0,$.jsx)($.Fragment,{children:(0,$.jsx)(gn,{label:r.transportLabel,required:!0,children:(0,$.jsx)(s,{className:_n(),value:n.transport,onChange:e=>i({transport:e.target.value}),children:hn.map(e=>(0,$.jsx)(c,{value:e,children:r.transportLabels[e]},e))})})}):null,t[0]=i,t[1]=n.transport,t[2]=f,t[3]=d,t[4]=r,t[5]=m):m=t[5];let h;t[6]!==a||t[7]!==i||t[8]!==n.id||t[9]!==p||t[10]!==r?(h=p?(0,$.jsxs)(gn,{label:r.serverIdLabel,children:[(0,$.jsx)(`input`,{className:_n(),value:n.id,placeholder:r.serverIdPlaceholder,onChange:e=>i({id:e.target.value})}),a?(0,$.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-300`,children:a}):null]}):null,t[6]=a,t[7]=i,t[8]=n.id,t[9]=p,t[10]=r,t[11]=h):h=t[11];let g;t[12]!==i||t[13]!==n.argsText||t[14]!==n.command||t[15]!==n.cwd||t[16]!==n.envJson||t[17]!==n.headers||t[18]!==n.oauthClientId||t[19]!==n.transport||t[20]!==n.url||t[21]!==p||t[22]!==f||t[23]!==r||t[24]!==u?(g=n.transport===`stdio`?(0,$.jsxs)($.Fragment,{children:[f?(0,$.jsx)(`div`,{className:u===`basic`?`md:col-span-2`:void 0,children:(0,$.jsx)(gn,{label:r.commandLabel,required:!0,children:(0,$.jsx)(`input`,{className:_n(),value:n.command,onChange:e=>i({command:e.target.value})})})}):null,f?(0,$.jsx)(gn,{label:r.argsLabel,description:r.argsHint,children:(0,$.jsx)(`input`,{className:_n(),value:n.argsText,onChange:e=>i({argsText:e.target.value})})}):null,p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(gn,{label:r.cwdLabel,children:(0,$.jsx)(`input`,{className:_n(),value:n.cwd,onChange:e=>i({cwd:e.target.value})})}),(0,$.jsx)(gn,{label:r.envLabel,description:r.envHint,children:(0,$.jsx)(`textarea`,{className:y(_n(),`min-h-[4rem] font-mono text-xs`),value:n.envJson,onChange:e=>i({envJson:e.target.value})})})]}):null]}):(0,$.jsxs)($.Fragment,{children:[f?(0,$.jsx)(`div`,{className:`md:col-span-2`,children:(0,$.jsx)(gn,{label:r.urlLabel,required:!0,children:(0,$.jsx)(`input`,{className:y(_n(),`font-mono text-xs`),value:n.url,placeholder:`https://example.com/mcp`,onChange:e=>i({url:e.target.value})})})}):null,p?(0,$.jsx)(gn,{label:r.oauthClientIdLabel,description:r.oauthClientIdHint,children:(0,$.jsx)(`input`,{className:_n(),value:n.oauthClientId,onChange:e=>i({oauthClientId:e.target.value})})}):null,p?(0,$.jsx)(mn,{label:r.headersLabel,optionalLabel:r.optionalSuffix,addLabel:r.addHeader,removeHeaderAria:r.removeHeader,pasteLabel:r.pasteHeaders,pasteFailed:r.pasteHeadersFailed,pasteFailedTitle:r.pasteHeadersFailedTitle,dismissLabel:r.pasteHeadersDismiss,keyPlaceholder:r.headerKeyPlaceholder,valuePlaceholder:r.headerValuePlaceholder,headers:n.headers,onChange:e=>i({headers:e})}):null]}),t[12]=i,t[13]=n.argsText,t[14]=n.command,t[15]=n.cwd,t[16]=n.envJson,t[17]=n.headers,t[18]=n.oauthClientId,t[19]=n.transport,t[20]=n.url,t[21]=p,t[22]=f,t[23]=r,t[24]=u,t[25]=g):g=t[25];let _;t[26]!==i||t[27]!==n.exposure||t[28]!==p||t[29]!==r?(_=p?(0,$.jsx)(gn,{label:r.exposureLabel,children:(0,$.jsx)(s,{className:_n(),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))})}):null,t[26]=i,t[27]=n.exposure,t[28]=p,t[29]=r,t[30]=_):_=t[30];let v;t[31]!==i||t[32]!==n.timeout||t[33]!==p||t[34]!==r?(v=p?(0,$.jsx)(gn,{label:r.requestTimeoutLabel,children:(0,$.jsx)(et,{allowEmpty:!0,type:`number`,min:1,className:_n(),value:n.timeout??``,placeholder:`60`,onChange:e=>i({timeout:e.target.value?Number(e.target.value):void 0})})}):null,t[31]=i,t[32]=n.timeout,t[33]=p,t[34]=r,t[35]=v):v=t[35];let b;return t[36]!==m||t[37]!==h||t[38]!==g||t[39]!==_||t[40]!==v?(b=(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[m,h,g,_,v]}),t[36]=m,t[37]=h,t[38]=g,t[39]=_,t[40]=v,t[41]=b):b=t[41],b}var yn=y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,L);function bn(e){let{t,cs:n}=e,[r,i]=(0,Z.useState)(e.initialRow),[a,o]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(),[g,v]=(0,Z.useState)(),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(``),[j,M]=(0,Z.useState)([]),[P,F]=(0,Z.useState)(``),[I,L]=(0,Z.useState)(``),R=(0,Z.useRef)(e.mode===`edit`?e.initialRow.id:``),z=(0,Z.useRef)(void 0),B=(0,Z.useRef)(void 0),V=(0,Z.useRef)(null),H=(0,Z.useRef)(``),U=(0,Z.useRef)(!0),W=(0,Z.useRef)(e.onSaved);W.current=e.onSaved;let G=g?.state===`starting`||g?.state===`authorizing`,K=a||G;(0,Z.useEffect)(()=>(U.current=!0,()=>{U.current=!1,z.current?.abort(),V.current?.close(),B.current&&Ht(B.current).catch(()=>{})}),[]),(0,Z.useEffect)(()=>{if(!g||!G)return;let e=g.id,n=new AbortController,r;async function i(){try{let r=await Vt(e,n.signal);if(n.signal.aborted)return;if(v(r),r.authorizationUrl&&H.current!==r.authorizationUrl)if(H.current=r.authorizationUrl,window.electronAPI?.shell?.openExternalUrl){let e=await window.electronAPI.shell.openExternalUrl(r.authorizationUrl);e.ok||u(e.error??t.oauthOpenFailed)}else V.current&&!V.current.closed&&V.current.location.replace(r.authorizationUrl);if(r.state===`connected`){B.current=void 0,V.current?.close(),p({state:`connected`,toolCount:r.toolCount}),u(``),await W.current();return}if(r.state===`error`||r.state===`cancelled`){V.current?.close(),u(r.error??t.setupCancelled),/client.{0,20}(id|registration)|register|registration/i.test(r.error??``)&&x(!0);return}}catch(e){if(n.signal.aborted)return;u(e instanceof Error?e.message:String(e)),v(e=>e?{...e,state:`error`}:void 0),B.current&&Ht(B.current).catch(()=>{});return}r=setTimeout(()=>void i(),1200)}return i(),()=>{n.abort(),clearTimeout(r)}},[g?.id,G,t.oauthOpenFailed,t.setupCancelled]);function q(e){i(t=>({...t,...e})),p(void 0),v(void 0),u(``)}function ee(){try{let t=Pt(S);M(t),q({...t[0],clientKey:e.initialRow.clientKey}),C(``)}catch(e){u(`${t.setupImportError} ${e instanceof Error?e.message:String(e)}`)}}async function J(){o(!0),u(``),v(void 0),z.current?.abort();let a=new AbortController;z.current=a;try{let o=e.existingCustomServers.filter(t=>t.clientKey!==e.initialRow.clientKey&&t.id!==R.current),s={...r,url:r.transport===`streamable-http`?Nt(r.url):r.url};if(s.transport===`stdio`&&!s.command.trim())throw Error(t.setupCommandRequired);let c=new Set([...e.managedServerIds,...o.map(e=>e.id)]);if(s.id=s.id.trim()||Mt(s,c),[...c].some(e=>e.replace(/-/g,`_`)===s.id.replace(/-/g,`_`)))throw Error(n.duplicateServerId);if(s.extra={...s.extra,enabled:!0},await Lt({servers:[...o,s]},Dt(e.config)),R.current=s.id,!U.current)return;i(s),await W.current();let l=await zt(s.id,a.signal);if(!U.current)return;p(l),l.state===`error`&&u(l.error??t.setupConnectionFailed)}catch(e){U.current&&!a.signal.aborted&&u(e instanceof Error?e.message:String(e))}finally{U.current&&o(!1)}}async function te(){u(``),o(!0),H.current=``,window.electronAPI?.shell?.openExternalUrl||(V.current=window.open(`about:blank`,`_blank`),V.current&&(V.current.opener=null));try{let e=await Bt(R.current);if(!U.current){V.current?.close(),Ht(e.id).catch(()=>{});return}B.current=e.id,v(e)}catch(e){V.current?.close(),u(e instanceof Error?e.message:String(e))}finally{U.current&&o(!1)}}async function ne(){let e=g?.authorizationUrl;if(e)if(window.electronAPI?.shell?.openExternalUrl){let n=await window.electronAPI.shell.openExternalUrl(e);n.ok||u(n.error??t.oauthOpenFailed)}else window.open(e,`_blank`,`noopener,noreferrer`)}async function re(){if(g){u(``);try{await Ut(g.id,P),F(``)}catch(e){u(e instanceof Error?e.message:String(e))}}}function ie(e){L(e),i(t=>({...t,headers:[...t.headers.filter(e=>e.key.toLowerCase()!==`authorization`),...e.trim()?[xt(`Authorization`,/^Bearer\s/i.test(e.trim())?e.trim():`Bearer ${e.trim()}`)]:[]]})),u(``)}return(0,$.jsx)(A,{open:e.open,onOpenChange:t=>{t||e.onClose()},children:(0,$.jsxs)(D,{children:[(0,$.jsx)(w,{className:`fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(O,{className:`fixed left-1/2 top-1/2 z-[60] flex h-[min(42rem,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`,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)(k,{className:`font-semibold`,children:t.setupTitle}),(0,$.jsx)(T,{className:`mt-1 text-sm text-fg-muted`,children:t.setupHint})]}),(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(`button`,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":n.modalClose,children:(0,$.jsx)(_,{className:`size-5`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`fieldset`,{disabled:K,className:`min-w-0 space-y-4`,children:[(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(N,{variant:`ghost`,onClick:()=>q({transport:r.transport===`stdio`?`streamable-http`:`stdio`}),children:r.transport===`stdio`?t.setupUseUrl:t.setupUseCommand})}),(0,$.jsx)(vn,{row:r,t,variant:`basic`,showTransport:!1,onUpdate:q}),f?.state===`token_required`?(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:t.setupTokenLabel}),(0,$.jsx)(`input`,{type:`password`,autoComplete:`off`,className:yn,value:I,onChange:e=>ie(e.target.value)}),(0,$.jsx)(`span`,{className:`block text-xs font-normal text-fg-muted`,children:t.setupTokenHint})]}):null,(0,$.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,open:b,onToggle:e=>x(e.currentTarget.open),children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:t.setupAdvanced}),(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(vn,{row:r,t,variant:`advanced`,onUpdate:q})})]}),(0,$.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:t.setupImport}),(0,$.jsxs)(`label`,{className:`mt-3 block`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:t.setupImport}),(0,$.jsx)(`textarea`,{className:y(yn,`min-h-28 font-mono text-xs`),placeholder:`{"mcpServers": {"docs": {"url": "https://example.com/mcp"}}}`,value:S,onChange:e=>C(e.target.value)})]}),(0,$.jsx)(N,{variant:`secondary`,className:`mt-2`,disabled:!S.trim(),onClick:ee,children:t.setupImportAction}),j.length>1?(0,$.jsxs)(`label`,{className:`mt-3 block text-sm text-fg`,children:[(0,$.jsx)(`span`,{children:t.setupImportChoose}),(0,$.jsx)(s,{className:y(yn,`mt-1.5`),value:r.id,onChange:t=>{let n=j.find(e=>e.id===t.target.value);n&&q({...n,clientKey:e.initialRow.clientKey})},children:j.map(e=>(0,$.jsx)(c,{value:e.id,children:e.id},e.id))})]}):null]})]}),a?(0,$.jsxs)(`p`,{role:`status`,className:`mt-4 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(h,{className:`size-4 animate-spin`,"aria-hidden":!0}),t.setupChecking]}):null,f?.state===`connected`?(0,$.jsxs)(`p`,{role:`status`,className:`mt-4 flex items-center gap-2 text-sm text-success`,children:[(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),t.setupConnected.replace(`{{count}}`,String(f.toolCount??0))]}):null,f?.state===`oauth_required`&&!G&&g?.state!==`connected`?(0,$.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:t.setupOAuthRequired}):null,G?(0,$.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-lg border border-edge p-4`,children:[(0,$.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(h,{className:`size-4 animate-spin`,"aria-hidden":!0}),t.setupAuthorizing]}),g?.authorizationUrl?(0,$.jsxs)(N,{variant:`secondary`,onClick:()=>void ne(),children:[(0,$.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t.oauthOpenAuthorization]}):null,g?.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`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:t.setupRedirectLabel}),(0,$.jsx)(`input`,{className:yn,value:P,placeholder:`http://127.0.0.1:…/callback?code=…`,onChange:e=>F(e.target.value)})]}),(0,$.jsx)(N,{className:`mt-2`,disabled:!P.trim(),onClick:()=>void re(),children:t.setupContinue})]}):null]}):null,l?(0,$.jsx)(`p`,{role:`alert`,className:`mt-4 whitespace-pre-wrap break-words text-sm text-danger`,children:l}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge p-4`,children:[(0,$.jsx)(N,{variant:`secondary`,onClick:e.onClose,children:n.modalCancel}),f?.state===`connected`?(0,$.jsx)(N,{onClick:e.onClose,children:t.setupDone}):f?.state===`oauth_required`?(0,$.jsx)(N,{disabled:K,"aria-busy":K,onClick:()=>void te(),children:t.setupSignIn}):(0,$.jsx)(N,{disabled:K||f?.state===`token_required`&&!I.trim()||(r.transport===`streamable-http`?!r.url.trim():!r.command.trim()),"aria-busy":K,onClick:()=>void J(),children:t.setupConnect})]})]})]})})}var xn=`builtin`,Sn=`composio`,Cn=`xopc-store`;function wn(e){return xn}function Tn(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 En(e){return e.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t)}function Dn(e){return e?.startsWith(`/`)&&!e.startsWith(`//`)?e:`/user-model`}function On({embedded:e=!1,onHeaderActionChange:t}){let n=j().filter(e=>e.format===`agent-plugin`),r=S(e=>e.language),o=v(r),s=o.connectorsSettings,c=o.mcpSettings,u=x(e=>e.conversationId),d=!!u,f=a(),[p,m]=i(),g=p.get(`understanding`)===`1`,_=Dn(p.get(`returnTo`)),b=!!p.get(`returnTo`)&&!g,C=p.get(`tab`),[w,T]=(0,Z.useState)(!g&&C===`connected`?`connected`:`discover`),E=(0,Z.useRef)(!1),[D,O]=(0,Z.useState)({catalog:[],registryCatalog:[],instances:[],loading:!0,error:null}),[k,A]=(0,Z.useState)(!1),[M,P]=(0,Z.useState)(!1),[F,L]=(0,Z.useState)(1),[R,z]=(0,Z.useState)(void 0),[B,V]=(0,Z.useState)(``),[H,U]=(0,Z.useState)(g||b?p.get(`connector`)??``:``),[G,K]=(0,Z.useState)(wn(g?`understanding`:`default`)),[q,ee]=(0,Z.useState)(`name`),[J,re]=(0,Z.useState)(g?`understand`:`all`),[ie,ae]=(0,Z.useState)(null),[oe,Y]=(0,Z.useState)(null),[ce,X]=(0,Z.useState)(null),[le,ue]=(0,Z.useState)(null),[de,fe]=(0,Z.useState)(null),[me,ge]=(0,Z.useState)(null),{data:_e,mutate:ve}=I(d),ye=_e?.payload?.config,xe=(0,Z.useMemo)(()=>ye===void 0?null:It(ye),[ye]),Se=xe?.servers??[],Ce=D.instances.length+Se.length+n.reduce((e,t)=>e+(t.components?.mcp.length??0),0);(0,Z.useEffect)(()=>{},[xe]);let we=(0,Z.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([ne(),te()]);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,Z.useEffect)(()=>{we()},[we]),(0,Z.useEffect)(()=>{E.current||D.loading||d&&!xe||(T(g?`discover`:Ce>0?`connected`:`discover`),E.current=!0)},[d,Ce,xe,g,D.loading]);let Te=(0,Z.useCallback)(e=>{E.current=!0,T(e)},[]),Ee=(0,Z.useMemo)(()=>[{id:Sn,displayName:s.composioSourceName},{id:Cn,displayName:s.storeSourceName}],[s.composioSourceName,s.storeSourceName]),De=(0,Z.useCallback)(async e=>{if(!d||G===`builtin`){O(e=>({...e,registryCatalog:[]})),L(1),z(void 0);return}let t=H.trim(),n=Math.max(e?.page??1,1),r=e?.append??!1,i=G===`all`?Ee:Ee.filter(e=>e.id===G);if(i.length!==0){A(!0),r?O(e=>({...e,error:null})):(L(1),z(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 be({q:t||void 0,page:n,pageSize:24,verification:`experimental`});return{connectors:e.connectors,totalPages:e.meta.totalPages}}let r=await he({q:t||void 0,page:n,pageSize:24,sort:q===`source`?`newest`:`downloads`});return{connectors:r.items.flatMap(e=>{let t=Tn(e);return t?[t]:[]}),totalPages:r.meta.totalPages}})),a=En(e.flatMap(e=>e.connectors)),o=Math.max(1,...e.map(e=>e.totalPages??1));L(n),z(o),O(e=>({...e,registryCatalog:r?En([...e.registryCatalog,...a]):a}))}catch(e){O(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{A(!1)}}},[q,H,G,d,Ee]);(0,Z.useEffect)(()=>{if(w!==`discover`||D.loading)return;if(G===`builtin`){O(e=>({...e,registryCatalog:[]})),L(1),z(void 0);return}let e=window.setTimeout(()=>{De()},H.trim()?350:0);return()=>window.clearTimeout(e)},[H,G,De,D.loading,w]);let Oe=(0,Z.useMemo)(()=>new Set(D.instances.map(e=>e.connectorId)),[D.instances]),ke=(0,Z.useMemo)(()=>new Map([...D.catalog,...D.registryCatalog].map(e=>[e.id,e])),[D.catalog,D.registryCatalog]);(0,Z.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,V(``),X(n.instanceId),ue(n),T(`connected`);else if(e){let t=ke.get(e);if(!t)return;E.current=!0,K(wn(g?`understanding`:`default`)),U(``),Y(t),T(`discover`)}let r=new URLSearchParams(p);r.delete(`connector`),r.delete(`instance`),r.set(`tab`,n?`connected`:`discover`),m(r,{replace:!0})},[ke,g,p,m,D.instances,D.loading]);let Ae=(0,Z.useCallback)(async e=>{P(!0),O(e=>({...e,error:null}));try{let t=await Le(e);ae(Ue(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{P(!1)}},[]),je=(0,Z.useMemo)(()=>new Set(D.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[D.instances]),Me=(0,Z.useCallback)(async e=>{!xe||ye===void 0||(await Lt({servers:Se.filter(t=>t.clientKey!==e.clientKey)},Dt(ye)),await ve(),await we())},[ye,Se,we,xe,ve]),Ne=(0,Z.useCallback)(()=>{ge({mode:`add`,row:fn(Se,je)})},[Se,je]),Pe=ze(e=>e.setPageHeader),Fe=ze(e=>e.clearPageHeader),Be=(0,Z.useMemo)(()=>({searchLabel:w===`connected`?s.connectedSearchPlaceholder:s.discoverSearchPlaceholder,search:(0,$.jsx)(Ye,{value:w===`connected`?B:H,onChange:w===`connected`?V:U,placeholder:w===`connected`?s.connectedSearchPlaceholder:s.discoverSearchPlaceholder}),secondary:(0,$.jsx)(bt,{onRefresh:w===`connected`&&d?we:void 0,refreshing:D.loading,refreshLabel:s.refreshConnections,onBrowseCatalog:()=>Te(`discover`),onAddCustomServer:Ne,addLabel:s.addConnection,browseLabel:s.addFromCatalog,customLabel:s.addCustomServerAdvanced,serviceLabel:r.startsWith(`zh`)?`应用连接服务`:`Connection service`,moreActionsLabel:o.capabilitiesHub.moreActions})}),[B,s,H,d,r,we,o.capabilitiesHub.moreActions,Ne,Te,D.loading,w]);(0,Z.useLayoutEffect)(()=>e?(t?.(Be),()=>t?.(null)):(Pe({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)(Xe,{contribution:Be})}),()=>Fe()),[Fe,s.title,e,Be,t,Pe]);let Ve=(0,Z.useMemo)(()=>D.instances.map(e=>({instance:e,value:ft(e,ke.get(e.connectorId))})),[ke,D.instances]),He=(0,Z.useMemo)(()=>new Map(Ve.map(({instance:e,value:t})=>[e.instanceId,t])),[Ve]),We=(0,Z.useMemo)(()=>D.instances.filter(e=>Ie(e,B)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=He.get(e.instanceId)?.state??`checking`,i=He.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[B,He,D.instances]),Ge=(0,Z.useMemo)(()=>We.filter(e=>He.get(e.instanceId)?.state===`needs_setup`),[He,We]),Ke=(0,Z.useMemo)(()=>We.filter(e=>He.get(e.instanceId)?.state!==`needs_setup`),[He,We]),qe=(0,Z.useMemo)(()=>Se.filter(e=>Re(e,B)),[B,Se]),Je=(0,Z.useMemo)(()=>{let e=B.trim().toLowerCase();return n.flatMap(t=>(t.components?.mcp??[]).filter(n=>`${t.name} ${n.name}`.toLowerCase().includes(e)).map(e=>({extension:t,server:e})))},[B,n]),Ze=We.length+qe.length+Je.length,et=(0,Z.useMemo)(()=>D.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1&&pe(e)),[D.catalog]),Q=(0,Z.useMemo)(()=>G===`builtin`?et:G===`all`?En([...et,...D.registryCatalog]):D.registryCatalog,[et,G,D.registryCatalog]),nt=(0,Z.useMemo)(()=>{let e=g?Q.filter(e=>e.understanding?.mode===`activity`):Q;return W(J===`all`?e:e.filter(e=>ut(e).includes(J)),H,q)},[q,H,Q,g,J]),at=(0,Z.useMemo)(()=>lt.filter(e=>Q.some(t=>ut(t).includes(e))),[Q]);(0,Z.useEffect)(()=>{J!==`all`&&!at.includes(J)&&re(`all`)},[at,J]);let st=w===`discover`&&G!==`builtin`&&!!(R&&F<R),dt=(0,Z.useMemo)(()=>D.instances.find(e=>e.instanceId===ce)??le,[ce,le,D.instances]),pt=(0,Z.useMemo)(()=>[{value:`all`,label:s.discoverSourceAll},{value:xn,label:s.discoverSourceBuiltin},...Ee.map(e=>({value:e.id,label:e.displayName}))],[s.discoverSourceAll,s.discoverSourceBuiltin,Ee]),mt=[{id:`connected`,label:s.tabConnected,count:Ce},{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:y(`mx-auto flex w-full max-w-7xl flex-col gap-6 px-4 sm:px-6 lg:px-8`,e?`pb-7 pt-3 lg:pb-9 lg:pt-4`:`py-7 lg:py-9`),children:[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}),g?(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,b?(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)(Qe,{items:mt,activeTab:w,onChange:Te,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:rt.slice(0,3).map(e=>(0,$.jsx)(ct,{},e))}):Ce===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:()=>Te(`discover`),children:s.addFromCatalog})]}):Ze===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)(dn,{instance:e,definition:ke.get(e.connectorId),highlighted:e.instanceId===de,onOpenDetails:e=>{fe(null),X(e.instanceId),ue(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)(dn,{instance:e,definition:ke.get(e.connectorId),highlighted:e.instanceId===de,onOpenDetails:e=>{fe(null),X(e.instanceId),ue(e)},t:s},e.instanceId))})}):null,Je.map(({extension:e,server:t})=>(0,$.jsx)($e,{pluginId:e.pluginId,server:t,enabled:e.active},t.id)),qe.length||!B.trim()?(0,$.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-base`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer px-4 py-3`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:s.customIntegrationsTitle}),(0,$.jsx)(`span`,{className:`ml-2 text-xs tabular-nums text-fg-subtle`,children:qe.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:Ne,children:s.addCustomServerAdvanced})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:qe.map(e=>(0,$.jsx)(Jt,{row:e,t:c,cs:s,onEdit:()=>ge({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>Me(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:[g?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`,...at].map(e=>(0,$.jsx)(`button`,{type:`button`,className:y(`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:()=>re(e),children:e===`all`?s.taskAll:s.connectorBenefitHeadings[e]},e))}),(0,$.jsxs)(`div`,{className:y(`ml-auto grid w-full gap-2 sm:flex sm:w-auto sm:justify-end`,g?`grid-cols-1`:`grid-cols-2`),children:[g?null:(0,$.jsx)(`div`,{className:`min-w-0 sm:w-40`,children:(0,$.jsx)(l,{value:G,options:pt,placeholder:s.discoverSourceAll,allowEmpty:!1,ariaLabel:s.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:K})}),(0,$.jsx)(`div`,{className:`min-w-0 sm:w-40`,children:(0,$.jsx)(l,{value:q,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=>ee(e)})})]})]}),(D.loading||k)&&nt.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:rt.map(e=>(0,$.jsx)(ot,{},e))}):nt.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)(h,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:nt.map(e=>(0,$.jsx)(tt,{connector:e,installed:Oe.has(e.id)||it(e,D.instances),onInstall:e=>{if(e.source===`store`){Ae(e.id);return}ae(Ue(e))},onOpenDetails:e.source===`store`?void 0:Y,t:s},e.id))}),st?(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsxs)(N,{type:`button`,variant:`secondary`,disabled:k||M,onClick:()=>void De({page:F+1,append:!0}),children:[k?(0,$.jsx)(h,{className:`size-4 animate-spin`}):null,s.loadMore]})}):null]})]}):null]}),ie?(0,$.jsx)(se,{draft:ie,onChange:ae,onClose:()=>ae(null),t:s,onInstalled:async e=>{await we(),await ve(),fe(e.instanceId),Te(`connected`)}}):null,oe?(0,$.jsx)(gt,{connector:oe,installed:Oe.has(oe.id)||it(oe,D.instances),onClose:()=>Y(null),onInstall:e=>ae(Ue(e)),t:s}):null,dt?(0,$.jsx)(un,{instance:dt,definition:ke.get(dt.connectorId),onClose:()=>{X(null),ue(null)},onChanged:we,t:s,mcp:c}):null,me?(0,$.jsx)(bn,{open:!0,mode:me.mode,initialRow:me.row,existingCustomServers:Se,config:ye,managedServerIds:je,t:c,cs:s,onClose:()=>ge(null),onSaved:async()=>{await ve(),await we(),Te(`connected`)}},`${me.mode}-${me.row.clientKey}`):null]})})}export{On as ConnectorsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,p as a}from"./chunk-KS7C4IRE--EKdQGRF.js";import{t as o}from"./chevron-right-BweFrslA.js";import{n as s,r as c,t as l}from"./popover-select-DHC7J4lG.js";import{t as u}from"./circle-alert-BEjgurr2.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./clock-3-DnrAnuyZ.js";import{t as p}from"./ellipsis-0k4rZLoy.js";import{t as m}from"./external-link-DjqjBmc3.js";import{t as h}from"./loader-circle-CifKLtgG.js";import{t as g}from"./plus-Q2yW6OE7.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./messages-DTqbfje6.js";import{t as y}from"./cn-0WouolD0.js";import{a as b,c as x,n as S,r as C}from"./locale-store-uRu_DsWm.js";import{a as w,i as T,n as E,o as D,r as O,s as k,t as A}from"./dist-BGTk37IG.js";import{r as j}from"./extension-provider-CJZ5EVpQ.js";import{n as M}from"./copy-to-clipboard-HOJ79TWv.js";import{t as N}from"./button-aIC072nz.js";import{n as P}from"./interaction-BdhHBbYa.js";import{n as F,r as I}from"./gateway-config-swr-D0tBjSgj.js";import{s as L}from"./form-field-width-DJw_jULe.js";import{t as R}from"./skeleton-BI5TyibZ.js";import{n as z}from"./electron-env-Dit0bHgy.js";import{$ as B,$a as V,Aa as H,Ac as U,An as W,Ao as G,Ba as K,Bn as q,Cc as ee,Co as J,Da as te,Ea as ne,Fa as re,Fn as ie,Go as ae,Ia as oe,In as Y,J as se,Ja as ce,Jo as X,Ka as le,La as ue,Ln as de,Ma as fe,Mn as pe,Na as me,Oa as he,Q as ge,Qa as _e,Ra as ve,Rn as ye,Ta as be,Ua as xe,Va as Se,Vs as Ce,Wa as we,Wo as Te,X as Ee,Xa as De,Xo as Oe,Y as ke,Ya as Ae,Z as je,Za as Me,eo as Ne,fo as Pe,ja as Fe,jn as Ie,ka as Le,kn as Re,na as ze,no as Be,pc as Ve,ps as He,q as Ue,qa as We,to as Ge,ui as Ke,wa as qe,za as Je}from"./index-CNH8vwcY.js";import{n as Ye,t as Xe}from"./capability-header-actions-Chuhscdb.js";import{t as Ze}from"./connector-service-page-3W0_7-4L.js";import{t as Qe}from"./page-tabs-HLrKIjXH.js";import{n as $e}from"./agent-plugin-dialog-DRhTOw_O.js";import{t as et}from"./number-input-DDeqHK-G.js";var Z=e(t(),1),Q=n(),$=r();function tt(e){let t=(0,Q.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(nt),m=e.slice(0,2),h=Math.max(0,e.length-m.length),g=o.connect,_;t[11]!==n||t[12]!==o?(_=Ee(n,o),t[11]=n,t[12]=o,t[13]=_):_=t[13];let v=_,b=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:y(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:()=>i(n),children:[(0,$.jsx)(He,{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)(B,{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]===b?w=t[24]:(w=b?(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:b}):null,t[23]=b,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 nt(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}var rt=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function it(e,t){return t.some(t=>t.connectorId===e.id)}var at=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ot(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:y(`size-10 shrink-0 rounded-xl`,at)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`div`,{className:`flex h-full min-h-[9.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:y(`h-4 min-w-0 flex-1`,at)}),(0,$.jsx)(`div`,{className:y(`h-8 w-[4.5rem] shrink-0 rounded-lg`,at)})]}),(0,$.jsx)(`div`,{className:y(`h-3 w-full`,at)}),(0,$.jsx)(`div`,{className:y(`h-3 w-[88%]`,at)})]})]})}),e[1]=n):n=e[1],n}var st=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ct(){let e=(0,Q.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:y(`size-10 shrink-0 rounded-xl`,st)}),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:y(`h-4 w-48 max-w-full`,st)}),(0,$.jsx)(`div`,{className:y(`h-3 w-72 max-w-full`,st)})]}),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:y(`h-9 w-20 rounded-lg`,st)}),(0,$.jsx)(`div`,{className:y(`h-9 w-20 rounded-lg`,st)})]})]})]}),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:y(`h-8 w-20 rounded-md`,st)}),(0,$.jsx)(`div`,{className:y(`h-8 w-24 rounded-md`,st)}),(0,$.jsx)(`div`,{className:y(`h-8 w-28 rounded-md`,st)})]}),(0,$.jsx)(`div`,{className:y(`mt-3 h-20 rounded-xl`,st)})]}),e[3]=i):i=e[3],i}var lt=[`understand`,`act`,`reach`];function ut(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 dt(e){return ut(e)[0]??`act`}function ft(e,t){let n=t?dt(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 pt(e,t){return t.connectorCapabilityLabels[e]??e}function mt(e,t){if(e.runtime.type===`mcp`)return je(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 je(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function ht(e,t){return e.auth.mode===`cli`?t.connectorAuthCli:e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function gt(e){let t=(0,Q.c)(133),{connector:n,installed:r,onClose:i,onInstall:a,t:o}=e,s;t[0]!==n||t[1]!==o?(s=Ee(n,o),t[0]=n,t[1]=o,t[2]=s):s=t[2];let c=s,l,u,f,p,m,h,g,v,b,x,S,C,j,M,F,I;if(t[3]!==n||t[4]!==c||t[5]!==r||t[6]!==i||t[7]!==o){let e=ut(n),a;t[24]!==n.setup.config||t[25]!==n.setup.secrets?(a=[...(n.setup.secrets??[]).filter(yt),...(n.setup.config??[]).filter(vt)],t[24]=n.setup.config,t[25]=n.setup.secrets,t[26]=a):a=t[26];let s=a,N=n.capabilities.filter(_t);f=A,g=!0,t[27]===i?v=t[28]:(v=e=>{e||i()},t[27]=i,t[28]=v),u=D,t[29]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(w,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[29]=h):h=t[29],l=O,t[30]===Symbol.for(`react.memo_cache_sentinel`)?(p=y(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,42rem)] w-[min(100%-2rem,min(92vw,44rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-overlay shadow-float outline-none dark:border-edge`),t[30]=p):p=t[30];let L;t[31]===n?L=t[32]:(L=(0,$.jsx)(B,{connector:n,size:`lg`}),t[31]=n,t[32]=L);let R;t[33]===n.displayName?R=t[34]:(R=(0,$.jsx)(k,{className:`text-base font-semibold text-fg`,children:n.displayName}),t[33]=n.displayName,t[34]=R);let z;t[35]!==r||t[36]!==o.connectedBadge?(z=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]=z):z=t[37];let V;t[38]!==R||t[39]!==z?(V=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[R,z]}),t[38]=R,t[39]=z,t[40]=V):V=t[40];let H;t[41]===c?H=t[42]:(H=(0,$.jsx)(T,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:c}),t[41]=c,t[42]=H);let U;t[43]!==V||t[44]!==H?(U=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[V,H]}),t[43]=V,t[44]=H,t[45]=U):U=t[45];let W;t[46]!==L||t[47]!==U?(W=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[L,U]}),t[46]=L,t[47]=U,t[48]=W):W=t[48];let G;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(G=y(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,P.focusRingPanel),t[49]=G):G=t[49];let K;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(_,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[50]=K):K=t[50];let q;t[51]===o.modalClose?q=t[52]:(q=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:G,"aria-label":o.modalClose,children:K})}),t[51]=o.modalClose,t[52]=q),t[53]!==W||t[54]!==q?(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:[W,q]}),t[53]=W,t[54]=q,t[55]=m):m=t[55],M=`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-5 sm:px-6`,F=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 ee;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(Ce,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[56]=ee):ee=t[56];let J;t[57]===o.detailPermissions?J=t[58]:(J=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.detailPermissions}),t[57]=o.detailPermissions,t[58]=J);let te;t[59]!==n||t[60]!==o?(te=ht(n,o),t[59]=n,t[60]=o,t[61]=te):te=t[61];let ne;t[62]===te?ne=t[63]:(ne=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:te}),t[62]=te,t[63]=ne);let re;t[64]!==J||t[65]!==ne?(re=(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3`,children:[ee,(0,$.jsxs)(`div`,{children:[J,ne]})]}),t[64]=J,t[65]=ne,t[66]=re):re=t[66];let ie;t[67]===o.connectorSetupTitle?ie=t[68]:(ie=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o.connectorSetupTitle}),t[67]=o.connectorSetupTitle,t[68]=ie);let oe;t[69]!==s.length||t[70]!==o.connectorRequiredInputsCount||t[71]!==o.connectorSetupNone?(oe=s.length?je(o.connectorRequiredInputsCount,{count:String(s.length)}):o.connectorSetupNone,t[69]=s.length,t[70]=o.connectorRequiredInputsCount,t[71]=o.connectorSetupNone,t[72]=oe):oe=t[72];let Y;t[73]===oe?Y=t[74]:(Y=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:oe}),t[73]=oe,t[74]=Y);let se;t[75]!==ie||t[76]!==Y?(se=(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[ie,Y]}),t[75]=ie,t[76]=Y,t[77]=se):se=t[77],t[78]!==re||t[79]!==se?(I=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[re,se]}),t[78]=re,t[79]=se,t[80]=I):I=t[80],C=`rounded-xl border border-edge bg-surface-base`,t[81]===o.connectorTechnicalDetails?j=t[82]:(j=(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]=j),b=`space-y-5 border-t border-edge-subtle px-4 py-4`;let ce;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),t[83]=ce):ce=t[83];let X;t[84]===o.connectorRuntimeTitle?X=t[85]:(X=(0,$.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[ce,o.connectorRuntimeTitle]}),t[84]=o.connectorRuntimeTitle,t[85]=X);let le;t[86]!==n||t[87]!==o?(le=mt(n,o),t[86]=n,t[87]=o,t[88]=le):le=t[88];let ue;t[89]===le?ue=t[90]:(ue=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-subtle`,children:le}),t[89]=le,t[90]=ue),t[91]!==X||t[92]!==ue?(x=(0,$.jsxs)(`div`,{children:[X,ue]}),t[91]=X,t[92]=ue,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:pt(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]=v,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=j,t[21]=M,t[22]=F,t[23]=I}else l=t[8],u=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],v=t[15],b=t[16],x=t[17],S=t[18],C=t[19],j=t[20],M=t[21],F=t[22],I=t[23];let L;t[94]!==b||t[95]!==x||t[96]!==S?(L=(0,$.jsxs)(`div`,{className:b,children:[x,S]}),t[94]=b,t[95]=x,t[96]=S,t[97]=L):L=t[97];let R;t[98]!==L||t[99]!==C||t[100]!==j?(R=(0,$.jsxs)(`details`,{className:C,children:[j,L]}),t[98]=L,t[99]=C,t[100]=j,t[101]=R):R=t[101];let z;t[102]!==R||t[103]!==M||t[104]!==F||t[105]!==I?(z=(0,$.jsxs)(`div`,{className:M,children:[F,I,R]}),t[102]=R,t[103]=M,t[104]=F,t[105]=I,t[106]=z):z=t[106];let V;t[107]===o.modalClose?V=t[108]:(V=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(N,{variant:`secondary`,children:o.modalClose})}),t[107]=o.modalClose,t[108]=V);let H;t[109]!==n||t[110]!==r||t[111]!==i||t[112]!==a||t[113]!==o.connect?(H=r?null:(0,$.jsxs)(N,{variant:`primary`,onClick:()=>{a(n),i()},children:[(0,$.jsx)(He,{className:`size-4`}),o.connect]}),t[109]=n,t[110]=r,t[111]=i,t[112]=a,t[113]=o.connect,t[114]=H):H=t[114];let U;t[115]!==V||t[116]!==H?(U=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[V,H]}),t[115]=V,t[116]=H,t[117]=U):U=t[117];let W;t[118]!==l||t[119]!==p||t[120]!==m||t[121]!==z||t[122]!==U?(W=(0,$.jsxs)(l,{className:p,children:[m,z,U]}),t[118]=l,t[119]=p,t[120]=m,t[121]=z,t[122]=U,t[123]=W):W=t[123];let G;t[124]!==u||t[125]!==h||t[126]!==W?(G=(0,$.jsxs)(u,{children:[h,W]}),t[124]=u,t[125]=h,t[126]=W,t[127]=G):G=t[127];let K;return t[128]!==f||t[129]!==g||t[130]!==v||t[131]!==G?(K=(0,$.jsx)(f,{open:g,onOpenChange:v,children:G}),t[128]=f,t[129]=g,t[130]=v,t[131]=G,t[132]=K):K=t[132],K}function _t(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}function vt(e){return e.required}function yt(e){return e.required}var bt=(0,Z.memo)(function(e){let t=(0,Q.c)(45),{onRefresh:n,refreshing:r,refreshLabel:i,onBrowseCatalog:a,onAddCustomServer:o,addLabel:s,browseLabel:c,customLabel:l,serviceLabel:u,moreActionsLabel:d}=e,[f,m]=(0,Z.useState)(!1),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=y(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[highlighted]:bg-surface-hover`,P.transition),t[0]=_):_=t[0];let v=_,b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(g,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[1]=b):b=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)(U,{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)(q,{asChild:!0,children:(0,$.jsxs)(N,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":s,children:[b,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)(G,{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)(Y,{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)(Pe,{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)(Y,{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)(de,{children:(0,$.jsxs)(ie,{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)(ye,{children:[C,O]}),t[19]=O,t[20]=C,t[21]=k):k=t[21];let A;t[22]===f?A=t[23]:(A=(0,$.jsx)(Ze,{open:f,onOpenChange:m,hideTrigger:!0}),t[22]=f,t[23]=A);let j;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t[24]=j):j=t[24];let M;t[25]===d?M=t[26]:(M=(0,$.jsx)(q,{asChild:!0,children:(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":d,title:d,children:j})}),t[25]=d,t[26]=M);let F;t[27]!==n||t[28]!==i||t[29]!==r?(F=n?(0,$.jsxs)(Y,{className:v,disabled:r,onSelect:n,children:[r?(0,$.jsx)(h,{className:`size-4 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,$.jsx)(Oe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,t[27]=n,t[28]=i,t[29]=r,t[30]=F):F=t[30];let I,L;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>m(!0),L=(0,$.jsx)(Te,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t[31]=I,t[32]=L):(I=t[31],L=t[32]);let R;t[33]===u?R=t[34]:(R=(0,$.jsxs)(Y,{className:v,onSelect:I,children:[L,u]}),t[33]=u,t[34]=R);let z;t[35]!==F||t[36]!==R?(z=(0,$.jsx)(de,{children:(0,$.jsxs)(ie,{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:[F,R]})}),t[35]=F,t[36]=R,t[37]=z):z=t[37];let B;t[38]!==M||t[39]!==z?(B=(0,$.jsxs)(ye,{children:[M,z]}),t[38]=M,t[39]=z,t[40]=B):B=t[40];let V;return t[41]!==k||t[42]!==A||t[43]!==B?(V=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[k,A,B]}),t[41]=k,t[42]=A,t[43]=B,t[44]=V):V=t[44],V});function xt(e=``,t=``){return{clientKey:crypto.randomUUID(),key:e,value:t}}var St=/^([^:=]+)[:=](.*)$/;function Ct(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Object.entries(e).map(([e,t])=>xt(e,t==null?``:String(t)))}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=St.exec(t);r&&n.push(xt(r[1].trim(),r[2].trim()))}return n.length>0?n:null}function wt(e){let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return Object.keys(t).length>0?t:void 0}function Tt(e){if(!e||typeof e!=`object`)return[xt()];let t=Object.entries(e).map(([e,t])=>xt(e,t==null?``:String(t)));return t.length>0?t:[xt()]}function Et(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 Dt(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=(t&&typeof t==`object`?t:{}).servers,r={};if(!n||typeof n!=`object`||Array.isArray(n))return r;for(let[e,t]of Object.entries(n))!t||typeof t!=`object`||Array.isArray(t)||Et(t)&&(r[e]=t);return r}function Ot(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!==`'`?(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 kt(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 At(e){let t={...e.extra,exposure:e.exposure};if(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=Ot(e.argsText);n&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=kt(e.envJson)),delete t.oauth}else{t.type=`http`,t.url=e.url.trim();let n=wt(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 jt(e,t){let n=t.oauth;return{clientKey:e,id:e,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:Tt(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 Mt(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 Nt(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 Pt(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,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=jt(e,n);return r.clientKey=crypto.randomUUID(),r.url&&=Nt(r.url),r})}function Ft(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`streamable-http`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[],oauthClientId:``,timeout:void 0,exposure:`codemode`,extra:{}}}function It(e){let t=e?.mcp?.servers??{};return{servers:Object.entries(t).filter(([,e])=>!Et(e)).map(([e,t])=>jt(e,t)).sort((e,t)=>e.id.localeCompare(t.id))}}async function Lt(e,t={}){let n={...t};for(let r of e.servers){let e=r.id.trim();if(!/^[a-zA-Z0-9_-]+$/.test(e))throw Error(`MCP IDs require letters, digits, underscores or hyphens.`);if(t[e])throw Error(`Server id "${e}" is reserved by an installed connector.`);n[e]=At(r)}await b(C(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:{servers:n}})}),F()}async function Rt(e,t){return(await b(C(`/api/mcp/servers/${encodeURIComponent(e)}/tools`),{method:`POST`,signal:AbortSignal.any([t,AbortSignal.timeout(95e3)])})).payload.tools}async function zt(e,t){return(await b(C(`/api/mcp/servers/${encodeURIComponent(e)}/probe`),{method:`POST`,signal:AbortSignal.any([t,AbortSignal.timeout(95e3)])})).payload}async function Bt(e){return(await b(C(`/api/mcp/servers/${encodeURIComponent(e)}/auth`),{method:`POST`})).payload}async function Vt(e,t){return(await b(C(`/api/mcp/auth/${encodeURIComponent(e)}`),{signal:t})).payload}async function Ht(e){await b(C(`/api/mcp/auth/${encodeURIComponent(e)}`),{method:`DELETE`})}async function Ut(e,t){await b(C(`/api/mcp/auth/${encodeURIComponent(e)}/redirect`),{method:`POST`,body:JSON.stringify({url:t})})}function Wt(e){let t=(0,Q.c)(88),{serverId:n,t:r,onClose:i,onConfigure:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],t[0]=o):o=t[0];let[s,c]=(0,Z.useState)(o),[l,u]=(0,Z.useState)(!0),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(0),_;t[1]===n?_=t[2]:(_=()=>{let e=new AbortController,t=!0;return u(!0),f(``),c([]),Rt(n,e.signal).then(e=>{t&&c(e)}).catch(e=>{t&&f(e instanceof Error?e.message:String(e))}).finally(()=>{t&&u(!1)}),()=>{t=!1,e.abort()}},t[1]=n,t[2]=_);let v;t[3]!==h||t[4]!==n?(v=[n,h],t[3]=h,t[4]=n,t[5]=v):v=t[5],(0,Z.useEffect)(_,v);let y,b,x,S,C,j,M,P,F,I,L,R;if(t[6]!==d||t[7]!==l||t[8]!==i||t[9]!==a||t[10]!==p||t[11]!==n||t[12]!==r.setupConfigure||t[13]!==r.toolParameters||t[14]!==r.toolsAuthHint||t[15]!==r.toolsDialogSearchEmpty||t[16]!==r.toolsDialogSearchPlaceholder||t[17]!==r.toolsDialogSubtitle||t[18]!==r.toolsDialogTitle||t[19]!==r.toolsEmpty||t[20]!==r.toolsLoading||t[21]!==r.toolsTitle||t[22]!==s){let e=p.trim().toLowerCase(),o=s.filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e));x=A,C=!0,t[35]===i?j=t[36]:(j=e=>{e||i()},t[35]=i,t[36]=j),b=D,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(w,{className:`fixed inset-0 z-[60] bg-scrim`}),t[37]=S):S=t[37],y=O,L=`fixed left-1/2 top-1/2 z-[60] flex h-[min(42rem,calc(100vh-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 c;t[38]===r.toolsDialogTitle?c=t[39]:(c=(0,$.jsx)(k,{className:`font-semibold`,children:r.toolsDialogTitle}),t[38]=r.toolsDialogTitle,t[39]=c);let u;t[40]!==l||t[41]!==n||t[42]!==r.toolsDialogSubtitle||t[43]!==s.length?(u=l?n:r.toolsDialogSubtitle.replace(`{{serverId}}`,n).replace(`{{count}}`,String(s.length)),t[40]=l,t[41]=n,t[42]=r.toolsDialogSubtitle,t[43]=s.length,t[44]=u):u=t[44];let f;t[45]===u?f=t[46]:(f=(0,$.jsx)(T,{className:`mt-1 text-sm text-fg-muted`,children:u}),t[45]=u,t[46]=f);let h;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>m(e.target.value),t[47]=h):h=t[47];let g;t[48]!==p||t[49]!==r.toolsDialogSearchPlaceholder?(g=(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:p,onChange:h,placeholder:r.toolsDialogSearchPlaceholder,"aria-label":r.toolsDialogSearchPlaceholder}),t[48]=p,t[49]=r.toolsDialogSearchPlaceholder,t[50]=g):g=t[50],t[51]!==c||t[52]!==f||t[53]!==g?(R=(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge p-5`,children:[c,f,g]}),t[51]=c,t[52]=f,t[53]=g,t[54]=R):R=t[54],M=`min-h-0 flex-1 overflow-y-auto p-5`,P=l,t[55]!==r.toolsTitle||t[56]!==s.length?(F=r.toolsTitle.replace(`{{count}}`,String(s.length)),t[55]=r.toolsTitle,t[56]=s.length,t[57]=F):F=t[57],I=l?(0,$.jsx)(`div`,{role:`status`,"aria-label":r.toolsLoading,className:`space-y-3`,children:[0,1,2].map(Kt)}):d?(0,$.jsxs)(`div`,{role:`alert`,className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm text-danger`,children:d}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.toolsAuthHint.replace(`{{serverId}}`,n)}),a?(0,$.jsx)(N,{variant:`secondary`,onClick:a,children:r.setupConfigure}):null]}):o.length?(0,$.jsx)(`div`,{className:`space-y-3`,children:o.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}),e.exposure?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children: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:r.toolParameters}),(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,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.length?r.toolsDialogSearchEmpty:r.toolsEmpty}),t[6]=d,t[7]=l,t[8]=i,t[9]=a,t[10]=p,t[11]=n,t[12]=r.setupConfigure,t[13]=r.toolParameters,t[14]=r.toolsAuthHint,t[15]=r.toolsDialogSearchEmpty,t[16]=r.toolsDialogSearchPlaceholder,t[17]=r.toolsDialogSubtitle,t[18]=r.toolsDialogTitle,t[19]=r.toolsEmpty,t[20]=r.toolsLoading,t[21]=r.toolsTitle,t[22]=s,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=j,t[29]=M,t[30]=P,t[31]=F,t[32]=I,t[33]=L,t[34]=R}else y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],j=t[28],M=t[29],P=t[30],F=t[31],I=t[32],L=t[33],R=t[34];let z;t[58]!==M||t[59]!==P||t[60]!==F||t[61]!==I?(z=(0,$.jsx)(`div`,{className:M,"aria-busy":P,"aria-label":F,children:I}),t[58]=M,t[59]=P,t[60]=F,t[61]=I,t[62]=z):z=t[62];let B;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>g(Gt),t[63]=B):B=t[63];let V;t[64]!==l||t[65]!==r.refreshTools?(V=(0,$.jsx)(N,{variant:`secondary`,disabled:l,onClick:B,children:r.refreshTools}),t[64]=l,t[65]=r.refreshTools,t[66]=V):V=t[66];let H;t[67]!==i||t[68]!==r.toolsDialogClose?(H=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(N,{onClick:i,children:r.toolsDialogClose})}),t[67]=i,t[68]=r.toolsDialogClose,t[69]=H):H=t[69];let U;t[70]!==V||t[71]!==H?(U=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge p-4`,children:[V,H]}),t[70]=V,t[71]=H,t[72]=U):U=t[72];let W;t[73]!==y||t[74]!==z||t[75]!==U||t[76]!==L||t[77]!==R?(W=(0,$.jsxs)(y,{className:L,children:[R,z,U]}),t[73]=y,t[74]=z,t[75]=U,t[76]=L,t[77]=R,t[78]=W):W=t[78];let G;t[79]!==b||t[80]!==S||t[81]!==W?(G=(0,$.jsxs)(b,{children:[S,W]}),t[79]=b,t[80]=S,t[81]=W,t[82]=G):G=t[82];let K;return t[83]!==x||t[84]!==C||t[85]!==j||t[86]!==G?(K=(0,$.jsx)(x,{open:C,onOpenChange:j,children:G}),t[83]=x,t[84]=C,t[85]=j,t[86]=G,t[87]=K):K=t[87],K}function Gt(e){return e+1}function Kt(e){return(0,$.jsx)(R,{className:`h-24 w-full`},e)}function qt(e){if(e.transport===`stdio`){let t=e.command.trim();if(!t)return``;let n=e.argsText.trim();return n?`${t} ${n}`:t}return e.url.trim()}function Jt(e){let t=(0,Q.c)(48),{row:n,t:r,cs:i,onEdit:a,onRemove:o}=e,[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(``),p;t[0]===n.id?p=t[1]:(p=(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:n.id}),t[0]=n.id,t[1]=p);let m;t[2]===n?m=t[3]:(m=qt(n),t[2]=n,t[3]=m);let h;t[4]===m?h=t[5]:(h=(0,$.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-fg-muted`,children:m}),t[4]=m,t[5]=h);let g;t[6]!==a||t[7]!==p||t[8]!==h?(g=(0,$.jsxs)(`button`,{className:`block w-full text-left`,onClick:a,children:[p,h]}),t[6]=a,t[7]=p,t[8]=h,t[9]=g):g=t[9];let _;t[10]===r.setupEditHint?_=t[11]:(_=(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r.setupEditHint}),t[10]=r.setupEditHint,t[11]=_);let v;t[12]===d?v=t[13]:(v=d?(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:d}):null,t[12]=d,t[13]=v);let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>c(!0),t[14]=y):y=t[14];let b;t[15]===r.viewTools?b=t[16]:(b=(0,$.jsx)(N,{variant:`secondary`,onClick:y,children:r.viewTools}),t[15]=r.viewTools,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>u(!0),t[17]=x):x=t[17];let S;t[18]===r.removeServer?S=t[19]:(S=(0,$.jsx)(N,{variant:`ghost`,onClick:x,children:r.removeServer}),t[18]=r.removeServer,t[19]=S);let C;t[20]!==S||t[21]!==b?(C=(0,$.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[b,S]}),t[20]=S,t[21]=b,t[22]=C):C=t[22];let w;t[23]!==a||t[24]!==n.id||t[25]!==s||t[26]!==r?(w=s?(0,$.jsx)(Wt,{serverId:n.id,t:r,onClose:()=>c(!1),onConfigure:()=>{c(!1),a()}}):null,t[23]=a,t[24]=n.id,t[25]=s,t[26]=r,t[27]=w):w=t[27];let T;t[28]!==i.removeConfirmTitle||t[29]!==n.id?(T=i.removeConfirmTitle.replace(`{{name}}`,n.id),t[28]=i.removeConfirmTitle,t[29]=n.id,t[30]=T):T=t[30];let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>u(!1),t[31]=E):E=t[31];let D;t[32]===o?D=t[33]:(D=()=>{u(!1),o().catch(e=>f(String(e)))},t[32]=o,t[33]=D);let O;t[34]!==l||t[35]!==i.modalCancel||t[36]!==i.removeConfirmDescription||t[37]!==r.removeServer||t[38]!==T||t[39]!==D?(O=(0,$.jsx)(Ke,{open:l,title:T,description:i.removeConfirmDescription,confirmLabel:r.removeServer,cancelLabel:i.modalCancel,destructive:!0,onCancel:E,onConfirm:D}),t[34]=l,t[35]=i.modalCancel,t[36]=i.removeConfirmDescription,t[37]=r.removeServer,t[38]=T,t[39]=D,t[40]=O):O=t[40];let k;return t[41]!==C||t[42]!==w||t[43]!==O||t[44]!==g||t[45]!==_||t[46]!==v?(k=(0,$.jsxs)(`div`,{className:`px-4 py-3.5`,children:[g,_,v,C,w,O]}),t[41]=C,t[42]=w,t[43]=O,t[44]=g,t[45]=_,t[46]=v,t[47]=k):k=t[47],k}function Yt(e){let t=e.connectedAt?Date.parse(e.connectedAt):0;return Number.isFinite(t)?t:0}function Xt(e,t){return e.status===`active`&&t.status!==`active`?-1:e.status!==`active`&&t.status===`active`?1:e.isCurrentAuthorization===t.isCurrentAuthorization?Yt(t)-Yt(e):e.isCurrentAuthorization?-1:1}function Zt(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(Xt);return{key:e,primary:n[0],authorizations:n}}).sort((e,t)=>Xt(e.primary,t.primary))}var Qt=y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,L);function $t(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function en(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function tn(e,t,n){return e.status===`connected`?je(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 nn(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 rn(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 an({instance:e,t,onChanged:n}){let r=$t(e),i=S(e=>e.language)===`zh`,[a,o]=(0,Z.useState)([]),[l,f]=(0,Z.useState)([]),[p,m]=(0,Z.useState)([]),[g,_]=(0,Z.useState)(null),[v,b]=(0,Z.useState)([]),[x,C]=(0,Z.useState)(null),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)([]),[O,k]=(0,Z.useState)({}),[A,j]=(0,Z.useState)(`read`),[M,P]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(null),[L,B]=(0,Z.useState)(!1),[U,W]=(0,Z.useState)(null),[G,q]=(0,Z.useState)(null),[ee,te]=(0,Z.useState)(!1),[ne,ie]=(0,Z.useState)(!1),[ae,Y]=(0,Z.useState)(!1),se=(0,Z.useRef)(0),X=(0,Z.useRef)(0),de=(0,Z.useMemo)(()=>Zt(a),[a]),pe=(0,Z.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]),he=(0,Z.useCallback)(async()=>{if(!r||e.materialized.type!==`composio`||e.materialized.role===`credential`)return;P(!0),I(null);let t=++se.current;try{let e=(await Promise.allSettled([pe(ue()).then(e=>{t===se.current&&(o(e.filter(e=>e.toolkit.toLowerCase()===r.toLowerCase())),te(!0))}),pe(me(r)).then(e=>{t===se.current&&j(e)}),pe(fe(r)).then(e=>{t===se.current&&(_(e.policy),b(e.agents))})])).find(e=>e.status===`rejected`);t===se.current&&e?.status===`rejected`&&I(String(e.reason instanceof Error?e.reason.message:e.reason))}finally{t===se.current&&P(!1)}},[e.materialized,r,pe]);(0,Z.useEffect)(()=>(he(),()=>{se.current++}),[he]);let ge=(0,Z.useCallback)(async()=>{if(!r)return;let e=++X.current;Y(!0),B(!1);let t=t=>n=>{e===X.current&&t(n)},n=await Promise.allSettled([pe(ve(r)).then(t(f)),pe(Je(20)).then(t(e=>m(e.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===r.toLowerCase())))),pe(re(r)).then(t(T)),pe(Fe(r)).then(t(C))]);e===X.current&&(B(n.some(e=>e.status===`rejected`)),Y(!1))},[r,pe]);(0,Z.useEffect)(()=>(ne&&ge(),()=>{X.current++}),[ne,ge]),(0,Z.useEffect)(()=>{let e=!1,t=Zt(a).map(e=>e.primary).filter(e=>e.supportsLearning&&e.accountId);if(t.length)return pe(K()).then(t=>{e||D(t)}).catch(()=>{}),Promise.allSettled(t.map(async e=>[e.accountId,await pe(oe(e.accountId))])).then(t=>{e||k(Object.fromEntries(t.flatMap(e=>e.status===`fulfilled`?[e.value]:[])))}),()=>{e=!0}},[a,pe]);let ye=(0,Z.useCallback)(async i=>{if(!r)return;let a=z()?null:window.open(`about:blank`,`_blank`);a&&(a.opener=null),P(!0),I(null);try{if(!z()&&!a)throw Error(`Allow popups to open the authorization page.`);let t=await ce(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 Be(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?.(),he()])}catch(e){I(ke(e,t))}finally{a?.close(),P(!1)}},[e.connectorId,he,n,t,r]),be=(0,Z.useCallback)(async t=>{P(!0),I(null);try{await Ne(e.instanceId,{config:{...e.config??{},authConfigId:t||void 0}}),await Promise.all([n?.(),he()])}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}},[e.config,e.instanceId,he,n]),xe=async e=>{let t=z()?null:window.open(`about:blank`,`_blank`);t&&(t.opener=null),I(null);try{let n=await H(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 he()}catch(e){t?.close(),I(e instanceof Error?e.message:String(e))}},Te=(0,Z.useCallback)(async e=>{if(r){j(e),I(null);try{await le(r,e)}catch(e){I(e instanceof Error?e.message:String(e)),await he()}}},[he,r]),Ee=(0,Z.useCallback)(async e=>{if(r){I(null);try{_(await V(r,e))}catch(e){I(e instanceof Error?e.message:String(e))}}},[r]),De=(0,Z.useCallback)(e=>{if(!g)return;let t=g.allowedAgentIds.includes(e);t&&g.allowedAgentIds.length===1||Ee({allowedAgentIds:t?g.allowedAgentIds.filter(t=>t!==e):[...g.allowedAgentIds,e]})},[Ee,g]),Ae=(0,Z.useCallback)(async e=>{P(!0),I(null);try{await e(),await he()}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}},[he]);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 Pe=de.filter(e=>e.primary.status===`active`).length,Ie=Pe>0?t.composioAddAccount:t.composioConnectAccount,Le=ee&&Pe>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:y(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,Le?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:[Le?(0,$.jsx)(d,{className:`size-3.5`}):(0,$.jsx)(u,{className:`size-3.5`}),Le?t.connectionReady:ee||F?t.connectionNeedsSetup:t.connectionChecking]}),ee&&(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:je(t.composioAccountCount,{count:String(de.length)})})]}),(0,$.jsxs)(N,{variant:`primary`,className:`shrink-0`,disabled:M,onClick:()=>void ye(),children:[M?(0,$.jsx)(h,{className:`size-4 animate-spin`}):(0,$.jsx)(Ce,{className:`size-4`}),Ie]})]}),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:M,onClick:()=>void he(),children:t.composioRetry})]}):null,x&&!Le?(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:tn(x,Pe,t)}),x.recovery===`none`?null:(0,$.jsx)(N,{variant:`secondary`,disabled:M,onClick:()=>void(x.recovery===`retry`?he():ye()),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,g?(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 Te(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:g.confirmationPolicy,onChange:e=>void Ee({confirmationPolicy:e.currentTarget.value}),children:[(0,$.jsx)(c,{value:`writes`,children:t.composioConfirmWrites}),(0,$.jsx)(c,{value:`always`,children:t.composioConfirmAlways}),g.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:g.allowedAgentIds.length?t.composioAllowedAgentsSelected:t.composioAllowedAgentsAll}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,className:y(`rounded-full border px-2.5 py-1 text-xs transition-colors`,g.allowedAgentIds.length===0?`border-accent bg-accent/10 text-accent`:`border-edge bg-surface-panel text-fg-muted hover:text-fg`),onClick:()=>void Ee({allowedAgentIds:[]}),children:t.composioAllowedAgentsAllOption}),v.map(e=>(0,$.jsx)(`button`,{type:`button`,className:y(`rounded-full border px-2.5 py-1 text-xs transition-colors`,g.allowedAgentIds.includes(e.id)?`border-accent bg-accent/10 text-accent`:`border-edge bg-surface-panel text-fg-muted hover:text-fg`),onClick:()=>De(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:g.selectedAccountIds===null,disabled:M,onChange:e=>void Ee({selectedAccountIds:e.currentTarget.checked?null:[]})}),i?`所有账号(包括以后新增)`:`All accounts, including new ones`]}),g.selectedAccountIds!==null&&de.map(({primary:e})=>e.accountId&&(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:M,checked:g.selectedAccountIds.includes(e.accountId),onChange:t=>void Ee({selectedAccountIds:t.currentTarget.checked?[...g.selectedAccountIds,e.accountId]:g.selectedAccountIds.filter(t=>t!==e.accountId)})}),e.alias??e.accountEmail??e.accountId]},e.accountId)),g.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}),ee&&(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:je(t.composioAccountCount,{count:String(de.length)})})]}),(0,$.jsxs)(N,{variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:M,onClick:()=>void he(),children:[(0,$.jsx)(Oe,{className:y(`size-3.5`,M&&`animate-spin`)}),t.refresh]})]}),de.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:de.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:y(`mt-1 text-xs`,r.status===`active`?`text-emerald-700 dark:text-emerald-300`:`text-amber-700 dark:text-amber-300`),children:r.accountEnabled===!1?i?`已暂停`:`Paused`:nn(r.status,t)}),a?(0,$.jsx)(`p`,{className:y(`mt-1 text-xs`,a.status===`failed`?`text-red-600`:`text-fg-subtle`),children:je(t.connectorLearningStatus,{status:rn(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 xe(r),children:i?`继续授权`:`Continue authorization`}),r.accountId&&(0,$.jsx)(N,{variant:`ghost`,className:`h-8 px-2.5 text-xs text-danger`,disabled:M,onClick:()=>q(r.accountId),children:i?`断开`:`Disconnect`}),r.accountId&&r.status!==`active`&&(0,$.jsx)(N,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,disabled:M,onClick:()=>void ye(r.accountId),children:t.composioReconnectAccount}),r.accountId&&(0,$.jsx)(N,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,disabled:M,onClick:()=>void Ae(()=>Me(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:M,onClick:()=>void Ae(async()=>{if(!r.accountId)throw Error(`Connector account is unavailable.`);await We(r.accountId),await n?.()}),children:[(0,$.jsx)(Oe,{className:`size-3.5`}),t.composioSyncNow]}):null]})]}),(0,$.jsxs)(`details`,{className:`mt-3 text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`w-fit cursor-pointer font-medium hover:text-fg`,children:t.composioAccountSettings}),(0,$.jsxs)(`div`,{className:`mt-3 space-y-4 rounded-lg bg-surface-panel p-3`,children:[r.accountId&&(0,$.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,$.jsx)(`legend`,{className:`mb-2 font-medium`,children:t.composioAllowedAgents}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:M,checked:r.allowedAgentIds==null,onChange:e=>void Ae(()=>Me(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:M,checked:r.allowedAgentIds.includes(e.id),onChange:t=>{let n=t.currentTarget.checked;Ae(()=>Me(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:M,onChange:e=>void Ae(()=>Ge(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:M,onChange:e=>void Ae(()=>Ge(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:y(Qt,`mt-1 h-8 py-1 text-xs`),defaultValue:r.alias??``,onBlur:e=>{e.currentTarget.value!==(r.alias??``)&&Ae(()=>_e(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:M,onClick:()=>W(e.id),children:(0,$.jsx)(J,{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:M,onClick:()=>void Ae(()=>Se(r.id)),children:(0,$.jsx)(Oe,{className:`size-4`})})})]})]})]},e.key)})}):M&&!ee?(0,$.jsxs)(`div`,{"aria-busy":`true`,"aria-label":t.connectionChecking,className:`space-y-3`,children:[(0,$.jsx)(R,{className:`h-16 w-full`}),(0,$.jsx)(R,{className:`h-16 w-full`})]}):ee?(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=>ie(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:[ae?(0,$.jsx)(R,{"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:ae,onClick:()=>void ge(),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:M,onChange:e=>void be(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:[en(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)(Ke,{open:G!==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=G;q(null),e&&Ae(()=>qe(e))},onCancel:()=>q(null)}),(0,$.jsx)(Ke,{open:U!==null,title:t.composioRevoke,description:t.composioRevokeConfirm,confirmLabel:t.composioRevoke,cancelLabel:t.modalCancel,destructive:!0,onConfirm:()=>{let e=U;W(null),e&&Ae(()=>we(e))},onCancel:()=>W(null)})]})}var on=y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,L);function sn(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 cn(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 ln({instance:e,definition:t,onClose:n,onChanged:r,t:i}){let[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),[g,v]=(0,Z.useState)(()=>sn(t,e)),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(null),F=t?.setup.config??[],I=(e.materialized.type===`mcp`||e.materialized.type===`memorySource`)&&F.length>0&&(t?.setup.secrets??[]).length===0,L=e.materialized.type===`mcp`,R=e.materialized.type===`composio`,z=e.materialized.type===`memorySource`,V=t?Ee(t,i):null,H=(0,Z.useCallback)(async()=>{C(!0),x(null);try{let t=await De(e.instanceId);M(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]),U=(0,Z.useCallback)(async()=>{o(!0),x(null);try{await xe(e.instanceId),await r(),n()}catch(e){x(e instanceof Error?e.message:String(e)),o(!1)}},[e.instanceId,r,n]),W=(0,Z.useCallback)(async()=>{if(!(!t||!I)){u(!0),x(null);try{let n={};for(let e of t.setup.config??[]){let t=cn(e.type,g[e.key]??``);t!==void 0&&(n[e.key]=t)}await Ne(e.instanceId,{config:n}),await r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{u(!1)}}},[g,t,e.instanceId,r,I]),G=(0,Z.useCallback)(async()=>{f(!0),m(null),x(null);try{m((await Ae(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)(A,{open:!0,onOpenChange:e=>{e||n()},children:[(0,$.jsxs)(D,{children:[(0,$.jsx)(w,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(O,{className:y(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,R?`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)(B,{connector:t,size:`lg`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(k,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,$.jsx)(T,{className:`mt-1 text-sm text-fg-muted`,children:V??(e.materialized.type===`mcp`?je(i.mcpServerRuntime,{serverId:e.materialized.serverId}):je(i.runtimeLabel,{runtime:e.materialized.type}))})]})]}),(0,$.jsx)(E,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:y(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,P.focusRingPanel),"aria-label":i.modalClose,children:[(0,$.jsx)(_,{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:[b?(0,$.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:b}):null,L?(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:j?.ok?je(i.toolsAvailable,{count:String(j.toolCount)}):j?i.healthStatusLabels[j.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 H(),children:[S?(0,$.jsx)(h,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0}),i.test]})]}),I?F.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:on,value:g[e.key]??``,placeholder:e.placeholder,onChange:t=>v(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key)):null]}):null,R?(0,$.jsx)(an,{instance:e,t:i,onChanged:r}):null,z?(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}),V?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:V}):null,p===null?null:(0,$.jsx)(`p`,{className:`mt-1 text-xs text-emerald-600`,children:je(i.connectedSourceSynced,{count:String(p)})})]}),(0,$.jsxs)(N,{disabled:d,onClick:()=>void G(),children:[d?(0,$.jsx)(h,{className:`size-4 animate-spin`}):(0,$.jsx)(Ve,{className:`size-4`}),i.composioSyncNow]})]}),I?(0,$.jsx)(`div`,{className:`grid gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:F.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:on,value:g[e.key]??``,placeholder:e.placeholder,onChange:t=>v(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}):null,!L&&!R&&!z?(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)(h,{className:`size-4 animate-spin`}):(0,$.jsx)(J,{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}),(L||z)&&I?(0,$.jsxs)(N,{variant:`primary`,disabled:l,onClick:()=>void W(),children:[l?(0,$.jsx)(h,{className:`size-4 animate-spin`}):(0,$.jsx)(X,{className:`size-4`}),i.modalSave]}):null]})]})]}),(0,$.jsx)(Ke,{open:s,title:je(i.removeConfirmTitle,{name:e.displayName}),description:i.removeConfirmDescription,confirmLabel:i.removeConfirmAction,cancelLabel:i.modalCancel,destructive:!0,onConfirm:()=>{c(!1),U()},onCancel:()=>{a||c(!1)}})]})}function un(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=e.instance.materialized.type===`cli`&&e.definition?(0,$.jsx)(ge,{definition:e.definition,instance:e.instance,onClose:e.onClose,onChanged:e.onChanged}):(0,$.jsx)(ln,{...e}),t[0]=e,t[1]=n),n}function dn(e){let t=(0,Q.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=ft(n,r),t[0]=r,t[1]=n,t[2]=l):l=t[2];let p=l.state,m;t[3]!==r||t[4]!==s?(m=r?Ee(r,s):null,t[3]=r,t[4]=s,t[5]=m):m=t[5];let h=m,g,_,v,b,x,S,C,w,T;if(t[6]!==p||t[7]!==r||t[8]!==c||t[9]!==n||t[10]!==a||t[11]!==s.connectionChecking||t[12]!==s.connectionNeedsSetup||t[13]!==s.connectionReady){g=p===`ready`?{label:s.connectionReady,Icon:d,className:`text-emerald-700 dark:text-emerald-300`}:p===`needs_setup`?{label:s.connectionNeedsSetup,Icon:u,className:`text-amber-700 dark:text-amber-300`}:{label:s.connectionChecking,Icon:f,className:`text-fg-muted`},w=`button`;let e=c&&`bg-accent-soft`;t[23]===e?T=t[24]:(T=y(`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)]`,P.transition,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,e),t[23]=e,t[24]=T),t[25]!==n||t[26]!==a?(_=()=>a(n),t[25]=n,t[26]=a,t[27]=_):_=t[27],t[28]===r?v=t[29]:(v=(0,$.jsx)(B,{connector:r}),t[28]=r,t[29]=v),C=`min-w-0 flex-1`,x=`flex min-w-0 items-center gap-2`,t[30]===n.displayName?S=t[31]:(S=(0,$.jsx)(`h3`,{className:`truncate text-sm font-medium text-fg`,children:n.displayName}),t[30]=n.displayName,t[31]=S),b=y(`inline-flex shrink-0 items-center gap-1 text-xs font-medium`,g.className),t[6]=p,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]=g,t[15]=_,t[16]=v,t[17]=b,t[18]=x,t[19]=S,t[20]=C,t[21]=w,t[22]=T}else g=t[14],_=t[15],v=t[16],b=t[17],x=t[18],S=t[19],C=t[20],w=t[21],T=t[22];let E;t[32]===g.Icon?E=t[33]:(E=(0,$.jsx)(g.Icon,{className:`size-3.5`,"aria-hidden":!0}),t[32]=g.Icon,t[33]=E);let D;t[34]!==g.label||t[35]!==E||t[36]!==b?(D=(0,$.jsxs)(`span`,{className:b,children:[E,g.label]}),t[34]=g.label,t[35]=E,t[36]=b,t[37]=D):D=t[37];let O;t[38]!==D||t[39]!==x||t[40]!==S?(O=(0,$.jsxs)(`div`,{className:x,children:[S,D]}),t[38]=D,t[39]=x,t[40]=S,t[41]=O):O=t[41];let k;t[42]===h?k=t[43]:(k=h?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:h}):null,t[42]=h,t[43]=k);let A;t[44]!==O||t[45]!==k||t[46]!==C?(A=(0,$.jsxs)(`div`,{className:C,children:[O,k]}),t[44]=O,t[45]=k,t[46]=C,t[47]=A):A=t[47];let j;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(o,{className:`size-4 shrink-0 text-fg-disabled`,"aria-hidden":!0}),t[48]=j):j=t[48];let M;return t[49]!==_||t[50]!==v||t[51]!==A||t[52]!==w||t[53]!==T?(M=(0,$.jsxs)(`button`,{type:w,className:T,onClick:_,children:[v,A,j]}),t[49]=_,t[50]=v,t[51]=A,t[52]=w,t[53]=T,t[54]=M):M=t[54],M}function fn(e,t){let n=e.length+1,r=`server-${n}`,i=new Set([...e.map(e=>e.id.trim()),...t]);for(;i.has(r);)n+=1,r=`server-${n}`;return Ft(r)}function pn(){return y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,L)}function mn({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:i,pasteFailed:a,pasteFailedTitle:o,dismissLabel:s,keyPlaceholder:c,valuePlaceholder:l,headers:u,onChange:d}){let[f,p]=(0,Z.useState)(!1),m=(e,t)=>{d(u.map((n,r)=>r===e?{...n,...t}:n))},h=()=>{d([...u,xt()])},g=e=>{let t=u.filter((t,n)=>n!==e);d(t.length>0?t:[xt()])},_=async()=>{try{let e=await M();if(!e){p(!0);return}let t=Ct(e);if(!t?.length){p(!0);return}d(t)}catch{p(!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 _(),children:[(0,$.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),i]})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{className:y(pn(),`min-w-0 flex-1 font-mono text-xs`),value:e.key,placeholder:c,onChange:e=>m(t,{key:e.target.value})}),(0,$.jsx)(`input`,{className:y(pn(),`min-w-0 flex-[1.4] font-mono text-xs`),value:e.value,placeholder:l,onChange:e=>m(t,{value:e.target.value})}),(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:u.length<=1&&!e.key&&!e.value,onClick:()=>g(t),"aria-label":r,children:(0,$.jsx)(J,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})})]},e.clientKey))}),(0,$.jsx)(Ke,{open:f,title:o,description:a,confirmLabel:s,onConfirm:()=>p(!1),onCancel:()=>p(!1)}),(0,$.jsxs)(`button`,{type:`button`,className:y(`self-start text-sm text-accent hover:underline`,P.press),onClick:h,children:[`+ `,n]})]})}var hn=[`stdio`,`streamable-http`];function gn(e){let t=(0,Q.c)(11),{label:n,description:r,required:i,children:a}=e,o;t[0]===i?o=t[1]:(o=i?(0,$.jsx)(`span`,{className:`ml-0.5 text-danger`,children:`*`}):null,t[0]=i,t[1]=o);let s;t[2]!==n||t[3]!==o?(s=(0,$.jsxs)(`div`,{className:`text-sm font-medium text-fg`,children:[n,o]}),t[2]=n,t[3]=o,t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=r?(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:r}):null,t[5]=r,t[6]=c);let l;return t[7]!==a||t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[s,a,c]}),t[7]=a,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function _n(){return y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,L)}function vn(e){let t=(0,Q.c)(42),{row:n,t:r,onUpdate:i,idConflictMessage:a,variant:o,showTransport:l}=e,u=o===void 0?`all`:o,d=l===void 0?!0:l,f=u===`all`||u===`basic`,p=u===`all`||u===`advanced`,m;t[0]!==i||t[1]!==n.transport||t[2]!==f||t[3]!==d||t[4]!==r?(m=f&&d?(0,$.jsx)($.Fragment,{children:(0,$.jsx)(gn,{label:r.transportLabel,required:!0,children:(0,$.jsx)(s,{className:_n(),value:n.transport,onChange:e=>i({transport:e.target.value}),children:hn.map(e=>(0,$.jsx)(c,{value:e,children:r.transportLabels[e]},e))})})}):null,t[0]=i,t[1]=n.transport,t[2]=f,t[3]=d,t[4]=r,t[5]=m):m=t[5];let h;t[6]!==a||t[7]!==i||t[8]!==n.id||t[9]!==p||t[10]!==r?(h=p?(0,$.jsxs)(gn,{label:r.serverIdLabel,children:[(0,$.jsx)(`input`,{className:_n(),value:n.id,placeholder:r.serverIdPlaceholder,onChange:e=>i({id:e.target.value})}),a?(0,$.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-300`,children:a}):null]}):null,t[6]=a,t[7]=i,t[8]=n.id,t[9]=p,t[10]=r,t[11]=h):h=t[11];let g;t[12]!==i||t[13]!==n.argsText||t[14]!==n.command||t[15]!==n.cwd||t[16]!==n.envJson||t[17]!==n.headers||t[18]!==n.oauthClientId||t[19]!==n.transport||t[20]!==n.url||t[21]!==p||t[22]!==f||t[23]!==r||t[24]!==u?(g=n.transport===`stdio`?(0,$.jsxs)($.Fragment,{children:[f?(0,$.jsx)(`div`,{className:u===`basic`?`md:col-span-2`:void 0,children:(0,$.jsx)(gn,{label:r.commandLabel,required:!0,children:(0,$.jsx)(`input`,{className:_n(),value:n.command,onChange:e=>i({command:e.target.value})})})}):null,f?(0,$.jsx)(gn,{label:r.argsLabel,description:r.argsHint,children:(0,$.jsx)(`input`,{className:_n(),value:n.argsText,onChange:e=>i({argsText:e.target.value})})}):null,p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(gn,{label:r.cwdLabel,children:(0,$.jsx)(`input`,{className:_n(),value:n.cwd,onChange:e=>i({cwd:e.target.value})})}),(0,$.jsx)(gn,{label:r.envLabel,description:r.envHint,children:(0,$.jsx)(`textarea`,{className:y(_n(),`min-h-[4rem] font-mono text-xs`),value:n.envJson,onChange:e=>i({envJson:e.target.value})})})]}):null]}):(0,$.jsxs)($.Fragment,{children:[f?(0,$.jsx)(`div`,{className:`md:col-span-2`,children:(0,$.jsx)(gn,{label:r.urlLabel,required:!0,children:(0,$.jsx)(`input`,{className:y(_n(),`font-mono text-xs`),value:n.url,placeholder:`https://example.com/mcp`,onChange:e=>i({url:e.target.value})})})}):null,p?(0,$.jsx)(gn,{label:r.oauthClientIdLabel,description:r.oauthClientIdHint,children:(0,$.jsx)(`input`,{className:_n(),value:n.oauthClientId,onChange:e=>i({oauthClientId:e.target.value})})}):null,p?(0,$.jsx)(mn,{label:r.headersLabel,optionalLabel:r.optionalSuffix,addLabel:r.addHeader,removeHeaderAria:r.removeHeader,pasteLabel:r.pasteHeaders,pasteFailed:r.pasteHeadersFailed,pasteFailedTitle:r.pasteHeadersFailedTitle,dismissLabel:r.pasteHeadersDismiss,keyPlaceholder:r.headerKeyPlaceholder,valuePlaceholder:r.headerValuePlaceholder,headers:n.headers,onChange:e=>i({headers:e})}):null]}),t[12]=i,t[13]=n.argsText,t[14]=n.command,t[15]=n.cwd,t[16]=n.envJson,t[17]=n.headers,t[18]=n.oauthClientId,t[19]=n.transport,t[20]=n.url,t[21]=p,t[22]=f,t[23]=r,t[24]=u,t[25]=g):g=t[25];let _;t[26]!==i||t[27]!==n.exposure||t[28]!==p||t[29]!==r?(_=p?(0,$.jsx)(gn,{label:r.exposureLabel,children:(0,$.jsx)(s,{className:_n(),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))})}):null,t[26]=i,t[27]=n.exposure,t[28]=p,t[29]=r,t[30]=_):_=t[30];let v;t[31]!==i||t[32]!==n.timeout||t[33]!==p||t[34]!==r?(v=p?(0,$.jsx)(gn,{label:r.requestTimeoutLabel,children:(0,$.jsx)(et,{allowEmpty:!0,type:`number`,min:1,className:_n(),value:n.timeout??``,placeholder:`60`,onChange:e=>i({timeout:e.target.value?Number(e.target.value):void 0})})}):null,t[31]=i,t[32]=n.timeout,t[33]=p,t[34]=r,t[35]=v):v=t[35];let b;return t[36]!==m||t[37]!==h||t[38]!==g||t[39]!==_||t[40]!==v?(b=(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[m,h,g,_,v]}),t[36]=m,t[37]=h,t[38]=g,t[39]=_,t[40]=v,t[41]=b):b=t[41],b}var yn=y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,L);function bn(e){let{t,cs:n}=e,[r,i]=(0,Z.useState)(e.initialRow),[a,o]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(),[g,v]=(0,Z.useState)(),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(``),[j,M]=(0,Z.useState)([]),[P,F]=(0,Z.useState)(``),[I,L]=(0,Z.useState)(``),R=(0,Z.useRef)(e.mode===`edit`?e.initialRow.id:``),z=(0,Z.useRef)(void 0),B=(0,Z.useRef)(void 0),V=(0,Z.useRef)(null),H=(0,Z.useRef)(``),U=(0,Z.useRef)(!0),W=(0,Z.useRef)(e.onSaved);W.current=e.onSaved;let G=g?.state===`starting`||g?.state===`authorizing`,K=a||G;(0,Z.useEffect)(()=>(U.current=!0,()=>{U.current=!1,z.current?.abort(),V.current?.close(),B.current&&Ht(B.current).catch(()=>{})}),[]),(0,Z.useEffect)(()=>{if(!g||!G)return;let e=g.id,n=new AbortController,r;async function i(){try{let r=await Vt(e,n.signal);if(n.signal.aborted)return;if(v(r),r.authorizationUrl&&H.current!==r.authorizationUrl)if(H.current=r.authorizationUrl,window.electronAPI?.shell?.openExternalUrl){let e=await window.electronAPI.shell.openExternalUrl(r.authorizationUrl);e.ok||u(e.error??t.oauthOpenFailed)}else V.current&&!V.current.closed&&V.current.location.replace(r.authorizationUrl);if(r.state===`connected`){B.current=void 0,V.current?.close(),p({state:`connected`,toolCount:r.toolCount}),u(``),await W.current();return}if(r.state===`error`||r.state===`cancelled`){V.current?.close(),u(r.error??t.setupCancelled),/client.{0,20}(id|registration)|register|registration/i.test(r.error??``)&&x(!0);return}}catch(e){if(n.signal.aborted)return;u(e instanceof Error?e.message:String(e)),v(e=>e?{...e,state:`error`}:void 0),B.current&&Ht(B.current).catch(()=>{});return}r=setTimeout(()=>void i(),1200)}return i(),()=>{n.abort(),clearTimeout(r)}},[g?.id,G,t.oauthOpenFailed,t.setupCancelled]);function q(e){i(t=>({...t,...e})),p(void 0),v(void 0),u(``)}function ee(){try{let t=Pt(S);M(t),q({...t[0],clientKey:e.initialRow.clientKey}),C(``)}catch(e){u(`${t.setupImportError} ${e instanceof Error?e.message:String(e)}`)}}async function J(){o(!0),u(``),v(void 0),z.current?.abort();let a=new AbortController;z.current=a;try{let o=e.existingCustomServers.filter(t=>t.clientKey!==e.initialRow.clientKey&&t.id!==R.current),s={...r,url:r.transport===`streamable-http`?Nt(r.url):r.url};if(s.transport===`stdio`&&!s.command.trim())throw Error(t.setupCommandRequired);let c=new Set([...e.managedServerIds,...o.map(e=>e.id)]);if(s.id=s.id.trim()||Mt(s,c),[...c].some(e=>e.replace(/-/g,`_`)===s.id.replace(/-/g,`_`)))throw Error(n.duplicateServerId);if(s.extra={...s.extra,enabled:!0},await Lt({servers:[...o,s]},Dt(e.config)),R.current=s.id,!U.current)return;i(s),await W.current();let l=await zt(s.id,a.signal);if(!U.current)return;p(l),l.state===`error`&&u(l.error??t.setupConnectionFailed)}catch(e){U.current&&!a.signal.aborted&&u(e instanceof Error?e.message:String(e))}finally{U.current&&o(!1)}}async function te(){u(``),o(!0),H.current=``,window.electronAPI?.shell?.openExternalUrl||(V.current=window.open(`about:blank`,`_blank`),V.current&&(V.current.opener=null));try{let e=await Bt(R.current);if(!U.current){V.current?.close(),Ht(e.id).catch(()=>{});return}B.current=e.id,v(e)}catch(e){V.current?.close(),u(e instanceof Error?e.message:String(e))}finally{U.current&&o(!1)}}async function ne(){let e=g?.authorizationUrl;if(e)if(window.electronAPI?.shell?.openExternalUrl){let n=await window.electronAPI.shell.openExternalUrl(e);n.ok||u(n.error??t.oauthOpenFailed)}else window.open(e,`_blank`,`noopener,noreferrer`)}async function re(){if(g){u(``);try{await Ut(g.id,P),F(``)}catch(e){u(e instanceof Error?e.message:String(e))}}}function ie(e){L(e),i(t=>({...t,headers:[...t.headers.filter(e=>e.key.toLowerCase()!==`authorization`),...e.trim()?[xt(`Authorization`,/^Bearer\s/i.test(e.trim())?e.trim():`Bearer ${e.trim()}`)]:[]]})),u(``)}return(0,$.jsx)(A,{open:e.open,onOpenChange:t=>{t||e.onClose()},children:(0,$.jsxs)(D,{children:[(0,$.jsx)(w,{className:`fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(O,{className:`fixed left-1/2 top-1/2 z-[60] flex h-[min(42rem,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`,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)(k,{className:`font-semibold`,children:t.setupTitle}),(0,$.jsx)(T,{className:`mt-1 text-sm text-fg-muted`,children:t.setupHint})]}),(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(`button`,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":n.modalClose,children:(0,$.jsx)(_,{className:`size-5`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`fieldset`,{disabled:K,className:`min-w-0 space-y-4`,children:[(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(N,{variant:`ghost`,onClick:()=>q({transport:r.transport===`stdio`?`streamable-http`:`stdio`}),children:r.transport===`stdio`?t.setupUseUrl:t.setupUseCommand})}),(0,$.jsx)(vn,{row:r,t,variant:`basic`,showTransport:!1,onUpdate:q}),f?.state===`token_required`?(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:t.setupTokenLabel}),(0,$.jsx)(`input`,{type:`password`,autoComplete:`off`,className:yn,value:I,onChange:e=>ie(e.target.value)}),(0,$.jsx)(`span`,{className:`block text-xs font-normal text-fg-muted`,children:t.setupTokenHint})]}):null,(0,$.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,open:b,onToggle:e=>x(e.currentTarget.open),children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:t.setupAdvanced}),(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(vn,{row:r,t,variant:`advanced`,onUpdate:q})})]}),(0,$.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:t.setupImport}),(0,$.jsxs)(`label`,{className:`mt-3 block`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:t.setupImport}),(0,$.jsx)(`textarea`,{className:y(yn,`min-h-28 font-mono text-xs`),placeholder:`{"mcpServers": {"docs": {"url": "https://example.com/mcp"}}}`,value:S,onChange:e=>C(e.target.value)})]}),(0,$.jsx)(N,{variant:`secondary`,className:`mt-2`,disabled:!S.trim(),onClick:ee,children:t.setupImportAction}),j.length>1?(0,$.jsxs)(`label`,{className:`mt-3 block text-sm text-fg`,children:[(0,$.jsx)(`span`,{children:t.setupImportChoose}),(0,$.jsx)(s,{className:y(yn,`mt-1.5`),value:r.id,onChange:t=>{let n=j.find(e=>e.id===t.target.value);n&&q({...n,clientKey:e.initialRow.clientKey})},children:j.map(e=>(0,$.jsx)(c,{value:e.id,children:e.id},e.id))})]}):null]})]}),a?(0,$.jsxs)(`p`,{role:`status`,className:`mt-4 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(h,{className:`size-4 animate-spin`,"aria-hidden":!0}),t.setupChecking]}):null,f?.state===`connected`?(0,$.jsxs)(`p`,{role:`status`,className:`mt-4 flex items-center gap-2 text-sm text-success`,children:[(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),t.setupConnected.replace(`{{count}}`,String(f.toolCount??0))]}):null,f?.state===`oauth_required`&&!G&&g?.state!==`connected`?(0,$.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:t.setupOAuthRequired}):null,G?(0,$.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-lg border border-edge p-4`,children:[(0,$.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(h,{className:`size-4 animate-spin`,"aria-hidden":!0}),t.setupAuthorizing]}),g?.authorizationUrl?(0,$.jsxs)(N,{variant:`secondary`,onClick:()=>void ne(),children:[(0,$.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t.oauthOpenAuthorization]}):null,g?.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`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:t.setupRedirectLabel}),(0,$.jsx)(`input`,{className:yn,value:P,placeholder:`http://127.0.0.1:…/callback?code=…`,onChange:e=>F(e.target.value)})]}),(0,$.jsx)(N,{className:`mt-2`,disabled:!P.trim(),onClick:()=>void re(),children:t.setupContinue})]}):null]}):null,l?(0,$.jsx)(`p`,{role:`alert`,className:`mt-4 whitespace-pre-wrap break-words text-sm text-danger`,children:l}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge p-4`,children:[(0,$.jsx)(N,{variant:`secondary`,onClick:e.onClose,children:n.modalCancel}),f?.state===`connected`?(0,$.jsx)(N,{onClick:e.onClose,children:t.setupDone}):f?.state===`oauth_required`?(0,$.jsx)(N,{disabled:K,"aria-busy":K,onClick:()=>void te(),children:t.setupSignIn}):(0,$.jsx)(N,{disabled:K||f?.state===`token_required`&&!I.trim()||(r.transport===`streamable-http`?!r.url.trim():!r.command.trim()),"aria-busy":K,onClick:()=>void J(),children:t.setupConnect})]})]})]})})}var xn=`builtin`,Sn=`composio`,Cn=`xopc-store`;function wn(e){return xn}function Tn(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 En(e){return e.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t)}function Dn(e){return e?.startsWith(`/`)&&!e.startsWith(`//`)?e:`/user-model`}function On({embedded:e=!1,onHeaderActionChange:t}){let n=j().filter(e=>e.format===`agent-plugin`),r=S(e=>e.language),o=v(r),s=o.connectorsSettings,c=o.mcpSettings,u=x(e=>e.conversationId),d=!!u,f=a(),[p,m]=i(),g=p.get(`understanding`)===`1`,_=Dn(p.get(`returnTo`)),b=!!p.get(`returnTo`)&&!g,C=p.get(`tab`),[w,T]=(0,Z.useState)(!g&&C===`connected`?`connected`:`discover`),E=(0,Z.useRef)(!1),[D,O]=(0,Z.useState)({catalog:[],registryCatalog:[],instances:[],loading:!0,error:null}),[k,A]=(0,Z.useState)(!1),[M,P]=(0,Z.useState)(!1),[F,L]=(0,Z.useState)(1),[R,z]=(0,Z.useState)(void 0),[B,V]=(0,Z.useState)(``),[H,U]=(0,Z.useState)(g||b?p.get(`connector`)??``:``),[G,K]=(0,Z.useState)(wn(g?`understanding`:`default`)),[q,ee]=(0,Z.useState)(`name`),[J,re]=(0,Z.useState)(g?`understand`:`all`),[ie,ae]=(0,Z.useState)(null),[oe,Y]=(0,Z.useState)(null),[ce,X]=(0,Z.useState)(null),[le,ue]=(0,Z.useState)(null),[de,fe]=(0,Z.useState)(null),[me,ge]=(0,Z.useState)(null),{data:_e,mutate:ve}=I(d),ye=_e?.payload?.config,xe=(0,Z.useMemo)(()=>ye===void 0?null:It(ye),[ye]),Se=xe?.servers??[],Ce=D.instances.length+Se.length+n.reduce((e,t)=>e+(t.components?.mcp.length??0),0);(0,Z.useEffect)(()=>{},[xe]);let we=(0,Z.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([ne(),te()]);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,Z.useEffect)(()=>{we()},[we]),(0,Z.useEffect)(()=>{E.current||D.loading||d&&!xe||(T(g?`discover`:Ce>0?`connected`:`discover`),E.current=!0)},[d,Ce,xe,g,D.loading]);let Te=(0,Z.useCallback)(e=>{E.current=!0,T(e)},[]),Ee=(0,Z.useMemo)(()=>[{id:Sn,displayName:s.composioSourceName},{id:Cn,displayName:s.storeSourceName}],[s.composioSourceName,s.storeSourceName]),De=(0,Z.useCallback)(async e=>{if(!d||G===`builtin`){O(e=>({...e,registryCatalog:[]})),L(1),z(void 0);return}let t=H.trim(),n=Math.max(e?.page??1,1),r=e?.append??!1,i=G===`all`?Ee:Ee.filter(e=>e.id===G);if(i.length!==0){A(!0),r?O(e=>({...e,error:null})):(L(1),z(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 be({q:t||void 0,page:n,pageSize:24,verification:`experimental`});return{connectors:e.connectors,totalPages:e.meta.totalPages}}let r=await he({q:t||void 0,page:n,pageSize:24,sort:q===`source`?`newest`:`downloads`});return{connectors:r.items.flatMap(e=>{let t=Tn(e);return t?[t]:[]}),totalPages:r.meta.totalPages}})),a=En(e.flatMap(e=>e.connectors)),o=Math.max(1,...e.map(e=>e.totalPages??1));L(n),z(o),O(e=>({...e,registryCatalog:r?En([...e.registryCatalog,...a]):a}))}catch(e){O(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{A(!1)}}},[q,H,G,d,Ee]);(0,Z.useEffect)(()=>{if(w!==`discover`||D.loading)return;if(G===`builtin`){O(e=>({...e,registryCatalog:[]})),L(1),z(void 0);return}let e=window.setTimeout(()=>{De()},H.trim()?350:0);return()=>window.clearTimeout(e)},[H,G,De,D.loading,w]);let Oe=(0,Z.useMemo)(()=>new Set(D.instances.map(e=>e.connectorId)),[D.instances]),ke=(0,Z.useMemo)(()=>new Map([...D.catalog,...D.registryCatalog].map(e=>[e.id,e])),[D.catalog,D.registryCatalog]);(0,Z.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,V(``),X(n.instanceId),ue(n),T(`connected`);else if(e){let t=ke.get(e);if(!t)return;E.current=!0,K(wn(g?`understanding`:`default`)),U(``),Y(t),T(`discover`)}let r=new URLSearchParams(p);r.delete(`connector`),r.delete(`instance`),r.set(`tab`,n?`connected`:`discover`),m(r,{replace:!0})},[ke,g,p,m,D.instances,D.loading]);let Ae=(0,Z.useCallback)(async e=>{P(!0),O(e=>({...e,error:null}));try{let t=await Le(e);ae(Ue(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{P(!1)}},[]),je=(0,Z.useMemo)(()=>new Set(D.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[D.instances]),Me=(0,Z.useCallback)(async e=>{!xe||ye===void 0||(await Lt({servers:Se.filter(t=>t.clientKey!==e.clientKey)},Dt(ye)),await ve(),await we())},[ye,Se,we,xe,ve]),Ne=(0,Z.useCallback)(()=>{ge({mode:`add`,row:fn(Se,je)})},[Se,je]),Pe=ze(e=>e.setPageHeader),Fe=ze(e=>e.clearPageHeader),Be=(0,Z.useMemo)(()=>({searchLabel:w===`connected`?s.connectedSearchPlaceholder:s.discoverSearchPlaceholder,search:(0,$.jsx)(Ye,{value:w===`connected`?B:H,onChange:w===`connected`?V:U,placeholder:w===`connected`?s.connectedSearchPlaceholder:s.discoverSearchPlaceholder}),secondary:(0,$.jsx)(bt,{onRefresh:w===`connected`&&d?we:void 0,refreshing:D.loading,refreshLabel:s.refreshConnections,onBrowseCatalog:()=>Te(`discover`),onAddCustomServer:Ne,addLabel:s.addConnection,browseLabel:s.addFromCatalog,customLabel:s.addCustomServerAdvanced,serviceLabel:r.startsWith(`zh`)?`应用连接服务`:`Connection service`,moreActionsLabel:o.capabilitiesHub.moreActions})}),[B,s,H,d,r,we,o.capabilitiesHub.moreActions,Ne,Te,D.loading,w]);(0,Z.useLayoutEffect)(()=>e?(t?.(Be),()=>t?.(null)):(Pe({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)(Xe,{contribution:Be})}),()=>Fe()),[Fe,s.title,e,Be,t,Pe]);let Ve=(0,Z.useMemo)(()=>D.instances.map(e=>({instance:e,value:ft(e,ke.get(e.connectorId))})),[ke,D.instances]),He=(0,Z.useMemo)(()=>new Map(Ve.map(({instance:e,value:t})=>[e.instanceId,t])),[Ve]),We=(0,Z.useMemo)(()=>D.instances.filter(e=>Ie(e,B)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=He.get(e.instanceId)?.state??`checking`,i=He.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[B,He,D.instances]),Ge=(0,Z.useMemo)(()=>We.filter(e=>He.get(e.instanceId)?.state===`needs_setup`),[He,We]),Ke=(0,Z.useMemo)(()=>We.filter(e=>He.get(e.instanceId)?.state!==`needs_setup`),[He,We]),qe=(0,Z.useMemo)(()=>Se.filter(e=>Re(e,B)),[B,Se]),Je=(0,Z.useMemo)(()=>{let e=B.trim().toLowerCase();return n.flatMap(t=>(t.components?.mcp??[]).filter(n=>`${t.name} ${n.name}`.toLowerCase().includes(e)).map(e=>({extension:t,server:e})))},[B,n]),Ze=We.length+qe.length+Je.length,et=(0,Z.useMemo)(()=>D.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1&&pe(e)),[D.catalog]),Q=(0,Z.useMemo)(()=>G===`builtin`?et:G===`all`?En([...et,...D.registryCatalog]):D.registryCatalog,[et,G,D.registryCatalog]),nt=(0,Z.useMemo)(()=>{let e=g?Q.filter(e=>e.understanding?.mode===`activity`):Q;return W(J===`all`?e:e.filter(e=>ut(e).includes(J)),H,q)},[q,H,Q,g,J]),at=(0,Z.useMemo)(()=>lt.filter(e=>Q.some(t=>ut(t).includes(e))),[Q]);(0,Z.useEffect)(()=>{J!==`all`&&!at.includes(J)&&re(`all`)},[at,J]);let st=w===`discover`&&G!==`builtin`&&!!(R&&F<R),dt=(0,Z.useMemo)(()=>D.instances.find(e=>e.instanceId===ce)??le,[ce,le,D.instances]),pt=(0,Z.useMemo)(()=>[{value:`all`,label:s.discoverSourceAll},{value:xn,label:s.discoverSourceBuiltin},...Ee.map(e=>({value:e.id,label:e.displayName}))],[s.discoverSourceAll,s.discoverSourceBuiltin,Ee]),mt=[{id:`connected`,label:s.tabConnected,count:Ce},{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:y(`mx-auto flex w-full max-w-7xl flex-col gap-6 px-4 sm:px-6 lg:px-8`,e?`pb-7 pt-3 lg:pb-9 lg:pt-4`:`py-7 lg:py-9`),children:[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}),g?(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,b?(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)(Qe,{items:mt,activeTab:w,onChange:Te,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:rt.slice(0,3).map(e=>(0,$.jsx)(ct,{},e))}):Ce===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:()=>Te(`discover`),children:s.addFromCatalog})]}):Ze===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)(dn,{instance:e,definition:ke.get(e.connectorId),highlighted:e.instanceId===de,onOpenDetails:e=>{fe(null),X(e.instanceId),ue(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)(dn,{instance:e,definition:ke.get(e.connectorId),highlighted:e.instanceId===de,onOpenDetails:e=>{fe(null),X(e.instanceId),ue(e)},t:s},e.instanceId))})}):null,Je.map(({extension:e,server:t})=>(0,$.jsx)($e,{pluginId:e.pluginId,server:t,enabled:e.active},t.id)),qe.length||!B.trim()?(0,$.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-base`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer px-4 py-3`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:s.customIntegrationsTitle}),(0,$.jsx)(`span`,{className:`ml-2 text-xs tabular-nums text-fg-subtle`,children:qe.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:Ne,children:s.addCustomServerAdvanced})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:qe.map(e=>(0,$.jsx)(Jt,{row:e,t:c,cs:s,onEdit:()=>ge({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>Me(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:[g?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`,...at].map(e=>(0,$.jsx)(`button`,{type:`button`,className:y(`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:()=>re(e),children:e===`all`?s.taskAll:s.connectorBenefitHeadings[e]},e))}),(0,$.jsxs)(`div`,{className:y(`ml-auto grid w-full gap-2 sm:flex sm:w-auto sm:justify-end`,g?`grid-cols-1`:`grid-cols-2`),children:[g?null:(0,$.jsx)(`div`,{className:`min-w-0 sm:w-40`,children:(0,$.jsx)(l,{value:G,options:pt,placeholder:s.discoverSourceAll,allowEmpty:!1,ariaLabel:s.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:K})}),(0,$.jsx)(`div`,{className:`min-w-0 sm:w-40`,children:(0,$.jsx)(l,{value:q,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=>ee(e)})})]})]}),(D.loading||k)&&nt.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:rt.map(e=>(0,$.jsx)(ot,{},e))}):nt.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)(h,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:nt.map(e=>(0,$.jsx)(tt,{connector:e,installed:Oe.has(e.id)||it(e,D.instances),onInstall:e=>{if(e.source===`store`){Ae(e.id);return}ae(Ue(e))},onOpenDetails:e.source===`store`?void 0:Y,t:s},e.id))}),st?(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsxs)(N,{type:`button`,variant:`secondary`,disabled:k||M,onClick:()=>void De({page:F+1,append:!0}),children:[k?(0,$.jsx)(h,{className:`size-4 animate-spin`}):null,s.loadMore]})}):null]})]}):null]}),ie?(0,$.jsx)(se,{draft:ie,onChange:ae,onClose:()=>ae(null),t:s,onInstalled:async e=>{await we(),await ve(),fe(e.instanceId),Te(`connected`)}}):null,oe?(0,$.jsx)(gt,{connector:oe,installed:Oe.has(oe.id)||it(oe,D.instances),onClose:()=>Y(null),onInstall:e=>ae(Ue(e)),t:s}):null,dt?(0,$.jsx)(un,{instance:dt,definition:ke.get(dt.connectorId),onClose:()=>{X(null),ue(null)},onChanged:we,t:s,mcp:c}):null,me?(0,$.jsx)(bn,{open:!0,mode:me.mode,initialRow:me.row,existingCustomServers:Se,config:ye,managedServerIds:je,t:c,cs:s,onClose:()=>ge(null),onSaved:async()=>{await ve(),await we(),Te(`connected`)}},`${me.mode}-${me.row.clientKey}`):null]})})}export{On as ConnectorsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./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-DHC7J4lG.js";import{t as re}from"./cn-0WouolD0.js";import{n as ie}from"./locale-store-uRu_DsWm.js";import{c as ae,n as oe,s as se}from"./dist-C3DSFZCi.js";import{jc as ce}from"./index-
|
|
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-DHC7J4lG.js";import{t as re}from"./cn-0WouolD0.js";import{n as ie}from"./locale-store-uRu_DsWm.js";import{c as ae,n as oe,s as se}from"./dist-C3DSFZCi.js";import{jc as ce}from"./index-CNH8vwcY.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 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE--EKdQGRF.js";import{t as a}from"./check-DUBLcKHA.js";import{v as o}from"./use-file-preview-expanded-DSKIxfz9.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{Ac as g}from"./index-
|
|
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--EKdQGRF.js";import{t as a}from"./check-DUBLcKHA.js";import{v as o}from"./use-file-preview-expanded-DSKIxfz9.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{Ac as g}from"./index-CNH8vwcY.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};
|