@xopcai/xopc 0.0.323 → 0.0.324
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/plugin.js +1 -9
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DFzmThVi.js → agent-avatar-dicebear-B-Gczr_A.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CxcIHW_Z.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DYFYiuig.js → agent-plugin-dialog-CNuqJcHQ.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-BqIlB5Co.js → agents-CPpmkx7O.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BgvMRGWe.js → app-management-settings-panel-BwWdVRlb.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CliHU03A.js → appearance-settings-EoXNDO1j.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-6xEgLDv8.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DnuPpm0u.js → archive-plugin-B_T0uMvL.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BiwaK0ie.js → attachment-load-D9DDwxd2.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CJSISGQH.js → automations-page-jI9vNr2r.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-rztQnZDk.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-KDjduQZO.js → binary-plugins-Dzsxh9OL.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-bclvgove.js → block-editor-CWUUgWWk.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-CfQ2T9t6.js → browser-automation-inputs-DSWXq9lI.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-Cxq38Nnp.js → browser-automations-page-D96o3bDY.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-DUQzQ3ic.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-sAZT4brT.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CKWtXof8.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-C8ducWB7.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DKQC62nQ.js → chat-terminal-dock-WXZrEB3K.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-D1whpIqL.js → computer-settings-page-uy9YDwxJ.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BAuYTgf5.js → connector-service-page-BpF0SjB9.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-eZTfIMWI.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-Do1dl0La.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-DOuVO2M1.js → dependency-picker-BhS8s080.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-D9tu6Bhu.js → desktop-pet-DPVPqFlh.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CQPXub2f.js → desktop-pet-settings-Dv3vG9HZ.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DxkOYSut.js → device-pairing-wizard-DdvO1O6W.js} +1 -1
- package/dist/gateway/static/root/assets/dist-3h6cXXhT.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-CtWClPz-.js → extension-debug-page-cuG5Lnwf.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BHh9HLCz.js → extension-page-BCTAXdyE.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BdT3v5Uh.js → extension-settings-page-kadW_icu.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-1eqyz9vZ.js → gateway-config-swr-CoQVulMd.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CZas_Ekx.js → gateway-settings-CLZyN-u9.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C4rsW6vJ.js → gateway-startup-retry-B5GJ-CQV.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BSqg-JE9.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-B5DXMylk.js → image-generation-api-DvWDkbk1.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-B1JH0G5j.js → imports-page-_pddpuej.js} +1 -1
- package/dist/gateway/static/root/assets/{index-CNc4N4TX.css → index-BKL5tg2f.css} +1 -1
- package/dist/gateway/static/root/assets/index-CJuypaNt.js +121 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DGrLJ8Yh.js → keyboard-shortcuts-settings-C1fKIjz4.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DXFnYiA0.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DqjStqbL.js → local-apps-page-CkXKS5xe.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BIkcRr3t.js → locale-store-BPZR8x9b.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-C33z-ife.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-gCfH4cwH.js → management-settings-8eDZb0uS.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-Ck_5MADq.js → markdown-view-Dft8ASFD.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DTsZqgo6.js → media-plugins-Cjj-fidX.js} +1 -1
- package/dist/gateway/static/root/assets/messages-kFWhF6_t.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-C95RtLuL.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-kFxknjMR.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-DTI_g4tz.js → page-context-capture-button-OUL3fEYh.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-CfW_Q-K5.js → page-tabs-CVbY7_N5.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-DcsFzD_i.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CuPN-vAn.js → preview-open-alternatives-CKiIby0r.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BHjxRz1E.js → product-open-page-DlpCi5zT.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-LPAxUszX.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-Bk-es4i9.js → projects-page-Cbyb4hyy.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-BAAZUGnU.js → registry-api-DWWO6ajd.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BtDFZc6g.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CHJBJKL1.js → runtime-tools-settings-panel-BT_ANpaT.js} +1 -1
- package/dist/gateway/static/root/assets/scenes-page-CJlc-mg1.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-FQAit5HL.js → schema-form-BcqsqSsV.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CUo6-iV2.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-XeSxPjP7.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BDc6bw1q.js → settings-form-section-Dol9j_pF.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DnhxBJjV.js → settings-page-B65vii9U.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-D3KNSQ5g.js → settings-page-layout-eqTUTW2L.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BCt__prc.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DVQCRxwK.js → share-preview-page-BS8o58NJ.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BsjSqEnw.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-evN7gs0S.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BifYwEhe.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-mDwC9UJ-.js → skills-page.utils-DOk-iOvN.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Bk7GrMij.js → system-settings-panel-CcSvoHfY.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-pCRG7Jb3.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-D3Aquraj.js → tunnel-api-DDGMf44u.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C1xQ-sHn.js → use-autosave-DiIkxIq7.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CvYeM0Ml.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DCNECvcp.js → voice-api-key-field-DJV-qERt.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-B-_niUTU.js → voice-config-api-BaxITrwZ.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BrGx_JS_.js → work-discovery-overlay-DcHhy54L.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CmmC2Pdr.js → workflow-run-setup-panel-DbVtLh0R.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CT8ouKcB.js +6 -0
- package/dist/gateway/static/root/index.html +11 -10
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/home.js +284 -55
- package/dist/packages/gateway-contract/src/index.js +0 -2
- package/dist/packages/gateway-contract/src/notifications.js +3 -10
- package/dist/src/activity/emitter.js +2 -1
- package/dist/src/activity/service.js +2 -1
- package/dist/src/agent/agent-manager.d.ts +3 -2
- package/dist/src/agent/agent-manager.js +36 -44
- package/dist/src/agent/agent-scope.d.ts +19 -48
- package/dist/src/agent/agent-scope.js +47 -169
- package/dist/src/agent/background-review/run-background-review.js +5 -4
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/commands/command-registry.js +7 -3
- package/dist/src/agent/context/coordinator.js +1 -1
- package/dist/src/agent/context/execution-context.js +2 -1
- package/dist/src/agent/context/execution-scope.js +2 -1
- package/dist/src/agent/context/workspace-seed.d.ts +1 -2
- package/dist/src/agent/context/workspace-seed.js +3 -3
- package/dist/src/agent/context/workspace-state.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +2 -2
- package/dist/src/agent/embedded/run-turn.js +2 -1
- package/dist/src/agent/embedded/sqlite-hydrating-session-manager.js +2 -1
- package/dist/src/agent/external-tools/cliProvider.js +2 -1
- package/dist/src/agent/external-tools/composio-provider.js +2 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/index.js +2 -3
- package/dist/src/agent/external-tools/mcp-provider.js +2 -2
- package/dist/src/agent/image/tool-model-config.js +4 -5
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/ipc/socket.js +3 -3
- package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
- package/dist/src/agent/media-generation/runtime-shared.js +1 -1
- package/dist/src/agent/memory/plugin-discovery.js +1 -2
- package/dist/src/agent/models/manager.d.ts +1 -1
- package/dist/src/agent/models/manager.js +2 -2
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +1 -1
- package/dist/src/agent/prompt/response-language.js +2 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +6 -3
- package/dist/src/agent/prompt/system-prompt.js +2 -1
- package/dist/src/agent/reply/post-compaction-context.js +2 -2
- package/dist/src/agent/service/build-direct-message-content.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +2 -1
- package/dist/src/agent/service/parse-outbound-session-key.js +2 -1
- package/dist/src/agent/service/process-direct-streaming.js +3 -2
- package/dist/src/agent/service/webchat-tts.js +2 -1
- package/dist/src/agent/service.d.ts +1 -1
- package/dist/src/agent/service.js +12 -11
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/session/session-inspector.js +4 -5
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.d.ts +5 -0
- package/dist/src/agent/starter-agents.d.ts +4 -5
- package/dist/src/agent/starter-agents.js +21 -20
- package/dist/src/agent/tasks/task-judge-service.js +2 -2
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +31 -1
- package/dist/src/agent/tools/delegation-parent-policy.js +2 -3
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +10 -9
- package/dist/src/agent/tools/image-generate-tool.js +1 -1
- package/dist/src/agent/tools/workflow-tool.js +2 -3
- package/dist/src/agent/tools/xopc-use-tool.d.ts +3 -2
- package/dist/src/agent/tools/xopc-use-tool.js +54 -6
- package/dist/src/agent/workflow/workflow-child-tools.js +1 -2
- package/dist/src/agent/workspace-runtime/registry.d.ts +1 -1
- package/dist/src/agent/workspace-runtime/registry.js +2 -2
- package/dist/src/agent-catalog/capabilities.d.ts +3 -0
- package/dist/src/agent-catalog/capabilities.js +238 -0
- package/dist/src/agent-catalog/id.d.ts +15 -0
- package/dist/src/agent-catalog/id.js +101 -0
- package/dist/src/agent-catalog/index.d.ts +6 -0
- package/dist/src/agent-catalog/index.js +10 -0
- package/dist/src/agent-catalog/migrations/legacy-config-cutover.d.ts +11 -0
- package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +195 -0
- package/dist/src/agent-catalog/repository.d.ts +39 -0
- package/dist/src/agent-catalog/repository.js +319 -0
- package/dist/src/agent-catalog/service.d.ts +33 -0
- package/dist/src/agent-catalog/service.js +202 -0
- package/dist/src/agent-catalog/test-support.d.ts +14 -0
- package/dist/src/agent-catalog/test-support.js +34 -0
- package/dist/src/agent-catalog/types.d.ts +26 -0
- package/dist/src/agent-catalog/types.js +1 -0
- package/dist/src/agent-config/index.js +2 -2
- package/dist/src/agent-config/schema.d.ts +1 -172
- package/dist/src/agent-config/schema.js +2 -41
- package/dist/src/auth/credentials.js +3 -3
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/sync-provider-auth.d.ts +1 -1
- package/dist/src/auth/sync-provider-auth.js +5 -9
- package/dist/src/automations/capabilities/drafts.js +8 -7
- package/dist/src/automations/service/action-executor.js +2 -1
- package/dist/src/bootstrap/application-state.d.ts +10 -0
- package/dist/src/bootstrap/application-state.js +26 -0
- package/dist/src/browser/automations/repository.js +2 -1
- package/dist/src/browser/automations/schema.d.ts +1 -1
- package/dist/src/browser/automations/service.d.ts +1 -1
- package/dist/src/browser/native-messaging-host.js +5 -4
- package/dist/src/browser/providers/extension.js +4 -2
- package/dist/src/browser/providers/realtime-extension.js +2 -1
- package/dist/src/capabilities/readiness/from-config.js +7 -4
- package/dist/src/capabilities/runtime/dispatcher.d.ts +1 -0
- package/dist/src/capabilities/runtime/dispatcher.js +10 -4
- package/dist/src/capabilities/runtime/product.js +2 -0
- package/dist/src/channels/catalog/channel-catalog-service.js +7 -13
- package/dist/src/chat-commands/agent-edit.js +4 -3
- package/dist/src/chat-commands/builtins/config.js +6 -8
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/builtins/workflow.js +1 -1
- package/dist/src/chat-commands/config-paths.js +1 -1
- package/dist/src/chat-commands/context.js +2 -3
- package/dist/src/chat-previews/store.js +2 -1
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/agent.js +4 -4
- package/dist/src/cli/commands/agents.d.ts +1 -1
- package/dist/src/cli/commands/agents.js +36 -48
- package/dist/src/cli/commands/auth.js +1 -0
- package/dist/src/cli/commands/browser-cli-helpers.js +1 -2
- package/dist/src/cli/commands/channels.js +2 -4
- package/dist/src/cli/commands/config.js +4 -5
- package/dist/src/cli/commands/connectors.js +1 -2
- package/dist/src/cli/commands/doctor/checks/channel-config.js +2 -4
- package/dist/src/cli/commands/doctor/checks/channel-pairing-pending.js +1 -2
- package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -2
- package/dist/src/cli/commands/doctor/checks/config-health.js +1 -2
- package/dist/src/cli/commands/doctor/checks/database-schema.js +4 -4
- package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -2
- package/dist/src/cli/commands/doctor/checks/gateway-service.js +1 -2
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +13 -11
- package/dist/src/cli/commands/doctor/checks/security-audit.js +1 -2
- package/dist/src/cli/commands/doctor/checks/session-integrity.js +3 -3
- package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -2
- package/dist/src/cli/commands/doctor/checks/workspace-status.js +5 -7
- package/dist/src/cli/commands/extension-agent-plugin.js +1 -2
- package/dist/src/cli/commands/extension-dev.js +2 -4
- package/dist/src/cli/commands/extension-marketplace.js +1 -2
- package/dist/src/cli/commands/extension-pack.js +1 -2
- package/dist/src/cli/commands/extension.js +1 -2
- package/dist/src/cli/commands/gateway/run-foreground.js +3 -3
- package/dist/src/cli/commands/gateway/shared.js +1 -1
- package/dist/src/cli/commands/history.js +2 -1
- package/dist/src/cli/commands/image.js +2 -2
- package/dist/src/cli/commands/init.js +11 -30
- package/dist/src/cli/commands/mcp.js +1 -2
- package/dist/src/cli/commands/models.js +13 -11
- package/dist/src/cli/commands/onboard/channels/registry.js +1 -2
- package/dist/src/cli/commands/onboard/gateway.js +1 -2
- package/dist/src/cli/commands/onboard/model.d.ts +1 -1
- package/dist/src/cli/commands/onboard/model.js +17 -25
- package/dist/src/cli/commands/onboard.js +4 -2
- package/dist/src/cli/commands/platform.js +1 -0
- package/dist/src/cli/commands/project.js +3 -3
- package/dist/src/cli/commands/providers.js +1 -0
- package/dist/src/cli/commands/runtime.js +1 -2
- package/dist/src/cli/commands/search.js +1 -2
- package/dist/src/cli/commands/skills.js +1 -2
- package/dist/src/cli/commands/tui-runner.js +3 -2
- package/dist/src/cli/commands/tui.js +6 -8
- package/dist/src/cli/commands/tunnel.js +1 -1
- package/dist/src/cli/commands/voice.js +1 -2
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/cli/index.js +4 -2
- package/dist/src/cli/utils/gateway-client.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +15 -16
- package/dist/src/cli/utils/session.js +1 -2
- package/dist/src/computer/model-config.d.ts +3 -3
- package/dist/src/computer/model-config.js +10 -20
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/agent-model-intents.js +2 -2
- package/dist/src/config/agent-profile.d.ts +5 -6
- package/dist/src/config/agent-profile.js +19 -19
- package/dist/src/config/config-surface.d.ts +0 -3
- package/dist/src/config/default-model.js +2 -6
- package/dist/src/config/index.js +7 -8
- package/dist/src/config/loader.js +12 -18
- package/dist/src/config/models-json.d.ts +6 -6
- package/dist/src/config/paths.d.ts +18 -19
- package/dist/src/config/paths.js +35 -35
- package/dist/src/config/reload.d.ts +0 -1
- package/dist/src/config/reload.js +1 -6
- package/dist/src/config/rules.js +0 -15
- package/dist/src/config/schema.d.ts +3 -406
- package/dist/src/config/schema.js +24 -86
- package/dist/src/config/validate-channel-configs.js +8 -14
- package/dist/src/config/workspace-dirs.d.ts +3 -4
- package/dist/src/config/workspace-dirs.js +9 -8
- package/dist/src/config/workspace-path-helpers.d.ts +1 -1
- package/dist/src/config/workspace-path-helpers.js +2 -2
- package/dist/src/connectors/cli/lifecycle.js +2 -1
- package/dist/src/connectors/composio-managed-events.js +2 -1
- package/dist/src/connectors/connected-source-ingestion.js +2 -1
- package/dist/src/connectors/connected-source-understanding.js +4 -2
- package/dist/src/connectors/content-enrichment.js +2 -1
- package/dist/src/connectors/learning-coordinator.js +2 -1
- package/dist/src/connectors/runtime-adapter-registry.js +2 -1
- package/dist/src/connectors/workflow-preflight.d.ts +8 -1
- package/dist/src/connectors/workflow-preflight.js +11 -3
- package/dist/src/discussions/analyzer.js +2 -2
- package/dist/src/endpoint-tools/runtime.js +2 -1
- package/dist/src/execution-environments/subject.js +2 -1
- package/dist/src/extensions/activation-context.js +3 -16
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/discover-extensions.js +9 -15
- package/dist/src/extensions/extension-metadata-snapshot.d.ts +1 -1
- package/dist/src/extensions/extension-metadata-snapshot.js +9 -16
- package/dist/src/extensions/index.js +4 -10
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/extensions/loader.js +7 -14
- package/dist/src/extensions/manifest-registry.js +93 -98
- package/dist/src/extensions/marketplace.js +5 -2
- package/dist/src/extensions/normalize-manifest.js +12 -17
- package/dist/src/extensions/update.js +1 -2
- package/dist/src/files/file-service.js +7 -8
- package/dist/src/gateway/agents-admin.d.ts +23 -27
- package/dist/src/gateway/agents-admin.js +109 -130
- package/dist/src/gateway/file-path-classifier.js +3 -3
- package/dist/src/gateway/file-space-service.js +2 -1
- package/dist/src/gateway/global-defaults-admin.d.ts +6 -4
- package/dist/src/gateway/global-defaults-admin.js +21 -20
- package/dist/src/gateway/hono/app.js +2 -1
- package/dist/src/gateway/hono/lib/config-payload.js +12 -9
- package/dist/src/gateway/hono/middleware/auth.js +2 -1
- package/dist/src/gateway/hono/middleware/scopes.js +2 -1
- package/dist/src/gateway/hono/routes/agents.js +22 -49
- package/dist/src/gateway/hono/routes/browser.js +4 -2
- package/dist/src/gateway/hono/routes/channels.js +1 -2
- package/dist/src/gateway/hono/routes/cli-connectors.js +2 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +3 -1
- package/dist/src/gateway/hono/routes/composer-history.js +2 -1
- package/dist/src/gateway/hono/routes/config-patch/index.d.ts +1 -3
- package/dist/src/gateway/hono/routes/config-patch/index.js +1 -2
- package/dist/src/gateway/hono/routes/config-patch/misc.js +18 -11
- package/dist/src/gateway/hono/routes/config.js +0 -2
- package/dist/src/gateway/hono/routes/connectors.js +8 -4
- package/dist/src/gateway/hono/routes/context-sources.js +4 -3
- package/dist/src/gateway/hono/routes/device-pairing-approval.js +2 -1
- package/dist/src/gateway/hono/routes/device-push.js +3 -2
- package/dist/src/gateway/hono/routes/devices.js +6 -3
- package/dist/src/gateway/hono/routes/discussions.js +2 -1
- package/dist/src/gateway/hono/routes/endpoint-tools.js +2 -1
- package/dist/src/gateway/hono/routes/global-defaults.js +8 -16
- package/dist/src/gateway/hono/routes/home.js +93 -4
- package/dist/src/gateway/hono/routes/interaction-state.js +2 -1
- package/dist/src/gateway/hono/routes/models.js +8 -7
- package/dist/src/gateway/hono/routes/notes.js +4 -5
- package/dist/src/gateway/hono/routes/projects.js +6 -6
- package/dist/src/gateway/hono/routes/public-gateway.js +2 -1
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +4 -2
- package/dist/src/gateway/hono/routes/shares.js +4 -3
- package/dist/src/gateway/hono/routes/site-shares.js +2 -2
- package/dist/src/gateway/hono/routes/status.js +2 -3
- package/dist/src/gateway/hono/routes/tasks.js +1 -2
- package/dist/src/gateway/hono/routes/user-model-refresh.js +2 -1
- package/dist/src/gateway/hono/routes/user-model.js +3 -2
- package/dist/src/gateway/hono/routes/work-discovery.js +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/image-generation-setup.d.ts +19 -10
- package/dist/src/gateway/image-generation-setup.js +59 -23
- package/dist/src/gateway/index.js +1 -4
- package/dist/src/gateway/lock.js +13 -18
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +4 -3
- package/dist/src/gateway/run-loop.js +2 -3
- package/dist/src/gateway/security/gateway-scopes.js +6 -2
- package/dist/src/gateway/security/index.js +4 -1
- package/dist/src/gateway/service/agent-runner.js +4 -2
- package/dist/src/gateway/service/app-context-access.js +2 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +0 -1
- package/dist/src/gateway/service/config-coordinator.js +4 -22
- package/dist/src/gateway/service/marketplace-service.js +3 -1
- package/dist/src/gateway/service/run-gateway-agent.js +4 -2
- package/dist/src/gateway/service/session-input-coordinator.js +4 -2
- package/dist/src/gateway/service.d.ts +5 -0
- package/dist/src/gateway/service.js +109 -33
- package/dist/src/gateway/session-context-summary.js +4 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +2 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.js +15 -10
- package/dist/src/home-intelligence/application-service.d.ts +31 -0
- package/dist/src/home-intelligence/application-service.js +134 -0
- package/dist/src/home-intelligence/capability-preflight.d.ts +32 -0
- package/dist/src/home-intelligence/capability-preflight.js +118 -0
- package/dist/src/home-intelligence/evaluation.d.ts +34 -0
- package/dist/src/home-intelligence/evaluation.js +49 -0
- package/dist/src/home-intelligence/generator.d.ts +125 -0
- package/dist/src/home-intelligence/generator.js +227 -0
- package/dist/src/home-intelligence/host.d.ts +53 -0
- package/dist/src/home-intelligence/host.js +257 -0
- package/dist/src/home-intelligence/notification.d.ts +8 -0
- package/dist/src/home-intelligence/notification.js +20 -0
- package/dist/src/home-intelligence/policy.d.ts +16 -0
- package/dist/src/home-intelligence/policy.js +152 -0
- package/dist/src/home-intelligence/repository.d.ts +81 -0
- package/dist/src/home-intelligence/repository.js +495 -0
- package/dist/src/home-intelligence/snapshot.d.ts +43 -0
- package/dist/src/home-intelligence/snapshot.js +133 -0
- package/dist/src/home-intelligence/strategy.d.ts +14 -0
- package/dist/src/home-intelligence/strategy.js +10 -0
- package/dist/src/home-intelligence/types.d.ts +13 -0
- package/dist/src/home-intelligence/types.js +1 -0
- package/dist/src/infra/update-restart.js +4 -2
- package/dist/src/knowledge/connected-knowledge-pipeline.js +2 -1
- package/dist/src/knowledge/ingestion-service.js +2 -1
- package/dist/src/knowledge-memory/repository.js +2 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/local-apps/store.js +2 -1
- package/dist/src/mcp/channel-bridge.js +1 -2
- package/dist/src/mcp/channel-server.js +1 -2
- package/dist/src/mcp/gateway-http-client.js +1 -2
- package/dist/src/media/session-references.js +2 -1
- package/dist/src/memory-maintenance/service.js +2 -1
- package/dist/src/migrations/memory-config.js +1 -2
- package/dist/src/notes/agent-context.js +2 -1
- package/dist/src/notes/attachment-ref.js +8 -4
- package/dist/src/notes/note-attachment-sync.js +2 -1
- package/dist/src/notes/note-index-meta.js +14 -7
- package/dist/src/notes/note-markdown.js +13 -7
- package/dist/src/notes/service.js +6 -3
- package/dist/src/notes/store.js +4 -2
- package/dist/src/notifications/device-store.js +1 -1
- package/dist/src/notifications/planner.js +24 -0
- package/dist/src/notifications/service.d.ts +7 -14
- package/dist/src/notifications/service.js +13 -3
- package/dist/src/notifications/store.js +1 -1
- package/dist/src/notifications/types.d.ts +1 -1
- package/dist/src/notifications/types.js +1 -1
- package/dist/src/projects/capabilities/write.js +2 -1
- package/dist/src/projects/project-agent-suggestion.js +1 -1
- package/dist/src/projects/project-agent.js +4 -4
- package/dist/src/projects/project-service.js +2 -1
- package/dist/src/projects/workspace.js +3 -2
- package/dist/src/providers/index.js +3 -3
- package/dist/src/providers/model-reference-auditor.d.ts +1 -2
- package/dist/src/providers/model-reference-auditor.js +8 -5
- package/dist/src/realtime/runtime.js +2 -1
- package/dist/src/routing/binding-schema.d.ts +41 -0
- package/dist/src/routing/binding-schema.js +26 -0
- package/dist/src/routing/bindings.d.ts +4 -2
- package/dist/src/routing/bindings.js +4 -4
- package/dist/src/routing/index.d.ts +1 -1
- package/dist/src/routing/resolve-route.d.ts +7 -24
- package/dist/src/routing/resolve-route.js +17 -18
- package/dist/src/routing/resolve-tui-session-key.d.ts +1 -4
- package/dist/src/routing/resolve-tui-session-key.js +10 -9
- package/dist/src/scenes/execution.d.ts +1 -1
- package/dist/src/scenes/model.js +1 -1
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +1 -1
- package/dist/src/scenes/taskFollowUp/service.js +6 -4
- package/dist/src/scenes/templates.d.ts +2 -2
- package/dist/src/session/config-store.js +2 -1
- package/dist/src/session/init-session-turn.js +2 -1
- package/dist/src/session/resolve-session.js +2 -1
- package/dist/src/session/session-workspace.js +1 -1
- package/dist/src/session/store.js +3 -2
- package/dist/src/storage/sqlite/activity-repository.js +6 -2
- package/dist/src/storage/sqlite/browser-tab-binding-repository.js +6 -2
- package/dist/src/storage/sqlite/clarification-wait-repository.js +13 -8
- package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/collaboration-rule-repository.js +8 -3
- package/dist/src/storage/sqlite/composer-input-history-repository.js +8 -3
- package/dist/src/storage/sqlite/config-repository.js +9 -5
- package/dist/src/storage/sqlite/connector-learning-repository.js +6 -2
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +6 -2
- package/dist/src/storage/sqlite/context-evidence-repository.js +8 -3
- package/dist/src/storage/sqlite/context-extraction-repository.js +8 -3
- package/dist/src/storage/sqlite/device-access-repository.js +15 -9
- package/dist/src/storage/sqlite/device-pairing-approval.js +6 -2
- package/dist/src/storage/sqlite/device-pairing-repository.js +10 -5
- package/dist/src/storage/sqlite/endpoint-principal-repository.js +6 -2
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.js +6 -2
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +6 -2
- package/dist/src/storage/sqlite/gateway-identity-repository.js +6 -2
- package/dist/src/storage/sqlite/home-attention-repository.js +6 -2
- package/dist/src/storage/sqlite/index.d.ts +0 -1
- package/dist/src/storage/sqlite/index.js +72 -42
- package/dist/src/storage/sqlite/interaction-state-repository.js +10 -4
- package/dist/src/storage/sqlite/knowledge-repository.js +6 -2
- package/dist/src/storage/sqlite/migrations/203_remove_retired_proactive_contracts.sql +70 -0
- package/dist/src/storage/sqlite/migrations/204_home_intelligence.sql +78 -0
- package/dist/src/storage/sqlite/migrations/205_agent_catalog.sql +66 -0
- package/dist/src/storage/sqlite/migrations/206_home_advice_strategy_version.sql +3 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +2 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.js +8 -4
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.d.ts +7 -1
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +2 -2
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +4 -4
- package/dist/src/storage/sqlite/note-agent-context-repository.js +6 -2
- package/dist/src/storage/sqlite/notes-repository.js +9 -4
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-task-plan-repository.js +14 -9
- package/dist/src/storage/sqlite/session-turn-replace-repository.js +9 -5
- package/dist/src/storage/sqlite/sidebar-layout-repository.js +14 -9
- package/dist/src/storage/sqlite/transcript-repository.js +10 -6
- package/dist/src/storage/sqlite/user-people-repository.js +8 -3
- package/dist/src/storage/sqlite/user-trust-repository.js +8 -3
- package/dist/src/tasks/attention-governor.d.ts +0 -1
- package/dist/src/tasks/attention-governor.js +1 -7
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.d.ts +1 -1
- package/dist/src/tasks/execution-context.d.ts +2 -2
- package/dist/src/tasks/execution-context.js +6 -5
- package/dist/src/tasks/home-query-service.d.ts +3 -2
- package/dist/src/tasks/home-query-service.js +23 -44
- package/dist/src/tasks/task-context-assembler.js +2 -1
- package/dist/src/tasks/task-context-repository.d.ts +1 -1
- package/dist/src/tasks/task-contract-planner.d.ts +0 -3
- package/dist/src/tasks/task-contract-planner.js +1 -4
- package/dist/src/tasks/task-handoff-service.d.ts +0 -2
- package/dist/src/tasks/task-handoff-service.js +3 -3
- package/dist/src/tasks/task-value-metrics-service.js +2 -1
- package/dist/src/tui/backends/embedded-backend.js +12 -14
- package/dist/src/tui/extension-host/load-extensions.js +1 -1
- package/dist/src/tui/tui-commands.js +5 -3
- package/dist/src/tui/tui-skills-autocomplete.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +3 -3
- package/dist/src/tui/tui.js +5 -5
- package/dist/src/tunnel/registration-proof.js +2 -1
- package/dist/src/user-context/access-policy.js +2 -1
- package/dist/src/user-context/domain.d.ts +1 -1
- package/dist/src/user-context/domain.js +18 -13
- package/dist/src/user-context/extraction/registry.js +2 -1
- package/dist/src/user-context/interaction-state.js +4 -1
- package/dist/src/user-context/relationship-continuity.js +2 -1
- package/dist/src/user-context/trust-policy.js +13 -8
- package/dist/src/user-model/bootstrap.js +2 -1
- package/dist/src/user-model/capture/executor.js +4 -2
- package/dist/src/user-model/capture/semantic.d.ts +1 -1
- package/dist/src/user-model/capture/semantic.js +1 -1
- package/dist/src/user-model/domain.js +7 -2
- package/dist/src/user-model/goals.js +2 -1
- package/dist/src/user-model/index.js +4 -1
- package/dist/src/user-model/repository.js +2 -1
- package/dist/src/utils/helpers.js +1 -4
- package/dist/src/utils/index.js +2 -2
- package/dist/src/utils/logger/index.d.ts +1 -1
- package/dist/src/utils/logger/index.js +2 -2
- package/dist/src/utils/logger/redact.d.ts +2 -0
- package/dist/src/utils/logger/redact.js +11 -3
- package/dist/src/utils/logger.js +2 -2
- package/dist/src/voice/realtime/memory-context.js +2 -1
- package/dist/src/voice/realtime/persona-context.js +6 -6
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/work-discovery/analyzer.js +3 -3
- package/dist/src/work-discovery/investigator.js +1 -1
- package/dist/src/work-discovery/service.js +12 -11
- package/dist/src/workflows/draft/workflow-draft-service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +4 -5
- package/dist/src/workflows/store/paths.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CAFHadiy.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Drt3Foi9.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-B-Eduqwz.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-Dwgir6mu.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-H5L5vynP.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-uFKh3Hd0.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-RFBRYe5S.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Px-v3Q6Q.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-CfCo3lqh.js +0 -1
- package/dist/gateway/static/root/assets/home-page-w3_aWeNt.js +0 -1
- package/dist/gateway/static/root/assets/index--3c0awkr.js +0 -121
- package/dist/gateway/static/root/assets/local-app-workbench-page-BYKrJpFF.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-Dl4kM4Na.js +0 -2
- package/dist/gateway/static/root/assets/messages-7VAhscYe.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-j6sioeL1.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-CMvvHv0f.js +0 -8
- package/dist/gateway/static/root/assets/popover-select-B-GDnZO9.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-C9K_e-EV.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CLGJNA42.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-ClLAD1pz.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-Xj8MkXN1.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DwALV8mi.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-F0rCQ-2a.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-C7hf6Cov.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-xPrFejRE.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-RdDYu7Yj.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-2A966jFY.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-CnBxPBVe.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-BZVpqw4T.js +0 -6
- package/dist/packages/gateway-contract/src/proactive.js +0 -136
- package/dist/src/commands/agents.config.d.ts +0 -31
- package/dist/src/commands/agents.config.js +0 -129
- package/dist/src/gateway/hono/routes/config-patch/agents.d.ts +0 -2
- package/dist/src/gateway/hono/routes/config-patch/agents.js +0 -6
- package/dist/src/storage/sqlite/relationship-settings-repository.d.ts +0 -17
- package/dist/src/storage/sqlite/relationship-settings-repository.js +0 -65
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{n as o,r as s,t as c}from"./popover-select-B-GDnZO9.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-JdwAhgNB.js";import{c as p,n as m}from"./locale-store-BIkcRr3t.js";import{t as h}from"./messages-7VAhscYe.js";import{a as g,i as _,n as v,o as y,r as b,s as x,t as S}from"./dist-BGTk37IG.js";import{n as C}from"./copy-to-clipboard-HOJ79TWv.js";import{t as w}from"./button-CS04eWY9.js";import{r as T}from"./gateway-config-swr-1eqyz9vZ.js";import{t as E}from"./skeleton-BwbyijEw.js";import{i as D,o as O}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as k}from"./electron-env-Dit0bHgy.js";import{a as A,i as j,n as M,r as N,t as P}from"./dist-Che_jiQF.js";import{$ as F,$c as I,An as L,As as R,Bs as z,Cc as B,Cs as V,Do as ee,Ds as H,Dt as U,Ec as te,Es as ne,Fn as re,Fs as ie,Gc as ae,Gs as oe,Gu as se,Hc as ce,Hs as le,In as ue,Io as de,Is as fe,Jc as pe,Kl as me,Ln as W,Ls as he,Mc as ge,Mn as _e,Ms as G,Ns as ve,Os as ye,Ot as K,Pn as be,Pu as xe,Q as Se,Rl as q,Rs as Ce,Ts as we,Us as Te,Uu as Ee,Vs as De,Ws as Oe,X as ke,Yc as J,Z as Ae,Zc as Y,Zo as je,_s as Me,ba as Ne,bs as Pe,dl as Fe,et as X,fs as Ie,gc as Le,gs as Re,hs as ze,id as Be,jn as Ve,kn as He,ks as Ue,kt as We,ll as Ge,ms as Ke,nd as qe,nl as Je,nt as Ye,ps as Xe,qs as Ze,td as Qe,tt as $e,tu as et,vs as tt,ws as nt,wu as rt,xl as it,xs as at,ya as ot,ys as st,zn as ct,zs as lt}from"./index--3c0awkr.js";import{t as ut}from"./connector-service-page-BAuYTgf5.js";import{t as dt}from"./page-tabs-CfW_Q-K5.js";import{a as ft,c as pt,d as mt,f as ht,g as gt,h as _t,i as vt,l as yt,m as bt,n as xt,o as St,p as Ct,r as wt,s as Tt,u as Et}from"./agent-plugin-dialog-DYFYiuig.js";var Z=e(t(),1),Q=n(),$=r();function Dt(e){let t=(0,Q.c)(57),{connector:n,installed:r,onInstall:i,onOpenDetails:a,t:o}=e,s,c,u,d,p,m;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o){let e=n.capabilities.filter(Ot),h=e.slice(0,2),g=Math.max(0,e.length-h.length),_=o.connect,v;t[11]!==n||t[12]!==o?(v=F(n,o),t[11]=n,t[12]=o,t[13]=v):v=t[13];let y=v,b=n.verificationLevel===`verified`?o.connectorVerified:n.verificationLevel===`beta`?o.connectorBeta:n.verificationLevel===`experimental`?o.connectorExperimental:null,x;t[14]!==_||t[15]!==n||t[16]!==i?(x=e=>(0,$.jsxs)(w,{type:`button`,variant:`primary`,className:f(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:()=>i(n),children:[(0,$.jsx)(it,{className:`size-4`}),_]}),t[14]=_,t[15]=n,t[16]=i,t[17]=x):x=t[17],s=x,m=`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)(Ye,{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 T;t[23]===b?T=t[24]:(T=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]=T);let E;t[25]!==T||t[26]!==C?(E=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[C,T]}),t[25]=T,t[26]=C,t[27]=E):E=t[27];let D;t[28]!==E||t[29]!==S?(D=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[S,E]}),t[28]=E,t[29]=S,t[30]=D):D=t[30];let O;t[31]!==r||t[32]!==s?(O=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]=O):O=t[33];let k;t[34]!==r||t[35]!==o.connectedBadge?(k=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)(l,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}):null,t[34]=r,t[35]=o.connectedBadge,t[36]=k):k=t[36];let A;t[37]!==O||t[38]!==k?(A=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[O,k]}),t[37]=O,t[38]=k,t[39]=A):A=t[39],t[40]!==D||t[41]!==A?(u=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[D,A]}),t[40]=D,t[41]=A,t[42]=u):u=t[42],t[43]===y?d=t[44]:(d=(0,$.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-6 text-fg-muted`,title:y,children:y}),t[43]=y,t[44]=d),p=h.length>0?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[h.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)),g>0?(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-subtle`,children:[`+`,g]}):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]=u,t[8]=d,t[9]=p,t[10]=m}else s=t[5],c=t[6],u=t[7],d=t[8],p=t[9],m=t[10];let h;t[45]!==c||t[46]!==u||t[47]!==d||t[48]!==p?(h=(0,$.jsxs)(`div`,{className:c,children:[u,d,p]}),t[45]=c,t[46]=u,t[47]=d,t[48]=p,t[49]=h):h=t[49];let g;t[50]!==r||t[51]!==s?(g=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]=g):g=t[52];let _;return t[53]!==m||t[54]!==h||t[55]!==g?(_=(0,$.jsxs)(`div`,{className:m,children:[h,g]}),t[53]=m,t[54]=h,t[55]=g,t[56]=_):_=t[56],_}function Ot(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}var kt=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function At(e,t){return t.some(t=>t.connectorId===e.id)}var jt=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function Mt(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:f(`size-10 shrink-0 rounded-xl`,jt)}),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:f(`h-4 min-w-0 flex-1`,jt)}),(0,$.jsx)(`div`,{className:f(`h-8 w-[4.5rem] shrink-0 rounded-lg`,jt)})]}),(0,$.jsx)(`div`,{className:f(`h-3 w-full`,jt)}),(0,$.jsx)(`div`,{className:f(`h-3 w-[88%]`,jt)})]})]})}),e[1]=n):n=e[1],n}var Nt=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function Pt(){let e=(0,Q.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:f(`size-10 shrink-0 rounded-xl`,Nt)}),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:f(`h-4 w-48 max-w-full`,Nt)}),(0,$.jsx)(`div`,{className:f(`h-3 w-72 max-w-full`,Nt)})]}),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:f(`h-9 w-20 rounded-lg`,Nt)}),(0,$.jsx)(`div`,{className:f(`h-9 w-20 rounded-lg`,Nt)})]})]})]}),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:f(`h-8 w-20 rounded-md`,Nt)}),(0,$.jsx)(`div`,{className:f(`h-8 w-24 rounded-md`,Nt)}),(0,$.jsx)(`div`,{className:f(`h-8 w-28 rounded-md`,Nt)})]}),(0,$.jsx)(`div`,{className:f(`mt-3 h-20 rounded-xl`,Nt)})]}),e[3]=i):i=e[3],i}var Ft=[`understand`,`act`,`reach`];function It(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 Lt(e){return It(e)[0]??`act`}function Rt(e,t){let n=t?Lt(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 zt(e,t){return t.connectorCapabilityLabels[e]??e}function Bt(e,t){if(e.runtime.type===`mcp`)return X(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 X(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function Vt(e,t){return e.auth.mode===`cli`?t.connectorAuthCli:e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function Ht(e){let t=(0,Q.c)(9),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`h4`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,12).map(Ut),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,$.jsxs)(`section`,{children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function Ut(e){return(0,$.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,$.jsx)(`p`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function Wt({connector:e,installed:t,onClose:n,onInstall:r,t:i}){let[a,o]=(0,Z.useState)(!1),s=F(e,i),[c,u]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),h=It(e),C=[...(e.setup.secrets??[]).filter(e=>e.required),...(e.setup.config??[]).filter(e=>e.required)],T=e.capabilities.filter(e=>!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)),E=async()=>{o(!0),m(null);try{u(await Ue(e))}catch(e){u(null),m(e instanceof Error?e.message:String(e))}finally{o(!1)}};return(0,$.jsx)(S,{open:!0,onOpenChange:e=>{e||n()},children:(0,$.jsxs)(y,{children:[(0,$.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(b,{className:f(`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`),children:[(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:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(Ye,{connector:e,size:`lg`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(x,{className:`text-base font-semibold text-fg`,children:e.displayName}),t?(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)(l,{className:`size-3`,"aria-hidden":!0}),i.connectedBadge]}):null]}),(0,$.jsx)(_,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:s})]})]}),(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:f(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,Ze.focusRingPanel),"aria-label":i.modalClose,children:(0,$.jsx)(d,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-5 sm:px-6`,children:[h.length?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorWhyConnect}),(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:h.map(e=>(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:i.connectorBenefitHeadings[e]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.connectorBenefitHints[e]})]},e))})]}):null,(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsx)(et,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:i.detailPermissions}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:Vt(e,i)})]})]}),(0,$.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:i.connectorSetupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:C.length?X(i.connectorRequiredInputsCount,{count:String(C.length)}):i.connectorSetupNone})]})]}),(0,$.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-base`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium text-fg-muted hover:text-fg`,children:i.connectorTechnicalDetails}),(0,$.jsxs)(`div`,{className:`space-y-5 border-t border-edge-subtle px-4 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(J,{className:`size-3.5`,"aria-hidden":!0}),i.connectorRuntimeTitle]}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-subtle`,children:Bt(e,i)})]}),T.length?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:T.map(e=>(0,$.jsx)(`span`,{className:`rounded-md bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:zt(e,i)},e))}):null,(0,$.jsxs)(w,{variant:`secondary`,disabled:a,onClick:()=>void E(),children:[a?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(Le,{className:`size-4`}),i.connectorPreviewButton]}),p?(0,$.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:p}):null,c?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(Ht,{title:i.detailTools,items:c.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,$.jsx)(Ht,{title:i.detailResources,items:c.resources.map(e=>({id:e.uri,title:e.title??e.name??e.uri,description:e.description}))}),(0,$.jsx)(Ht,{title:i.detailPrompts,items:c.prompts.map(e=>({id:e.name,title:e.title??e.name,description:e.description}))})]}):null]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(w,{variant:`secondary`,children:i.modalClose})}),t?null:(0,$.jsxs)(w,{variant:`primary`,onClick:()=>{r(e),n()},children:[(0,$.jsx)(it,{className:`size-4`}),i.connect]})]})]})]})})}var Gt=f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,je);function Kt(e){let t=(0,Q.c)(58),{open:n,sessionIdleTtlMinutes:r,saving:i,onChange:a,onSave:o,onClose:s,t:c,mcp:l}=e,u;t[0]===s?u=t[1]:(u=e=>{e||s()},t[0]=s,t[1]=u);let p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=f(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(32rem,calc(100vh-2rem))] w-[min(100%-2rem,38rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-overlay shadow-float dark:border-edge`),t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(Ge,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),t[4]=h):h=t[4];let C;t[5]===c.runtimeSettingsTitle?C=t[6]:(C=(0,$.jsx)(x,{className:`text-base font-semibold text-fg`,children:c.runtimeSettingsTitle}),t[5]=c.runtimeSettingsTitle,t[6]=C);let T;t[7]===c.runtimeSettingsHint?T=t[8]:(T=(0,$.jsx)(_,{className:`mt-1 text-sm text-fg-muted`,children:c.runtimeSettingsHint}),t[7]=c.runtimeSettingsHint,t[8]=T);let E;t[9]!==C||t[10]!==T?(E=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[h,(0,$.jsxs)(`div`,{className:`min-w-0`,children:[C,T]})]}),t[9]=C,t[10]=T,t[11]=E):E=t[11];let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=f(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,Ze.focusRingPanel),t[12]=D):D=t[12];let O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(d,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[13]=O):O=t[13];let k;t[14]===c.modalClose?k=t[15]:(k=(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:D,"aria-label":c.modalClose,children:O})}),t[14]=c.modalClose,t[15]=k);let A;t[16]!==k||t[17]!==E?(A=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[E,k]}),t[16]=k,t[17]=E,t[18]=A):A=t[18];let j;t[19]===l.idleTtlLabel?j=t[20]:(j=(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:l.idleTtlLabel}),t[19]=l.idleTtlLabel,t[20]=j);let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=f(Gt,`w-40 flex-none`),t[21]=M):M=t[21];let N=r??``,P;t[22]===a?P=t[23]:(P=e=>{let t=e.currentTarget.value.trim();a(t===``?void 0:Number.parseInt(t,10))},t[22]=a,t[23]=P);let F;t[24]!==l.idleTtlPlaceholder||t[25]!==N||t[26]!==P?(F=(0,$.jsx)(`input`,{type:`number`,min:0,className:M,value:N,placeholder:l.idleTtlPlaceholder,onChange:P}),t[24]=l.idleTtlPlaceholder,t[25]=N,t[26]=P,t[27]=F):F=t[27];let I;t[28]===l.idleTtlHint?I=t[29]:(I=(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:l.idleTtlHint}),t[28]=l.idleTtlHint,t[29]=I);let L;t[30]!==j||t[31]!==F||t[32]!==I?(L=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,$.jsxs)(`label`,{className:`flex max-w-xl flex-col gap-1.5`,children:[j,F,I]})}),t[30]=j,t[31]=F,t[32]=I,t[33]=L):L=t[33];let R;t[34]!==s||t[35]!==i||t[36]!==c.modalCancel?(R=(0,$.jsx)(w,{type:`button`,variant:`secondary`,disabled:i,onClick:s,children:c.modalCancel}),t[34]=s,t[35]=i,t[36]=c.modalCancel,t[37]=R):R=t[37];let z;t[38]===o?z=t[39]:(z=()=>void o(),t[38]=o,t[39]=z);let B;t[40]===i?B=t[41]:(B=i?(0,$.jsx)(q,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,t[40]=i,t[41]=B);let V;t[42]!==l.save||t[43]!==i||t[44]!==z||t[45]!==B?(V=(0,$.jsxs)(w,{type:`button`,variant:`primary`,disabled:i,onClick:z,children:[B,l.save]}),t[42]=l.save,t[43]=i,t[44]=z,t[45]=B,t[46]=V):V=t[46];let ee;t[47]!==R||t[48]!==V?(ee=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[R,V]}),t[47]=R,t[48]=V,t[49]=ee):ee=t[49];let H;t[50]!==A||t[51]!==L||t[52]!==ee?(H=(0,$.jsxs)(y,{children:[p,(0,$.jsxs)(b,{className:m,children:[A,L,ee]})]}),t[50]=A,t[51]=L,t[52]=ee,t[53]=H):H=t[53];let U;return t[54]!==n||t[55]!==u||t[56]!==H?(U=(0,$.jsx)(S,{open:n,onOpenChange:u,children:H}),t[54]=n,t[55]=u,t[56]=H,t[57]=U):U=t[57],U}var qt=(0,Z.memo)(function(e){let t=(0,Q.c)(12),{value:n,onChange:r,placeholder:i,className:a}=e,o;t[0]===a?o=t[1]:(o=f(`relative flex min-h-11 sm:min-h-9 min-w-0 flex-1 cursor-text items-center rounded-pill border border-edge bg-surface-panel py-1.5 pl-9 pr-3 focus-within:ring-2 focus-within:ring-accent`,a),t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(Y,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=s):s=t[2];let c;t[3]===r?c=t[4]:(c=e=>r(e.currentTarget.value),t[3]=r,t[4]=c);let l;t[5]!==i||t[6]!==c||t[7]!==n?(l=(0,$.jsx)(`input`,{type:`search`,"aria-label":i,enterKeyHint:`search`,value:n,onChange:c,placeholder:i,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-base sm:text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),t[5]=i,t[6]=c,t[7]=n,t[8]=l):l=t[8];let u;return t[9]!==o||t[10]!==l?(u=(0,$.jsxs)(`label`,{className:o,children:[s,l]}),t[9]=o,t[10]=l,t[11]=u):u=t[11],u}),Jt=(0,Z.memo)(function(e){let t=(0,Q.c)(28),{onRefresh:n,refreshing:r,refreshLabel:i,onBrowseCatalog:a,onAddCustomServer:o,addLabel:s,browseLabel:c,customLabel:l}=e,d;t[0]!==n||t[1]!==i||t[2]!==r?(d=n?(0,$.jsx)(ot,{className:`size-9 shrink-0 p-0`,loading:r,label:i,title:i,onClick:n}):null,t[0]=n,t[1]=i,t[2]=r,t[3]=d):d=t[3];let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(ut,{}),t[4]=p):p=t[4];let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(u,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[5]=m):m=t[5];let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(Be,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[6]=h):h=t[6];let g;t[7]===s?g=t[8]:(g=(0,$.jsx)(ct,{asChild:!0,children:(0,$.jsxs)(w,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,children:[m,s,h]})}),t[7]=s,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=f(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,Ze.transition),t[9]=_):_=t[9];let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(ge,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[10]=v):v=t[10];let y;t[11]!==c||t[12]!==a?(y=(0,$.jsxs)(re,{className:_,onSelect:a,children:[v,c]}),t[11]=c,t[12]=a,t[13]=y):y=t[13];let b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=f(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,Ze.transition),t[14]=b):b=t[14];let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(Le,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[15]=x):x=t[15];let S;t[16]!==l||t[17]!==o?(S=(0,$.jsxs)(re,{className:b,onSelect:o,children:[x,l]}),t[16]=l,t[17]=o,t[18]=S):S=t[18];let C;t[19]!==S||t[20]!==y?(C=(0,$.jsx)(ue,{children:(0,$.jsxs)(be,{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:[y,S]})}),t[19]=S,t[20]=y,t[21]=C):C=t[21];let T;t[22]!==C||t[23]!==g?(T=(0,$.jsxs)(W,{children:[g,C]}),t[22]=C,t[23]=g,t[24]=T):T=t[24];let E;return t[25]!==d||t[26]!==T?(E=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[d,p,T]}),t[25]=d,t[26]=T,t[27]=E):E=t[27],E});function Yt(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 Xt({row:e,t,cs:n,onEdit:r,onRemove: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)(null),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),y=Yt(e),b=e.transport===`streamable-http`&&e.auth===`oauth`;(0,Z.useEffect)(()=>{if(!b){g(null);return}let t=!1,n=async()=>{try{let n=await pt(e.id.trim());t||(g(n),n.status===`error`&&n.session?.error&&m(n.session.error),n.status===`connected`&&m(null))}catch(e){t||m(e instanceof Error?e.message:String(e))}};n();let r=window.setInterval(()=>{h?.status===`authorizing`&&n()},1e3);return()=>{t=!0,window.clearInterval(r)}},[h?.status,e.id,b]);let x=(0,Z.useCallback)(async()=>{v(!0),m(null);let n=We();try{let r=await bt(e.id.trim());g(r),r.status===`error`&&r.session?.error&&m(r.session.error),r.status===`connected`&&m(null);let i=r.session?.authorizationUrl;i?await K(i,n)||m(t.oauthOpenFailed):U(n)}catch(e){U(n),m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e.id,t.oauthOpenFailed]),S=(0,Z.useCallback)(async()=>{v(!0),m(null);try{g(await ft(e.id.trim()))}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e.id]),C=(0,Z.useCallback)(async()=>{o(!0),m(null);try{let t=await _t(e.id.trim());f({toolCount:t.toolCount,resourceCount:t.resourceCount,promptCount:t.promptCount})}catch(e){m(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e.id]),T=(0,Z.useCallback)(async()=>{c(!0),m(null);try{await i()}catch(e){m(e instanceof Error?e.message:String(e)),c(!1)}},[i]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`px-4 py-3.5 hover:bg-surface-hover/50`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`block w-full min-w-0 text-left`,onClick:r,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.id.trim()||t.cardUntitled}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:n.customBadge}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:t.transportLabels[e.transport]}),b&&h?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:t.oauthStatus[h.status===`not_configured`?`disconnected`:h.status]}):null]}),y?(0,$.jsx)(`p`,{className:`mt-3 line-clamp-2 break-all font-mono text-xs leading-5 text-fg-subtle`,title:y,children:y}):null,p?(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:p}):null,d?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:X(n.customCapabilitySummary,{tools:String(d.toolCount),resources:String(d.resourceCount),prompts:String(d.promptCount)})}):null]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[b&&h?.status!==`connected`?(0,$.jsxs)(w,{variant:`secondary`,disabled:_,onClick:()=>void x(),children:[_?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(me,{className:`size-4`}),h?.status===`authorizing`?t.oauthOpenAuthorization:t.oauthConnect]}):(0,$.jsxs)(w,{variant:`secondary`,disabled:a,onClick:()=>void C(),children:[a?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(Fe,{className:`size-4`}),t.testConnection]}),b&&h?.status===`connected`?(0,$.jsxs)(w,{variant:`ghost`,disabled:_,onClick:()=>void S(),children:[_?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(B,{className:`size-4`}),t.oauthDisconnect]}):null,(0,$.jsxs)(w,{variant:`ghost`,disabled:s,onClick:()=>u(!0),children:[s?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(te,{className:`size-4`}),t.removeServer]})]})]}),(0,$.jsx)(Ne,{open:l,title:n.removeConfirmTitle.replace(`{{name}}`,e.id.trim()||t.cardUntitled),description:n.removeConfirmDescription,confirmLabel:t.removeServer,cancelLabel:n.modalCancel,destructive:!0,onConfirm:()=>{u(!1),T()},onCancel:()=>{s||u(!1)}})]})}function Zt(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function Qt(e,t,n){let r=t.trim().toLowerCase();if(!r)return!0;let i=e.shortName||Zt(e.name,n);return[e.name,i,e.description].filter(Boolean).join(`
|
|
2
|
-
`).toLowerCase().includes(r)}function $t(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function en(e){let t=(0,Q.c)(29),{tools:n,stripPrefix:r,searchPlaceholder:i,searchEmptyLabel:a}=e,[o,s]=(0,Z.useState)(``),c;if(t[0]!==o||t[1]!==r||t[2]!==n){let e;t[4]!==o||t[5]!==r?(e=e=>Qt(e,o,r),t[4]=o,t[5]=r,t[6]=e):e=t[6],c=n.filter(e),t[0]=o,t[1]=r,t[2]=n,t[3]=c}else c=t[3];let l=c,u;t[7]===o?u=t[8]:(u=o.trim(),t[7]=o,t[8]=u);let d=u.length>0,p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(Y,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=p):p=t[9];let m,h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=f(`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg`,`placeholder:text-fg-subtle`,je),h=e=>s(e.target.value),t[10]=m,t[11]=h):(m=t[10],h=t[11]);let g;t[12]!==o||t[13]!==i?(g=(0,$.jsxs)(`div`,{className:`relative`,children:[p,(0,$.jsx)(`input`,{type:`search`,value:o,placeholder:i,"aria-label":i,className:m,onChange:h})]}),t[12]=o,t[13]=i,t[14]=g):g=t[14];let _;t[15]!==l.length||t[16]!==d||t[17]!==n.length?(_=d?(0,$.jsxs)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:[l.length,` / `,n.length]}):null,t[15]=l.length,t[16]=d,t[17]=n.length,t[18]=_):_=t[18];let v;t[19]!==g||t[20]!==_?(v=(0,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-3`,children:[g,_]}),t[19]=g,t[20]=_,t[21]=v):v=t[21];let y;t[22]!==l||t[23]!==a||t[24]!==r?(y=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:l.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:l.map((e,t)=>{let n=e.shortName||$t(e.name,r)||e.name||`?`,i=e.name||`tool-${t}`;return(0,$.jsxs)(`li`,{className:`min-w-0 rounded-lg border border-edge bg-surface-base px-3 py-2.5`,children:[(0,$.jsx)(`div`,{className:`truncate font-mono text-sm font-medium text-fg`,title:e.name===n?n:e.name,children:n}),e.description?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs leading-relaxed text-fg-muted`,title:e.description,children:e.description}):null]},i)})})}),t[22]=l,t[23]=a,t[24]=r,t[25]=y):y=t[25];let b;return t[26]!==v||t[27]!==y?(b=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[v,y]}),t[26]=v,t[27]=y,t[28]=b):b=t[28],b}function tn(e){let t=(0,Q.c)(38),{open:n,onOpenChange:r,serverId:i,title:a,subtitle:o,searchPlaceholder:s,searchEmptyLabel:c,emptyLabel:l,closeLabel:u,tools:p,stripPrefix:m}=e,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(g,{className:f(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,O)}),t[0]=h):h=t[0];let C;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(C=f(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(88vh,40rem)] w-[min(100%-2rem,min(92vw,36rem))] -translate-x-1/2 -translate-y-1/2 flex-col`,D,`rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none dark:border-edge`),t[1]=C):C=t[1];let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Le,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[2]=T):T=t[2];let E;t[3]===a?E=t[4]:(E=(0,$.jsxs)(x,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[T,a]}),t[3]=a,t[4]=E);let k;t[5]!==i||t[6]!==o||t[7]!==p.length?(k=o.replace(`{{serverId}}`,i).replace(`{{count}}`,String(p.length)),t[5]=i,t[6]=o,t[7]=p.length,t[8]=k):k=t[8];let A;t[9]===k?A=t[10]:(A=(0,$.jsx)(_,{className:`mt-1 text-sm text-fg-muted`,children:k}),t[9]=k,t[10]=A);let j;t[11]!==E||t[12]!==A?(j=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[E,A]}),t[11]=E,t[12]=A,t[13]=j):j=t[13];let M;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),t[14]=M):M=t[14];let N;t[15]===u?N=t[16]:(N=(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(w,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 px-0`,"aria-label":u,children:M})}),t[15]=u,t[16]=N);let P;t[17]!==j||t[18]!==N?(P=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[j,N]}),t[17]=j,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==l||t[21]!==n||t[22]!==c||t[23]!==s||t[24]!==i||t[25]!==m||t[26]!==p?(F=p.length>0?(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,$.jsx)(en,{tools:p,stripPrefix:m,searchPlaceholder:s,searchEmptyLabel:c},`${i}-${n?`open`:`closed`}`)}):(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:l})}),t[20]=l,t[21]=n,t[22]=c,t[23]=s,t[24]=i,t[25]=m,t[26]=p,t[27]=F):F=t[27];let I;t[28]===u?I=t[29]:(I=(0,$.jsx)(`div`,{className:`flex justify-end border-t border-edge px-5 py-3`,children:(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(w,{type:`button`,variant:`secondary`,children:u})})}),t[28]=u,t[29]=I);let L;t[30]!==P||t[31]!==F||t[32]!==I?(L=(0,$.jsxs)(y,{children:[h,(0,$.jsxs)(b,{className:C,children:[P,F,I]})]}),t[30]=P,t[31]=F,t[32]=I,t[33]=L):L=t[33];let R;return t[34]!==r||t[35]!==n||t[36]!==L?(R=(0,$.jsx)(S,{open:n,onOpenChange:r,children:L}),t[34]=r,t[35]=n,t[36]=L,t[37]=R):R=t[37],R}function nn(e){let t=e.connectedAt?Date.parse(e.connectedAt):0;return Number.isFinite(t)?t:0}function rn(e,t){return e.status===`active`&&t.status!==`active`?-1:e.status!==`active`&&t.status===`active`?1:e.isCurrentAuthorization===t.isCurrentAuthorization?nn(t)-nn(e):e.isCurrentAuthorization?-1:1}function an(e){let t=new Map;for(let n of e){let e=n.accountId??n.identityKey??`authorization:${n.id}`;t.set(e,[...t.get(e)??[],n])}return[...t.entries()].map(([e,t])=>{let n=[...t].sort(rn);return{key:e,primary:n[0],authorizations:n}}).sort((e,t)=>rn(e.primary,t.primary))}var on=f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,je);function sn(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function cn(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function ln(e,t,n){return e.status===`connected`?X(n.composioHealthConnected,{count:String(t)}):e.status===`reauthorization_required`?n.composioHealthReconnect:e.status===`disconnected`?n.composioHealthDisconnected:e.errorCode===`missing_credential`?n.composioHealthMissingCredential:e.errorCode===`unauthorized`?n.composioHealthUnauthorized:e.errorCode===`forbidden`?n.composioHealthForbidden:e.errorCode===`network`?n.composioHealthNetwork:e.errorCode===`timeout`?n.composioHealthTimeout:n.composioHealthDegraded}function un(e,t){return e===`active`?t.composioConnectionHealthy:e===`pending`?t.composioConnectionPending:e===`expired`?t.composioConnectionExpired:e===`failed`?t.composioConnectionFailed:e===`revoked`||e===`disabled`?t.composioConnectionRevoked:t.composioConnectionUnknown}function dn(e,t,n){return e.status===`paused`?t?.scanEnabled===!1?n.connectorLearningPausedByPolicy:n.connectorLearningPausedByFailure:e.status===`queued`?n.connectorLearningQueued:e.status===`running`?n.connectorLearningRunning:e.status===`completed`?n.connectorLearningCompleted:n.connectorLearningFailed}function fn({instance:e,t,onChanged:n}){let r=sn(e),i=m(e=>e.language)===`zh`,[a,c]=(0,Z.useState)([]),[u,d]=(0,Z.useState)([]),[p,h]=(0,Z.useState)([]),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)([]),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(null),[T,D]=(0,Z.useState)([]),[O,A]=(0,Z.useState)({}),[j,M]=(0,Z.useState)(`read`),[N,P]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(null),[L,B]=(0,Z.useState)(!1),[ee,U]=(0,Z.useState)(null),[re,ae]=(0,Z.useState)(null),[se,ce]=(0,Z.useState)(!1),[ue,de]=(0,Z.useState)(!1),[pe,me]=(0,Z.useState)(!1),W=(0,Z.useRef)(0),ge=(0,Z.useRef)(0),_e=(0,Z.useMemo)(()=>an(a),[a]),G=(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]),K=(0,Z.useCallback)(async()=>{if(!r||e.materialized.type!==`composio`||e.materialized.role===`credential`)return;P(!0),I(null);let t=++W.current;try{let e=(await Promise.allSettled([G(we()).then(e=>{t===W.current&&(c(e.filter(e=>e.toolkit.toLowerCase()===r.toLowerCase())),ce(!0))}),G(at(r)).then(e=>{t===W.current&&M(e)}),G(Pe(r)).then(e=>{t===W.current&&(_(e.policy),y(e.agents))})])).find(e=>e.status===`rejected`);t===W.current&&e?.status===`rejected`&&I(String(e.reason instanceof Error?e.reason.message:e.reason))}finally{t===W.current&&P(!1)}},[e.materialized,r,G]);(0,Z.useEffect)(()=>(K(),()=>{W.current++}),[K]);let be=(0,Z.useCallback)(async()=>{if(!r)return;let e=++ge.current;me(!0),B(!1);let t=t=>n=>{e===ge.current&&t(n)},n=await Promise.allSettled([G(ne(r)).then(t(d)),G(H(20)).then(t(e=>h(e.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===r.toLowerCase())))),G(V(r)).then(t(C)),G(st(r)).then(t(x))]);e===ge.current&&(B(n.some(e=>e.status===`rejected`)),me(!1))},[r,G]);(0,Z.useEffect)(()=>(ue&&be(),()=>{ge.current++}),[ue,be]),(0,Z.useEffect)(()=>{let e=!1,t=an(a).map(e=>e.primary).filter(e=>e.supportsLearning&&e.accountId);if(t.length)return G(ye()).then(t=>{e||D(t)}).catch(()=>{}),Promise.allSettled(t.map(async e=>[e.accountId,await G(nt(e.accountId))])).then(t=>{e||A(Object.fromEntries(t.flatMap(e=>e.status===`fulfilled`?[e.value]:[])))}),()=>{e=!0}},[a,G]);let xe=(0,Z.useCallback)(async i=>{if(!r)return;let a=k()?null:window.open(`about:blank`,`_blank`);a&&(a.opener=null),P(!0),I(null);try{if(!k()&&!a)throw Error(`Allow popups to open the authorization page.`);let t=await he(e.connectorId,i);if(!t.authorizationUrl)throw Error(`The authorization provider did not return an authorization URL.`);if(k()){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 oe(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?.(),K()])}catch(e){I(Se(e,t))}finally{a?.close(),P(!1)}},[e.connectorId,K,n,t,r]),Ce=(0,Z.useCallback)(async t=>{P(!0),I(null);try{await Te(e.instanceId,{config:{...e.config??{},authConfigId:t||void 0}}),await Promise.all([n?.(),K()])}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}},[e.config,e.instanceId,K,n]),Ee=async e=>{let t=k()?null:window.open(`about:blank`,`_blank`);t&&(t.opener=null),I(null);try{let n=await tt(e.id);if(n.authorizationUrl)if(k())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 K()}catch(e){t?.close(),I(e instanceof Error?e.message:String(e))}},ke=(0,Z.useCallback)(async e=>{if(r){M(e),I(null);try{await ie(r,e)}catch(e){I(e instanceof Error?e.message:String(e)),await K()}}},[K,r]),J=(0,Z.useCallback)(async e=>{if(r){I(null);try{_(await le(r,e))}catch(e){I(e instanceof Error?e.message:String(e))}}},[r]),Ae=(0,Z.useCallback)(e=>{if(!g)return;let t=g.allowedAgentIds.includes(e);t&&g.allowedAgentIds.length===1||J({allowedAgentIds:t?g.allowedAgentIds.filter(t=>t!==e):[...g.allowedAgentIds,e]})},[J,g]),Y=(0,Z.useCallback)(async e=>{P(!0),I(null);try{await e(),await K()}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}},[K]);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 je=_e.filter(e=>e.primary.status===`active`).length,Me=je>0?t.composioAddAccount:t.composioConnectAccount,Fe=se&&je>0,Le=S?.requiresCustomAuthConfig===!0,Re=S?.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:f(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,Fe?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:[Fe?(0,$.jsx)(l,{className:`size-3.5`}):(0,$.jsx)(Qe,{className:`size-3.5`}),Fe?t.connectionReady:se||F?t.connectionNeedsSetup:t.connectionChecking]}),se&&(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:X(t.composioAccountCount,{count:String(_e.length)})})]}),(0,$.jsxs)(w,{variant:`primary`,className:`shrink-0`,disabled:N,onClick:()=>void xe(),children:[N?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(et,{className:`size-4`}),Me]})]}),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)(w,{variant:`secondary`,disabled:N,onClick:()=>void K(),children:t.composioRetry})]}):null,b&&!Fe?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-amber-500/25 bg-amber-500/5 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:ln(b,je,t)}),b.recovery===`none`?null:(0,$.jsx)(w,{variant:`secondary`,disabled:N,onClick:()=>void(b.recovery===`retry`?K():xe()),children:b.recovery===`retry`?t.composioRetry:t.composioReconnectAccount})]}):null,Le&&Re.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:j===`read`?t.composioAccessReadHint:j===`admin`?t.composioAccessAdminHint:t.composioAccessWriteHint})]}),(0,$.jsxs)(o,{value:j,onChange:e=>void ke(e.currentTarget.value),children:[(0,$.jsx)(s,{value:`read`,children:t.composioAccessReadOnly}),(0,$.jsx)(s,{value:`write`,children:t.composioAccessReadWrite}),j===`admin`?(0,$.jsx)(s,{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)(o,{value:g.confirmationPolicy,onChange:e=>void J({confirmationPolicy:e.currentTarget.value}),children:[(0,$.jsx)(s,{value:`writes`,children:t.composioConfirmWrites}),(0,$.jsx)(s,{value:`always`,children:t.composioConfirmAlways}),g.confirmationPolicy===`never`?(0,$.jsx)(s,{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:f(`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 J({allowedAgentIds:[]}),children:t.composioAllowedAgentsAllOption}),v.map(e=>(0,$.jsx)(`button`,{type:`button`,className:f(`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:()=>Ae(e.id),children:e.name},e.id))]})]}),(0,$.jsxs)(`fieldset`,{className:`space-y-2 border-t border-edge-subtle p-4 text-xs text-fg-muted`,children:[(0,$.jsx)(`legend`,{children:i?`可用账号范围`:`Available accounts`}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:g.selectedAccountIds===null,disabled:N,onChange:e=>void J({selectedAccountIds:e.currentTarget.checked?null:[]})}),i?`所有账号(包括以后新增)`:`All accounts, including new ones`]}),g.selectedAccountIds!==null&&_e.map(({primary:e})=>e.accountId&&(0,$.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,disabled:N,checked:g.selectedAccountIds.includes(e.accountId),onChange:t=>void J({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}),se&&(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:X(t.composioAccountCount,{count:String(_e.length)})})]}),(0,$.jsxs)(w,{variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:N,onClick:()=>void K(),children:[(0,$.jsx)(Je,{className:f(`size-3.5`,N&&`animate-spin`)}),t.refresh]})]}),_e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-base`,children:_e.map(e=>{let r=e.primary,a=T.find(e=>r.accountId?e.accountId===r.accountId:e.connectionId===r.id),c=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:f(`mt-1 text-xs`,r.status===`active`?`text-emerald-700 dark:text-emerald-300`:`text-amber-700 dark:text-amber-300`),children:r.accountEnabled===!1?i?`已暂停`:`Paused`:un(r.status,t)}),a?(0,$.jsx)(`p`,{className:f(`mt-1 text-xs`,a.status===`failed`?`text-red-600`:`text-fg-subtle`),children:X(t.connectorLearningStatus,{status:dn(a,c,t),count:String(a.candidatesCreated)})}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[r.status===`pending`&&(0,$.jsx)(w,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,onClick:()=>void Ee(r),children:i?`继续授权`:`Continue authorization`}),r.accountId&&(0,$.jsx)(w,{variant:`ghost`,className:`h-8 px-2.5 text-xs text-danger`,disabled:N,onClick:()=>ae(r.accountId),children:i?`断开`:`Disconnect`}),r.accountId&&r.status!==`active`&&(0,$.jsx)(w,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,disabled:N,onClick:()=>void xe(r.accountId),children:t.composioReconnectAccount}),r.accountId&&(0,$.jsx)(w,{variant:`secondary`,className:`h-8 px-2.5 text-xs`,disabled:N,onClick:()=>void Y(()=>z(r.accountId,{enabled:r.accountEnabled===!1})),children:r.accountEnabled===!1?i?`启用`:`Enable`:i?`暂停`:`Pause`}),r.supportsLearning&&r.status===`active`&&r.accountEnabled!==!1?(0,$.jsxs)(w,{variant:`secondary`,className:`h-8 shrink-0 px-2.5 text-xs`,disabled:N,onClick:()=>void Y(async()=>{if(!r.accountId)throw Error(`Connector account is unavailable.`);await fe(r.accountId),await n?.()}),children:[(0,$.jsx)(Je,{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:N,checked:r.allowedAgentIds==null,onChange:e=>void Y(()=>z(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:N,checked:r.allowedAgentIds.includes(e.id),onChange:t=>{let n=t.currentTarget.checked;Y(()=>z(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&&c?(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:c.scanEnabled,disabled:N,onChange:e=>void Y(()=>Oe(r.accountId,{scanEnabled:e.currentTarget.checked}))}),t.connectorScheduledScan]}),c.scanEnabled?(0,$.jsxs)(`label`,{className:`sm:col-span-2`,children:[t.connectorScanInterval,(0,$.jsxs)(o,{className:`mt-1`,value:String(c.intervalMinutes??30),disabled:N,onChange:e=>void Y(()=>Oe(r.accountId,{intervalMinutes:Number(e.currentTarget.value)})),children:[(0,$.jsxs)(s,{value:`5`,children:[`5 `,t.connectorMinutes]}),(0,$.jsxs)(s,{value:`15`,children:[`15 `,t.connectorMinutes]}),(0,$.jsxs)(s,{value:`30`,children:[`30 `,t.connectorMinutes]}),(0,$.jsxs)(s,{value:`60`,children:[`60 `,t.connectorMinutes]})]})]}):null]}):null,(0,$.jsxs)(`label`,{className:`block`,children:[t.composioAccountAlias,(0,$.jsx)(`input`,{className:f(on,`mt-1 h-8 py-1 text-xs`),defaultValue:r.alias??``,onBlur:e=>{e.currentTarget.value!==(r.alias??``)&&Y(()=>De(r.id,{alias:e.currentTarget.value}))}})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:e.authorizations.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`p`,{className:`min-w-0 break-all font-mono text-fg-subtle`,children:[t.composioAuthorizationId,`: `,e.providerConnectionId]}),(0,$.jsx)(w,{variant:`ghost`,className:`size-7 shrink-0 p-0 text-danger`,title:t.composioRevoke,disabled:N,onClick:()=>U(e.id),children:(0,$.jsx)(te,{className:`size-3.5`})})]},e.id))}),(0,$.jsx)(`div`,{className:`flex justify-end gap-1`,children:(0,$.jsx)(w,{variant:`ghost`,className:`size-8 p-0`,title:t.refresh,disabled:N,onClick:()=>void Y(()=>R(r.id)),children:(0,$.jsx)(Je,{className:`size-4`})})})]})]})]},e.key)})}):N&&!se?(0,$.jsxs)(`div`,{"aria-busy":`true`,"aria-label":t.connectionChecking,className:`space-y-3`,children:[(0,$.jsx)(E,{className:`h-16 w-full`}),(0,$.jsx)(E,{className:`h-16 w-full`})]}):se?(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=>de(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:[pe?(0,$.jsx)(E,{"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)(w,{variant:`ghost`,disabled:pe,onClick:()=>void be(),children:t.composioRetry})]}):null,S?.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:Le?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)(o,{className:`mt-3`,value:typeof e.config?.authConfigId==`string`?e.config.authConfigId:``,disabled:N,onChange:e=>void Ce(e.currentTarget.value),children:[Le?null:(0,$.jsx)(s,{value:``,children:t.composioAuthConfigManaged}),Le&&typeof e.config?.authConfigId!=`string`?(0,$.jsx)(s,{value:``,disabled:!0,children:t.composioAuthConfigSelect}):null,Re.map(e=>(0,$.jsxs)(s,{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:u.length?u.slice(0,8).map(e=>(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.slug}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[cn(e.scope,t),e.curated?``:` ${t.composioUncuratedSuffix}`]})]},e.slug)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioToolsEmpty})})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioRecentTriggers}),(0,$.jsx)(`div`,{className:`space-y-2`,children:p.length?p.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`p`,{className:`truncate text-xs text-fg`,children:e.trigger??e.id}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:new Date(e.at).toLocaleString()})]},`${e.id}-${e.at}`)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioTriggersEmpty})})]})]})]})]}),(0,$.jsx)(Ne,{open:re!==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=re;ae(null),e&&Y(()=>Ie(e))},onCancel:()=>ae(null)}),(0,$.jsx)(Ne,{open:ee!==null,title:t.composioRevoke,description:t.composioRevokeConfirm,confirmLabel:t.composioRevoke,cancelLabel:t.modalCancel,destructive:!0,onConfirm:()=>{let e=ee;U(null),e&&Y(()=>ve(e))},onCancel:()=>U(null)})]})}var pn=f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,je);function mn(e,t){return e?t.healthStatusLabels[e]??e:t.healthNotTested}function hn(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 gn(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 _n(e){let t=(0,Q.c)(12),{title:n,description:r,meta:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,$.jsx)(N,{delayDuration:300,skipDelayDuration:100,children:(0,$.jsxs)(j,{children:[(0,$.jsx)(A,{asChild:!0,children:(0,$.jsx)(`p`,{tabIndex:0,title:r,className:f(`mt-1 line-clamp-3 cursor-help text-xs leading-5 text-fg-muted`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),children:r})}),(0,$.jsx)(M,{children:(0,$.jsx)(P,{side:`top`,align:`start`,sideOffset:6,collisionPadding:12,className:`!z-[10000] max-h-[min(16rem,45vh)] max-w-[min(32rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-5 text-fg shadow-popover`,children:(0,$.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:r})})})]})}):null,t[0]=r,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=(0,$.jsx)(`p`,{className:`min-w-0 break-all font-mono text-xs font-medium leading-5 text-fg`,children:n}),t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=i?(0,$.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] leading-4 text-fg-subtle`,children:i}):null,t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==o||t[10]!==l?(u=(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[l,o]}),t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function vn({instance:e,definition:t,onClose:n,onChanged:r,t:i,mcp:a}){let[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),[u,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(!1),[C,T]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(`health`),[M,N]=(0,Z.useState)(!1),[P,L]=(0,Z.useState)(()=>hn(t,e)),[R,z]=(0,Z.useState)(null),B=t?.setup.config??[],V=(e.materialized.type===`mcp`||e.materialized.type===`memorySource`)&&B.length>0&&(t?.setup.secrets??[]).length===0,ee=O?O.toolCount:e.usage.lastToolCount,H=e.materialized.type===`mcp`,U=e.materialized.type===`composio`,ne=e.materialized.type===`memorySource`,re=t?F(t,i):null,ie=(0,Z.useMemo)(()=>{let t=[[`health`,ae,i.detailHealth],[`tools`,Le,`${i.detailTools} ${O?O.toolCount:e.usage.lastToolCount??``}`],[`resources`,xe,`${i.detailResources} ${O?O.resourceCount:e.usage.lastResourceCount??``}`],[`prompts`,rt,`${i.detailPrompts} ${O?O.promptCount:e.usage.lastPromptCount??``}`],[`permissions`,et,i.detailPermissions]];return V?[...t,[`config`,xe,i.connectorConfigLabel]]:t},[O,e.usage.lastPromptCount,e.usage.lastResourceCount,e.usage.lastToolCount,V,i]),oe=(0,Z.useCallback)(async()=>{s(!0),z(null);try{let t=await lt(e.instanceId);k(t),t.toolCount>0&&j(`tools`),r()}catch(e){z(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e.instanceId,r]),se=(0,Z.useCallback)(async()=>{l(!0),z(null);try{await G(e.instanceId),await r(),n()}catch(e){z(e instanceof Error?e.message:String(e)),l(!1)}},[e.instanceId,r,n]),ce=(0,Z.useCallback)(async()=>{if(!(!t||!V)){h(!0),z(null);try{let n={};for(let e of t.setup.config??[]){let t=gn(e.type,P[e.key]??``);t!==void 0&&(n[e.key]=t)}await Te(e.instanceId,{config:n}),await r(),j(`health`)}catch(e){z(e instanceof Error?e.message:String(e))}finally{h(!1)}}},[P,t,e.instanceId,r,V]),le=(0,Z.useCallback)(async()=>{T(!0),D(null),z(null);try{D((await Ce(e.connectorId)).recordIds.length),await r()}catch(e){z(e instanceof Error?e.message:String(e))}finally{T(!1)}},[e.connectorId,r]);return(0,$.jsxs)(S,{open:!0,onOpenChange:e=>{e||n()},children:[(0,$.jsxs)(y,{children:[(0,$.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(b,{className:f(`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`,U?`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)(Ye,{connector:t,size:`lg`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(x,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,$.jsx)(_,{className:`mt-1 text-sm text-fg-muted`,children:re??(e.materialized.type===`mcp`?X(i.mcpServerRuntime,{serverId:e.materialized.serverId}):X(i.runtimeLabel,{runtime:e.materialized.type}))})]})]}),(0,$.jsx)(v,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:f(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,Ze.focusRingPanel),"aria-label":i.modalClose,children:[(0,$.jsx)(d,{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:[R?(0,$.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:R}):null,H?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ie.map(([e,t,n])=>(0,$.jsxs)(`button`,{type:`button`,className:f(`inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-xs`,A===e?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:text-fg`),onClick:()=>j(e),children:[(0,$.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))}),(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[A===`health`?(0,$.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,$.jsxs)(`p`,{children:[i.statusLabel,` `,(0,$.jsx)(`span`,{className:O?.ok?`font-medium text-emerald-700 dark:text-emerald-300`:`font-medium text-fg`,children:mn(O?.status??e.usage.lastHealthStatus,i)})]}),(0,$.jsxs)(`p`,{children:[i.lastCheckLabel,` `,e.usage.lastHealthCheckAt?new Date(e.usage.lastHealthCheckAt).toLocaleString():i.never]}),O?.action?(0,$.jsx)(`p`,{children:O.action}):null]}):null,A===`tools`?O?.tools.length?(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:X(i.toolsAvailable,{count:String(O.tools.length)})}),(0,$.jsx)(w,{type:`button`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>N(!0),children:a.viewAllTools})]}),(0,$.jsx)(`div`,{className:`grid gap-2`,children:O.tools.slice(0,8).map(e=>(0,$.jsx)(_n,{title:e.shortName??e.name,description:e.description},e.name))})]}):(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`text-fg-muted`,children:ee?X(i.toolsLastCheckSummary,{count:String(ee)}):i.toolsRunTestHint}),(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:o,onClick:()=>void oe(),children:[o?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(Fe,{className:`size-4`}),i.test]})]}):null,A===`resources`?O?.resources.length?(0,$.jsx)(`div`,{className:`grid gap-2`,children:O.resources.slice(0,8).map(e=>(0,$.jsx)(_n,{title:e.title??e.name,description:e.uri,meta:e.mimeType},e.uri))}):(0,$.jsx)(`p`,{className:`text-fg-muted`,children:i.resourcesRunTestHint}):null,A===`prompts`?O?.prompts.length?(0,$.jsx)(`div`,{className:`grid gap-2`,children:O.prompts.slice(0,8).map(e=>(0,$.jsx)(_n,{title:e.title??e.name,description:e.description,meta:e.argumentCount?X(i.promptArgumentCount,{count:String(e.argumentCount)}):void 0},e.name))}):(0,$.jsx)(`p`,{className:`text-fg-muted`,children:i.promptsRunTestHint}):null,A===`permissions`?(0,$.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,$.jsx)(`p`,{children:X(i.secretsConfigured,{count:String(Object.values(e.secretStatus).filter(Boolean).length)})}),(0,$.jsx)(`p`,{children:e.materialized.type===`mcp`?X(i.runtimeServerLabel,{runtime:e.materialized.type.toUpperCase(),serverId:e.materialized.serverId}):X(i.runtimeLabel,{runtime:e.materialized.type.toUpperCase()})}),(0,$.jsx)(`p`,{children:e.materialized.type===`mcp`?i.mcpPolicyHint:i.connectorPolicyHint})]}):null,A===`config`&&V?(0,$.jsx)(`div`,{className:`grid gap-3`,children:B.map(e=>(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,$.jsx)(`input`,{className:pn,value:P[e.key]??``,placeholder:e.placeholder,onChange:t=>L(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]})]}):null,U?(0,$.jsx)(fn,{instance:e,t:i,onChanged:r}):null,ne?(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}),re?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:re}):null,E===null?null:(0,$.jsx)(`p`,{className:`mt-1 text-xs text-emerald-600`,children:X(i.connectedSourceSynced,{count:String(E)})})]}),(0,$.jsxs)(w,{disabled:C,onClick:()=>void le(),children:[C?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(xe,{className:`size-4`}),i.composioSyncNow]})]}),V?(0,$.jsx)(`div`,{className:`grid gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:B.map(e=>(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,$.jsx)(`input`,{className:pn,value:P[e.key]??``,placeholder:e.placeholder,onChange:t=>L(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}):null,!H&&!U&&!ne?(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)(w,{variant:`secondary`,className:`shrink-0 border-danger/30 text-danger hover:bg-danger/10`,disabled:c,onClick:()=>p(!0),children:[c?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(te,{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)(w,{variant:`secondary`,onClick:n,children:i.modalClose}),(H&&A===`config`||ne)&&V?(0,$.jsxs)(w,{variant:`primary`,disabled:m,onClick:()=>void ce(),children:[m?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(I,{className:`size-4`}),i.modalSave]}):null,H?(0,$.jsxs)(w,{variant:`secondary`,disabled:o,onClick:()=>void oe(),children:[o?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(Fe,{className:`size-4`}),i.test]}):null]})]})]}),e.materialized.type===`mcp`?(0,$.jsx)(tn,{open:M,onOpenChange:N,serverId:e.materialized.serverId,title:X(i.installedToolsDialogTitle,{name:e.displayName}),subtitle:i.installedToolsDialogSubtitle,searchPlaceholder:a.toolsDialogSearchPlaceholder,searchEmptyLabel:a.toolsDialogSearchEmpty,emptyLabel:i.toolsRunTestHint,closeLabel:a.toolsDialogClose,tools:O?.tools??[],stripPrefix:`${e.materialized.serverId}__`}):null,(0,$.jsx)(Ne,{open:u,title:X(i.removeConfirmTitle,{name:e.displayName}),description:i.removeConfirmDescription,confirmLabel:i.removeConfirmAction,cancelLabel:i.modalCancel,destructive:!0,onConfirm:()=>{p(!1),se()},onCancel:()=>{c||p(!1)}})]})}function yn(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)($e,{definition:e.definition,instance:e.instance,onClose:e.onClose,onChanged:e.onChanged}):(0,$.jsx)(vn,{...e}),t[0]=e,t[1]=n),n}function bn(e){let t=(0,Q.c)(55),{instance:n,definition:r,highlighted:i,onOpenDetails:a,t:o}=e,s=i===void 0?!1:i,c;t[0]!==r||t[1]!==n?(c=Rt(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let u=c.state,d;t[3]!==r||t[4]!==o?(d=r?F(r,o):null,t[3]=r,t[4]=o,t[5]=d):d=t[5];let p=d,m,h,g,_,v,y,b,x,S;if(t[6]!==u||t[7]!==r||t[8]!==s||t[9]!==n||t[10]!==a||t[11]!==o.connectionChecking||t[12]!==o.connectionNeedsSetup||t[13]!==o.connectionReady){m=u===`ready`?{label:o.connectionReady,Icon:l,className:`text-emerald-700 dark:text-emerald-300`}:u===`needs_setup`?{label:o.connectionNeedsSetup,Icon:Qe,className:`text-amber-700 dark:text-amber-300`}:{label:o.connectionChecking,Icon:Ee,className:`text-fg-muted`},x=`button`;let e=s&&`bg-accent-soft`;t[23]===e?S=t[24]:(S=f(`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)]`,Ze.transition,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,e),t[23]=e,t[24]=S),t[25]!==n||t[26]!==a?(h=()=>a(n),t[25]=n,t[26]=a,t[27]=h):h=t[27],t[28]===r?g=t[29]:(g=(0,$.jsx)(Ye,{connector:r}),t[28]=r,t[29]=g),b=`min-w-0 flex-1`,v=`flex min-w-0 items-center gap-2`,t[30]===n.displayName?y=t[31]:(y=(0,$.jsx)(`h3`,{className:`truncate text-sm font-medium text-fg`,children:n.displayName}),t[30]=n.displayName,t[31]=y),_=f(`inline-flex shrink-0 items-center gap-1 text-xs font-medium`,m.className),t[6]=u,t[7]=r,t[8]=s,t[9]=n,t[10]=a,t[11]=o.connectionChecking,t[12]=o.connectionNeedsSetup,t[13]=o.connectionReady,t[14]=m,t[15]=h,t[16]=g,t[17]=_,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S}else m=t[14],h=t[15],g=t[16],_=t[17],v=t[18],y=t[19],b=t[20],x=t[21],S=t[22];let C;t[32]===m.Icon?C=t[33]:(C=(0,$.jsx)(m.Icon,{className:`size-3.5`,"aria-hidden":!0}),t[32]=m.Icon,t[33]=C);let w;t[34]!==m.label||t[35]!==C||t[36]!==_?(w=(0,$.jsxs)(`span`,{className:_,children:[C,m.label]}),t[34]=m.label,t[35]=C,t[36]=_,t[37]=w):w=t[37];let T;t[38]!==w||t[39]!==v||t[40]!==y?(T=(0,$.jsxs)(`div`,{className:v,children:[y,w]}),t[38]=w,t[39]=v,t[40]=y,t[41]=T):T=t[41];let E;t[42]===p?E=t[43]:(E=p?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:p}):null,t[42]=p,t[43]=E);let D;t[44]!==T||t[45]!==E||t[46]!==b?(D=(0,$.jsxs)(`div`,{className:b,children:[T,E]}),t[44]=T,t[45]=E,t[46]=b,t[47]=D):D=t[47];let O;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(qe,{className:`size-4 shrink-0 text-fg-disabled`,"aria-hidden":!0}),t[48]=O):O=t[48];let k;return t[49]!==h||t[50]!==g||t[51]!==D||t[52]!==x||t[53]!==S?(k=(0,$.jsxs)(`button`,{type:x,className:S,onClick:h,children:[g,D,O]}),t[49]=h,t[50]=g,t[51]=D,t[52]=x,t[53]=S,t[54]=k):k=t[54],k}function xn(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 St(r)}function Sn(e,t,n){let r=e.key.trim();if(r)return`key:${r}`;let i=e.value.trim();return i?`value:${i}`:`empty:${n.slice(0,t).filter(e=>!e.key.trim()&&!e.value.trim()).length}`}function Cn(){return f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,je)}function wn({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:i,pasteFailed:a,keyPlaceholder:o,valuePlaceholder:s,headers:c,onChange:l}){let u=(e,t)=>{l(c.map((n,r)=>r===e?{...n,...t}:n))},d=()=>{l([...c,{key:``,value:``}])},p=e=>{let t=c.filter((t,n)=>n!==e);l(t.length>0?t:[{key:``,value:``}])},m=async()=>{try{let e=await C();if(!e){window.alert(a);return}let t=gt(e);if(!t?.length){window.alert(a);return}l(t)}catch{window.alert(a)}};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)(w,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void m(),children:[(0,$.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),i]})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:c.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{className:f(Cn(),`min-w-0 flex-1 font-mono text-xs`),value:e.key,placeholder:o,onChange:e=>u(t,{key:e.target.value})}),(0,$.jsx)(`input`,{className:f(Cn(),`min-w-0 flex-[1.4] font-mono text-xs`),value:e.value,placeholder:s,onChange:e=>u(t,{value:e.target.value})}),(0,$.jsx)(w,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:c.length<=1&&!e.key&&!e.value,onClick:()=>p(t),"aria-label":r,children:(0,$.jsx)(te,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})})]},Sn(e,t,c)))}),(0,$.jsxs)(`button`,{type:`button`,className:f(`self-start text-sm text-accent hover:underline`,Ze.press),onClick:d,children:[`+ `,n]})]})}var Tn=[`stdio`,`sse`,`streamable-http`],En=[`none`,`oauth`];function Dn(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)(`div`,{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 On(){return f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,je)}function kn(e){let t=(0,Q.c)(37),{row:n,t:r,onUpdate:i,idConflictMessage:a,variant:c}=e,l=c===void 0?`all`:c,u=l===`all`||l===`basic`,d=l===`all`||l===`advanced`,p;t[0]!==a||t[1]!==i||t[2]!==n.id||t[3]!==n.transport||t[4]!==u||t[5]!==r?(p=u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Dn,{label:r.transportLabel,required:!0,children:(0,$.jsx)(o,{className:On(),value:n.transport,onChange:e=>i({transport:e.target.value}),children:Tn.map(e=>(0,$.jsx)(s,{value:e,children:r.transportLabels[e]},e))})}),(0,$.jsxs)(Dn,{label:r.serverIdLabel,required:!0,children:[(0,$.jsx)(`input`,{className:On(),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[0]=a,t[1]=i,t[2]=n.id,t[3]=n.transport,t[4]=u,t[5]=r,t[6]=p):p=t[6];let m;t[7]!==i||t[8]!==n.argsText||t[9]!==n.auth||t[10]!==n.command||t[11]!==n.cwd||t[12]!==n.envJson||t[13]!==n.headers||t[14]!==n.oauthClientId||t[15]!==n.transport||t[16]!==n.url||t[17]!==d||t[18]!==u||t[19]!==r||t[20]!==l?(m=n.transport===`stdio`?(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsx)(`div`,{className:l===`basic`?`md:col-span-2`:void 0,children:(0,$.jsx)(Dn,{label:r.commandLabel,required:!0,children:(0,$.jsx)(`input`,{className:On(),value:n.command,onChange:e=>i({command:e.target.value})})})}):null,d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Dn,{label:r.argsLabel,description:r.argsHint,children:(0,$.jsx)(`input`,{className:On(),value:n.argsText,onChange:e=>i({argsText:e.target.value})})}),(0,$.jsx)(Dn,{label:r.cwdLabel,children:(0,$.jsx)(`input`,{className:On(),value:n.cwd,onChange:e=>i({cwd:e.target.value})})}),(0,$.jsx)(Dn,{label:r.envLabel,description:r.envHint,children:(0,$.jsx)(`textarea`,{className:f(On(),`min-h-[4rem] font-mono text-xs`),value:n.envJson,onChange:e=>i({envJson:e.target.value})})})]}):null]}):(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsx)(`div`,{className:`md:col-span-2`,children:(0,$.jsx)(Dn,{label:r.urlLabel,required:!0,children:(0,$.jsx)(`input`,{className:f(On(),`font-mono text-xs`),value:n.url,placeholder:`https://example.com/mcp`,onChange:e=>i({url:e.target.value})})})}):null,u&&n.transport===`streamable-http`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Dn,{label:r.authLabel,description:r.authHint,children:(0,$.jsx)(o,{className:On(),value:n.auth,onChange:e=>{let t=e.target.value;i({auth:t,headers:t===`oauth`?n.headers.filter(jn):n.headers})},children:En.map(e=>(0,$.jsx)(s,{value:e,children:r.authLabels[e]},e))})}),n.auth===`oauth`?(0,$.jsx)(Dn,{label:r.oauthClientIdLabel,description:r.oauthClientIdHint,children:(0,$.jsx)(`input`,{className:f(On(),`font-mono text-xs`),value:n.oauthClientId,placeholder:r.oauthClientIdPlaceholder,onChange:e=>i({oauthClientId:e.target.value})})}):null]}):null,d?(0,$.jsx)(wn,{label:r.headersLabel,optionalLabel:r.optionalSuffix,addLabel:r.addHeader,removeHeaderAria:r.removeHeader,pasteLabel:r.pasteHeaders,pasteFailed:r.pasteHeadersFailed,keyPlaceholder:r.headerKeyPlaceholder,valuePlaceholder:r.headerValuePlaceholder,headers:n.headers,onChange:e=>i({headers:n.auth===`oauth`?e.filter(An):e})}):null]}),t[7]=i,t[8]=n.argsText,t[9]=n.auth,t[10]=n.command,t[11]=n.cwd,t[12]=n.envJson,t[13]=n.headers,t[14]=n.oauthClientId,t[15]=n.transport,t[16]=n.url,t[17]=d,t[18]=u,t[19]=r,t[20]=l,t[21]=m):m=t[21];let h;t[22]!==i||t[23]!==n||t[24]!==d||t[25]!==r?(h=d?(0,$.jsx)(Dn,{label:r.timeoutLabel,description:r.timeoutHint,children:(0,$.jsx)(`input`,{type:`number`,min:1,max:600,className:On(),value:vt(n),placeholder:r.timeoutPlaceholder,onChange:e=>i({connectionTimeoutMs:Et(e.target.value)})})}):null,t[22]=i,t[23]=n,t[24]=d,t[25]=r,t[26]=h):h=t[26];let g;t[27]!==i||t[28]!==n||t[29]!==d||t[30]!==r?(g=d?(0,$.jsx)(Dn,{label:r.requestTimeoutLabel,description:r.requestTimeoutHint,children:(0,$.jsx)(`input`,{type:`number`,min:1,max:14400,className:On(),value:Ct(n),placeholder:r.requestTimeoutPlaceholder,onChange:e=>i({requestTimeoutMs:mt(e.target.value)})})}):null,t[27]=i,t[28]=n,t[29]=d,t[30]=r,t[31]=g):g=t[31];let _;return t[32]!==p||t[33]!==m||t[34]!==h||t[35]!==g?(_=(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[p,m,h,g]}),t[32]=p,t[33]=m,t[34]=h,t[35]=g,t[36]=_):_=t[36],_}function An(e){return e.key.trim().toLowerCase()!==`authorization`}function jn(e){return e.key.trim().toLowerCase()!==`authorization`}function Mn(e,t){if(e.shortName)return e.shortName;let n=`${t.trim()}__`;return n&&e.name.startsWith(n)?e.name.slice(n.length):e.name}function Nn(e){let t=(0,Q.c)(13),{tool:n,serverId:r}=e,i;t[0]!==r||t[1]!==n?(i=Mn(n,r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o=n.name===a?a:n.name,s;t[3]===n.description?s=t[4]:(s=n.description?.trim(),t[3]=n.description,t[4]=s);let c=s,l;t[5]!==a||t[6]!==o?(l=(0,$.jsx)(`p`,{className:`break-all font-mono text-xs font-medium leading-5 text-fg`,title:o,children:a}),t[5]=a,t[6]=o,t[7]=l):l=t[7];let u;t[8]===c?u=t[9]:(u=c?(0,$.jsx)(N,{delayDuration:300,skipDelayDuration:100,children:(0,$.jsxs)(j,{children:[(0,$.jsx)(A,{asChild:!0,children:(0,$.jsx)(`p`,{tabIndex:0,title:c,className:f(`mt-1 line-clamp-3 cursor-help text-xs leading-5 text-fg-muted`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),children:c})}),(0,$.jsx)(M,{children:(0,$.jsx)(P,{side:`top`,align:`start`,sideOffset:6,collisionPadding:12,className:`!z-[10000] max-h-[min(16rem,45vh)] max-w-[min(32rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-5 text-fg shadow-popover`,children:(0,$.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:c})})})]})}):null,t[8]=c,t[9]=u);let d;return t[10]!==l||t[11]!==u?(d=(0,$.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[l,u]}),t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function Pn({open:e,mode:t,initialRow:n,existingCustomServers:r,sessionIdleTtlMinutes:i,config:a,managedServerIds:o,t:s,cs:c,onClose:u,onSaved:p}){let[m,h]=(0,Z.useState)(n),[C,T]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(!1),[M,N]=(0,Z.useState)({status:`idle`}),[P,F]=(0,Z.useState)(null),I=n.id.trim(),L=m.id.trim()!==I&&o.has(m.id.trim())||o.has(m.id.trim())&&t===`add`?s.reservedServerId:void 0,R=m.id.trim()&&r.some(e=>e.clientKey!==n.clientKey&&e.id.trim()===m.id.trim())?c.duplicateServerId:void 0,z=m.id.trim().length>0&&!L&&!R&&(m.transport===`stdio`?m.command.trim().length>0:m.url.trim().length>0),B=!(m.transport===`streamable-http`&&m.auth===`oauth`),V=Yt(m),ee=(0,Z.useCallback)(async()=>{if(m.id.trim()){D(!0),k(null),N({status:`loading`});try{N({status:`ok`,tools:(await _t(m.id.trim(),wt(m))).tools})}catch(e){N({status:`error`,message:e instanceof Error?e.message:String(e)})}finally{D(!1)}}},[m]),H=(0,Z.useCallback)(async()=>{if(!(!z||C)){T(!0),k(null);try{let e=r.filter(e=>!(t===`edit`&&e.clientKey===n.clientKey));e.push(m),await ht({sessionIdleTtlMinutes:i,servers:e.sort((e,t)=>e.id.localeCompare(t.id))},Tt(a)),await p(),u()}catch(e){k(e instanceof Error?e.message:String(e))}finally{T(!1)}}},[z,a,r,n.clientKey,t,u,p,I,m,C,i]);return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S,{open:e,onOpenChange:e=>{e||u()},children:(0,$.jsxs)(y,{children:[(0,$.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(b,{className:f(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-overlay shadow-float 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:`min-w-0`,children:[(0,$.jsx)(x,{className:`text-base font-semibold text-fg`,children:t===`add`?c.addCustomServerTitle:c.editCustomServerTitle}),(0,$.jsx)(_,{className:`mt-1 text-sm text-fg-muted`,children:t===`add`?c.addCustomServerHint:c.editCustomServerHint})]}),(0,$.jsx)(v,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:f(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,Ze.focusRingPanel),"aria-label":c.modalClose,children:[(0,$.jsx)(d,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`sr-only`,children:c.modalClose})]})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(J,{className:`size-4 text-accent`,"aria-hidden":!0}),m.id.trim()||s.cardUntitled]}),(0,$.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs leading-5 text-fg-muted`,children:V||(m.transport===`stdio`?s.commandLabel:s.urlLabel)})]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:s.transportLabels[m.transport]})]})}),(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`mb-3`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c.connectorBasicConfigTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:c.connectorBasicConfigHint})]}),(0,$.jsx)(kn,{row:m,t:s,variant:`basic`,onUpdate:e=>{h(t=>({...t,...e})),k(null)},idConflictMessage:L??R})]}),M.status===`ok`?(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(Le,{className:`size-4 text-accent`,"aria-hidden":!0}),M.tools.length===0?s.toolsEmpty:s.toolsTitle.replace(`{{count}}`,String(M.tools.length))]}),M.tools.length>0?(0,$.jsx)(w,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:()=>F(M.tools),children:s.viewAllTools}):null]}),M.tools.length>0?(0,$.jsx)(`div`,{className:`mt-3 grid gap-2`,children:M.tools.slice(0,6).map((e,t)=>(0,$.jsx)(Nn,{tool:e,serverId:m.id},e.name||`tool-${t}`))}):null]}):null,M.status===`error`?(0,$.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:M.message}):null,O?(0,$.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:O}):null,(0,$.jsxs)(`details`,{open:A,onToggle:e=>j(e.currentTarget.open),className:`group rounded-xl border border-edge bg-surface-base`,children:[(0,$.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg hover:text-fg [&::-webkit-details-marker]:hidden`,children:[(0,$.jsx)(Be,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`group-open:hidden`,children:c.connectorShowAdvancedConfig}),(0,$.jsx)(`span`,{className:`hidden group-open:inline`,children:c.connectorHideAdvancedConfig})]}),(0,$.jsx)(`div`,{className:`border-t border-edge p-4`,children:(0,$.jsx)(kn,{row:m,t:s,variant:`advanced`,onUpdate:e=>{h(t=>({...t,...e})),k(null)}})})]})]})}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,$.jsxs)(w,{variant:`secondary`,disabled:!m.id.trim()||E||!B,title:B?void 0:s.oauthSaveBeforeTest,onClick:()=>void ee(),children:[E?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(Fe,{className:`size-4`}),s.testConnection]}),(0,$.jsx)(v,{asChild:!0,children:(0,$.jsx)(w,{variant:`secondary`,children:c.modalCancel})}),(0,$.jsxs)(w,{variant:`primary`,disabled:!z||C,onClick:()=>void H(),children:[C?(0,$.jsx)(q,{className:`size-4 animate-spin`}):(0,$.jsx)(l,{className:`size-4`}),C?s.saving:c.modalSave]})]})]})]})}),P?(0,$.jsx)(tn,{open:!0,onOpenChange:e=>{e||F(null)},serverId:m.id,title:s.toolsDialogTitle,subtitle:s.toolsDialogSubtitle,searchPlaceholder:s.toolsDialogSearchPlaceholder,searchEmptyLabel:s.toolsDialogSearchEmpty,emptyLabel:s.toolsEmpty,closeLabel:s.toolsDialogClose,tools:P,stripPrefix:`${m.id.trim()}__`}):null]}):null}var Fn=`builtin`,In=`composio`,Ln=`xopc-store`;function Rn(e){return Fn}function zn(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`,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 Bn(e){return e.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t)}function Vn(e){return e?.startsWith(`/`)&&!e.startsWith(`//`)?e:`/user-model`}function Hn(){let e=ee().filter(e=>e.format===`agent-plugin`),t=h(m(e=>e.language)),n=t.connectorsSettings,r=t.mcpSettings,o=p(e=>e.conversationId),s=!!o,l=i(),[u,d]=a(),g=u.get(`understanding`)===`1`,_=Vn(u.get(`returnTo`)),v=u.get(`tab`),[y,b]=(0,Z.useState)(!g&&v===`connected`?`connected`:`discover`),x=(0,Z.useRef)(!1),[S,C]=(0,Z.useState)({catalog:[],registryCatalog:[],instances:[],loading:!0,error:null}),[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(1),[M,N]=(0,Z.useState)(void 0),[P,F]=(0,Z.useState)(``),[I,R]=(0,Z.useState)(g?u.get(`connector`)??``:``),[z,B]=(0,Z.useState)(Rn(g?`understanding`:`default`)),[V,H]=(0,Z.useState)(`name`),[U,te]=(0,Z.useState)(g?`understand`:`all`),[ne,re]=(0,Z.useState)(null),[ie,ae]=(0,Z.useState)(null),[oe,se]=(0,Z.useState)(null),[le,ue]=(0,Z.useState)(null),[fe,me]=(0,Z.useState)(null),[W,he]=(0,Z.useState)(null),[ge,G]=(0,Z.useState)(!1),[ve,ye]=(0,Z.useState)(void 0),[K,be]=(0,Z.useState)(!1),{data:xe,mutate:Se}=T(s),Ce=xe?.payload?.config,we=(0,Z.useMemo)(()=>Ce===void 0?null:yt(Ce),[Ce]),Te=we?.servers??[],Ee=S.instances.length+Te.length+e.reduce((e,t)=>e+(t.components?.mcp.length??0),0);(0,Z.useEffect)(()=>{we&&ye(we.sessionIdleTtlMinutes)},[we]);let De=(0,Z.useCallback)(async()=>{if(!o){C({catalog:[],registryCatalog:[],instances:[],loading:!1,error:null});return}C(e=>({...e,loading:!0,error:null}));try{let[e,t]=await Promise.all([Ke(),ze()]);C(n=>({catalog:e,registryCatalog:n.registryCatalog,instances:t,loading:!1,error:null}))}catch(e){C({catalog:[],registryCatalog:[],instances:[],loading:!1,error:e instanceof Error?e.message:String(e)})}},[o]);(0,Z.useEffect)(()=>{De()},[De]),(0,Z.useEffect)(()=>{x.current||S.loading||s&&!we||(b(g?`discover`:Ee>0?`connected`:`discover`),x.current=!0)},[s,Ee,we,g,S.loading]);let Oe=(0,Z.useCallback)(e=>{x.current=!0,b(e)},[]),J=(0,Z.useMemo)(()=>[{id:In,displayName:n.composioSourceName},{id:Ln,displayName:n.storeSourceName}],[n.composioSourceName,n.storeSourceName]),Y=(0,Z.useCallback)(async e=>{if(!s||z===`builtin`){C(e=>({...e,registryCatalog:[]})),j(1),N(void 0);return}let t=I.trim(),n=Math.max(e?.page??1,1),r=e?.append??!1,i=z===`all`?J:J.filter(e=>e.id===z);if(i.length!==0){D(!0),r?C(e=>({...e,error:null})):(j(1),N(void 0),C(e=>({...e,registryCatalog:[],error:null})));try{let e=await Promise.all(i.map(async e=>{if(e.id===`composio`){let e=await Xe({q:t||void 0,page:n,pageSize:24,verification:`experimental`});return{connectors:e.connectors,totalPages:e.meta.totalPages}}let r=await Re({q:t||void 0,page:n,pageSize:24,sort:V===`source`?`newest`:`downloads`});return{connectors:r.items.flatMap(e=>{let t=zn(e);return t?[t]:[]}),totalPages:r.meta.totalPages}})),a=Bn(e.flatMap(e=>e.connectors)),o=Math.max(1,...e.map(e=>e.totalPages??1));j(n),N(o),C(e=>({...e,registryCatalog:r?Bn([...e.registryCatalog,...a]):a}))}catch(e){C(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{D(!1)}}},[V,I,z,s,J]);(0,Z.useEffect)(()=>{if(y!==`discover`||S.loading)return;if(z===`builtin`){C(e=>({...e,registryCatalog:[]})),j(1),N(void 0);return}let e=window.setTimeout(()=>{Y()},I.trim()?350:0);return()=>window.clearTimeout(e)},[I,z,Y,S.loading,y]);let je=(0,Z.useMemo)(()=>new Set(S.instances.map(e=>e.connectorId)),[S.instances]),Ne=(0,Z.useMemo)(()=>new Map([...S.catalog,...S.registryCatalog].map(e=>[e.id,e])),[S.catalog,S.registryCatalog]);(0,Z.useEffect)(()=>{if(S.loading)return;let e=u.get(`connector`),t=u.get(`instance`);if(!e&&!t)return;let n=S.instances.find(n=>t?n.instanceId===t:n.connectorId===e);if(n)x.current=!0,F(``),se(n.instanceId),ue(n),b(`connected`);else if(e){let t=Ne.get(e);if(!t)return;x.current=!0,B(Rn(g?`understanding`:`default`)),R(``),ae(t),b(`discover`)}let r=new URLSearchParams(u);r.delete(`connector`),r.delete(`instance`),r.set(`tab`,n?`connected`:`discover`),d(r,{replace:!0})},[Ne,g,u,d,S.instances,S.loading]);let Pe=(0,Z.useCallback)(async e=>{k(!0),C(e=>({...e,error:null}));try{let t=await Me(e);re(ke(t.definition,{packageName:t.packageName,version:t.version,permissions:t.permissions}))}catch(e){C(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{k(!1)}},[]),Fe=(0,Z.useMemo)(()=>new Set(S.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[S.instances]),X=(0,Z.useCallback)(async e=>{if(!we||Ce===void 0)return;let t=Te.filter(t=>t.clientKey!==e.clientKey);await ht({sessionIdleTtlMinutes:we.sessionIdleTtlMinutes,servers:t},Tt(Ce)),await Se(),await De()},[Ce,Te,De,we,Se]),Ie=(0,Z.useCallback)(()=>{he({mode:`add`,row:xn(Te,Fe)})},[Te,Fe]),Le=(0,Z.useCallback)(async()=>{if(!(!we||Ce===void 0||K)){be(!0);try{await ht({sessionIdleTtlMinutes:ve,servers:Te},Tt(Ce)),await Se(),G(!1)}finally{be(!1)}}},[Ce,Te,r.saved,we,Se,ve,K]),Be=de(e=>e.setPageHeader),Ue=de(e=>e.clearPageHeader),We=(0,Z.useMemo)(()=>(0,$.jsx)(Jt,{onRefresh:y===`connected`&&s?De:void 0,refreshing:S.loading,refreshLabel:n.refreshConnections,onBrowseCatalog:()=>Oe(`discover`),onAddCustomServer:Ie,addLabel:n.addConnection,browseLabel:n.addFromCatalog,customLabel:n.addCustomServerAdvanced}),[n,s,De,Ie,Oe,S.loading,y]);(0,Z.useLayoutEffect)(()=>(Be({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:n.title})}),end:We}),()=>Ue()),[Ue,n.title,We,Be]);let Ge=(0,Z.useMemo)(()=>S.instances.map(e=>({instance:e,value:Rt(e,Ne.get(e.connectorId))})),[Ne,S.instances]),qe=(0,Z.useMemo)(()=>new Map(Ge.map(({instance:e,value:t})=>[e.instanceId,t])),[Ge]),Je=(0,Z.useMemo)(()=>S.instances.filter(e=>Ve(e,P)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=qe.get(e.instanceId)?.state??`checking`,i=qe.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[P,qe,S.instances]),Ye=(0,Z.useMemo)(()=>Je.filter(e=>qe.get(e.instanceId)?.state===`needs_setup`),[qe,Je]),Ze=(0,Z.useMemo)(()=>Je.filter(e=>qe.get(e.instanceId)?.state!==`needs_setup`),[qe,Je]),Qe=(0,Z.useMemo)(()=>Te.filter(e=>He(e,P)),[P,Te]),$e=(0,Z.useMemo)(()=>{let t=P.trim().toLowerCase();return e.flatMap(e=>(e.components?.mcp??[]).filter(n=>`${e.name} ${n.name}`.toLowerCase().includes(t)).map(t=>({extension:e,server:t})))},[P,e]),et=Je.length+Qe.length+$e.length,tt=(0,Z.useMemo)(()=>S.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1&&_e(e)),[S.catalog]),nt=(0,Z.useMemo)(()=>z===`builtin`?tt:z===`all`?Bn([...tt,...S.registryCatalog]):S.registryCatalog,[tt,z,S.registryCatalog]),rt=(0,Z.useMemo)(()=>{let e=g?nt.filter(e=>e.understanding?.mode===`activity`):nt;return L(U===`all`?e:e.filter(e=>It(e).includes(U)),I,V)},[V,I,nt,g,U]),it=(0,Z.useMemo)(()=>Ft.filter(e=>nt.some(t=>It(t).includes(e))),[nt]);(0,Z.useEffect)(()=>{U!==`all`&&!it.includes(U)&&te(`all`)},[it,U]);let at=y===`discover`&&z!==`builtin`&&!!(M&&A<M),ot=(0,Z.useMemo)(()=>S.instances.find(e=>e.instanceId===oe)??le,[oe,le,S.instances]),st=(0,Z.useMemo)(()=>[{value:`all`,label:n.discoverSourceAll},{value:Fn,label:n.discoverSourceBuiltin},...J.map(e=>({value:e.id,label:e.displayName}))],[n.discoverSourceAll,n.discoverSourceBuiltin,J]),ct=[{id:`connected`,label:n.tabConnected,count:Ee},{id:`discover`,label:n.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:`mx-auto flex w-full max-w-7xl flex-col gap-6 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[s?null:(0,$.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel px-4 py-3 text-sm text-fg-muted`,children:n.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:n.understandingSetupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.understandingSetupHint})]}),(0,$.jsx)(w,{type:`button`,variant:`secondary`,className:`shrink-0`,onClick:()=>l(_),children:n.understandingSetupDone})]}):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)(dt,{items:ct,activeTab:y,onChange:Oe,ariaLabel:n.navAria,tabIdPrefix:`connectors-tab`,panelIdPrefix:`connectors-panel`,className:`flex-wrap`})}),S.error?(0,$.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:S.error}):null,y===`connected`&&s?(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[Ee>5||P?(0,$.jsx)(qt,{value:P,onChange:F,placeholder:n.connectedSearchPlaceholder,className:`max-w-xl`}):null,S.loading?(0,$.jsx)(`div`,{className:`grid gap-3`,"aria-busy":`true`,"aria-label":n.loading,children:kt.slice(0,3).map(e=>(0,$.jsx)(Pt,{},e))}):Ee===0?(0,$.jsxs)(`div`,{className:`py-14 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.connectionsEmpty}),(0,$.jsx)(w,{type:`button`,variant:`primary`,className:`mt-4`,onClick:()=>Oe(`discover`),children:n.addFromCatalog})]}):et===0?(0,$.jsx)(`div`,{className:`py-14 text-center text-sm text-fg-muted`,children:n.connectionsSearchEmpty}):(0,$.jsxs)(`div`,{className:`space-y-6`,children:[Ye.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:n.needsAttentionTitle}),(0,$.jsx)(`span`,{className:`text-xs tabular-nums text-amber-700 dark:text-amber-300`,children:Ye.length})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-amber-500/25 bg-amber-500/5`,children:Ye.map(e=>(0,$.jsx)(bn,{instance:e,definition:Ne.get(e.connectorId),highlighted:e.instanceId===fe,onOpenDetails:e=>{me(null),se(e.instanceId),ue(e)},t:n},e.instanceId))})]}):null,Ze.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:Ze.map(e=>(0,$.jsx)(bn,{instance:e,definition:Ne.get(e.connectorId),highlighted:e.instanceId===fe,onOpenDetails:e=>{me(null),se(e.instanceId),ue(e)},t:n},e.instanceId))})}):null,$e.map(({extension:e,server:t})=>(0,$.jsx)(xt,{pluginId:e.pluginId,server:t,enabled:e.active},t.id)),Qe.length||!P.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:n.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:n.customIntegrationsHint})]}),(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2 px-4 py-3`,children:[(0,$.jsx)(w,{type:`button`,variant:`secondary`,className:`h-8 text-xs`,onClick:Ie,children:n.addCustomServerAdvanced}),(0,$.jsxs)(w,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:()=>G(!0),children:[(0,$.jsx)(pe,{className:`size-3.5`}),n.runtimeSettings]})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Qe.map(e=>(0,$.jsx)(Xt,{row:e,t:r,cs:n,onEdit:()=>he({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>X(e)},e.clientKey))})]})]}):null]})]}):null,y===`discover`&&s?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[g?null:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":n.taskFilterAria,children:[`all`,...it].map(e=>(0,$.jsx)(`button`,{type:`button`,className:f(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,U===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":U===e,onClick:()=>te(e),children:e===`all`?n.taskAll:n.connectorBenefitHeadings[e]},e))}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,$.jsx)(qt,{value:I,onChange:R,placeholder:n.discoverSearchPlaceholder,className:`max-w-xl`}),(0,$.jsxs)(`details`,{className:`relative shrink-0 lg:ml-auto`,children:[(0,$.jsxs)(`summary`,{className:`flex h-9 cursor-pointer list-none items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,children:[(0,$.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),n.filters]}),(0,$.jsxs)(`div`,{className:f(`mt-2 grid min-w-[15rem] grid-cols-1 gap-2 rounded-xl border border-edge bg-surface-panel p-3 shadow-popover sm:absolute sm:right-0 sm:z-10`,!g&&`sm:min-w-[24rem] sm:grid-cols-2`),children:[g?null:(0,$.jsx)(c,{value:z,options:st,placeholder:n.discoverSourceAll,allowEmpty:!1,ariaLabel:n.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:B}),(0,$.jsx)(c,{value:V,options:[{value:`name`,label:n.sortName},{value:`source`,label:n.sortSource}],placeholder:n.sortName,allowEmpty:!1,ariaLabel:n.sortAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:e=>H(e)})]})]})]}),(S.loading||E)&&rt.length===0?(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":n.loading,children:kt.map(e=>(0,$.jsx)(Mt,{},e))}):rt.length===0?(0,$.jsx)(`div`,{className:`py-14 text-center text-sm text-fg-muted`,children:n.discoverEmpty}):(0,$.jsxs)(`div`,{className:`relative`,children:[E?(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":n.loading,children:(0,$.jsx)(q,{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:rt.map(e=>(0,$.jsx)(Dt,{connector:e,installed:je.has(e.id)||At(e,S.instances),onInstall:e=>{if(e.source===`store`){Pe(e.id);return}re(ke(e))},onOpenDetails:e.source===`store`?void 0:ae,t:n},e.id))}),at?(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:E||O,onClick:()=>void Y({page:A+1,append:!0}),children:[E?(0,$.jsx)(q,{className:`size-4 animate-spin`}):null,n.loadMore]})}):null]})]}):null]}),ne?(0,$.jsx)(Ae,{draft:ne,onChange:re,onClose:()=>re(null),t:n,onInstalled:async e=>{await De(),await Se(),me(e.instanceId),Oe(`connected`)}}):null,ie?(0,$.jsx)(Wt,{connector:ie,installed:je.has(ie.id)||At(ie,S.instances),onClose:()=>ae(null),onInstall:e=>re(ke(e)),t:n}):null,ot?(0,$.jsx)(yn,{instance:ot,definition:Ne.get(ot.connectorId),onClose:()=>{se(null),ue(null)},onChanged:De,t:n,mcp:r}):null,W?(0,$.jsx)(Pn,{open:!0,mode:W.mode,initialRow:W.row,existingCustomServers:Te,sessionIdleTtlMinutes:ve,config:Ce,managedServerIds:Fe,t:r,cs:n,onClose:()=>he(null),onSaved:async()=>{await Se(),await De(),Oe(`connected`)}},`${W.mode}-${W.row.clientKey}`):null,(0,$.jsx)(Kt,{open:ge,sessionIdleTtlMinutes:ve,saving:K,onChange:ye,onSave:Le,onClose:()=>G(!1),t:n,mcp:r})]})})}export{Hn as ConnectorsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{c as i,m as a,p as ee,s as te}from"./popover-select-B-GDnZO9.js";import{t as ne}from"./cn-JdwAhgNB.js";import{n as re}from"./locale-store-BIkcRr3t.js";import{n as ie,r as ae}from"./settings-shell-layer-context-BTQUDoJ2.js";import{ad as oe,nd as se,rd as ce}from"./index--3c0awkr.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=re(_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=ie(Se),Ee=te(ae(),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=a,je=s&&`cursor-not-allowed opacity-50`,A;t[22]!==l||t[23]!==je?(A=ne(`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=ne(`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)(oe,{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)(ee,{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=a,Pe=Te??void 0,Fe=a,Ie=ne(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)(ce,{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)(se,{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:ne(`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)(i,{className:`fill-surface-overlay`}),t[88]=Ue):Ue=t[88];let Q;t[89]!==Fe.Content||t[90]!==Ie||t[91]!==U||t[92]!==W||t[93]!==K||t[94]!==Z?(Q=(0,c.jsxs)(Fe.Content,{align:`start`,sideOffset:6,collisionPadding:12,className:Ie,children:[U,W,K,Z,Ue]}),t[89]=Fe.Content,t[90]=Ie,t[91]=U,t[92]=W,t[93]=K,t[94]=Z,t[95]=Q):Q=t[95];let $;t[96]!==Ne.Portal||t[97]!==Pe||t[98]!==Q?($=(0,c.jsx)(Ne.Portal,{container:Pe,children:Q}),t[96]=Ne.Portal,t[97]=Pe,t[98]=Q,t[99]=$):$=t[99];let We;return t[100]!==h||t[101]!==Ae.Root||t[102]!==F||t[103]!==$?(We=(0,c.jsxs)(Ae.Root,{open:h,onOpenChange:xe,children:[F,$]}),t[100]=h,t[101]=Ae.Root,t[102]=F,t[103]=$,t[104]=We):We=t[104],We}function me(e,t){return(0,c.jsx)(`div`,{className:`flex h-8 items-center justify-center text-[11px] font-medium text-fg-subtle`,children:e},`${e}-${t}`)}function he(e){return new Date(e.getFullYear(),e.getMonth()+1,1,12)}function ge(e){return new Date(e.getFullYear(),e.getMonth()-1,1,12)}function _e(e){return e.language}export{l as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./plus-Q2yW6OE7.js";import{t as o}from"./x-B_N4OPjy.js";import{t as s}from"./cn-JdwAhgNB.js";import{n as c}from"./locale-store-BIkcRr3t.js";import{t as l}from"./messages-7VAhscYe.js";import{a as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-BGTk37IG.js";import{t as _}from"./button-CS04eWY9.js";import{t as v}from"./skeleton-BwbyijEw.js";import{Aa as y,Bc as b,Ii as x,Io as ee,Ys as te,_l as S,ac as ne,bi as C,ci as w,fn as re,hn as ie,ic as T,ji as ae,mn as oe,nd as se,od as E,pc as D,pn as ce,r as O,tc as le,td as k,ts as A,xi as ue}from"./index--3c0awkr.js";import{n as de}from"./tab-completion-input-D64VNmiA.js";var j=e(t(),1),M=n(),N=r(),P=12e3;function fe(e){let t=(0,M.c)(106),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:c,isDragging:l,attachmentBusy:u,attachmentsFull:d,voice:f,chat:p,cancelAction:m,onIntentChange:h,onPickFiles:g,onRemoveAttachment:v,onPaste:y,onDragOver:x,onDragLeave:ee,onDrop:te,onSubmit:ne}=e,C=n===`inline`,w;t[0]!==c||t[1]!==a?(w=!!a.trim()||c.length>0,t[0]=c,t[1]=a,t[2]=w):w=t[2];let re=w,ie=f.voiceActive&&f.phase!==`error`,T;t[3]!==ne||t[4]!==f.voiceActive?(T=e=>{if(f.voiceActive){e.preventDefault();return}ne(e)},t[3]=ne,t[4]=f.voiceActive,t[5]=T):T=t[5];let se=C?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,E;t[6]===se?E=t[7]:(E=s(`relative`,se),t[6]=se,t[7]=E);let D;t[8]!==C||t[9]!==l||t[10]!==o.dropFiles?(D=l?(0,N.jsx)(`div`,{className:s(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,C&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=C,t[9]=l,t[10]=o.dropFiles,t[11]=D):D=t[11];let ce=!C&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,O;t[12]===ce?O=t[13]:(O=s(ce),t[12]=ce,t[13]=O);let le=C?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,k;t[14]!==r||t[15]!==o.intentLabel||t[16]!==le?(k=(0,N.jsx)(`label`,{htmlFor:r,className:le,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=le,t[17]=k):k=t[17];let A;t[18]!==u||t[19]!==p||t[20]!==f.audioLevel||t[21]!==f.cancelVoiceInput||t[22]!==f.confirmVoiceInput||t[23]!==f.elapsedLabel||t[24]!==f.error||t[25]!==f.finalTranscript||t[26]!==f.partialTranscript||t[27]!==f.phase||t[28]!==f.retryVoiceInput||t[29]!==f.settingsRequired||t[30]!==f.voiceActive?(A=f.voiceActive?(0,N.jsx)(oe,{phase:f.phase,elapsedLabel:f.elapsedLabel,audioLevel:f.audioLevel,partialTranscript:f.partialTranscript,finalTranscript:f.finalTranscript,error:f.error,settingsRequired:f.settingsRequired,disabled:u,chat:p,onCancel:f.cancelVoiceInput,onConfirm:f.confirmVoiceInput,onRetry:f.retryVoiceInput}):null,t[18]=u,t[19]=p,t[20]=f.audioLevel,t[21]=f.cancelVoiceInput,t[22]=f.confirmVoiceInput,t[23]=f.elapsedLabel,t[24]=f.error,t[25]=f.finalTranscript,t[26]=f.partialTranscript,t[27]=f.phase,t[28]=f.retryVoiceInput,t[29]=f.settingsRequired,t[30]=f.voiceActive,t[31]=A):A=t[31];let j=ie&&`hidden`,fe=C?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,F;t[32]!==j||t[33]!==fe?(F=s(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,j,fe),t[32]=j,t[33]=fe,t[34]=F):F=t[34];let I;t[35]===h?I=t[36]:(I=e=>h(e.target.value),t[35]=h,t[36]=I);let me=!C,L;t[37]!==r||t[38]!==i||t[39]!==a||t[40]!==o.intentPlaceholder||t[41]!==o.intentSuggestion||t[42]!==h||t[43]!==y||t[44]!==F||t[45]!==I||t[46]!==me?(L=(0,N.jsx)(de,{ref:i,id:r,className:F,value:a,onChange:I,onPaste:y,suggestion:o.intentSuggestion,onAcceptSuggestion:h,onKeyDown:pe,placeholder:o.intentPlaceholder,maxLength:P,autoFocus:me}),t[37]=r,t[38]=i,t[39]=a,t[40]=o.intentPlaceholder,t[41]=o.intentSuggestion,t[42]=h,t[43]=y,t[44]=F,t[45]=I,t[46]=me,t[47]=L):L=t[47];let he=C?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,R;t[48]!==c||t[49]!==v||t[50]!==he?(R=(0,N.jsx)(ae,{attachments:c,topPadded:!1,onRemove:v,className:he}),t[48]=c,t[49]=v,t[50]=he,t[51]=R):R=t[51];let z;t[52]!==C||t[53]!==a.length||t[54]!==o.shortcut?(z=C?null:(0,N.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,N.jsx)(`span`,{children:o.shortcut}),(0,N.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,P.toLocaleString()]})]}),t[52]=C,t[53]=a.length,t[54]=o.shortcut,t[55]=z):z=t[55];let B;t[56]!==A||t[57]!==L||t[58]!==R||t[59]!==z||t[60]!==O||t[61]!==k?(B=(0,N.jsxs)(`div`,{className:O,children:[k,A,L,R,z]}),t[56]=A,t[57]=L,t[58]=R,t[59]=z,t[60]=O,t[61]=k,t[62]=B):B=t[62];let V=C?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,H;t[63]===V?H=t[64]:(H=s(`flex shrink-0 items-center gap-2 border-t`,V),t[63]=V,t[64]=H);let U=!C&&`mr-auto`,W;t[65]===U?W=t[66]:(W=s(`flex items-center gap-1`,U),t[65]=U,t[66]=W);let ge=u||d,G;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,N.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[67]=G):G=t[67];let K;t[68]!==o.attachTitle||t[69]!==g||t[70]!==ge?(K=(0,N.jsx)(_,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ge,title:o.attachTitle,"aria-label":o.attachTitle,onClick:g,children:G}),t[68]=o.attachTitle,t[69]=g,t[70]=ge,t[71]=K):K=t[71];let q;t[72]!==u||t[73]!==p||t[74]!==f.startVoiceInput||t[75]!==f.voiceActive?(q=f.voiceActive?null:(0,N.jsx)(ue,{disabled:u,chat:p,onStart:f.startVoiceInput}),t[72]=u,t[73]=p,t[74]=f.startVoiceInput,t[75]=f.voiceActive,t[76]=q):q=t[76];let J;t[77]!==W||t[78]!==K||t[79]!==q?(J=(0,N.jsxs)(`div`,{className:W,children:[K,q]}),t[77]=W,t[78]=K,t[79]=q,t[80]=J):J=t[80];let Y;t[81]!==m||t[82]!==C||t[83]!==o.shortcut?(Y=C?(0,N.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):m,t[81]=m,t[82]=C,t[83]=o.shortcut,t[84]=Y):Y=t[84];let _e=C?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,ve=!re||u||f.voiceActive,ye=C?`size-3.5`:`size-4`,X;t[85]===ye?X=t[86]:(X=(0,N.jsx)(b,{className:ye,"aria-hidden":!0}),t[85]=ye,t[86]=X);let Z;t[87]!==o.submit||t[88]!==_e||t[89]!==ve||t[90]!==X?(Z=(0,N.jsxs)(_,{type:`submit`,variant:`primary`,className:_e,disabled:ve,children:[X,o.submit]}),t[87]=o.submit,t[88]=_e,t[89]=ve,t[90]=X,t[91]=Z):Z=t[91];let Q;t[92]!==H||t[93]!==J||t[94]!==Y||t[95]!==Z?(Q=(0,N.jsxs)(`div`,{className:H,children:[J,Y,Z]}),t[92]=H,t[93]=J,t[94]=Y,t[95]=Z,t[96]=Q):Q=t[96];let be;return t[97]!==ee||t[98]!==x||t[99]!==te||t[100]!==T||t[101]!==B||t[102]!==Q||t[103]!==E||t[104]!==D?(be=(0,N.jsxs)(`form`,{onSubmit:T,onDragOver:x,onDragLeave:ee,onDrop:te,className:E,children:[D,B,Q]}),t[97]=ee,t[98]=x,t[99]=te,t[100]=T,t[101]=B,t[102]=Q,t[103]=E,t[104]=D,t[105]=be):be=t[105],be}function pe(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function F(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function I(){let e=(0,M.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,N.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsx)(v,{className:`h-10 w-3/5 rounded-xl`}),(0,N.jsx)(v,{className:`h-5 w-4/5 rounded-lg`})]}),(0,N.jsx)(v,{className:`h-64 rounded-2xl`}),(0,N.jsx)(v,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function me(e){let t=(0,M.c)(33),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:o,locale:s,onAction:c}=e,l;t[0]!==a||t[1]!==n.dueAt||t[2]!==s?(l=n.dueAt?`${a} ${w(new Date(n.dueAt),s)}`:null,t[0]=a,t[1]=n.dueAt,t[2]=s,t[3]=l):l=t[3];let u=l,d=n.kind===`failure`?o:u,f;t[4]===d?f=t[5]:(f=d?(0,N.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,N.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,N.jsx)(`span`,{children:d})]}):null,t[4]=d,t[5]=f);let p=!n.openAction,m;t[6]!==n.id||t[7]!==n.openAction||t[8]!==c?(m=()=>n.openAction&&c(n.openAction,n.id),t[6]=n.id,t[7]=n.openAction,t[8]=c,t[9]=m):m=t[9];let h;t[10]===n.title?h=t[11]:(h=(0,N.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[10]=n.title,t[11]=h);let g;t[12]===n.summary?g=t[13]:(g=(0,N.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[12]=n.summary,t[13]=g);let v;t[14]!==p||t[15]!==m||t[16]!==h||t[17]!==g?(v=(0,N.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,onClick:m,children:[h,g]}),t[14]=p,t[15]=m,t[16]=h,t[17]=g,t[18]=v):v=t[18];let y;t[19]!==n.recommendation||t[20]!==i?(y=n.recommendation?(0,N.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,N.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[19]=n.recommendation,t[20]=i,t[21]=y):y=t[21];let b;t[22]!==r||t[23]!==n.id||t[24]!==n.primaryAction||t[25]!==n.secondaryActions||t[26]!==c?(b=n.primaryAction||n.secondaryActions.length>0?(0,N.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,N.jsx)(_,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,onClick:()=>c(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,N.jsx)(_,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>c(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[22]=r,t[23]=n.id,t[24]=n.primaryAction,t[25]=n.secondaryActions,t[26]=c,t[27]=b):b=t[27];let x;return t[28]!==f||t[29]!==v||t[30]!==y||t[31]!==b?(x=(0,N.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,children:[f,v,y,b]}),t[28]=f,t[29]=v,t[30]=y,t[31]=b,t[32]=x):x=t[32],x}function L(e){let t=(0,M.c)(26),{item:n,onAction:r}=e,i;t[0]===n.kind?i=t[1]:(i=n.kind===`scheduled`?(0,N.jsx)(E,{className:`size-4`,"aria-hidden":!0}):(0,N.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`,"aria-hidden":!0}),t[0]=n.kind,t[1]=i);let a=i,o=!n.openAction,s;t[2]!==n.id||t[3]!==n.openAction||t[4]!==r?(s=()=>n.openAction&&r(n.openAction,n.id),t[2]=n.id,t[3]=n.openAction,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,N.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:a}),t[6]=a,t[7]=c);let l;t[8]===n.title?l=t[9]:(l=(0,N.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[8]=n.title,t[9]=l);let u;t[10]===n.summary?u=t[11]:(u=(0,N.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[10]=n.summary,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,N.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;t[15]===n.statusLabel?f=t[16]:(f=n.statusLabel?(0,N.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[15]=n.statusLabel,t[16]=f);let p;t[17]===n.openAction?p=t[18]:(p=n.openAction?(0,N.jsx)(se,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[17]=n.openAction,t[18]=p);let m;return t[19]!==o||t[20]!==s||t[21]!==c||t[22]!==d||t[23]!==f||t[24]!==p?(m=(0,N.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:o,onClick:s,children:[c,d,f,p]}),t[19]=o,t[20]=s,t[21]=c,t[22]=d,t[23]=f,t[24]=p,t[25]=m):m=t[25],m}function he(){let e=c(e=>e.language),t=l(e),n=t.projectsPage,r=D(e),s=i(),v=ee(e=>e.setPageHeader),b=ee(e=>e.clearPageHeader),[S,w]=(0,j.useState)(null),[ae,oe]=(0,j.useState)(!0),[se,E]=(0,j.useState)(null),[ue,de]=(0,j.useState)(!1),[M,P]=(0,j.useState)(``),[pe,he]=(0,j.useState)(null),[R,z]=(0,j.useState)(!1),B=C({chat:t.chat}),V=(0,j.useRef)(null),H=A({disabled:R,chat:t.chat,onTranscript:e=>{P(t=>ie(t,e)),window.setTimeout(()=>V.current?.focus(),0)}}),{phase:U,voiceActive:W,startVoiceInput:ge,cancelVoiceInput:G,confirmVoiceInput:K,retryVoiceInput:q}=H,J=(0,j.useCallback)(async(t=!1)=>{t&&oe(!0),E(null);try{let t=await le(e);w({...t,needsUser:t.needsUser.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`),background:t.background.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`)})}catch(e){E(e instanceof Error?e.message:String(e))}finally{oe(!1)}},[e]);(0,j.useEffect)(()=>{J(!0)},[J]),(0,j.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,J()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[J]);let Y=(0,j.useCallback)(async e=>{if(!(e.length===0||R)){z(!0);try{await B.processFiles(e)}finally{z(!1)}}},[R,B.processFiles]),_e=(0,j.useCallback)(async e=>{let t=x(e.clipboardData);t.length!==0&&(e.preventDefault(),await Y(t))},[Y]),ve=(0,j.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,B.setIsDragging(!0))},[B.setIsDragging]),ye=(0,j.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&B.setIsDragging(!1)},[B.setIsDragging]),X=(0,j.useCallback)(async e=>{e.preventDefault(),B.setIsDragging(!1),await Y(Array.from(e.dataTransfer.files))},[B.setIsDragging,Y]),Z=(0,j.useCallback)(e=>{e.preventDefault();let t=B.wireAttachmentsPayload(),n=y(M,t.length>0?O(t):void 0,{projectScope:`none`});n&&(de(!1),P(``),B.clearAttachments(),s(n))},[B.clearAttachments,B.wireAttachmentsPayload,M,s]),Q=B.attachments.length>=10,be={attachTitle:Q?F(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${B.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},$=!!(S&&S.needsUser.length===0&&S.backgroundCount===0),xe=$||ue;(0,j.useEffect)(()=>{!xe&&W&&G()},[G,xe,W]),(0,j.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!xe||R||(e.preventDefault(),U===`recording`?K():U===`idle`?(V.current?.focus(),ge()):U===`error`&&q())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!xe||!W||(e.preventDefault(),G(),V.current?.focus())};return window.addEventListener(ce,e),window.addEventListener(re,t),()=>{window.removeEventListener(ce,e),window.removeEventListener(re,t)}},[R,G,xe,K,q,ge,W,U]);let Se=(0,j.useCallback)(e=>{e||G(),de(e)},[G]),Ce=(0,j.useMemo)(()=>$?null:(0,N.jsxs)(_,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>de(!0),children:[(0,N.jsx)(a,{className:`size-4`,"aria-hidden":!0}),r.newWork]}),[r.newWork,$]),we=(0,j.useCallback)((e,t)=>{if(e.type===`open`){s(e.href);return}if(e.type===`review_judgment`){s(`/assistant-work?item=${encodeURIComponent(e.itemId)}`);return}he(t),E(null),(async()=>{try{e.type===`connector_decision`?await T({kind:`connector_approval`,approvalId:e.approvalId},e.decision):e.type===`retry_run`?await ne({kind:e.subjectKind,runId:e.runId}):e.type===`acknowledge_run`&&await te({kind:e.subjectKind,runId:e.runId}),await J()}catch(e){E(e instanceof Error?e.message:String(e))}finally{he(null)}})()},[J,s]);(0,j.useLayoutEffect)(()=>(v({startExtra:null,main:(0,N.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:Ce}),()=>b()),[b,Ce,v,n.title]);let Te=S?.needsUser.length??0,Ee=S?.backgroundCount??0,De=Te>0?F(n.home.attentionTitle,{count:Te}):Ee>0?n.home.clearTitle:n.home.idleTitle,Oe=Te>0?Ee>0?F(n.home.attentionIntroWithBackground,{count:Ee}):n.home.attentionIntro:Ee>0?F(n.home.clearIntro,{count:Ee}):n.home.idleIntro;return(0,N.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 py-8 sm:px-6 lg:px-8 lg:py-12`,children:[(0,N.jsx)(`input`,{ref:B.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Y(Array.from(t)),e.target.value=``}}),(0,N.jsx)(g,{open:ue,onOpenChange:Se,children:(0,N.jsxs)(p,{children:[(0,N.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,N.jsxs)(m,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,N.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(h,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,N.jsx)(d,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,N.jsx)(f,{asChild:!0,children:(0,N.jsx)(_,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,N.jsx)(o,{className:`size-4`,"aria-hidden":!0})})})]}),(0,N.jsx)(fe,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:V,intent:M,labels:{...be,submit:r.submit},attachments:B.attachments,isDragging:B.isDragging,attachmentBusy:R,attachmentsFull:Q,voice:H,chat:t.chat,cancelAction:(0,N.jsx)(f,{asChild:!0,children:(0,N.jsx)(_,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:P,onPickFiles:()=>B.fileInputRef.current?.click(),onRemoveAttachment:B.removeAttachment,onPaste:e=>void _e(e),onDragOver:ve,onDragLeave:ye,onDrop:e=>void X(e),onSubmit:Z})]})]})}),se?(0,N.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,N.jsx)(`span`,{children:se}),(0,N.jsx)(_,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void J(),children:n.home.retry})]}):null,ae?(0,N.jsx)(I,{}):S?(0,N.jsxs)(`div`,{className:$?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,N.jsxs)(`section`,{className:$?`w-full text-center`:`max-w-3xl`,children:[(0,N.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:De}),(0,N.jsx)(`p`,{className:$?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:Oe}),$?(0,N.jsx)(fe,{variant:`inline`,inputId:`idle-conversation-intent`,inputRef:V,intent:M,labels:be,attachments:B.attachments,isDragging:B.isDragging,attachmentBusy:R,attachmentsFull:Q,voice:H,chat:t.chat,onIntentChange:P,onPickFiles:()=>B.fileInputRef.current?.click(),onRemoveAttachment:B.removeAttachment,onPaste:e=>void _e(e),onDragOver:ve,onDragLeave:ye,onDrop:e=>void X(e),onSubmit:Z}):null]}),S.needsUser.length>0?(0,N.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,N.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,N.jsx)(k,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,N.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,N.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:S.needsUser.map(t=>(0,N.jsx)(me,{item:t,busy:pe===t.id,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:we},t.id))})]}):null,S.background.length>0?(0,N.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,N.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,N.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:F(n.home.backgroundCount,{count:S.backgroundCount})})]}),(0,N.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:S.background.map(e=>(0,N.jsx)(L,{item:e,onAction:we},e.id))})]}):null]}):null]})}export{he as HomePage};
|