@xopcai/xopc 0.0.118 → 0.0.120
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/README.md +2 -1
- package/README.zh-CN.md +2 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-dzUrQoeZ.js → agent-avatar-dicebear-APTlX9Sq.js} +1 -1
- package/dist/gateway/static/root/assets/agents-CFW_FS_V.js +2 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-DTKc5HHT.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-BTciFrE9.js +1 -0
- package/dist/gateway/static/root/assets/{apps-page--wMEL00f.js → apps-page-DT52OrbM.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Cki4SfU2.js → archive-plugin-CiHaUMII.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D-KnS2Do.js → attachment-load-t4gSrNjL.js} +1 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-CtysjSoQ.js +1 -0
- package/dist/gateway/static/root/assets/automations-page-B2YvT3ES.js +1 -0
- package/dist/gateway/static/root/assets/{binary-plugins-D2sgvJja.js → binary-plugins-BAbSldW5.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DIq-4Gvb.js → block-editor-BNr_82xl.js} +28 -28
- package/dist/gateway/static/root/assets/browser-settings-page-BQEXPhDU.js +8 -0
- package/dist/gateway/static/root/assets/capability-presets-api-tzD702Gg.js +1 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-AGhTueAc.js +1 -0
- package/dist/gateway/static/root/assets/channel-recipient-api-DL_KzwGE.js +1 -0
- package/dist/gateway/static/root/assets/channels-settings-DRTutLlN.js +1 -0
- package/dist/gateway/static/root/assets/cn-BQ_8x0bT.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-DneJVuge.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-B3B1eqnr.js +2 -0
- package/dist/gateway/static/root/assets/dreaming-settings-BEwWA1yf.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DYu1KaFQ.js → extension-debug-page-Dl2kO0Sf.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-B3W6QwlZ.js → extension-page-DmbLPsx_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-D7VQ-cxE.js → extension-settings-page-BS2rx40e.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-B7xDPu-R.js → fetch-B3ME5Eri.js} +1 -1
- package/dist/gateway/static/root/assets/format-cron-label-arqgGlVV.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-BTBLSeUu.js → gateway-config-api-DI9_BBTo.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-DAFI_T0W.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CYj9FWCp.js → gateway-startup-retry-CSZQTz6K.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-DLuz4jC9.js +1 -0
- package/dist/gateway/static/root/assets/{goals-config-api-CQQgzPr3.js → goals-config-api-Bhzqrp2w.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-BHitvJAv.js → goals-page-DTAfv9Ft.js} +2 -2
- package/dist/gateway/static/root/assets/goals-settings-CWN2iirQ.js +1 -0
- package/dist/gateway/static/root/assets/heartbeat-settings-CkkkHvOi.js +1 -0
- package/dist/gateway/static/root/assets/index-CnjzMw5i.js +191 -0
- package/dist/gateway/static/root/assets/index-E1QinYKp.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-kMp08SlX.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-DjbfSsfA.js → locale-store-Ba72bFmP.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-C2Uqvae9.js → logs-page-CDXDlS_W.js} +2 -2
- package/dist/gateway/static/root/assets/{markdown-split-BwOFrJ2E.js → markdown-split-Bc0w40vz.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Cnz6Q5G6.js → media-plugins-DJ_HvgIy.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CISb1HLv.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-panel-BTwxMIgZ.js +2 -0
- package/dist/gateway/static/root/assets/note-detail-page-BBfOeB0m.js +2 -0
- package/dist/gateway/static/root/assets/{note-image-lightbox-B-Svpmza.js → note-image-lightbox-4zntqpZq.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-VocWOjoK.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Bss4TiwP.js → preview-open-alternatives-BbA7sRd_.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CXwjuD_Q.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BRNjdgKq.js → save-bar-controls-Dividh61.js} +1 -1
- package/dist/gateway/static/root/assets/schedule-field-pRheF2CO.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-Dub9sy8r.js → schema-form-D6PiPxfr.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CpcVySQK.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BVy_TawT.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-BeFLavGi.js → settings-collapsible-section-BMCOfuE_.js} +1 -1
- package/dist/gateway/static/root/assets/settings-form-section-DBkGwpIN.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-CZpNyCWn.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-layout-NxoW5Y57.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-MVHLLu_a.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-C8glrdqe.js → share-preview-page-B0suFCfj.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-C6DBbQGo.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-6hJmhwSn.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-Im1MA0Iw.js +2 -0
- package/dist/gateway/static/root/assets/system-settings-panel-CrmEnyX4.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-CD2wtgZV.js → theme-store-Bt6vAkSB.js} +1 -1
- package/dist/gateway/static/root/assets/typed-models-lib-BAsGn25g.js +1 -0
- package/dist/gateway/static/root/assets/{use-channel-catalog-DqlWTsDb.js → use-channel-catalog-C7vcAoGb.js} +1 -1
- package/dist/gateway/static/root/assets/user-profile-settings-panel-QAQWGelF.js +1 -0
- package/dist/gateway/static/root/assets/utils-Dl9efgnV.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-C73IVZeC.js → voice-api-key-field-D-6XueTv.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-player-store-C_ArLJPM.js → voice-player-store-CMC5NOJp.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-DVPllR4k.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-B94WISTW.js +18 -0
- package/dist/gateway/static/root/index.html +8 -9
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +4 -5
- package/dist/src/agent/agent-manager.js +4 -8
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/context/workspace-templates/AGENTS.md +3 -2
- package/dist/src/agent/embedded/run-for-session.js +102 -14
- package/dist/src/agent/embedded/run-for-session.js.map +1 -1
- package/dist/src/agent/fallback/candidates.d.ts +0 -8
- package/dist/src/agent/fallback/candidates.js.map +1 -1
- package/dist/src/agent/index.js +1 -1
- package/dist/src/agent/lifecycle/handlers/compaction.d.ts +1 -3
- package/dist/src/agent/lifecycle/handlers/compaction.js +1 -16
- package/dist/src/agent/lifecycle/handlers/compaction.js.map +1 -1
- package/dist/src/agent/lifecycle/progress.d.ts +0 -1
- package/dist/src/agent/lifecycle/progress.js +1 -6
- package/dist/src/agent/lifecycle/progress.js.map +1 -1
- package/dist/src/agent/lifecycle/timeout-wrapper.d.ts +1 -2
- package/dist/src/agent/lifecycle/timeout-wrapper.js +1 -7
- package/dist/src/agent/lifecycle/timeout-wrapper.js.map +1 -1
- package/dist/src/agent/memory/builtin-memory-store.d.ts +1 -1
- package/dist/src/agent/memory/builtin-memory-store.js +1 -1
- package/dist/src/agent/memory/builtin-memory-store.js.map +1 -1
- package/dist/src/agent/memory/builtin-provider.d.ts +2 -2
- package/dist/src/agent/memory/builtin-provider.js +2 -2
- package/dist/src/agent/memory/builtin-provider.js.map +1 -1
- package/dist/src/agent/memory/dreaming/light-sweep.d.ts +0 -7
- package/dist/src/agent/memory/dreaming/light-sweep.js +16 -277
- package/dist/src/agent/memory/dreaming/light-sweep.js.map +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.d.ts +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.js +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.js.map +1 -1
- package/dist/src/agent/memory/dreaming/short-term-store.d.ts +3 -3
- package/dist/src/agent/memory/dreaming/short-term-store.js +5 -5
- package/dist/src/agent/memory/dreaming/short-term-store.js.map +1 -1
- package/dist/src/agent/memory/dreaming/utils.d.ts +2 -2
- package/dist/src/agent/memory/dreaming/utils.js +2 -2
- package/dist/src/agent/memory/dreaming/utils.js.map +1 -1
- package/dist/src/agent/memory/index.d.ts +0 -2
- package/dist/src/agent/memory/index.js +1 -2
- package/dist/src/agent/middleware/self-verify.d.ts +0 -1
- package/dist/src/agent/middleware/self-verify.js +0 -2
- package/dist/src/agent/middleware/self-verify.js.map +1 -1
- package/dist/src/agent/models/index.d.ts +1 -1
- package/dist/src/agent/models/manager.d.ts +4 -20
- package/dist/src/agent/models/manager.js +9 -126
- package/dist/src/agent/models/manager.js.map +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -4
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -9
- package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
- package/dist/src/agent/prompt/sections/memory-skills.js +11 -10
- package/dist/src/agent/prompt/sections/memory-skills.js.map +1 -1
- package/dist/src/agent/prompt/sections/tooling.js +4 -4
- package/dist/src/agent/prompt/sections/tooling.js.map +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.d.ts +0 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +0 -12
- package/dist/src/agent/prompt/service-prompt-builder.js.map +1 -1
- package/dist/src/agent/prompt/subagent-context.js +1 -1
- package/dist/src/agent/prompt/subagent-context.js.map +1 -1
- package/dist/src/agent/prompt/types.d.ts +1 -1
- package/dist/src/agent/reply/startup-context.js +6 -105
- package/dist/src/agent/reply/startup-context.js.map +1 -1
- package/dist/src/agent/service.d.ts +1 -12
- package/dist/src/agent/service.js +3 -81
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/service.types.d.ts +2 -2
- package/dist/src/agent/session/session-config-service.d.ts +11 -11
- package/dist/src/agent/session/session-config-service.js +14 -14
- package/dist/src/agent/session/session-config-service.js.map +1 -1
- package/dist/src/agent/session/session-inspector.js +3 -2
- package/dist/src/agent/session/session-inspector.js.map +1 -1
- package/dist/src/agent/starter-agents.js +12 -12
- package/dist/src/agent/starter-agents.js.map +1 -1
- package/dist/src/agent/tools/automation-tool.d.ts +14 -0
- package/dist/src/agent/tools/automation-tool.js +102 -0
- package/dist/src/agent/tools/automation-tool.js.map +1 -0
- package/dist/src/agent/tools/delegate-tool.js +1 -1
- package/dist/src/agent/tools/delegate-tool.js.map +1 -1
- package/dist/src/agent/tools/factory.d.ts +3 -3
- package/dist/src/agent/tools/factory.js +2 -2
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/index.d.ts +1 -1
- package/dist/src/agent/tools/index.js +2 -2
- package/dist/src/agent/tools/memory-tool.js +2 -2
- package/dist/src/agent/tools/memory-tool.js.map +1 -1
- package/dist/src/agent-manifest/resolver.d.ts +1 -0
- package/dist/src/agent-manifest/resolver.js +1 -0
- package/dist/src/agent-manifest/resolver.js.map +1 -1
- package/dist/src/agent-manifest/schema.d.ts +6 -0
- package/dist/src/agent-manifest/schema.js +12 -3
- package/dist/src/agent-manifest/schema.js.map +1 -1
- package/dist/src/ai-assist/text-assist.d.ts +1 -1
- package/dist/src/ai-assist/text-assist.js +56 -0
- package/dist/src/ai-assist/text-assist.js.map +1 -1
- package/dist/src/auth/profiles/store.js.map +1 -1
- package/dist/src/automations/api/routes.d.ts +3 -0
- package/dist/src/automations/api/routes.js +193 -0
- package/dist/src/automations/api/routes.js.map +1 -0
- package/dist/src/automations/domain/index.d.ts +3 -0
- package/dist/src/automations/domain/index.js +3 -0
- package/dist/src/automations/domain/schedule.d.ts +4 -0
- package/dist/src/automations/domain/schedule.js +37 -0
- package/dist/src/automations/domain/schedule.js.map +1 -0
- package/dist/src/automations/domain/types.d.ts +160 -0
- package/dist/src/automations/domain/validation.d.ts +370 -0
- package/dist/src/automations/domain/validation.js +149 -0
- package/dist/src/automations/domain/validation.js.map +1 -0
- package/dist/src/automations/draft/automation-draft-prompt.d.ts +26 -0
- package/dist/src/automations/draft/automation-draft-prompt.js +127 -0
- package/dist/src/automations/draft/automation-draft-prompt.js.map +1 -0
- package/dist/src/automations/draft/automation-draft-service.d.ts +12 -0
- package/dist/src/automations/draft/automation-draft-service.js +135 -0
- package/dist/src/automations/draft/automation-draft-service.js.map +1 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +99 -0
- package/dist/src/automations/draft/automation-draft-validator.js +105 -0
- package/dist/src/automations/draft/automation-draft-validator.js.map +1 -0
- package/dist/src/automations/draft/automation-draft.types.d.ts +40 -0
- package/dist/src/automations/draft/index.d.ts +3 -0
- package/dist/src/automations/draft/index.js +3 -0
- package/dist/src/automations/index.d.ts +3 -0
- package/dist/src/automations/index.js +8 -0
- package/dist/src/automations/product-events.d.ts +5 -0
- package/dist/src/automations/product-events.js +21 -0
- package/dist/src/automations/product-events.js.map +1 -0
- package/dist/src/automations/service/action-executor.d.ts +9 -0
- package/dist/src/automations/service/action-executor.js +157 -0
- package/dist/src/automations/service/action-executor.js.map +1 -0
- package/dist/src/automations/service/automation-service.d.ts +54 -0
- package/dist/src/automations/service/automation-service.js +404 -0
- package/dist/src/automations/service/automation-service.js.map +1 -0
- package/dist/src/automations/service/index.d.ts +2 -0
- package/dist/src/automations/service/index.js +3 -0
- package/dist/src/automations/storage/automation-repository.d.ts +6 -0
- package/dist/src/automations/storage/automation-repository.js +61 -0
- package/dist/src/automations/storage/automation-repository.js.map +1 -0
- package/dist/src/automations/storage/automation-run-repository.d.ts +17 -0
- package/dist/src/automations/storage/automation-run-repository.js +130 -0
- package/dist/src/automations/storage/automation-run-repository.js.map +1 -0
- package/dist/src/automations/storage/index.d.ts +2 -0
- package/dist/src/automations/storage/index.js +3 -0
- package/dist/src/channels/plugin-types.d.ts +3 -0
- package/dist/src/chat-commands/builtins/thinking.js.map +1 -1
- package/dist/src/cli/command-catalog.js +0 -39
- package/dist/src/cli/command-catalog.js.map +1 -1
- package/dist/src/cli/command-loaders.js +0 -1
- package/dist/src/cli/command-loaders.js.map +1 -1
- package/dist/src/cli/command-manifest.js +0 -4
- package/dist/src/cli/command-manifest.js.map +1 -1
- package/dist/src/cli/commands/agents.js +7 -6
- package/dist/src/cli/commands/agents.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/{cron-health.d.ts → migrations.d.ts} +1 -1
- package/dist/src/cli/commands/doctor/checks/migrations.js +40 -0
- package/dist/src/cli/commands/doctor/checks/migrations.js.map +1 -0
- package/dist/src/cli/commands/doctor/flow.js +2 -2
- package/dist/src/cli/commands/doctor/flow.js.map +1 -1
- package/dist/src/cli/commands/gateway/call.js +2 -2
- package/dist/src/cli/commands/gateway/call.js.map +1 -1
- package/dist/src/cli/commands/gateway/run-foreground.js +4 -2
- package/dist/src/cli/commands/gateway/run-foreground.js.map +1 -1
- package/dist/src/cli/commands/init.js +27 -9
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/tui.js +24 -2
- package/dist/src/cli/commands/tui.js.map +1 -1
- package/dist/src/cli/templates.js +3 -2
- package/dist/src/cli/templates.js.map +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +2 -0
- package/dist/src/cli/utils/init-workspace-core.js.map +1 -1
- package/dist/src/commands/agents.config.d.ts +9 -0
- package/dist/src/commands/agents.config.js +40 -2
- package/dist/src/commands/agents.config.js.map +1 -1
- package/dist/src/config/agent-profile.js +4 -3
- package/dist/src/config/agent-profile.js.map +1 -1
- package/dist/src/config/agent-typed-models.js.map +1 -1
- package/dist/src/config/config-surface.d.ts +3 -0
- package/dist/src/config/index.d.ts +0 -1
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/index.js.map +1 -1
- package/dist/src/config/paths.d.ts +0 -9
- package/dist/src/config/paths.js +1 -14
- package/dist/src/config/paths.js.map +1 -1
- package/dist/src/config/profile.js +0 -1
- package/dist/src/config/profile.js.map +1 -1
- package/dist/src/config/rules.js +0 -5
- package/dist/src/config/rules.js.map +1 -1
- package/dist/src/config/schema.d.ts +13 -12
- package/dist/src/config/schema.js +22 -26
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/config/web-patch.d.ts +0 -12
- package/dist/src/config/web-patch.js +2 -29
- package/dist/src/config/web-patch.js.map +1 -1
- package/dist/src/extensions/api.d.ts +2 -0
- package/dist/src/extensions/api.js +10 -0
- package/dist/src/extensions/api.js.map +1 -1
- package/dist/src/extensions/extension-registry-impl.d.ts +4 -1
- package/dist/src/extensions/extension-registry-impl.js +8 -0
- package/dist/src/extensions/extension-registry-impl.js.map +1 -1
- package/dist/src/extensions/loader.d.ts +3 -3
- package/dist/src/extensions/loader.js +3 -3
- package/dist/src/extensions/loader.js.map +1 -1
- package/dist/src/extensions/sdk/testing.d.ts +2 -0
- package/dist/src/extensions/sdk/testing.js +7 -0
- package/dist/src/extensions/sdk/testing.js.map +1 -1
- package/dist/src/extensions/types/core.d.ts +10 -1
- package/dist/src/extensions/types/index.d.ts +1 -1
- package/dist/src/extensions/types/{phase4.d.ts → registration.d.ts} +2 -2
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.js.map +1 -1
- package/dist/src/gateway/agents-admin.d.ts +1 -0
- package/dist/src/gateway/agents-admin.js +13 -15
- package/dist/src/gateway/agents-admin.js.map +1 -1
- package/dist/src/gateway/capability-presets-admin.d.ts +1 -0
- package/dist/src/gateway/capability-presets-admin.js +19 -10
- package/dist/src/gateway/capability-presets-admin.js.map +1 -1
- package/dist/src/gateway/dreaming-automation-reconciler.d.ts +11 -0
- package/dist/src/gateway/dreaming-automation-reconciler.js +105 -0
- package/dist/src/gateway/dreaming-automation-reconciler.js.map +1 -0
- package/dist/src/gateway/heartbeat/service.d.ts +0 -2
- package/dist/src/gateway/heartbeat/service.js +0 -7
- package/dist/src/gateway/heartbeat/service.js.map +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +5 -6
- package/dist/src/gateway/hono/lib/config-payload.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.js.map +1 -1
- package/dist/src/gateway/hono/routes/agents.js.map +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +15 -6
- package/dist/src/gateway/hono/routes/config-patch/misc.js.map +1 -1
- package/dist/src/gateway/hono/routes/dreaming.js +27 -37
- package/dist/src/gateway/hono/routes/dreaming.js.map +1 -1
- package/dist/src/gateway/hono/routes/home.d.ts +2 -2
- package/dist/src/gateway/hono/routes/home.js +34 -25
- package/dist/src/gateway/hono/routes/home.js.map +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +10 -6
- package/dist/src/gateway/hono/routes/lazy-bundles.js.map +1 -1
- package/dist/src/gateway/hono/routes/migrations.d.ts +3 -0
- package/dist/src/gateway/hono/routes/migrations.js +35 -0
- package/dist/src/gateway/hono/routes/migrations.js.map +1 -0
- package/dist/src/gateway/hono/routes/public-gateway.js +2 -1
- package/dist/src/gateway/hono/routes/public-gateway.js.map +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +14 -0
- package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
- package/dist/src/gateway/run-loop.js +2 -0
- package/dist/src/gateway/run-loop.js.map +1 -1
- package/dist/src/gateway/security/operator-scopes.js +5 -1
- package/dist/src/gateway/security/operator-scopes.js.map +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +4 -4
- package/dist/src/gateway/service/config-coordinator.js +14 -8
- package/dist/src/gateway/service/config-coordinator.js.map +1 -1
- package/dist/src/gateway/service/sessions-api.d.ts +2 -1
- package/dist/src/gateway/service/sessions-api.js +6 -1
- package/dist/src/gateway/service/sessions-api.js.map +1 -1
- package/dist/src/gateway/service.d.ts +7 -3
- package/dist/src/gateway/service.js +61 -27
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/goals/goal-service.js +45 -4
- package/dist/src/goals/goal-service.js.map +1 -1
- package/dist/src/migrations/config/default-capability-preset.d.ts +10 -0
- package/dist/src/migrations/config/default-capability-preset.js +135 -0
- package/dist/src/migrations/config/default-capability-preset.js.map +1 -0
- package/dist/src/migrations/index.d.ts +4 -0
- package/dist/src/migrations/index.js +4 -0
- package/dist/src/migrations/registry.d.ts +8 -0
- package/dist/src/migrations/registry.js +18 -0
- package/dist/src/migrations/registry.js.map +1 -0
- package/dist/src/migrations/runner.d.ts +17 -0
- package/dist/src/migrations/runner.js +191 -0
- package/dist/src/migrations/runner.js.map +1 -0
- package/dist/src/migrations/types.d.ts +34 -0
- package/dist/src/notes/service.js +24 -1
- package/dist/src/notes/service.js.map +1 -1
- package/dist/src/providers/model-registry.d.ts +0 -1
- package/dist/src/providers/model-registry.js +0 -3
- package/dist/src/providers/model-registry.js.map +1 -1
- package/dist/src/routing/resolve-tui-session-key.d.ts +3 -0
- package/dist/src/routing/resolve-tui-session-key.js +14 -3
- package/dist/src/routing/resolve-tui-session-key.js.map +1 -1
- package/dist/src/session/transcript-outline.d.ts +47 -0
- package/dist/src/session/transcript-outline.js +481 -0
- package/dist/src/session/transcript-outline.js.map +1 -0
- package/dist/src/storage/sqlite/index.d.ts +0 -2
- package/dist/src/storage/sqlite/index.js +1 -3
- package/dist/src/storage/sqlite/migrations/016_automations.sql +47 -0
- package/dist/src/storage/sqlite/migrations/017_automation_run_events.sql +14 -0
- package/dist/src/storage/sqlite/migrations/018_automation_safety.sql +1 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/row-mappers.js +3 -1
- package/dist/src/storage/sqlite/row-mappers.js.map +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +56 -46
- package/dist/src/tui/backends/embedded-backend.d.ts +6 -0
- package/dist/src/tui/backends/embedded-backend.js +19 -9
- package/dist/src/tui/backends/embedded-backend.js.map +1 -1
- package/dist/src/tui/backends/gateway-sse-backend.d.ts +3 -0
- package/dist/src/tui/backends/gateway-sse-backend.js +14 -0
- package/dist/src/tui/backends/gateway-sse-backend.js.map +1 -1
- package/dist/src/tui/tui-backend.d.ts +4 -0
- package/dist/src/tui/tui-commands.d.ts +5 -0
- package/dist/src/tui/tui-commands.js +43 -0
- package/dist/src/tui/tui-commands.js.map +1 -1
- package/dist/src/tui/tui-transcript-tree.d.ts +1 -1
- package/dist/src/tui/tui-transcript-tree.js +17 -257
- package/dist/src/tui/tui-transcript-tree.js.map +1 -1
- package/dist/src/tui/tui-types.d.ts +2 -0
- package/dist/src/tui/tui-types.js.map +1 -1
- package/dist/src/tui/tui.js +7 -2
- package/dist/src/tui/tui.js.map +1 -1
- package/dist/src/workflows/domain/index.js +1 -1
- package/dist/src/workflows/domain/run.d.ts +7 -7
- package/dist/src/workflows/domain/run.js.map +1 -1
- package/dist/src/workflows/index.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.d.ts +2 -0
- package/dist/src/workflows/service/workflow-run-service.js +31 -9
- package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
- package/dist/src/workflows/service/workflow-run-service.types.d.ts +1 -1
- package/package.json +4 -2
- package/dist/gateway/static/root/assets/agents-BCxZbkOw.js +0 -2
- package/dist/gateway/static/root/assets/app-management-settings-panel-bxYJVJpx.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-BCIykXlI.js +0 -1
- package/dist/gateway/static/root/assets/browser-settings-page-DRhKdn81.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-api-CorhiHlg.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-qFx9Jtce.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-BAwAkqIA.js +0 -1
- package/dist/gateway/static/root/assets/cn-JdwAhgNB.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BQLcfitM.js +0 -2
- package/dist/gateway/static/root/assets/createLucideIcon-DPHK1VkS.js +0 -1
- package/dist/gateway/static/root/assets/cron-api-qGwmL-24.js +0 -1
- package/dist/gateway/static/root/assets/cron-dreaming-jobs-nCMWCf0p.js +0 -1
- package/dist/gateway/static/root/assets/cron-page-BBWMAj8-.js +0 -3
- package/dist/gateway/static/root/assets/dreaming-settings-Dw89Obml.js +0 -1
- package/dist/gateway/static/root/assets/format-cron-label-BsotZDO5.js +0 -2
- package/dist/gateway/static/root/assets/format-interval-label-BzxafKxR.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-Cmwy58rS.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-l7mu5GWX.js +0 -1
- package/dist/gateway/static/root/assets/goals-settings-CYVY4NGp.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-config-api-DriO_CN9.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CUQTKxg7.js +0 -1
- package/dist/gateway/static/root/assets/index-C17Tsd_b.css +0 -1
- package/dist/gateway/static/root/assets/index-Cc41r16l.js +0 -191
- package/dist/gateway/static/root/assets/interval-presets-DFPCKW_W.js +0 -1
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-CcVcqstx.js +0 -1
- package/dist/gateway/static/root/assets/messages-B1iSKjiw.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-BfLfcta8.js +0 -2
- package/dist/gateway/static/root/assets/note-detail-page-BjwOQBfT.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-DktdBiwB.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-rfVx96fq.js +0 -1
- package/dist/gateway/static/root/assets/schedule-field-CUCKODde.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DbtMFuuH.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-5re5gAnP.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-dmyaPOTG.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-D-WMyLlj.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cl-DEJAU.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CyPVvbLt.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CleTH1oz.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Ck8hdXqR.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-DI-LN_8G.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-kX9duch4.js +0 -1
- package/dist/gateway/static/root/assets/user-profile-settings-panel-B-UFPMXy.js +0 -1
- package/dist/gateway/static/root/assets/utils-Dm0hKalR.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-BtFGp2y_.js +0 -18
- package/dist/src/agent/fallback/error.d.ts +0 -22
- package/dist/src/agent/fallback/error.js +0 -32
- package/dist/src/agent/fallback/error.js.map +0 -1
- package/dist/src/agent/fallback/index.d.ts +0 -5
- package/dist/src/agent/fallback/index.js +0 -9
- package/dist/src/agent/fallback/index.js.map +0 -1
- package/dist/src/agent/memory/memory-flush.d.ts +0 -27
- package/dist/src/agent/memory/memory-flush.js +0 -124
- package/dist/src/agent/memory/memory-flush.js.map +0 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.d.ts +0 -29
- package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.js +0 -76
- package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.js.map +0 -1
- package/dist/src/agent/service/reconcile-dreaming-cron.d.ts +0 -6
- package/dist/src/agent/service/reconcile-dreaming-cron.js +0 -84
- package/dist/src/agent/service/reconcile-dreaming-cron.js.map +0 -1
- package/dist/src/agent/tools/cronjob-tool.d.ts +0 -29
- package/dist/src/agent/tools/cronjob-tool.js +0 -274
- package/dist/src/agent/tools/cronjob-tool.js.map +0 -1
- package/dist/src/cli/commands/cron-cli.d.ts +0 -2
- package/dist/src/cli/commands/cron-cli.js +0 -15
- package/dist/src/cli/commands/cron-cli.js.map +0 -1
- package/dist/src/cli/commands/cron.d.ts +0 -4
- package/dist/src/cli/commands/cron.js +0 -188
- package/dist/src/cli/commands/cron.js.map +0 -1
- package/dist/src/cli/commands/doctor/checks/cron-health.js +0 -35
- package/dist/src/cli/commands/doctor/checks/cron-health.js.map +0 -1
- package/dist/src/cron/execution-types.d.ts +0 -42
- package/dist/src/cron/executor.d.ts +0 -67
- package/dist/src/cron/executor.js +0 -669
- package/dist/src/cron/executor.js.map +0 -1
- package/dist/src/cron/index.d.ts +0 -7
- package/dist/src/cron/index.js +0 -7
- package/dist/src/cron/job-content.d.ts +0 -5
- package/dist/src/cron/job-content.js +0 -15
- package/dist/src/cron/job-content.js.map +0 -1
- package/dist/src/cron/run-log-store.d.ts +0 -12
- package/dist/src/cron/run-log-store.js +0 -58
- package/dist/src/cron/run-log-store.js.map +0 -1
- package/dist/src/cron/schedule.d.ts +0 -10
- package/dist/src/cron/schedule.js +0 -85
- package/dist/src/cron/schedule.js.map +0 -1
- package/dist/src/cron/service.d.ts +0 -58
- package/dist/src/cron/service.js +0 -419
- package/dist/src/cron/service.js.map +0 -1
- package/dist/src/cron/types.d.ts +0 -183
- package/dist/src/cron/validation.d.ts +0 -500
- package/dist/src/cron/validation.js +0 -192
- package/dist/src/cron/validation.js.map +0 -1
- package/dist/src/cron/workflow-run-completion.d.ts +0 -23
- package/dist/src/cron/workflow-run-completion.js +0 -72
- package/dist/src/cron/workflow-run-completion.js.map +0 -1
- package/dist/src/extensions/types/phase4.js +0 -1
- package/dist/src/gateway/hono/routes/cron.d.ts +0 -3
- package/dist/src/gateway/hono/routes/cron.js +0 -109
- package/dist/src/gateway/hono/routes/cron.js.map +0 -1
- package/dist/src/storage/sqlite/cron-job-repository.d.ts +0 -6
- package/dist/src/storage/sqlite/cron-job-repository.js +0 -70
- package/dist/src/storage/sqlite/cron-job-repository.js.map +0 -1
- package/dist/src/storage/sqlite/cron-run-repository.d.ts +0 -5
- package/dist/src/storage/sqlite/cron-run-repository.js +0 -96
- package/dist/src/storage/sqlite/cron-run-repository.js.map +0 -1
- /package/dist/src/{cron → automations/domain}/types.js +0 -0
- /package/dist/src/{config/defaults.d.ts → automations/draft/automation-draft.types.js} +0 -0
- /package/dist/src/{config/defaults.js → extensions/types/registration.js} +0 -0
- /package/dist/src/{cron/execution-types.js → migrations/types.js} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CISb1HLv.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{i as s}from"./theme-store-Bt6vAkSB.js";import{c,i as l,n as u}from"./fetch-B3ME5Eri.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,Ai as p,Ar as m,Bs as h,Cn as g,Ct as _,Di as v,Dn as y,Fa as b,Fi as x,Fr as S,Hs as C,Ii as w,Ir as T,Is as E,Li as D,Lr as O,Mi as k,Mr as A,Ms as j,Na as M,Ni as N,No as P,Nr as F,Oi as ee,On as I,Oo as L,Pi as te,Pr as ne,Ps as R,Qn as re,Qs as ie,Ri as z,Rr as B,Sn as ae,Tn as V,Ua as H,Wi as U,Xs as W,Ya as G,Yo as oe,Zn as se,Zs as ce,_n as le,_r as K,_t as ue,aa as q,at as de,ba as fe,bn as pe,br as me,bt as he,ca as ge,d as _e,dn as ve,dr as ye,dt as J,ea as be,es as xe,fn as Se,fr as Ce,ga as we,gn as Te,gr as Ee,ha as De,hn as Oe,hr as ke,ht as Ae,ja as je,ji as Me,jr as Ne,js as Pe,ki as Fe,ko as Ie,la as Le,ls as Y,lt as Re,mn as ze,mr as Be,mt as Ve,n as He,ni as Ue,pa as We,pn as Ge,pr as Ke,pt as qe,qo as Je,qs as Ye,sa as X,so as Xe,t as Ze,ta as Qe,to as $e,ts as et,u as tt,ua as nt,ut as rt,vn as it,vo as at,wn as ot,xt as st,ya as ct,yn as lt,zi as ut,zr as dt}from"./index-CnjzMw5i.js";import{t as ft}from"./markdown-editor-AssmZFx4.js";import{n as pt,t as mt}from"./settings-form-section-DBkGwpIN.js";import{n as ht,t as gt}from"./settings-page-layout-NxoW5Y57.js";import{n as _t}from"./agent-avatar-dicebear-APTlX9Sq.js";import{n as vt,r as yt,t as bt}from"./channel-recipient-api-DL_KzwGE.js";import{n as xt,r as St,t as Ct}from"./utils-Dl9efgnV.js";import{a as wt,i as Tt,n as Et,o as Dt,t as Ot}from"./typed-models-lib-BAsGn25g.js";import{a as kt,o as At,r as jt,s as Mt}from"./capability-presets-api-tzD702Gg.js";var Z=n(),Q=r();function Nt(e){let t=(0,Z.c)(40),{open:n,onOpenChange:r,busy:a,deletePurge:o,deleteTarget:s,deleteConfirmText:c,onDeleteConfirmTextChange:l,onConfirm:u,onCancel:d,a:f}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(Me,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=m):m=t[0];let h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=i(`fixed left-1/2 top-1/2 z-[81] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),t[1]=h):h=t[1];let g=o?f.purgeDisk:f.removeFromConfig,_;t[2]===g?_=t[3]:(_=(0,Q.jsx)(te,{className:`text-base font-semibold text-fg`,children:g}),t[2]=g,t[3]=_);let v=o?f.confirmDeletePurge:f.confirmDelete,y;t[4]===v?y=t[5]:(y=(0,Q.jsx)(p,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:v}),t[4]=v,t[5]=y);let b;t[6]!==f.purgeConfirmHint||t[7]!==f.purgeConfirmLabel||t[8]!==f.purgeConfirmPlaceholder||t[9]!==c||t[10]!==o||t[11]!==s||t[12]!==l?(b=o&&s?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:f.purgeConfirmLabel}),(0,Q.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:f.purgeConfirmPlaceholder.replace(`{{agentId}}`,s.id),value:c,onChange:e=>l(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:f.purgeConfirmHint.replace(`{{agentId}}`,s.id)})]}):null,t[6]=f.purgeConfirmHint,t[7]=f.purgeConfirmLabel,t[8]=f.purgeConfirmPlaceholder,t[9]=c,t[10]=o,t[11]=s,t[12]=l,t[13]=b):b=t[13];let x;t[14]!==f.createModalCancel||t[15]!==a||t[16]!==d?(x=(0,Q.jsx)(X,{type:`button`,variant:`ghost`,disabled:a,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=a,t[16]=d,t[17]=x):x=t[17];let S=o?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,C;t[18]!==a||t[19]!==c||t[20]!==o||t[21]!==s?(C=a||!s||o&&c.trim().toLowerCase()!==s.id.toLowerCase(),t[18]=a,t[19]=c,t[20]=o,t[21]=s,t[22]=C):C=t[22];let w=o?f.purgeDisk:f.removeFromConfig,T;t[23]!==u||t[24]!==C||t[25]!==w||t[26]!==S?(T=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:S,disabled:C,onClick:u,children:w}),t[23]=u,t[24]=C,t[25]=w,t[26]=S,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==x?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[x,T]}),t[28]=T,t[29]=x,t[30]=E):E=t[30];let D;t[31]!==E||t[32]!==_||t[33]!==y||t[34]!==b?(D=(0,Q.jsxs)(k,{children:[m,(0,Q.jsxs)(Fe,{className:h,onOpenAutoFocus:Pt,children:[_,y,b,E]})]}),t[31]=E,t[32]=_,t[33]=y,t[34]=b,t[35]=D):D=t[35];let O;return t[36]!==r||t[37]!==n||t[38]!==D?(O=(0,Q.jsx)(N,{open:n,onOpenChange:r,children:D}),t[36]=r,t[37]=n,t[38]=D,t[39]=O):O=t[39],O}function Pt(e){return e.preventDefault()}var Ft=[{id:`overview`,labelKey:`navOverview`,icon:Je},{id:`behavior`,labelKey:`navBehavior`,icon:M},{id:`tools`,labelKey:`navTools`,icon:nt},{id:`skills`,labelKey:`navSkills`,icon:ge},{id:`memory`,labelKey:`navMemory`,icon:j},{id:`connections`,labelKey:`navConnections`,icon:Pe},{id:`config`,labelKey:`navConfig`,icon:b},{id:`dangerZone`,labelKey:`navDangerZone`,icon:ct}];function It(e){let t=(0,Z.c)(11),{a:n,panel:r,onPanelChange:a}=e,o;t[0]!==a||t[1]!==r?(o=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:i(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,Qe.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e),t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c=n.editorNavAria,l;t[3]!==n||t[4]!==s?(l=Ft.map(e=>{let{id:t,labelKey:r,icon:i}=e;return s(t,n[r],i)}),t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l}),t[6]=l,t[7]=u);let d;return t[8]!==n.editorNavAria||t[9]!==u?(d=(0,Q.jsx)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":c,children:u}),t[8]=n.editorNavAria,t[9]=u,t[10]=d):d=t[10],d}function Lt(e){let t=(0,Z.c)(44),{open:n,onOpenChange:r,a,title:o,subtitle:s,panel:c,onPanelChange:l,onFooterSave:u,footerSaveDisabled:d,footerSavedFlash:f,showFooter:m,busy:h,children:g}=e,_=m===void 0?!0:m,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(Me,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,re)}),t[0]=v):v=t[0];let y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=i(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,se,`inset-4 h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] min-h-0`,`sm:inset-auto sm:left-1/2 sm:top-1/2 sm:h-[min(88vh,48rem)] sm:max-h-[min(88vh,48rem)] sm:min-h-[32rem] sm:w-[min(100%-2rem,58rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=y):y=t[1];let b;t[2]===o?b=t[3]:(b=(0,Q.jsx)(te,{className:`text-base font-semibold leading-snug text-fg`,children:o}),t[2]=o,t[3]=b);let x;t[4]===s?x=t[5]:(x=(0,Q.jsx)(p,{className:`mt-1 font-mono text-xs text-fg-muted`,children:s}),t[4]=s,t[5]=x);let S;t[6]!==b||t[7]!==x?(S=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[b,x]}),t[6]=b,t[7]=x,t[8]=S):S=t[8];let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=i(be,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=C):C=t[9];let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),t[10]=w):w=t[10];let T;t[11]===a.closeDialogAria?T=t[12]:(T=(0,Q.jsx)(ee,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:C,"aria-label":a.closeDialogAria,children:w})}),t[11]=a.closeDialogAria,t[12]=T);let E;t[13]!==S||t[14]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-edge-subtle px-4 pb-3 pt-4 dark:border-edge`,children:[S,T]}),t[13]=S,t[14]=T,t[15]=E):E=t[15];let D;t[16]!==a||t[17]!==l||t[18]!==c?(D=(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 dark:border-edge sm:flex sm:w-56 sm:shrink-0 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-0 sm:py-4 sm:pl-4 sm:pr-3`,children:(0,Q.jsx)(It,{a,panel:c,onPanelChange:l})}),t[16]=a,t[17]=l,t[18]=c,t[19]=D):D=t[19];let O;t[20]===g?O=t[21]:(O=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:g}),t[20]=g,t[21]=O);let A;t[22]!==a.footerSaveNotApplicable||t[23]!==a.personaSaved||t[24]!==a.save||t[25]!==h||t[26]!==d||t[27]!==f||t[28]!==u||t[29]!==_?(A=_?(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[f?(0,Q.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,a.personaSaved]}):d?(0,Q.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:a.footerSaveNotApplicable}):null,(0,Q.jsx)(X,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:h||d,onClick:()=>void u(),children:a.save})]}):null,t[22]=a.footerSaveNotApplicable,t[23]=a.personaSaved,t[24]=a.save,t[25]=h,t[26]=d,t[27]=f,t[28]=u,t[29]=_,t[30]=A):A=t[30];let j;t[31]!==O||t[32]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[O,A]}),t[31]=O,t[32]=A,t[33]=j):j=t[33];let M;t[34]!==D||t[35]!==j?(M=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[D,j]}),t[34]=D,t[35]=j,t[36]=M):M=t[36];let P;t[37]!==M||t[38]!==E?(P=(0,Q.jsxs)(k,{children:[v,(0,Q.jsx)(Fe,{className:y,onOpenAutoFocus:Rt,children:(0,Q.jsxs)(qe,{layer:`modal`,children:[E,M]})})]}),t[37]=M,t[38]=E,t[39]=P):P=t[39];let F;return t[40]!==r||t[41]!==n||t[42]!==P?(F=(0,Q.jsx)(N,{open:n,onOpenChange:r,children:P}),t[40]=r,t[41]=n,t[42]=P,t[43]=F):F=t[43],F}function Rt(e){return e.preventDefault()}var $=e(t(),1),zt=e=>u(e);function Bt(e){return!e||e.total<=0?null:Math.round(e.helpful/e.total*100)}function Vt(e){let t=Bt(e);return t==null?`border-edge bg-surface-panel text-fg-muted`:t>=70?`border-success/30 bg-success-soft text-fg`:t>=40?`border-warning/40 bg-warning-soft text-fg`:`border-danger/30 bg-danger-soft text-fg`}function Ht({embedded:e=!1,agentId:t}){let n=a(o(e=>e.language)).agentsSettings.memoryPanel,[r,i]=(0,$.useState)(``),[s,c]=(0,$.useState)(``),[f,p]=(0,$.useState)(``),[m,h]=(0,$.useState)({}),[g,_]=(0,$.useState)({searchStrategy:`fanout`,writeStrategy:`local-first`,allowExternalWrites:!1,allowedProviderIds:[],autoWriteKinds:[]}),{data:v}=d(l(`/api/memory/providers`),zt),{data:y,mutate:b}=d(l(`/api/memory/records?status=active&limit=80`),zt),{data:x,mutate:S}=d(l(`/api/memory/records?status=candidate&limit=80`),zt),{data:C}=d(l(`/api/memory/signals?limit=50`),zt),{data:w,mutate:T}=d(l(`/api/memory/traces?limit=80`),zt),{data:E}=d(l(`/api/memory/feedback-summary?limit=1000`),zt),{data:D,mutate:O}=d(l(`/api/memory/config${t?`?agentId=${encodeURIComponent(t)}`:``}`),zt),{data:k,isLoading:A}=d(s?l(`/api/memory/search`):null,e=>u(e,{method:`POST`,body:JSON.stringify({query:s,maxResults:20})})),j=k?.results.map(e=>({...e.record,score:e.score}))??y?.records??[],M=v?.providers.length??0,N=y?.records.length??0,P=x?.records.length??0,F=C?.signals.length??0,ee=w?.traces.length??0,I=E?.summaries??[],L=(0,$.useMemo)(()=>new Map(I.map(e=>[e.recordId,e])),[I]),te=I.reduce((e,t)=>e+t.total,0),ne=I.reduce((e,t)=>e+t.helpful,0),R=te>0?Math.round(ne/te*100):null,re=(0,$.useMemo)(()=>[{label:n.providers,value:M},{label:n.records,value:N},{label:n.inbox,value:P},{label:n.signals,value:F},{label:n.traceEvents,value:ee},{label:n.recallQuality,value:R==null?`—`:`${R}%`}],[P,R,M,N,F,n.inbox,n.providers,n.recallQuality,n.records,n.signals,n.traceEvents,ee]);(0,$.useEffect)(()=>{let e=D?.memory.providerRouting;e&&_({searchStrategy:e.searchStrategy??`fanout`,writeStrategy:e.writeStrategy??`local-first`,allowExternalWrites:e.allowExternalWrites??!1,allowedProviderIds:e.allowedProviderIds??[],autoWriteKinds:e.autoWriteKinds??[]})},[D]);async function ie(){if(D){p(n.saving);try{await u(l(`/api/memory/config`),{method:`PATCH`,body:JSON.stringify({agentId:D.agentId,memory:{...D.memory,providerRouting:g}})}),await O(),p(n.saved)}catch(e){p(e instanceof Error?e.message:n.saveFailed)}}}async function z(e){h(t=>({...t,[e]:n.testing}));try{let t=(await u(l(`/api/memory/providers/${encodeURIComponent(e)}/test`),{method:`POST`})).checks.find(e=>!e.ok);h(r=>({...r,[e]:t?`${t.name}: ${t.message??n.checkFailed}`:n.testPassed})),T()}catch(t){h(r=>({...r,[e]:t instanceof Error?t.message:n.testFailed}))}}async function B(e,t){await u(l(`/api/memory/records/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t})}),await Promise.all([S(),b()])}return(0,Q.jsxs)(`div`,{className:e?`flex min-h-0 w-full flex-1 flex-col gap-5 overflow-y-auto overscroll-contain pr-1`:`mx-auto flex w-full max-w-app-main flex-1 flex-col gap-5 px-4 py-6`,children:[e?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-xl font-semibold text-fg`,children:n.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-6`,children:re.map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface px-4 py-3`,children:[(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:e.label}),(0,Q.jsx)(`div`,{className:`mt-1 text-2xl font-semibold text-fg`,children:e.value})]},e.label))}),(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providerPolicy}),(0,Q.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.searchStrategy,(0,Q.jsx)(`select`,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:g.searchStrategy,onChange:e=>_(t=>({...t,searchStrategy:e.target.value})),children:[`fanout`,`local-first`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.writeStrategy,(0,Q.jsx)(`select`,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:g.writeStrategy,onChange:e=>_(t=>({...t,writeStrategy:e.target.value})),children:[`local-first`,`write-through`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg md:col-span-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:g.allowExternalWrites,onChange:e=>_(t=>({...t,allowExternalWrites:e.target.checked}))}),n.allowExternalWrites]}),(0,Q.jsxs)(`div`,{className:`md:col-span-2`,children:[(0,Q.jsx)(`div`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:n.writableProviders}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(v?.providers??[]).filter(e=>!e.capabilities.local).map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3 py-2 text-sm text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:g.allowedProviderIds?.includes(e.id)??!1,onChange:t=>_(n=>({...n,allowedProviderIds:t.target.checked?[...n.allowedProviderIds??[],e.id]:(n.allowedProviderIds??[]).filter(t=>t!==e.id)}))}),e.displayName]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 md:col-span-2`,children:[(0,Q.jsx)(X,{type:`button`,variant:`primary`,onClick:ie,children:n.savePolicy}),f?(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:f}):null]})]})]}),(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.inbox}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.inboxHint})]}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:P})]}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[(x?.records??[]).map(e=>(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.sensitivity??`normal`}),(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.confidence==null?null:(0,Q.jsxs)(`span`,{children:[Math.round(e.confidence*100),`%`]})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),e.evidence?.[0]?.sourceText?(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.evidence[0].sourceText}):null,(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(X,{type:`button`,variant:`primary`,onClick:()=>B(e.id,`active`),children:n.approve}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>B(e.id,`rejected`),children:n.reject}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>B(e.id,`needs_review`),children:n.needsReview})]})]},e.id)),P===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noInbox}):null]})]}),(0,Q.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),c(r.trim())},children:[(0,Q.jsx)(`input`,{className:`min-h-10 flex-1 rounded-md border border-edge bg-surface px-3 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:e=>i(e.target.value),placeholder:n.searchPlaceholder}),(0,Q.jsx)(X,{className:`min-h-10 rounded-md px-4`,type:`submit`,variant:`primary`,children:n.search})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_20rem]`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:s?`${n.searchResults}${A?`…`:``}`:n.recentRecords}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[j.map(e=>{let t=L.get(e.id),r=Bt(t);return(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),e.status?(0,Q.jsx)(`span`,{children:e.status}):null,e.sensitivity?(0,Q.jsx)(`span`,{children:e.sensitivity}):null,(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.source.path?(0,Q.jsx)(`span`,{children:e.source.path}):null,(0,Q.jsx)(`span`,{className:`rounded-full border px-2 py-0.5 ${Vt(t)}`,children:r==null?n.noRecallFeedback:`${n.recallQuality} ${r}% · ${t?.total??0}`})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),t?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`span`,{children:[n.helpful,`: `,t.helpful]}),(0,Q.jsxs)(`span`,{children:[n.notHelpful,`: `,t.notHelpful]}),t.mixed?(0,Q.jsxs)(`span`,{children:[n.mixed,`: `,t.mixed]}):null,t.irrelevant?(0,Q.jsxs)(`span`,{children:[n.irrelevant,`: `,t.irrelevant]}):null]}):null]},e.id)}),j.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecords}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providers}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:(v?.providers??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[e.id,` · `,e.available?n.available:n.unavailable]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,Q.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>z(e.id),children:n.test}),m[e.id]?(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:m[e.id]}):null]})]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.recallQuality}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[I.slice(0,8).map(e=>{let t=(y?.records??[]).find(t=>t.id===e.recordId),r=Bt(e);return(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 font-medium text-fg`,children:t?.kind??n.record}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 ${Vt(e)}`,children:[r??0,`%`]})]}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-fg-muted`,children:t?.content??e.recordId}),(0,Q.jsxs)(`div`,{className:`mt-2`,children:[e.helpful,` `,n.helpful,` · `,e.notHelpful,` `,n.notHelpful,` · `,e.total,` `,n.feedback]})]},e.recordId)}),I.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecallFeedback}):null]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.signals}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:(C?.signals??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`div`,{className:`font-medium text-fg`,children:e.source}),(0,Q.jsxs)(`div`,{children:[e.providerId??`local`,` · `,new Date(e.createdAt).toLocaleString()]})]},e.signalId))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.trace}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:(w?.traces??[]).slice(0,20).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`font-medium text-fg`,children:[e.phase,` · `,e.providerId]}),(0,Q.jsxs)(`div`,{children:[e.resultCount??0,` `,(e.resultCount??0)===1?n.result:n.results,` · `,e.durationMs,` ms`]}),e.skippedReason?(0,Q.jsxs)(`div`,{children:[n.skipped,`: `,e.skippedReason]}):null,e.error?(0,Q.jsx)(`div`,{className:`text-danger`,children:e.error}):null]},e.traceId))})]})]})]})]})}function Ut(e){let t=(0,Z.c)(28),{label:n,mode:r,value:a,inheritedFrom:o,inheritLabel:s,overrideLabel:c,onClick:l}=e,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=u);let d=a||`—`,f;t[2]===d?f=t[3]:(f=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==o||t[5]!==r?(p=r===`inherit`&&o?(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:o}):null,t[4]=o,t[5]=r,t[6]=p):p=t[6];let m;t[7]!==u||t[8]!==f||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[u,f,p]}),t[7]=u,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,g;t[11]===h?g=t[12]:(g=i(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,h),t[11]=h,t[12]=g);let _=r===`inherit`?s:c,v;t[13]!==g||t[14]!==_?(v=(0,Q.jsx)(`span`,{className:g,children:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==m||t[17]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[m,v]}),t[16]=m,t[17]=v,t[18]=y):y=t[18];let b=y,x=l?`w-full text-left transition-colors hover:border-edge hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 active:scale-[0.995] motion-reduce:active:scale-100`:void 0,S;t[19]===x?S=t[20]:(S=i(`flex flex-col gap-1 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,x),t[19]=x,t[20]=S);let C=S;if(l){let e;return t[21]!==C||t[22]!==b||t[23]!==l?(e=(0,Q.jsx)(`button`,{type:`button`,className:C,onClick:l,children:b}),t[21]=C,t[22]=b,t[23]=l,t[24]=e):e=t[24],e}let w;return t[25]!==C||t[26]!==b?(w=(0,Q.jsx)(`div`,{className:C,children:b}),t[25]=C,t[26]=b,t[27]=w):w=t[27],w}function Wt(e){let t=(0,Z.c)(38),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditModelStrategy:s,onEditWorkspace:c}=e,l=n.inheritance,u;t[0]===a?u=t[1]:(u=a.trim(),t[0]=a,t[1]=u);let d=!u,f;t[2]!==o||t[3]!==i?(f=!o.trim()||i.trim().length>0&&o.trim()===i.trim(),t[2]=o,t[3]=i,t[4]=f):f=t[4];let p=f,m=d?r||l.unset:a,h=p?i||l.unset:o,g;t[5]!==l.subtitle||t[6]!==l.title?(g=(0,Q.jsx)(pt,{icon:Ie,title:l.title,subtitle:l.subtitle}),t[5]=l.subtitle,t[6]=l.title,t[7]=g):g=t[7];let _=d?`inherit`:`override`,v;t[8]!==r||t[9]!==l.inheritsValue||t[10]!==d?(v=d&&r?l.inheritsValue.replace(`{{value}}`,r):void 0,t[8]=r,t[9]=l.inheritsValue,t[10]=d,t[11]=v):v=t[11];let y;t[12]!==m||t[13]!==l.badgeInherit||t[14]!==l.badgeOverride||t[15]!==l.modelLabel||t[16]!==s||t[17]!==_||t[18]!==v?(y=(0,Q.jsx)(Ut,{label:l.modelLabel,mode:_,value:m,inheritedFrom:v,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:s}),t[12]=m,t[13]=l.badgeInherit,t[14]=l.badgeOverride,t[15]=l.modelLabel,t[16]=s,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b=p?`inherit`:`override`,x;t[20]!==i||t[21]!==l.inheritsValue||t[22]!==p?(x=p&&i?l.inheritsValue.replace(`{{value}}`,i):void 0,t[20]=i,t[21]=l.inheritsValue,t[22]=p,t[23]=x):x=t[23];let S;t[24]!==h||t[25]!==l.badgeInherit||t[26]!==l.badgeOverride||t[27]!==l.workspaceLabel||t[28]!==c||t[29]!==b||t[30]!==x?(S=(0,Q.jsx)(Ut,{label:l.workspaceLabel,mode:b,value:h,inheritedFrom:x,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:c}),t[24]=h,t[25]=l.badgeInherit,t[26]=l.badgeOverride,t[27]=l.workspaceLabel,t[28]=c,t[29]=b,t[30]=x,t[31]=S):S=t[31];let C;t[32]!==y||t[33]!==S?(C=(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[y,S]}),t[32]=y,t[33]=S,t[34]=C):C=t[34];let w;return t[35]!==g||t[36]!==C?(w=(0,Q.jsxs)(mt,{children:[g,C]}),t[35]=g,t[36]=C,t[37]=w):w=t[37],w}function Gt(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Kt(e){let t=(0,Z.c)(5),{source:n}=e,r;if(t[0]!==n){let e=n.startsWith(`preset:`),a=n.startsWith(`agent:`);r=i(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium`,e&&`border-accent/25 bg-accent/10 text-accent`,a&&`border-edge bg-surface-base text-fg-muted`,!e&&!a&&`border-edge-subtle bg-surface-panel text-fg-subtle`),t[0]=n,t[1]=r}else r=t[1];let a;return t[2]!==n||t[3]!==r?(a=(0,Q.jsx)(`span`,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=a):a=t[4],a}function qt(e){let t=(0,Z.c)(13),n;t[0]===e.name?n=t[1]:(n=(0,Q.jsx)(`div`,{className:`min-w-0 truncate font-mono text-xs font-medium text-fg`,children:e.name}),t[0]=e.name,t[1]=n);let r=e.monoValue&&`font-mono text-xs`,a;t[2]===r?a=t[3]:(a=i(`min-w-0 truncate text-sm text-fg`,r),t[2]=r,t[3]=a);let o;t[4]!==e.value||t[5]!==a?(o=(0,Q.jsx)(`div`,{className:a,children:e.value}),t[4]=e.value,t[5]=a,t[6]=o):o=t[6];let s;t[7]===e.source?s=t[8]:(s=(0,Q.jsx)(Kt,{source:e.source}),t[7]=e.source,t[8]=s);let c;return t[9]!==n||t[10]!==o||t[11]!==s?(c=(0,Q.jsxs)(`div`,{className:`grid gap-2 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 sm:grid-cols-[minmax(0,10rem)_minmax(0,1fr)_auto] sm:items-center`,children:[n,o,s]}),t[9]=n,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Jt(e,t){return e&&e.length>0?e.join(`, `):t}function Yt(e){let t=(0,Z.c)(30),{a:n,selected:r}=e,i;t[0]===r.id?i=t[1]:(i=r.id?[`agent-effective-manifest`,r.id]:null,t[0]=r.id,t[1]=i);let a;t[2]===r.id?a=t[3]:(a=()=>it(r.id),t[2]=r.id,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[4]=o):o=t[4];let{data:s,error:c,isLoading:l}=d(i,a,o),u=s?.manifest,f;t[5]!==s?.presetChain||t[6]!==u?.extends?(f=s?.presetChain??u?.extends??[],t[5]=s?.presetChain,t[6]=u?.extends,t[7]=f):f=t[7];let p=f,m;if(t[8]!==n.effectiveBoundariesTitle||t[9]!==n.effectiveEmpty||t[10]!==n.effectiveError||t[11]!==n.effectiveHint||t[12]!==n.effectiveLoading||t[13]!==n.effectiveMemoryTitle||t[14]!==n.effectiveModelsTitle||t[15]!==n.effectiveNoPresets||t[16]!==n.effectiveNoToolPolicies||t[17]!==n.effectivePresetChain||t[18]!==n.effectiveSkillsTitle||t[19]!==n.effectiveTitle||t[20]!==n.effectiveToolsTitle||t[21]!==s?.sources||t[22]!==c||t[23]!==l||t[24]!==u||t[25]!==p){let e=s?.sources??{},r=Object.entries(u?.models?.roles??{}).sort(Zt),i=Object.entries(u?.tools?.builtin??{}).sort(Xt),a=u?.skills,o=u?.memory,d=u?.boundaries,f;t[27]!==n.effectiveHint||t[28]!==n.effectiveTitle?(f=(0,Q.jsx)(pt,{icon:L,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[27]=n.effectiveHint,t[28]=n.effectiveTitle,t[29]=f):f=t[29],m=(0,Q.jsxs)(mt,{children:[f,l?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveLoading}):c?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c instanceof Error?c.message:n.effectiveError}):u?(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectivePresetChain}),(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-sm text-fg`,children:p.length?p.join(` -> `):n.effectiveNoPresets})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveModelsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(qt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Gt(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(qt,{name:n,value:r.model,monoValue:!0,source:Gt(e,[`models.roles.${n}.model`,`models.roles.${n}`])},n)})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveToolsTitle}),i.length>0?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map(t=>{let[n,r]=t;return(0,Q.jsx)(qt,{name:n,value:r.mode,source:Gt(e,[`tools.builtin.${n}.mode`,`tools.builtin.${n}`])},n)})}):(0,Q.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:n.effectiveNoToolPolicies})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveSkillsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(qt,{name:`mode`,value:a?.mode??`all`,source:Gt(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(qt,{name:`allow`,value:Jt(a.allow,`—`),source:Gt(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(qt,{name:`deny`,value:Jt(a.deny,`—`),source:Gt(e,[`skills.deny`,`skills`])}):null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveMemoryTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(qt,{name:`mode`,value:o?.mode??`off`,source:Gt(e,[`memory.mode`,`memory`])}),(0,Q.jsx)(qt,{name:`sources`,value:Jt(o?.sources,`—`),source:Gt(e,[`memory.sources`,`memory`])})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveBoundariesTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(qt,{name:`requiresConfirmation`,value:Jt(d?.requiresConfirmation,`—`),source:Gt(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(qt,{name:`forbidden`,value:Jt(d?.forbidden,`—`),source:Gt(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(qt,{name:`escalation`,value:Jt(d?.escalation,`—`),source:Gt(e,[`boundaries.escalation`,`boundaries`])})]})]})]})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveEmpty})]}),t[8]=n.effectiveBoundariesTitle,t[9]=n.effectiveEmpty,t[10]=n.effectiveError,t[11]=n.effectiveHint,t[12]=n.effectiveLoading,t[13]=n.effectiveMemoryTitle,t[14]=n.effectiveModelsTitle,t[15]=n.effectiveNoPresets,t[16]=n.effectiveNoToolPolicies,t[17]=n.effectivePresetChain,t[18]=n.effectiveSkillsTitle,t[19]=n.effectiveTitle,t[20]=n.effectiveToolsTitle,t[21]=s?.sources,t[22]=c,t[23]=l,t[24]=u,t[25]=p,t[26]=m}else m=t[26];return m}function Xt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Zt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Qt(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1`,children:(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-5 pb-6`,children:n})}),t[0]=n,t[1]=r),r}function $t(e){let t=(0,Z.c)(4),{active:n,children:r,onClick:i}=e,a=n?`rounded-md bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg`:`rounded-md px-3 py-1.5 text-sm font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,Q.jsx)(`button`,{type:`button`,onClick:i,className:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function en(e){let t=(0,Z.c)(41),{a:n,selected:r,busy:i,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}=e,[p,m]=(0,$.useState)(`sources`),h=p===`sources`,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>m(`sources`),t[0]=g):g=t[0];let _;t[1]!==n.configSubtabSources||t[2]!==h?(_=(0,Q.jsx)($t,{active:h,onClick:g,children:n.configSubtabSources}),t[1]=n.configSubtabSources,t[2]=h,t[3]=_):_=t[3];let v=p===`shared`,y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(`shared`),t[4]=y):y=t[4];let b;t[5]!==n.configSubtabShared||t[6]!==v?(b=(0,Q.jsx)($t,{active:v,onClick:y,children:n.configSubtabShared}),t[5]=n.configSubtabShared,t[6]=v,t[7]=b):b=t[7];let x=p===`effective`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>m(`effective`),t[8]=S):S=t[8];let C;t[9]!==n.configSubtabEffective||t[10]!==x?(C=(0,Q.jsx)($t,{active:x,onClick:S,children:n.configSubtabEffective}),t[9]=n.configSubtabEffective,t[10]=x,t[11]=C):C=t[11];let w;t[12]!==_||t[13]!==b||t[14]!==C?(w=(0,Q.jsx)(`div`,{className:`shrink-0 rounded-lg border border-edge bg-surface-panel p-1`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[_,b,C]})}),t[12]=_,t[13]=b,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==n||t[17]!==s||t[18]!==c||t[19]!==a||t[20]!==o||t[21]!==p?(T=p===`sources`?(0,Q.jsx)(tn,{a:n,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c}):null,t[16]=n,t[17]=s,t[18]=c,t[19]=a,t[20]=o,t[21]=p,t[22]=T):T=t[22];let E;t[23]!==n||t[24]!==i||t[25]!==l||t[26]!==u||t[27]!==f||t[28]!==d||t[29]!==r||t[30]!==p?(E=p===`shared`?(0,Q.jsx)(nn,{a:n,selected:r,busy:i,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}):null,t[23]=n,t[24]=i,t[25]=l,t[26]=u,t[27]=f,t[28]=d,t[29]=r,t[30]=p,t[31]=E):E=t[31];let D;t[32]!==n||t[33]!==r||t[34]!==p?(D=p===`effective`?(0,Q.jsx)(on,{a:n,selected:r}):null,t[32]=n,t[33]=r,t[34]=p,t[35]=D):D=t[35];let O;return t[36]!==w||t[37]!==T||t[38]!==E||t[39]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[w,T,E,D]}),t[36]=w,t[37]=T,t[38]=E,t[39]=D,t[40]=O):O=t[40],O}function tn(e){let t=(0,Z.c)(7),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s}=e,c;return t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==r||t[4]!==i||t[5]!==s?(c=(0,Q.jsx)(Qt,{children:(0,Q.jsx)(Wt,{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s})}),t[0]=n,t[1]=a,t[2]=o,t[3]=r,t[4]=i,t[5]=s,t[6]=c):c=t[6],c}function nn(e){let t=(0,Z.c)(72),{a:n,selected:r,busy:i,capabilityPresets:a,defaultPresetId:o,onUpdateAgentExtends:s,onOpenCapabilityPreset:c}=e,l=o===void 0?`default`:o,u;t[0]===a?u=t[1]:(u=new Map(a.map(an)),t[0]=a,t[1]=u);let d=u,f;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==d?(f=d.get(l)??{id:l,name:n.capabilityPresetsGlobalDefault,description:n.capabilityPresetsGlobalDefaultHint},t[2]=n.capabilityPresetsGlobalDefault,t[3]=n.capabilityPresetsGlobalDefaultHint,t[4]=l,t[5]=d,t[6]=f):f=t[6];let p=f,m,g,_,v,y;if(t[7]!==n.capabilityPresetAdd||t[8]!==n.capabilityPresetMoveDown||t[9]!==n.capabilityPresetMoveUp||t[10]!==n.capabilityPresetRemove||t[11]!==n.capabilityPresetsEmptyAdditional||t[12]!==n.capabilityPresetsGlobalDefault||t[13]!==n.capabilityPresetsGlobalDefaultHint||t[14]!==n.capabilityPresetsHint||t[15]!==n.capabilityPresetsManage||t[16]!==n.capabilityPresetsTitle||t[17]!==i||t[18]!==a||t[19]!==l||t[20]!==p.description||t[21]!==p.id||t[22]!==p.name||t[23]!==c||t[24]!==s||t[25]!==d||t[26]!==r.extends){let e;t[32]===l?e=t[33]:(e=e=>e!==l,t[32]=l,t[33]=e);let o=r.extends.filter(e),u=a.map(rn).filter(e=>e!==l&&!o.includes(e)),f=u[0]??``;g=Qt,m=mt;let b;t[34]===c?b=t[35]:(b=()=>c(``),t[34]=c,t[35]=b);let x;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(et,{className:`size-3.5`,"aria-hidden":!0}),t[36]=x):x=t[36];let S;t[37]!==n.capabilityPresetsManage||t[38]!==i||t[39]!==b?(S=(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:i,onClick:b,children:[x,n.capabilityPresetsManage]}),t[37]=n.capabilityPresetsManage,t[38]=i,t[39]=b,t[40]=S):S=t[40],t[41]!==n.capabilityPresetsHint||t[42]!==n.capabilityPresetsTitle||t[43]!==S?(_=(0,Q.jsx)(pt,{icon:M,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:S}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=S,t[44]=_):_=t[44];let w;t[45]!==p.id||t[46]!==c?(w=()=>c(p.id),t[45]=p.id,t[46]=c,t[47]=w):w=t[47];let T=p.name||n.capabilityPresetsGlobalDefault,E;t[48]===T?E=t[49]:(E=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:T}),t[48]=T,t[49]=E);let D;t[50]===n.capabilityPresetsGlobalDefault?D=t[51]:(D=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full border border-accent/25 bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:n.capabilityPresetsGlobalDefault}),t[50]=n.capabilityPresetsGlobalDefault,t[51]=D);let O;t[52]!==E||t[53]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[E,D]}),t[52]=E,t[53]=D,t[54]=O):O=t[54];let k;t[55]===p.id?k=t[56]:(k=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:p.id}),t[55]=p.id,t[56]=k);let A=p.description||n.capabilityPresetsGlobalDefaultHint,j;t[57]===A?j=t[58]:(j=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:A}),t[57]=A,t[58]=j);let N;t[59]!==w||t[60]!==O||t[61]!==k||t[62]!==j?(N=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-accent/25 bg-accent-soft/20 px-3 py-2 sm:flex-row sm:items-center sm:justify-between`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:w,children:[O,k,j]})}),t[59]=w,t[60]=O,t[61]=k,t[62]=j,t[63]=N):N=t[63],v=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[N,o.length>0?o.map((e,t)=>{let r=d.get(e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:r?.name??e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:e}),r?.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:r.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===0,"aria-label":n.capabilityPresetMoveUp,onClick:()=>{let e=[...o],[n,r]=[e[t],e[t-1]];e[t-1]=n,e[t]=r,s(e)},children:(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===o.length-1,"aria-label":n.capabilityPresetMoveDown,onClick:()=>{let e=[...o],[n,r]=[e[t+1],e[t]];e[t]=n,e[t+1]=r,s(e)},children:(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i,"aria-label":n.capabilityPresetRemove,onClick:()=>s(o.filter(t=>t!==e)),children:(0,Q.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-3 text-sm text-fg-muted`,children:n.capabilityPresetsEmptyAdditional})]}),y=u.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,Q.jsx)(`select`,{className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,disabled:i,defaultValue:f,children:u.map(e=>(0,Q.jsx)(`option`,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:i||!f,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||f;t&&s([...o,t])},children:[(0,Q.jsx)($e,{className:`size-4`,"aria-hidden":!0}),n.capabilityPresetAdd]})]}):null,t[7]=n.capabilityPresetAdd,t[8]=n.capabilityPresetMoveDown,t[9]=n.capabilityPresetMoveUp,t[10]=n.capabilityPresetRemove,t[11]=n.capabilityPresetsEmptyAdditional,t[12]=n.capabilityPresetsGlobalDefault,t[13]=n.capabilityPresetsGlobalDefaultHint,t[14]=n.capabilityPresetsHint,t[15]=n.capabilityPresetsManage,t[16]=n.capabilityPresetsTitle,t[17]=i,t[18]=a,t[19]=l,t[20]=p.description,t[21]=p.id,t[22]=p.name,t[23]=c,t[24]=s,t[25]=d,t[26]=r.extends,t[27]=m,t[28]=g,t[29]=_,t[30]=v,t[31]=y}else m=t[27],g=t[28],_=t[29],v=t[30],y=t[31];let b;t[64]!==m||t[65]!==_||t[66]!==v||t[67]!==y?(b=(0,Q.jsxs)(m,{children:[_,v,y]}),t[64]=m,t[65]=_,t[66]=v,t[67]=y,t[68]=b):b=t[68];let x;return t[69]!==g||t[70]!==b?(x=(0,Q.jsx)(g,{children:b}),t[69]=g,t[70]=b,t[71]=x):x=t[71],x}function rn(e){return e.id}function an(e){return[e.id,e]}function on(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(Qt,{children:(0,Q.jsx)(Yt,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function sn(e){let t=(0,Z.c)(10),{a:n,selected:r,busy:i,onDelete:a}=e,o;return t[0]!==n.dangerZoneBody||t[1]!==n.dangerZoneHint||t[2]!==n.dangerZoneMainUnavailable||t[3]!==n.dangerZoneTitle||t[4]!==n.purgeDisk||t[5]!==n.removeFromConfig||t[6]!==i||t[7]!==a||t[8]!==r.id?(o=(0,Q.jsx)(Qt,{children:r.id===`main`?(0,Q.jsx)(mt,{children:(0,Q.jsx)(pt,{icon:ct,title:n.dangerZoneTitle,subtitle:n.dangerZoneMainUnavailable})}):(0,Q.jsxs)(mt,{className:`border border-red-200/70 bg-red-50/60 dark:border-red-900/50 dark:bg-red-950/25`,children:[(0,Q.jsx)(pt,{icon:ct,title:n.dangerZoneTitle,subtitle:n.dangerZoneHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`max-w-xl text-sm text-red-800 dark:text-red-200`,children:n.dangerZoneBody}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(fe,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`border-red-200 text-red-700 hover:bg-red-100 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/50`,disabled:i,onClick:()=>void a(!0),children:n.purgeDisk})]})]})]})}),t[0]=n.dangerZoneBody,t[1]=n.dangerZoneHint,t[2]=n.dangerZoneMainUnavailable,t[3]=n.dangerZoneTitle,t[4]=n.purgeDisk,t[5]=n.removeFromConfig,t[6]=i,t[7]=a,t[8]=r.id,t[9]=o):o=t[9],o}var cn=i(q,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function ln(e){let t=(0,Z.c)(62),{a:n,busy:r,bindingsLoading:a,agentBindings:o,onRemoveBinding:s,onAddBinding:c,channelStatuses:l,channelsStatusLoading:u,useManualChannel:d,newBindChannel:f,setNewBindChannel:p,bindSessionChats:m,sessionsLoading:h,newBindSessionIdx:g,setNewBindSessionIdx:_,newBindCustomPeer:v,setNewBindCustomPeer:y,onRefreshSessions:b,lastActiveLabels:x,selectRecipient:S}=e,C=!u&&(d||l.length>0),w;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(w=(0,Q.jsx)(pt,{className:`shrink-0`,icon:Ie,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=w):w=t[2];let T;t[3]!==n.channelsLoading||t[4]!==n.channelsNone||t[5]!==n.removeBinding||t[6]!==o||t[7]!==a||t[8]!==r||t[9]!==s?(T=a?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoading}):o.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:o.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:St(e.match)}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void s(e),children:n.removeBinding})]},`${e.match.channel}-${St(e.match)}`))}),t[3]=n.channelsLoading,t[4]=n.channelsNone,t[5]=n.removeBinding,t[6]=o,t[7]=a,t[8]=r,t[9]=s,t[10]=T):T=t[10];let E;t[11]!==n.channelLabel||t[12]!==n.channelsDisabledSuffix||t[13]!==n.channelsLoadingChannels||t[14]!==n.channelsManualChannelHint||t[15]!==l||t[16]!==u||t[17]!==f||t[18]!==p||t[19]!==y||t[20]!==_||t[21]!==d?(E=u?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoadingChannels}):d?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`input`,{className:Ct(),value:f,onChange:e=>p(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`select`,{className:i(Ct(),`py-2`),value:f,onChange:e=>{p(e.target.value),_(null),y(``)},children:l.map(e=>(0,Q.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:n.channelsDisabledSuffix]},e.name))})]}),t[11]=n.channelLabel,t[12]=n.channelsDisabledSuffix,t[13]=n.channelsLoadingChannels,t[14]=n.channelsManualChannelHint,t[15]=l,t[16]=u,t[17]=f,t[18]=p,t[19]=y,t[20]=_,t[21]=d,t[22]=E):E=t[22];let D;t[23]!==n.channelsCustomPeerHint||t[24]!==n.channelsCustomPeerPlaceholder||t[25]!==n.channelsLoadingSessions||t[26]!==n.channelsNoSessionsHint||t[27]!==n.channelsPeerAny||t[28]!==n.channelsPeerFromSessions||t[29]!==n.channelsRefreshSessions||t[30]!==n.channelsRefreshSessionsHint||t[31]!==n.channelsSessionLabel||t[32]!==n.peerIdLabel||t[33]!==m||t[34]!==r||t[35]!==x||t[36]!==f||t[37]!==v||t[38]!==g||t[39]!==b||t[40]!==S||t[41]!==h||t[42]!==y||t[43]!==_||t[44]!==C?(D=C&&f.trim()?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsSessionLabel}),(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||h||!f.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>b(),children:[(0,Q.jsx)(G,{className:i(`size-3.5`,h&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),h&&m.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsLoadingSessions}):null,(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsPeerFromSessions}),(0,Q.jsxs)(`select`,{className:i(Ct(),`py-2`),value:g==null?``:String(g),disabled:r||!f.trim()||!!v.trim(),onChange:e=>{let t=e.target.value;_(t===``?null:Number(t))},children:[(0,Q.jsx)(`option`,{value:``,children:n.channelsPeerAny}),m.map((e,t)=>(0,Q.jsx)(`option`,{value:String(t),children:bt(e,x)},`${e.channel}-${e.chatId}`))]})]}),m.length===0&&f.trim()&&!h?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,className:i(Ct(),`min-w-0 w-full sm:flex-1`),value:v,onChange:e=>{y(e.target.value),e.target.value.trim()&&_(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Q.jsxs)(`select`,{className:cn,value:v,onChange:e=>{let t=e.target.value;y(t||``),_(null)},children:[(0,Q.jsx)(`option`,{value:``,children:S}),m.map(e=>(0,Q.jsx)(`option`,{value:e.chatId,children:bt(e,x)},`${e.channel}-${e.chatId}`))]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsCustomPeerHint})]})]}):null,t[23]=n.channelsCustomPeerHint,t[24]=n.channelsCustomPeerPlaceholder,t[25]=n.channelsLoadingSessions,t[26]=n.channelsNoSessionsHint,t[27]=n.channelsPeerAny,t[28]=n.channelsPeerFromSessions,t[29]=n.channelsRefreshSessions,t[30]=n.channelsRefreshSessionsHint,t[31]=n.channelsSessionLabel,t[32]=n.peerIdLabel,t[33]=m,t[34]=r,t[35]=x,t[36]=f,t[37]=v,t[38]=g,t[39]=b,t[40]=S,t[41]=h,t[42]=y,t[43]=_,t[44]=C,t[45]=D):D=t[45];let O;t[46]!==r||t[47]!==u||t[48]!==f?(O=r||!f.trim()||u,t[46]=r,t[47]=u,t[48]=f,t[49]=O):O=t[49];let k;t[50]!==n.addBinding||t[51]!==O?(k=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(X,{type:`submit`,disabled:O,children:n.addBinding})}),t[50]=n.addBinding,t[51]=O,t[52]=k):k=t[52];let A;t[53]!==c||t[54]!==E||t[55]!==D||t[56]!==k?(A=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:c,children:[E,D,k]}),t[53]=c,t[54]=E,t[55]=D,t[56]=k,t[57]=A):A=t[57];let j;return t[58]!==w||t[59]!==T||t[60]!==A?(j=(0,Q.jsxs)(mt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[w,T,A]}),t[58]=w,t[59]=T,t[60]=A,t[61]=j):j=t[61],j}function un(e){let t=(0,Z.c)(29),{a:n,filesLoading:r,files:a,activeFile:o,setActiveFile:c,filesViewMode:l,setFilesViewMode:u,fileDraft:d,setFileDraft:f,fileSaving:p,profileFileLoading:m,profileEditorNonce:h,onTryInChat:g}=e,_=s(dn),v;t[0]===n.filesHint?v=t[1]:(v=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[0]=n.filesHint,t[1]=v);let y;t[2]!==n.filesAutoSaveHint||t[3]!==n.filesEmpty||t[4]!==n.filesLoading||t[5]!==n.filesMarkdownEdit||t[6]!==n.filesMarkdownPreview||t[7]!==n.filesNavAria||t[8]!==n.filesSavingStatus||t[9]!==n.missing||t[10]!==n.pickFile||t[11]!==n.tryInChat||t[12]!==o||t[13]!==d||t[14]!==p||t[15]!==a||t[16]!==r||t[17]!==l||t[18]!==_||t[19]!==g||t[20]!==h||t[21]!==m||t[22]!==c||t[23]!==f||t[24]!==u?(y=r?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesLoading}):a?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(`nav`,{className:`-mx-1 flex shrink-0 flex-wrap gap-1 px-1 pb-1`,role:`tablist`,"aria-label":n.filesNavAria,children:a.files.map(e=>{let t=o===e.name;return(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:i(`inline-flex shrink-0 items-center rounded-lg px-3 py-2 font-mono text-xs font-medium whitespace-nowrap transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Qe.press,t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`,e.missing&&`opacity-60`),onClick:()=>c(e.name),children:[e.name,e.missing?` (${n.missing})`:``]},e.name)})}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":`${n.filesMarkdownEdit} / ${n.filesMarkdownPreview}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Qe.press,l===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`edit`),children:[(0,Q.jsx)(je,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Qe.press,l===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`preview`),children:[(0,Q.jsx)(xe,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[p?(0,Q.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,Q.jsx)(`span`,{children:n.filesAutoSaveHint}),g?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(at,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),l===`edit`?(0,Q.jsx)(`div`,{className:i(Ct(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(ft,{initialContent:d,onChange:f,isDark:_,className:`min-h-0 flex-1`},`${o??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:i(Ct(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(me,{content:d,className:`text-sm`})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[2]=n.filesAutoSaveHint,t[3]=n.filesEmpty,t[4]=n.filesLoading,t[5]=n.filesMarkdownEdit,t[6]=n.filesMarkdownPreview,t[7]=n.filesNavAria,t[8]=n.filesSavingStatus,t[9]=n.missing,t[10]=n.pickFile,t[11]=n.tryInChat,t[12]=o,t[13]=d,t[14]=p,t[15]=a,t[16]=r,t[17]=l,t[18]=_,t[19]=g,t[20]=h,t[21]=m,t[22]=c,t[23]=f,t[24]=u,t[25]=y):y=t[25];let b;return t[26]!==v||t[27]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[v,y]}),t[26]=v,t[27]=y,t[28]=b):b=t[28],b}function dn(e){return e.resolved===`dark`}function fn(e){let t=(0,Z.c)(66),{a:n,chat:r,selected:i,busy:a,modelRows:o,setModelRows:s,onSaveModels:c,onClearModelsEntry:l,hideInlineSave:u}=e,d;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(d=(0,Q.jsx)(pt,{className:`shrink-0`,icon:P,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=d):d=t[2];let f;t[3]===n.modelsPresetLabel?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsPresetLabel}),t[3]=n.modelsPresetLabel,t[4]=f);let p;t[5]===i.typedModels.preset?p=t[6]:(p=Et(i.typedModels.preset),t[5]=i.typedModels.preset,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,Q.jsxs)(`div`,{children:[f,` `,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===n.modelsEffectiveLabel?h=t[11]:(h=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[10]=n.modelsEffectiveLabel,t[11]=h);let g;t[12]===i.typedModels.effective?g=t[13]:(g=Et(i.typedModels.effective),t[12]=i.typedModels.effective,t[13]=g);let _;t[14]!==h||t[15]!==g?(_=(0,Q.jsxs)(`div`,{children:[h,` `,g]}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==m||t[18]!==_?(v=(0,Q.jsxs)(`div`,{className:`mb-4 grid gap-2 rounded-lg border border-edge-subtle bg-surface-base/60 p-3 text-xs text-fg-muted dark:border-edge`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==n.addTypedModel||t[21]!==n.addTypedModelPurpose||t[22]!==n.removeTypedModel||t[23]!==n.typedModelAddFallback||t[24]!==n.typedModelCustomTitle||t[25]!==n.typedModelDefaultBadge||t[26]!==n.typedModelDescriptionLabel||t[27]!==n.typedModelDescriptionPlaceholder||t[28]!==n.typedModelFallbackEmptyHint||t[29]!==n.typedModelFallbackModelsLabel||t[30]!==n.typedModelFallbackPlaceholder||t[31]!==n.typedModelIdLabel||t[32]!==n.typedModelIdPlaceholder||t[33]!==n.typedModelNoCustomRoles||t[34]!==n.typedModelPrimaryModelLabel||t[35]!==n.typedModelRecommendedTitle||t[36]!==n.typedModelRemoveFallback||t[37]!==n.typedModelRoleDescriptions||t[38]!==n.typedModelRoleNames?(y={id:n.typedModelIdLabel,description:n.typedModelDescriptionLabel,primaryModel:n.typedModelPrimaryModelLabel,fallbackModels:n.typedModelFallbackModelsLabel,addFallback:n.typedModelAddFallback,removeFallback:n.typedModelRemoveFallback,fallbackPlaceholder:n.typedModelFallbackPlaceholder,fallbackEmptyHint:n.typedModelFallbackEmptyHint,add:n.addTypedModel,remove:n.removeTypedModel,recommendedTitle:n.typedModelRecommendedTitle,customTitle:n.typedModelCustomTitle,defaultBadge:n.typedModelDefaultBadge,addPurpose:n.addTypedModelPurpose,noCustomRoles:n.typedModelNoCustomRoles,idPlaceholder:n.typedModelIdPlaceholder,descriptionPlaceholder:n.typedModelDescriptionPlaceholder,roleNames:n.typedModelRoleNames,roleDescriptions:n.typedModelRoleDescriptions},t[20]=n.addTypedModel,t[21]=n.addTypedModelPurpose,t[22]=n.removeTypedModel,t[23]=n.typedModelAddFallback,t[24]=n.typedModelCustomTitle,t[25]=n.typedModelDefaultBadge,t[26]=n.typedModelDescriptionLabel,t[27]=n.typedModelDescriptionPlaceholder,t[28]=n.typedModelFallbackEmptyHint,t[29]=n.typedModelFallbackModelsLabel,t[30]=n.typedModelFallbackPlaceholder,t[31]=n.typedModelIdLabel,t[32]=n.typedModelIdPlaceholder,t[33]=n.typedModelNoCustomRoles,t[34]=n.typedModelPrimaryModelLabel,t[35]=n.typedModelRecommendedTitle,t[36]=n.typedModelRemoveFallback,t[37]=n.typedModelRoleDescriptions,t[38]=n.typedModelRoleNames,t[39]=y):y=t[39];let b;t[40]!==a||t[41]!==r||t[42]!==o||t[43]!==i.typedModels.defaultRole||t[44]!==s||t[45]!==y?(b=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Mt,{rows:o,onChange:s,disabled:a,defaultRole:i.typedModels.defaultRole,chat:r,labels:y})}),t[40]=a,t[41]=r,t[42]=o,t[43]=i.typedModels.defaultRole,t[44]=s,t[45]=y,t[46]=b):b=t[46];let x;t[47]!==n.modelsSave||t[48]!==a||t[49]!==u||t[50]!==c?(x=u?null:(0,Q.jsx)(X,{type:`button`,disabled:a,onClick:()=>void c(),children:n.modelsSave}),t[47]=n.modelsSave,t[48]=a,t[49]=u,t[50]=c,t[51]=x):x=t[51];let S;t[52]===l?S=t[53]:(S=()=>void l(),t[52]=l,t[53]=S);let C;t[54]!==n.modelsResetInherit||t[55]!==a||t[56]!==S?(C=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:S,children:n.modelsResetInherit}),t[54]=n.modelsResetInherit,t[55]=a,t[56]=S,t[57]=C):C=t[57];let w;t[58]!==x||t[59]!==C?(w=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[x,C]}),t[58]=x,t[59]=C,t[60]=w):w=t[60];let T;return t[61]!==d||t[62]!==w||t[63]!==v||t[64]!==b?(T=(0,Q.jsxs)(mt,{className:`flex min-h-0 flex-1 flex-col`,children:[d,v,b,w]}),t[61]=d,t[62]=w,t[63]=v,t[64]=b,t[65]=T):T=t[65],T}function pn(e){let t=(0,Z.c)(37),{value:n,onChange:r,disabled:a,wd:o,placeholder:s,inputClassName:c,trailing:l}=e,u;t[0]!==r||t[1]!==n?(u={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=u):u=t[2];let d=Re(u),f;t[3]===n?f=t[4]:(f=n.trim(),t[3]=n,t[4]=f);let p=f,m=p?`${p}\n${o.chooseFolder}`:`${s??o.notSet}\n${o.selectWorkingDirectory}`,h;t[5]===c?h=t[6]:(h=i(`min-w-0 flex-1`,c),t[5]=c,t[6]=h);let g=a||d.picking,_;t[7]===r?_=t[8]:(_=e=>void r(e.target.value),t[7]=r,t[8]=_);let v=s??o.pathInputPlaceholder,y;t[9]!==h||t[10]!==g||t[11]!==_||t[12]!==v||t[13]!==n?(y=(0,Q.jsx)(`input`,{type:`text`,className:h,value:n,disabled:g,onChange:_,placeholder:v,autoComplete:`off`,spellCheck:!1}),t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=n,t[14]=y):y=t[14];let b=a||d.picking,x;t[15]!==m||t[16]!==d.pick||t[17]!==b||t[18]!==n||t[19]!==o.selectWorkingDirectory?(x=(0,Q.jsx)(rt,{compact:!0,value:n,onPick:d.pick,disabled:b,title:m,"aria-label":o.selectWorkingDirectory}),t[15]=m,t[16]=d.pick,t[17]=b,t[18]=n,t[19]=o.selectWorkingDirectory,t[20]=x):x=t[20];let S;t[21]!==x||t[22]!==l?(S=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[x,l]}),t[21]=x,t[22]=l,t[23]=S):S=t[23];let C;t[24]!==S||t[25]!==y?(C=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[y,S]}),t[24]=S,t[25]=y,t[26]=C):C=t[26];let w;t[27]!==d.confirmPick||t[28]!==d.hasNativePicker||t[29]!==d.modalOpen||t[30]!==d.setModalOpen||t[31]!==p||t[32]!==o?(w=d.hasNativePicker?null:(0,Q.jsx)(de,{open:d.modalOpen,onOpenChange:d.setModalOpen,initialAbsolutePath:p||void 0,onConfirm:d.confirmPick,wd:o}),t[27]=d.confirmPick,t[28]=d.hasNativePicker,t[29]=d.modalOpen,t[30]=d.setModalOpen,t[31]=p,t[32]=o,t[33]=w):w=t[33];let T;return t[34]!==C||t[35]!==w?(T=(0,Q.jsxs)(Q.Fragment,{children:[C,w]}),t[34]=C,t[35]=w,t[36]=T):T=t[36],T}function mn(e,t){switch(e){case`adventurer`:return t.avatarStyleAdventurer;case`bottts`:return t.avatarStyleRobot;case`lorelei`:return t.avatarStyleLorelei;case`thumbs`:return t.avatarStyleThumbs;case`fun-emoji`:return t.avatarStyleFunEmoji;default:return e}}function hn(e){let{agentId:t,value:n,onChange:r,a,id:o}=e,s=(0,$.useRef)(null),[c,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),h=(0,$.useMemo)(()=>{let e=O(n.trim());return e&&T(e.styleId)?e.styleId:F[0]??`adventurer`},[n]),g=(0,$.useCallback)(async(e,n)=>{try{await ze(t)}catch{}r(S(e,n)),p(!1)},[t,r]),_=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){d(null),l(!0);try{await I(t,n),B(t),r(ne)}catch(e){let t=e instanceof Error?e.message:``;d(t===`avatar_too_large`?a.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?a.avatarInvalidImage:a.avatarUploadFailed)}finally{l(!1)}}},[a,t,r]),v=(e,t)=>{let r=O(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...o?{id:o}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:s,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void _(e)}),(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:c,onClick:()=>s.current?.click(),children:[(0,Q.jsx)(we,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),c?a.avatarUploading:a.avatarUploadCustom]})]})]}),u?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:u}):null,(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:F.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void g(e,A[0]??t),className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,Qe.press,h===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:mn(e,a)},e))}),(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[A.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void g(h,e),className:i(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,Qe.press,v(h,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:_t(h,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(D,{open:f,onOpenChange:p,children:[(0,Q.jsx)(z,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:i(`flex size-12 shrink-0 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`,Qe.press),children:a.avatarMore})}),(0,Q.jsx)(w,{children:(0,Q.jsxs)(x,{className:`z-[80] max-h-72 w-[min(22rem,calc(100vw-2rem))] overflow-y-auto rounded-xl border border-edge-subtle bg-surface-panel p-3 shadow-lg`,sideOffset:6,align:`end`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:mn(h,a)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ne.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void g(h,e),className:i(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,Qe.press,v(h,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:_t(h,e,88),alt:``,width:40,height:40,className:`size-10 rounded-full object-cover`,draggable:!1})},e))})]})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.personaAvatar}),(0,Q.jsx)(m,{agentId:t,avatar:n,size:40}),n.trim()&&!O(n.trim())&&n.trim()!==`xopc:custom`?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}function gn(e){let t=(0,Z.c)(207),{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:h,setEditWorkspace:g,editModel:_,setEditModel:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:w,profileMarkdownLoading:T,profileDraft:E,updateIdentity:D,handleSoulTemplateChange:O,handleSoulContentChange:A,setAvatarDialogOpen:j,toggleSoulPreviewMode:P,onTryInChat:F}=e,I=o(yn),L=s(vn),ne;t[0]===E?.identity?ne=t[1]:(ne=E?.identity??{name:``,description:``,language:``,creature:``,emoji:``,avatar:``},t[0]=E?.identity,t[1]=ne);let R=ne,ie=E?.soulTemplate??`professional`,z=E?.soulCustomContent??``,B=E?.soulEditorNonce??0,ae=E?.soulPreviewMode??!1,V=E?.avatarDialogOpen??!1,H;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(H=Ct(),t[2]=H):H=t[2];let U=H,W;t[3]===I?W=t[4]:(W=(e,t)=>I===`zh`?t:e,t[3]=I,t[4]=W);let G=W;if(!a){let e;return t[5]===n.selectAgentHint?e=t[6]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[5]=n.selectAgentHint,t[6]=e),e}let oe;t[7]!==R.avatar||t[8]!==a.id?(oe=(0,Q.jsx)(m,{agentId:a.id,avatar:R.avatar,size:36,className:`size-9 rounded-lg`}),t[7]=R.avatar,t[8]=a.id,t[9]=oe):oe=t[9];let ce;t[10]===j?ce=t[11]:(ce=()=>j(!0),t[10]=j,t[11]=ce);let le;t[12]!==n.avatarOpenSettingsAria||t[13]!==ce?(le={onClick:ce,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[12]=n.avatarOpenSettingsAria,t[13]=ce,t[14]=le):le=t[14];let K;t[15]!==n.globalDefaultBadge||t[16]!==n.tuiDefaultBadge||t[17]!==n.tuiDefaultInheritedBadge||t[18]!==x||t[19]!==S||t[20]!==a.isDefault?(K=a.isDefault||x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[a.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,x?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:S?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null]}):null,t[15]=n.globalDefaultBadge,t[16]=n.tuiDefaultBadge,t[17]=n.tuiDefaultInheritedBadge,t[18]=x,t[19]=S,t[20]=a.isDefault,t[21]=K):K=t[21];let q;t[22]!==n.setDefault||t[23]!==n.setTuiDefault||t[24]!==c||t[25]!==x||t[26]!==y||t[27]!==b||t[28]!==a.isDefault?(q=!a.isDefault||!x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[a.isDefault?null:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:c,onClick:()=>void y(),children:n.setDefault}),x?null:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:c,onClick:()=>void b(),children:n.setTuiDefault})]}):null,t[22]=n.setDefault,t[23]=n.setTuiDefault,t[24]=c,t[25]=x,t[26]=y,t[27]=b,t[28]=a.isDefault,t[29]=q):q=t[29];let de;t[30]!==n.personaSectionIdentity||t[31]!==n.personaSectionIdentityHint||t[32]!==oe||t[33]!==le||t[34]!==K||t[35]!==q?(de=(0,Q.jsx)(pt,{icon:M,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:oe,iconInteractive:le,titleAccessory:K,trailing:q}),t[30]=n.personaSectionIdentity,t[31]=n.personaSectionIdentityHint,t[32]=oe,t[33]=le,t[34]=K,t[35]=q,t[36]=de):de=t[36];let fe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Q.jsx)(Me,{className:i(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,re)}),t[37]=fe):fe=t[37];let pe;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(pe=i(`fixed left-1/2 top-1/2 w-[min(calc(100vw-2rem),26rem)] max-h-[min(90dvh,36rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,se),t[38]=pe):pe=t[38];let he;t[39]===n.avatarPickerTitle?he=t[40]:(he=(0,Q.jsx)(te,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[39]=n.avatarPickerTitle,t[40]=he);let ge;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ge=i(be,`shrink-0 p-1.5 hover:bg-surface-base`),t[41]=ge):ge=t[41];let _e;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Q.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),t[42]=_e):_e=t[42];let ve;t[43]===n.closeDialogAria?ve=t[44]:(ve=(0,Q.jsx)(ee,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:ge,"aria-label":n.closeDialogAria,children:_e})}),t[43]=n.closeDialogAria,t[44]=ve);let ye;t[45]!==he||t[46]!==ve?(ye=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[he,ve]}),t[45]=he,t[46]=ve,t[47]=ye):ye=t[47];let Se;t[48]===n.avatarRowHint?Se=t[49]:(Se=(0,Q.jsx)(p,{className:`sr-only`,children:n.avatarRowHint}),t[48]=n.avatarRowHint,t[49]=Se);let Ce;t[50]===D?Ce=t[51]:(Ce=e=>D({avatar:e}),t[50]=D,t[51]=Ce);let we;t[52]!==n||t[53]!==R.avatar||t[54]!==a.id||t[55]!==Ce?(we=(0,Q.jsx)(hn,{agentId:a.id,value:R.avatar,onChange:Ce,a:n}),t[52]=n,t[53]=R.avatar,t[54]=a.id,t[55]=Ce,t[56]=we):we=t[56];let Te;t[57]!==ye||t[58]!==Se||t[59]!==we?(Te=(0,Q.jsxs)(k,{children:[fe,(0,Q.jsxs)(Fe,{className:pe,onOpenAutoFocus:_n,children:[ye,Se,we]})]}),t[57]=ye,t[58]=Se,t[59]=we,t[60]=Te):Te=t[60];let Ee;t[61]!==V||t[62]!==j||t[63]!==Te?(Ee=(0,Q.jsx)(N,{open:V,onOpenChange:j,children:Te}),t[61]=V,t[62]=j,t[63]=Te,t[64]=Ee):Ee=t[64];let De;t[65]===n.displayName?De=t[66]:(De=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[65]=n.displayName,t[66]=De);let Oe;t[67]!==u||t[68]!==D?(Oe=e=>{u(e.target.value),D({name:e.target.value})},t[67]=u,t[68]=D,t[69]=Oe):Oe=t[69];let ke;t[70]!==n.personaNamePlaceholder||t[71]!==l||t[72]!==Oe?(ke=(0,Q.jsx)(`input`,{className:U,value:l,onChange:Oe,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[70]=n.personaNamePlaceholder,t[71]=l,t[72]=Oe,t[73]=ke):ke=t[73];let je;t[74]!==De||t[75]!==ke?(je=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[De,ke]}),t[74]=De,t[75]=ke,t[76]=je):je=t[76];let Ne;t[77]===n.personaEmoji?Ne=t[78]:(Ne=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[77]=n.personaEmoji,t[78]=Ne);let Pe;t[79]===D?Pe=t[80]:(Pe=e=>D({emoji:e.target.value}),t[79]=D,t[80]=Pe);let Ie;t[81]!==n.personaEmojiPlaceholder||t[82]!==R.emoji||t[83]!==Pe?(Ie=(0,Q.jsx)(`input`,{className:U,value:R.emoji,onChange:Pe,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[81]=n.personaEmojiPlaceholder,t[82]=R.emoji,t[83]=Pe,t[84]=Ie):Ie=t[84];let Re;t[85]!==Ne||t[86]!==Ie?(Re=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Ne,Ie]}),t[85]=Ne,t[86]=Ie,t[87]=Re):Re=t[87];let ze;t[88]===n.agentDescription?ze=t[89]:(ze=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[88]=n.agentDescription,t[89]=ze);let Be;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Be=i(U,`min-h-16 resize-y text-sm leading-relaxed`),t[90]=Be):Be=t[90];let Ve;t[91]!==f||t[92]!==D?(Ve=e=>{f(e.target.value),D({description:e.target.value})},t[91]=f,t[92]=D,t[93]=Ve):Ve=t[93];let He;t[94]!==n.agentDescriptionPlaceholder||t[95]!==d||t[96]!==Ve?(He=(0,Q.jsx)(`textarea`,{className:Be,value:d,onChange:Ve,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[94]=n.agentDescriptionPlaceholder,t[95]=d,t[96]=Ve,t[97]=He):He=t[97];let Ue;t[98]!==ze||t[99]!==He?(Ue=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ze,He]}),t[98]=ze,t[99]=He,t[100]=Ue):Ue=t[100];let Ge;t[101]===n.personaCreature?Ge=t[102]:(Ge=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[101]=n.personaCreature,t[102]=Ge);let Ke;t[103]===R.creature?Ke=t[104]:(Ke=Ae.some(e=>e.value===R.creature)?R.creature:`__custom__`,t[103]=R.creature,t[104]=Ke);let qe;t[105]===D?qe=t[106]:(qe=e=>{if(e.target.value===`__custom__`){D({creature:``});return}D({creature:e.target.value})},t[105]=D,t[106]=qe);let Je;t[107]===G?Je=t[108]:(Je=Ae.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:G(e.labelEn,e.labelZh)},e.value)),t[107]=G,t[108]=Je);let Ye;t[109]===G?Ye=t[110]:(Ye=G(`Custom…`,`自定义…`),t[109]=G,t[110]=Ye);let Ze;t[111]===Ye?Ze=t[112]:(Ze=(0,Q.jsx)(`option`,{value:`__custom__`,children:Ye}),t[111]=Ye,t[112]=Ze);let $e;t[113]!==Ke||t[114]!==qe||t[115]!==Je||t[116]!==Ze?($e=(0,Q.jsxs)(`select`,{className:U,value:Ke,onChange:qe,children:[Je,Ze]}),t[113]=Ke,t[114]=qe,t[115]=Je,t[116]=Ze,t[117]=$e):$e=t[117];let et;t[118]!==n.personaCreaturePlaceholder||t[119]!==R.creature||t[120]!==D?(et=Ae.some(e=>e.value===R.creature)?null:(0,Q.jsx)(`input`,{className:i(U,`mt-1 text-xs`),value:R.creature,onChange:e=>D({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[118]=n.personaCreaturePlaceholder,t[119]=R.creature,t[120]=D,t[121]=et):et=t[121];let tt;t[122]!==Ge||t[123]!==$e||t[124]!==et?(tt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[Ge,$e,et]}),t[122]=Ge,t[123]=$e,t[124]=et,t[125]=tt):tt=t[125];let nt;t[126]!==je||t[127]!==Re||t[128]!==Ue||t[129]!==tt?(nt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[je,Re,Ue,tt]}),t[126]=je,t[127]=Re,t[128]=Ue,t[129]=tt,t[130]=nt):nt=t[130];let rt;t[131]!==Ee||t[132]!==nt||t[133]!==de?(rt=(0,Q.jsxs)(mt,{children:[de,Ee,nt]}),t[131]=Ee,t[132]=nt,t[133]=de,t[134]=rt):rt=t[134];let it;t[135]!==n.editAgent||t[136]!==n.editAgentHint?(it=(0,Q.jsx)(pt,{icon:Y,title:n.editAgent,subtitle:n.editAgentHint}),t[135]=n.editAgent,t[136]=n.editAgentHint,t[137]=it):it=t[137];let ot;t[138]===n.modelPrimary?ot=t[139]:(ot=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[138]=n.modelPrimary,t[139]=ot);let st;t[140]===v?st=t[141]:(st=e=>v(e),t[140]=v,t[141]=st);let ct;t[142]!==c||t[143]!==r.modelNoMatches||t[144]!==r.modelPlaceholder||t[145]!==r.modelSearchPlaceholder||t[146]!==_||t[147]!==st?(ct=(0,Q.jsx)(J,{className:`min-w-0 flex-1`,value:_,disabled:c,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:st}),t[142]=c,t[143]=r.modelNoMatches,t[144]=r.modelPlaceholder,t[145]=r.modelSearchPlaceholder,t[146]=_,t[147]=st,t[148]=ct):ct=t[148];let lt;t[149]!==n.modelClear||t[150]!==c||t[151]!==_||t[152]!==v?(lt=_.trim()?(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:c,onClick:()=>v(``),children:n.modelClear}):null,t[149]=n.modelClear,t[150]=c,t[151]=_,t[152]=v,t[153]=lt):lt=t[153];let ut;t[154]!==ct||t[155]!==lt?(ut=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[ct,lt]}),t[154]=ct,t[155]=lt,t[156]=ut):ut=t[156];let dt;t[157]!==ot||t[158]!==ut?(dt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ot,ut]}),t[157]=ot,t[158]=ut,t[159]=dt):dt=t[159];let ht;t[160]===n.workspacePath?ht=t[161]:(ht=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[160]=n.workspacePath,t[161]=ht);let gt=r.workingDirectory,_t=r.workingDirectory.notSet,vt;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(vt=i(U,`font-mono text-xs`),t[162]=vt):vt=t[162];let yt;t[163]!==c||t[164]!==r.workingDirectory||t[165]!==h||t[166]!==g?(yt=(0,Q.jsx)(pn,{value:h,onChange:g,disabled:c,wd:gt,placeholder:_t,inputClassName:vt}),t[163]=c,t[164]=r.workingDirectory,t[165]=h,t[166]=g,t[167]=yt):yt=t[167];let bt;t[168]!==ht||t[169]!==yt?(bt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ht,yt]}),t[168]=ht,t[169]=yt,t[170]=bt):bt=t[170];let xt;t[171]!==dt||t[172]!==bt?(xt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[dt,bt]}),t[171]=dt,t[172]=bt,t[173]=xt):xt=t[173];let St;t[174]!==n.save||t[175]!==n.tryInChat||t[176]!==c||t[177]!==w||t[178]!==C||t[179]!==F?(St=w?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(X,{type:`button`,disabled:c,onClick:()=>void C(),children:n.save}),F?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:c,onClick:F,children:[(0,Q.jsx)(at,{className:`mr-1.5 size-4`,"aria-hidden":!0}),n.tryInChat]}):null]}),t[174]=n.save,t[175]=n.tryInChat,t[176]=c,t[177]=w,t[178]=C,t[179]=F,t[180]=St):St=t[180];let wt;t[181]!==it||t[182]!==xt||t[183]!==St?(wt=(0,Q.jsxs)(mt,{children:[it,xt,St]}),t[181]=it,t[182]=xt,t[183]=St,t[184]=wt):wt=t[184];let Tt;t[185]!==n.loading||t[186]!==n.personaSectionSoul||t[187]!==n.personaSectionSoulHint||t[188]!==n.personaSoulCustomEdit||t[189]!==n.personaSoulEdit||t[190]!==n.personaSoulPreview||t[191]!==n.personaSoulTemplate||t[192]!==A||t[193]!==O||t[194]!==L||t[195]!==G||t[196]!==T||t[197]!==z||t[198]!==B||t[199]!==ae||t[200]!==ie||t[201]!==P?(Tt=T?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.loading}):(0,Q.jsxs)(mt,{children:[(0,Q.jsx)(pt,{icon:We,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:ue.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:i(`flex flex-col items-center gap-1.5 rounded-xl border-2 p-3 text-center transition-all`,Qe.pressCard,ie===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>O(e.id),children:[(0,Q.jsx)(`span`,{className:`text-xl`,children:e.emoji}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:G(e.labelEn,e.labelZh)})]},e.id))})]}),ie===`custom`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulCustomEdit}),(0,Q.jsx)(`button`,{type:`button`,className:i(be,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:ae?n.personaSoulEdit:n.personaSoulPreview,"aria-label":ae?n.personaSoulEdit:n.personaSoulPreview,onClick:P,children:ae?(0,Q.jsx)(Xe,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(xe,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:i(U,`flex min-h-64 flex-col overflow-hidden p-0`),children:ae?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(me,{content:z})}):(0,Q.jsx)(ft,{initialContent:z,onChange:A,isDark:L,className:`min-h-0 flex-1`},`soul-${B}`)})]}):null]}),t[185]=n.loading,t[186]=n.personaSectionSoul,t[187]=n.personaSectionSoulHint,t[188]=n.personaSoulCustomEdit,t[189]=n.personaSoulEdit,t[190]=n.personaSoulPreview,t[191]=n.personaSoulTemplate,t[192]=A,t[193]=O,t[194]=L,t[195]=G,t[196]=T,t[197]=z,t[198]=B,t[199]=ae,t[200]=ie,t[201]=P,t[202]=Tt):Tt=t[202];let Et;return t[203]!==rt||t[204]!==wt||t[205]!==Tt?(Et=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[rt,wt,Tt]}),t[203]=rt,t[204]=wt,t[205]=Tt,t[206]=Et):Et=t[206],Et}function _n(e){return e.preventDefault()}function vn(e){return e.resolved===`dark`}function yn(e){return e.language}function bn(e){let t=(0,Z.c)(13),{label:n,value:r,badge:i,mono:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s;t[2]===i?s=t[3]:(s=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:i}),t[2]=i,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l=a?`mt-2 truncate font-mono text-xs text-fg`:`mt-2 truncate text-sm font-medium text-fg`,u;t[7]!==l||t[8]!==r?(u=(0,Q.jsx)(`p`,{className:l,children:r}),t[7]=l,t[8]=r,t[9]=u):u=t[9];let d;return t[10]!==c||t[11]!==u?(d=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function xn(e){let t=(0,Z.c)(12),{icon:n,label:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.8,"aria-hidden":!0})}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:i}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Sn(e){let t=(0,Z.c)(121),{a:n,selected:r,defaultModel:i,defaultWorkspace:a,isTuiDefault:o,isTuiDefaultInherited:s,busy:c,onSetDefault:l,onSetTuiDefault:u,onTryInChat:d}=e,f;t[0]!==n||t[1]!==r?(f=Se(r,n),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p=f,h;t[3]!==n||t[4]!==r?(h=ve(r,n)||n.listNoDescription,t[3]=n,t[4]=r,t[5]=h):h=t[5];let g=h,_;t[6]!==n.listUnsetValue||t[7]!==i||t[8]!==r.model?.primary?(_=r.model?.primary?.trim()||i||n.listUnsetValue,t[6]=n.listUnsetValue,t[7]=i,t[8]=r.model?.primary,t[9]=_):_=t[9];let v=_,y;t[10]!==n.listUnsetValue||t[11]!==a||t[12]!==r.workspace?(y=r.workspace?.trim()||a||n.listUnsetValue,t[10]=n.listUnsetValue,t[11]=a,t[12]=r.workspace,t[13]=y):y=t[13];let b=y,x=r.model?.primary?.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,S=r.workspace?.trim()&&r.workspace.trim()!==a.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,C=r.tools.effectiveDisable.length,w=r.skills.effectiveAllowlist?.length,T;t[14]!==r.avatar||t[15]!==r.id?(T=(0,Q.jsx)(`div`,{className:`flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base ring-1 ring-edge-subtle/50`,children:(0,Q.jsx)(m,{agentId:r.id,avatar:r.avatar,size:56,className:`size-full`})}),t[14]=r.avatar,t[15]=r.id,t[16]=T):T=t[16];let E;t[17]===p?E=t[18]:(E=(0,Q.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:p}),t[17]=p,t[18]=E);let D;t[19]!==n.globalDefaultBadge||t[20]!==r.isDefault?(D=r.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,t[19]=n.globalDefaultBadge,t[20]=r.isDefault,t[21]=D):D=t[21];let O;t[22]!==n.tuiDefaultBadge||t[23]!==n.tuiDefaultInheritedBadge||t[24]!==o||t[25]!==s?(O=o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:s?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null,t[22]=n.tuiDefaultBadge,t[23]=n.tuiDefaultInheritedBadge,t[24]=o,t[25]=s,t[26]=O):O=t[26];let k;t[27]!==E||t[28]!==D||t[29]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[E,D,O]}),t[27]=E,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]===r.id?A=t[32]:(A=(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r.id}),t[31]=r.id,t[32]=A);let N;t[33]!==A||t[34]!==k?(N=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[33]=A,t[34]=k,t[35]=N):N=t[35];let P;t[36]!==N||t[37]!==T?(P=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[T,N]}),t[36]=N,t[37]=T,t[38]=P):P=t[38];let F;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(F=d?(0,Q.jsxs)(X,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(at,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=F):F=t[42];let ee;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(ee=r.isDefault?null:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:c,onClick:l,children:n.setDefault}),t[43]=n.setDefault,t[44]=c,t[45]=l,t[46]=r.isDefault,t[47]=ee):ee=t[47];let I;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(I=o?null:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:c,onClick:u,children:n.setTuiDefault}),t[48]=n.setTuiDefault,t[49]=c,t[50]=o,t[51]=u,t[52]=I):I=t[52];let L;t[53]!==F||t[54]!==ee||t[55]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[F,ee,I]}),t[53]=F,t[54]=ee,t[55]=I,t[56]=L):L=t[56];let te;t[57]!==P||t[58]!==L?(te=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[P,L]}),t[57]=P,t[58]=L,t[59]=te):te=t[59];let ne;t[60]===g?ne=t[61]:(ne=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:g}),t[60]=g,t[61]=ne);let re;t[62]!==te||t[63]!==ne?(re=(0,Q.jsx)(mt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[te,ne]})}),t[62]=te,t[63]=ne,t[64]=re):re=t[64];let ie;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(ie=(0,Q.jsx)(pt,{icon:M,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=ie):ie=t[67];let z;t[68]!==n.modelPrimary||t[69]!==x||t[70]!==v?(z=(0,Q.jsx)(bn,{label:n.modelPrimary,value:v,badge:x,mono:!0}),t[68]=n.modelPrimary,t[69]=x,t[70]=v,t[71]=z):z=t[71];let B;t[72]!==n.workspacePath||t[73]!==S||t[74]!==b?(B=(0,Q.jsx)(bn,{label:n.workspacePath,value:b,badge:S,mono:!0}),t[72]=n.workspacePath,t[73]=S,t[74]=b,t[75]=B):B=t[75];let ae;t[76]!==z||t[77]!==B?(ae=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[z,B]}),t[76]=z,t[77]=B,t[78]=ae):ae=t[78];let V;t[79]!==ie||t[80]!==ae?(V=(0,Q.jsxs)(mt,{children:[ie,ae]}),t[79]=ie,t[80]=ae,t[81]=V):V=t[81];let H;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(H=(0,Q.jsx)(pt,{icon:R,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=H):H=t[84];let U;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==C?(U=C>0?n.listToolsDisabledCount.replace(`{{count}}`,String(C)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=C,t[88]=U):U=t[88];let W;t[89]!==n.listToolsLabel||t[90]!==U?(W=(0,Q.jsx)(xn,{icon:nt,label:n.listToolsLabel,value:U}),t[89]=n.listToolsLabel,t[90]=U,t[91]=W):W=t[91];let G;t[92]!==n.listInheritedValue||t[93]!==n.listSkillsCount||t[94]!==w?(G=w?n.listSkillsCount.replace(`{{count}}`,String(w)):n.listInheritedValue,t[92]=n.listInheritedValue,t[93]=n.listSkillsCount,t[94]=w,t[95]=G):G=t[95];let se;t[96]!==n.listSkillsLabel||t[97]!==G?(se=(0,Q.jsx)(xn,{icon:M,label:n.listSkillsLabel,value:G}),t[96]=n.listSkillsLabel,t[97]=G,t[98]=se):se=t[98];let ce;t[99]!==n.memoryTitle||t[100]!==n.overviewMemoryManaged?(ce=(0,Q.jsx)(xn,{icon:j,label:n.memoryTitle,value:n.overviewMemoryManaged}),t[99]=n.memoryTitle,t[100]=n.overviewMemoryManaged,t[101]=ce):ce=t[101];let le;t[102]!==n.connectionsTitle||t[103]!==n.overviewConnectionsManaged?(le=(0,Q.jsx)(xn,{icon:Pe,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[102]=n.connectionsTitle,t[103]=n.overviewConnectionsManaged,t[104]=le):le=t[104];let K;t[105]!==n.listWorkspaceLabel||t[106]!==b?(K=(0,Q.jsx)(xn,{icon:oe,label:n.listWorkspaceLabel,value:b}),t[105]=n.listWorkspaceLabel,t[106]=b,t[107]=K):K=t[107];let ue;t[108]!==W||t[109]!==se||t[110]!==ce||t[111]!==le||t[112]!==K?(ue=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[W,se,ce,le,K]}),t[108]=W,t[109]=se,t[110]=ce,t[111]=le,t[112]=K,t[113]=ue):ue=t[113];let q;t[114]!==H||t[115]!==ue?(q=(0,Q.jsxs)(mt,{children:[H,ue]}),t[114]=H,t[115]=ue,t[116]=q):q=t[116];let de;return t[117]!==re||t[118]!==V||t[119]!==q?(de=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[re,V,q]}),t[117]=re,t[118]=V,t[119]=q,t[120]=de):de=t[120],de}function Cn(e){let t=(0,Z.c)(66),{a:n,selected:r,busy:a,skillsCatalogLoading:o,catalogForPick:s,skillsInherit:c,setSkillsInherit:l,skillsPick:u,setSkillsPick:d,onSaveSkills:f,hideInlineSave:p}=e,m;t[0]===r.skills.effectiveAllowlist?m=t[1]:(m=function(e){let t=r.skills.effectiveAllowlist;return t===void 0?!0:t.length===0?!1:t.includes(e)},t[0]=r.skills.effectiveAllowlist,t[1]=m);let h=m,g;t[2]!==s||t[3]!==r.skills.effectiveAllowlist?(g=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(s.map(wn)):new Set(e)},t[2]=s,t[3]=r.skills.effectiveAllowlist,t[4]=g):g=t[4];let _=g,v;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(v=(0,Q.jsx)(pt,{className:`shrink-0`,icon:E,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=v):v=t[7];let y;t[8]===l?y=t[9]:(y=()=>l(!0),t[8]=l,t[9]=y);let b;t[10]!==n.skillsInherit||t[11]!==a||t[12]!==y?(b=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:y,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=a,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==_||t[15]!==l||t[16]!==d?(x=()=>{l(!1),d(_())},t[14]=_,t[15]=l,t[16]=d,t[17]=x):x=t[17];let S;t[18]!==n.skillsCustomize||t[19]!==a||t[20]!==x?(S=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:x,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=a,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==b||t[23]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b,S]}),t[22]=b,t[23]=S,t[24]=C):C=t[24];let w;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(w=U(`skills`),t[25]=w):w=t[25];let T;t[26]===n.skillsLibraryLink?T=t[27]:(T=(0,Q.jsx)(Ye,{to:w,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=T);let D;t[28]!==C||t[29]!==T?(D=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[C,T]}),t[28]=C,t[29]=T,t[30]=D):D=t[30];let O;t[31]===r.skills.preset?O=t[32]:(O=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=O);let k;t[33]!==n.skillsPresetLabel||t[34]!==O?(k=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,O]}),t[33]=n.skillsPresetLabel,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==c?(A=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):c?n.skillsInherit:`—`,t[36]=n.skillsInherit,t[37]=r.skills.effectiveAllowlist,t[38]=c,t[39]=A):A=t[39];let j;t[40]!==n.skillsEffectiveLabel||t[41]!==A?(j=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,A]}),t[40]=n.skillsEffectiveLabel,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==n.skillsCatalogLoading||t[44]!==n.skillsEmptyCatalog||t[45]!==n.skillsNoDescription||t[46]!==a||t[47]!==s||t[48]!==h||t[49]!==d||t[50]!==o||t[51]!==c||t[52]!==u?(M=o?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsCatalogLoading}):s.length===0?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsEmptyCatalog}):(0,Q.jsx)(`div`,{className:i(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,c&&`opacity-50`),children:(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:s.map(e=>{let t=e.name||e.directoryId,r=c?h(t):u.has(t),o=typeof e.description==`string`?e.description.trim():``,s=o||n.skillsNoDescription;return(0,Q.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 dark:border-edge-subtle`,children:(0,Q.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:r,disabled:c||a,onChange:()=>{d(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n})},"aria-label":t}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,Q.jsx)(`p`,{className:i(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!o&&`italic text-fg-subtle`),title:s,children:s})]})]})},t)})})}),t[43]=n.skillsCatalogLoading,t[44]=n.skillsEmptyCatalog,t[45]=n.skillsNoDescription,t[46]=a,t[47]=s,t[48]=h,t[49]=d,t[50]=o,t[51]=c,t[52]=u,t[53]=M):M=t[53];let N;t[54]!==n.skillsSave||t[55]!==a||t[56]!==p||t[57]!==f?(N=p?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(X,{type:`button`,disabled:a,onClick:()=>void f(),children:n.skillsSave})}),t[54]=n.skillsSave,t[55]=a,t[56]=p,t[57]=f,t[58]=N):N=t[58];let P;return t[59]!==D||t[60]!==k||t[61]!==j||t[62]!==M||t[63]!==N||t[64]!==v?(P=(0,Q.jsxs)(mt,{className:`flex min-h-0 flex-1 flex-col`,children:[v,D,k,j,M,N]}),t[59]=D,t[60]=k,t[61]=j,t[62]=M,t[63]=N,t[64]=v,t[65]=P):P=t[65],P}function wn(e){return e.name||e.directoryId}var Tn=[`write_file`,`edit_file`,`shell`],En=[`shell`,`image_generate`,`extensions`],Dn=[`send_message`,`send_media`];function On(e){let t=(0,Z.c)(88),{mode:n,builtinToolIds:r,loading:a,disableSet:o,onDisableSetChange:s,defaultsDisableSet:c,unknownDisabledIds:l,getToolDescription:u,getGroupTitle:d,labels:f,quickActionsDisabled:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let h=m,g=p===void 0?!1:p,_;t[2]===r?_=t[3]:(_=new Set(r),t[2]=r,t[3]=_);let v=_,y;t[4]===c?y=t[5]:(y=c??new Set,t[4]=c,t[5]=y);let b=y,x;t[6]!==b||t[7]!==o||t[8]!==n||t[9]!==s?(x=(e,t)=>{if(n===`agentEntry`&&t&&b.has(e))return;let r=new Set(o);t?r.delete(e):r.add(e),s(r)},t[6]=b,t[7]=o,t[8]=n,t[9]=s,t[10]=x):x=t[10];let S=x,C;t[11]!==v||t[12]!==s?(C=e=>{let t=new Set;for(let n of e)v.has(n)&&t.add(n);s(t)},t[11]=v,t[12]=s,t[13]=C):C=t[13];let w=C,T;t[14]===s?T=t[15]:(T=()=>{s(new Set)},t[14]=s,t[15]=T);let E=T,D;t[16]!==r||t[17]!==s||t[18]!==h?(D=()=>{s(new Set([...r,...h]))},t[16]=r,t[17]=s,t[18]=h,t[19]=D):D=t[19];let O=D,k;t[20]===r?k=t[21]:(k=At(r),t[20]=r,t[21]=k);let A=k,j;if(t[22]!==v||t[23]!==A||t[24]!==n||t[25]!==h){if(j=[],n===`defaults`&&h.length>0){let e;t[27]===h?e=t[28]:(e=h.toSorted(An),t[27]=h,t[28]=e);let n;t[29]===e?n=t[30]:(n={key:`unknown`,ids:e},t[29]=e,t[30]=n),j.push(n)}for(let e of kt){let t=e.toolIds.filter(e=>v.has(e));t.length>0&&j.push({key:e.key,ids:[...t]})}if(A.length>0){let e;t[31]===A?e=t[32]:(e={key:`misc`,ids:A},t[31]=A,t[32]=e),j.push(e)}t[22]=v,t[23]=A,t[24]=n,t[25]=h,t[26]=j}else j=t[26];let M=j,N=M.some(kn),P=g||a,F;t[33]===f.quickActionsLabel?F=t[34]:(F=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:f.quickActionsLabel}),t[33]=f.quickActionsLabel,t[34]=F);let ee=P||r.length===0&&h.length===0,I;t[35]!==E||t[36]!==f.quickEnableAll||t[37]!==ee?(I=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:Dt,disabled:ee,onClick:E,children:f.quickEnableAll}),t[35]=E,t[36]=f.quickEnableAll,t[37]=ee,t[38]=I):I=t[38];let L=P||r.length===0&&h.length===0,te;t[39]!==O||t[40]!==f.quickDisableAll||t[41]!==L?(te=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:Dt,disabled:L,onClick:O,children:f.quickDisableAll}),t[39]=O,t[40]=f.quickDisableAll,t[41]=L,t[42]=te):te=t[42];let ne=P||r.length===0,R;t[43]===w?R=t[44]:(R=()=>w(Tn),t[43]=w,t[44]=R);let re;t[45]!==f.quickReadOnlyWorkspace||t[46]!==ne||t[47]!==R?(re=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:Dt,disabled:ne,onClick:R,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=ne,t[47]=R,t[48]=re):re=t[48];let ie=P||r.length===0,z;t[49]===w?z=t[50]:(z=()=>w(En),t[49]=w,t[50]=z);let B;t[51]!==f.quickHighRiskOff||t[52]!==ie||t[53]!==z?(B=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:Dt,disabled:ie,onClick:z,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=ie,t[53]=z,t[54]=B):B=t[54];let ae=P||r.length===0,V;t[55]===w?V=t[56]:(V=()=>w(Dn),t[55]=w,t[56]=V);let H;t[57]!==f.quickNoOutbound||t[58]!==ae||t[59]!==V?(H=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:Dt,disabled:ae,onClick:V,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=ae,t[59]=V,t[60]=H):H=t[60];let U;t[61]!==I||t[62]!==te||t[63]!==re||t[64]!==B||t[65]!==H?(U=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[I,te,re,B,H]}),t[61]=I,t[62]=te,t[63]=re,t[64]=B,t[65]=H,t[66]=U):U=t[66];let W;t[67]!==F||t[68]!==U?(W=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[F,U]}),t[67]=F,t[68]=U,t[69]=W):W=t[69];let G;t[70]!==b||t[71]!==o||t[72]!==d||t[73]!==u||t[74]!==M||t[75]!==N||t[76]!==f.emptyBuiltin||t[77]!==f.loadingBuiltin||t[78]!==f.lockedByDefaults||t[79]!==f.notInBuiltin||t[80]!==a||t[81]!==n||t[82]!==P||t[83]!==S?(G=a?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.loadingBuiltin}):N?(0,Q.jsx)(`div`,{className:`max-h-[min(50vh,22rem)] overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-5 pr-1`,children:M.map(e=>{let{key:t,ids:r}=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:d(t)}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:r.map(e=>{let r=n===`defaults`&&t===`unknown`,a=n===`agentEntry`&&b.has(e),s=o.has(e),c=a?!1:!s,l=u(e);return(0,Q.jsx)(`li`,{className:i(`rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 py-2.5 dark:border-edge-subtle`,r&&`border-dashed`,a&&`opacity-60`),children:(0,Q.jsxs)(`label`,{className:i(`flex gap-3 text-sm`,a?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:c,disabled:a||P,onChange:()=>S(e,!c)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs font-medium text-fg`,children:e}),r?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.notInBuiltin,`)`]}):null,a?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.lockedByDefaults,`)`]}):null]}),l?(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:l}):null]})]})},e)})})]},t)})})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.emptyBuiltin}),t[70]=b,t[71]=o,t[72]=d,t[73]=u,t[74]=M,t[75]=N,t[76]=f.emptyBuiltin,t[77]=f.loadingBuiltin,t[78]=f.lockedByDefaults,t[79]=f.notInBuiltin,t[80]=a,t[81]=n,t[82]=P,t[83]=S,t[84]=G):G=t[84];let oe;return t[85]!==W||t[86]!==G?(oe=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[W,G]}),t[85]=W,t[86]=G,t[87]=oe):oe=t[87],oe}function kn(e){return e.ids.length>0}function An(e,t){return e.localeCompare(t)}function jn(e){let t=(0,Z.c)(51),{a:n,data:r,selected:i,busy:s,toolEntryDisable:c,setToolEntryDisable:l,onSaveTools:u,onClearToolsEntry:d,hideInlineSave:f}=e,p=o(Nn),m;t[0]===p?m=t[1]:(m=a(p),t[0]=p,t[1]=m);let h=m.agentSettings.advanced,g;t[2]===i.tools.presetDenied?g=t[3]:(g=new Set(i.tools.presetDenied.flatMap(Mn)),t[2]=i.tools.presetDenied,t[3]=g);let _=g,v;t[4]===l?v=t[5]:(v=e=>{l(e)},t[4]=l,t[5]=v);let y=v,b=n.toolsDisableGroups,x;t[6]===b?x=t[7]:(x=e=>b[e],t[6]=b,t[7]=x);let S=x,C;t[8]===n.toolDescriptions?C=t[9]:(C=e=>e in n.toolDescriptions?n.toolDescriptions[e]:``,t[8]=n.toolDescriptions,t[9]=C);let w=C,T;t[10]!==n.toolsHint||t[11]!==n.toolsTitle?(T=(0,Q.jsx)(pt,{className:`shrink-0`,icon:nt,title:n.toolsTitle,subtitle:n.toolsHint}),t[10]=n.toolsHint,t[11]=n.toolsTitle,t[12]=T):T=t[12];let E;t[13]!==n.toolsLockedByPreset||t[14]!==h.toolsDisableEmptyBuiltin||t[15]!==h.toolsDisableLoadingBuiltin||t[16]!==h.toolsDisableNotInBuiltin||t[17]!==h.toolsDisableQuickActionsLabel||t[18]!==h.toolsDisableQuickDisableAll||t[19]!==h.toolsDisableQuickEnableAll||t[20]!==h.toolsDisableQuickHighRiskOff||t[21]!==h.toolsDisableQuickNoOutbound||t[22]!==h.toolsDisableQuickReadOnlyWorkspace?(E={loadingBuiltin:h.toolsDisableLoadingBuiltin,emptyBuiltin:h.toolsDisableEmptyBuiltin,quickActionsLabel:h.toolsDisableQuickActionsLabel,quickEnableAll:h.toolsDisableQuickEnableAll,quickDisableAll:h.toolsDisableQuickDisableAll,quickReadOnlyWorkspace:h.toolsDisableQuickReadOnlyWorkspace,quickHighRiskOff:h.toolsDisableQuickHighRiskOff,quickNoOutbound:h.toolsDisableQuickNoOutbound,notInBuiltin:h.toolsDisableNotInBuiltin,lockedByDefaults:n.toolsLockedByPreset},t[13]=n.toolsLockedByPreset,t[14]=h.toolsDisableEmptyBuiltin,t[15]=h.toolsDisableLoadingBuiltin,t[16]=h.toolsDisableNotInBuiltin,t[17]=h.toolsDisableQuickActionsLabel,t[18]=h.toolsDisableQuickDisableAll,t[19]=h.toolsDisableQuickEnableAll,t[20]=h.toolsDisableQuickHighRiskOff,t[21]=h.toolsDisableQuickNoOutbound,t[22]=h.toolsDisableQuickReadOnlyWorkspace,t[23]=E):E=t[23];let D;t[24]!==s||t[25]!==r.builtinToolIds||t[26]!==S||t[27]!==w||t[28]!==y||t[29]!==_||t[30]!==E||t[31]!==c?(D=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(On,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:c,onDisableSetChange:y,defaultsDisableSet:_,getToolDescription:w,getGroupTitle:S,quickActionsDisabled:s,labels:E})}),t[24]=s,t[25]=r.builtinToolIds,t[26]=S,t[27]=w,t[28]=y,t[29]=_,t[30]=E,t[31]=c,t[32]=D):D=t[32];let O;t[33]!==n.toolsSave||t[34]!==s||t[35]!==f||t[36]!==u?(O=f?null:(0,Q.jsx)(X,{type:`button`,disabled:s,onClick:()=>void u(),children:n.toolsSave}),t[33]=n.toolsSave,t[34]=s,t[35]=f,t[36]=u,t[37]=O):O=t[37];let k;t[38]===d?k=t[39]:(k=()=>void d(),t[38]=d,t[39]=k);let A;t[40]!==n.toolsClearEntry||t[41]!==s||t[42]!==k?(A=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:s,onClick:k,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=s,t[42]=k,t[43]=A):A=t[43];let j;t[44]!==A||t[45]!==O?(j=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[O,A]}),t[44]=A,t[45]=O,t[46]=j):j=t[46];let M;return t[47]!==j||t[48]!==T||t[49]!==D?(M=(0,Q.jsxs)(mt,{className:`flex min-h-0 flex-1 flex-col`,children:[T,D,j]}),t[47]=j,t[48]=T,t[49]=D,t[50]=M):M=t[50],M}function Mn(e){let t=String(e).trim();return t?[t]:[]}function Nn(e){return e.language}function Pn(e){let t=(0,Z.c)(128),{a:n,chat:r,cCron:i,selected:a,panel:o,data:s,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,defaultModel:_,defaultWorkspace:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,onDelete:w,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O,overviewProfile:k,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:ee,setFileDraft:I,fileSaving:L,profileFileLoading:te,profileEditorNonce:ne,toolEntryDisable:R,setToolEntryDisable:re,onSaveTools:ie,onClearToolsEntry:z,modelRows:B,setModelRows:ae,onSaveModels:V,onClearModelsEntry:H,skillsCatalogLoading:U,catalogForPick:W,skillsInherit:G,setSkillsInherit:oe,skillsPick:se,setSkillsPick:ce,onSaveSkills:le,bindingsLoading:K,agentBindings:ue,bindChannelStatuses:q,bindChannelsLoading:de,useManualChannel:fe,newBindChannel:pe,setNewBindChannel:me,bindSessionChats:he,bindSessionsLoading:ge,newBindSessionIdx:_e,setNewBindSessionIdx:ve,newBindCustomPeer:ye,setNewBindCustomPeer:J,refreshBindSessions:be,onRemoveBinding:xe,onAddBinding:Se,onTryInChat:Ce}=e;if(!a){let e;return t[0]===n.selectAgentHint?e=t[1]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[0]=n.selectAgentHint,t[1]=e),e}if(o===`overview`){let e;return t[2]!==n||t[3]!==c||t[4]!==_||t[5]!==v||t[6]!==x||t[7]!==S||t[8]!==y||t[9]!==b||t[10]!==Ce||t[11]!==a?(e=(0,Q.jsx)(Sn,{a:n,selected:a,defaultModel:_,defaultWorkspace:v,isTuiDefault:x,isTuiDefaultInherited:S,busy:c,onSetDefault:y,onSetTuiDefault:b,onTryInChat:Ce}),t[2]=n,t[3]=c,t[4]=_,t[5]=v,t[6]=x,t[7]=S,t[8]=y,t[9]=b,t[10]=Ce,t[11]=a,t[12]=e):e=t[12],e}if(o===`behavior`){let e;t[13]!==n||t[14]!==c||t[15]!==r||t[16]!==d||t[17]!==h||t[18]!==l||t[19]!==p||t[20]!==x||t[21]!==S||t[22]!==C||t[23]!==y||t[24]!==b||t[25]!==Ce||t[26]!==k.draft||t[27]!==k.handleSoulContentChange||t[28]!==k.handleSoulTemplateChange||t[29]!==k.profileMarkdownLoading||t[30]!==k.setAvatarDialogOpen||t[31]!==k.toggleSoulPreviewMode||t[32]!==k.updateIdentity||t[33]!==a||t[34]!==f||t[35]!==g||t[36]!==u||t[37]!==m?(e=(0,Q.jsx)(gn,{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:!0,profileMarkdownLoading:k.profileMarkdownLoading,profileDraft:k.draft,updateIdentity:k.updateIdentity,handleSoulTemplateChange:k.handleSoulTemplateChange,handleSoulContentChange:k.handleSoulContentChange,setAvatarDialogOpen:k.setAvatarDialogOpen,toggleSoulPreviewMode:k.toggleSoulPreviewMode,onTryInChat:Ce}),t[13]=n,t[14]=c,t[15]=r,t[16]=d,t[17]=h,t[18]=l,t[19]=p,t[20]=x,t[21]=S,t[22]=C,t[23]=y,t[24]=b,t[25]=Ce,t[26]=k.draft,t[27]=k.handleSoulContentChange,t[28]=k.handleSoulTemplateChange,t[29]=k.profileMarkdownLoading,t[30]=k.setAvatarDialogOpen,t[31]=k.toggleSoulPreviewMode,t[32]=k.updateIdentity,t[33]=a,t[34]=f,t[35]=g,t[36]=u,t[37]=m,t[38]=e):e=t[38];let i;t[39]!==n||t[40]!==c||t[41]!==r||t[42]!==B||t[43]!==H||t[44]!==V||t[45]!==a||t[46]!==ae?(i=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(fn,{a:n,chat:r,selected:a,busy:c,modelRows:B,setModelRows:ae,onSaveModels:V,onClearModelsEntry:H})}),t[39]=n,t[40]=c,t[41]=r,t[42]=B,t[43]=H,t[44]=V,t[45]=a,t[46]=ae,t[47]=i):i=t[47];let o;t[48]!==n||t[49]!==M||t[50]!==ee||t[51]!==L||t[52]!==j||t[53]!==A||t[54]!==P||t[55]!==Ce||t[56]!==ne||t[57]!==te||t[58]!==N||t[59]!==I||t[60]!==F?(o=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(un,{a:n,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:ee,setFileDraft:I,fileSaving:L,profileFileLoading:te,profileEditorNonce:ne,onTryInChat:Ce})}),t[48]=n,t[49]=M,t[50]=ee,t[51]=L,t[52]=j,t[53]=A,t[54]=P,t[55]=Ce,t[56]=ne,t[57]=te,t[58]=N,t[59]=I,t[60]=F,t[61]=o):o=t[61];let s;return t[62]!==e||t[63]!==i||t[64]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[e,i,o]}),t[62]=e,t[63]=i,t[64]=o,t[65]=s):s=t[65],s}if(o===`tools`){let e;return t[66]!==n||t[67]!==c||t[68]!==s||t[69]!==z||t[70]!==ie||t[71]!==a||t[72]!==re||t[73]!==R?(e=(0,Q.jsx)(jn,{a:n,data:s,selected:a,busy:c,toolEntryDisable:R,setToolEntryDisable:re,onSaveTools:ie,onClearToolsEntry:z}),t[66]=n,t[67]=c,t[68]=s,t[69]=z,t[70]=ie,t[71]=a,t[72]=re,t[73]=R,t[74]=e):e=t[74],e}if(o===`skills`){let e;return t[75]!==n||t[76]!==c||t[77]!==W||t[78]!==le||t[79]!==a||t[80]!==oe||t[81]!==ce||t[82]!==U||t[83]!==G||t[84]!==se?(e=(0,Q.jsx)(Cn,{a:n,selected:a,busy:c,skillsCatalogLoading:U,catalogForPick:W,skillsInherit:G,setSkillsInherit:oe,skillsPick:se,setSkillsPick:ce,onSaveSkills:le}),t[75]=n,t[76]=c,t[77]=W,t[78]=le,t[79]=a,t[80]=oe,t[81]=ce,t[82]=U,t[83]=G,t[84]=se,t[85]=e):e=t[85],e}if(o===`memory`){let e;return t[86]===a.id?e=t[87]:(e=(0,Q.jsx)(Ht,{embedded:!0,agentId:a.id}),t[86]=a.id,t[87]=e),e}if(o===`connections`){let e;return t[88]!==n||t[89]!==ue||t[90]!==q||t[91]!==de||t[92]!==he||t[93]!==ge||t[94]!==K||t[95]!==c||t[96]!==i.lastActiveLabels||t[97]!==i.selectRecipient||t[98]!==pe||t[99]!==ye||t[100]!==_e||t[101]!==Se||t[102]!==xe||t[103]!==be||t[104]!==me||t[105]!==J||t[106]!==ve||t[107]!==fe?(e=(0,Q.jsx)(ln,{a:n,busy:c,bindingsLoading:K,agentBindings:ue,channelStatuses:q,channelsStatusLoading:de,useManualChannel:fe,newBindChannel:pe,setNewBindChannel:me,bindSessionChats:he,sessionsLoading:ge,newBindSessionIdx:_e,setNewBindSessionIdx:ve,newBindCustomPeer:ye,setNewBindCustomPeer:J,onRefreshSessions:be,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:xe,onAddBinding:Se}),t[88]=n,t[89]=ue,t[90]=q,t[91]=de,t[92]=he,t[93]=ge,t[94]=K,t[95]=c,t[96]=i.lastActiveLabels,t[97]=i.selectRecipient,t[98]=pe,t[99]=ye,t[100]=_e,t[101]=Se,t[102]=xe,t[103]=be,t[104]=me,t[105]=J,t[106]=ve,t[107]=fe,t[108]=e):e=t[108],e}if(o===`config`){let e;return t[109]!==n||t[110]!==c||t[111]!==T||t[112]!==_||t[113]!==E||t[114]!==v||t[115]!==h||t[116]!==p||t[117]!==O||t[118]!==D||t[119]!==a?(e=(0,Q.jsx)(en,{a:n,selected:a,busy:c,defaultModel:_,defaultWorkspace:v,agentModel:h,agentWorkspace:p,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O}),t[109]=n,t[110]=c,t[111]=T,t[112]=_,t[113]=E,t[114]=v,t[115]=h,t[116]=p,t[117]=O,t[118]=D,t[119]=a,t[120]=e):e=t[120],e}if(o===`dangerZone`){let e;return t[121]!==n||t[122]!==c||t[123]!==w||t[124]!==a?(e=(0,Q.jsx)(sn,{a:n,selected:a,busy:c,onDelete:w}),t[121]=n,t[122]=c,t[123]=w,t[124]=a,t[125]=e):e=t[125],e}let we;return t[126]===n.selectAgentHint?we=t[127]:(we=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[126]=n.selectAgentHint,t[127]=we),we}function Fn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=Se(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=ve(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function In(e,t){return e.replace(`{{count}}`,String(t))}function Ln(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?In(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?In(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function Rn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?In(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?In(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function zn(e){let t=(0,Z.c)(11),{text:n,children:r,className:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==n?(o=(0,Q.jsx)(Ee,{asChild:!0,children:(0,Q.jsx)(`span`,{className:a,title:n,children:r})}),t[0]=r,t[1]=a,t[2]=n,t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=i(`max-w-[min(28rem,calc(100vw-2rem))] rounded-lg border border-edge bg-surface-panel px-2.5 py-2`,`text-left text-xs leading-snug text-fg shadow-popover`,f),t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(ye,{className:`fill-surface-panel`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(Ke,{children:(0,Q.jsxs)(Ce,{side:`top`,align:`start`,sideOffset:6,className:s,children:[n,c]})}),t[6]=n,t[7]=l);let u;return t[8]!==o||t[9]!==l?(u=(0,Q.jsx)(Be,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(ke,{children:[o,l]})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}function Bn(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:a,tuiDefaultAgentId:o,tuiDefaultInherited:s,searchQuery:c,onOpenAgent:l,onChatWithAgent:u,busy:d}=e,f,p,h,g,_;if(t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==a||t[4]!==u||t[5]!==l||t[6]!==c||t[7]!==o||t[8]!==s){_=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Fn(r,c,n),v=r.length>0&&e.length===0&&c.trim().length>0;if(r.length===0){let e;t[14]===n.listNoAgentsYet?e=t[15]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listNoAgentsYet}),t[14]=n.listNoAgentsYet,t[15]=e),_=e;break bb0}h=`flex flex-col gap-4`,t[16]!==n||t[17]!==v?(g=v?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listEmpty}):null,t[16]=n,t[17]=v,t[18]=g):g=t[18],f=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let y;t[19]!==n||t[20]!==d||t[21]!==a||t[22]!==u||t[23]!==l||t[24]!==o||t[25]!==s?(y=e=>{let t=Se(e,n),r=e.id,c=ve(e,n),f=Ln(e,n),p=Rn(e,n),h=e.id===a||e.isDefault,g=e.id===o,_=g&&s,v=g&&!s;return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{role:`button`,tabIndex:d?-1:0,"aria-disabled":d,"aria-label":`${t} ${r}`,onClick:()=>{d||l(e.id)},onKeyDown:t=>{d||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.id))},className:i(`flex min-h-[15.5rem] cursor-pointer flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 shadow-surface`,`transition-[border-color,transform,box-shadow] duration-150 ease-out`,`hover:border-edge-strong`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60`,Qe.pressCard),children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 text-left`,children:[(0,Q.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base text-fg ring-1 ring-edge-subtle/40`,"aria-hidden":!0,children:(0,Q.jsx)(m,{agentId:e.id,avatar:e.avatar,size:48,className:`size-full`})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,title:r,children:r})]})]}),(0,Q.jsxs)(`div`,{className:`flex max-w-[9rem] shrink-0 flex-wrap justify-end gap-1.5`,children:[h?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,v?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultBadge}):null,_?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultInheritedBadge}):null,!h&&!g?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:n.listCustomBadge}):null]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 min-h-[6.25rem] text-left`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base px-3 py-3`,children:(0,Q.jsx)(`p`,{className:i(`line-clamp-2 text-sm leading-5`,c?`text-fg`:`text-fg-muted`),title:c||void 0,children:c||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:f,children:p.map(Vn)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:d,onClick:t=>{t.stopPropagation(),u(e.id)},className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(at,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=d,t[21]=a,t[22]=u,t[23]=l,t[24]=o,t[25]=s,t[26]=y):y=t[26],p=e.map(y)}t[0]=n,t[1]=r,t[2]=d,t[3]=a,t[4]=u,t[5]=l,t[6]=c,t[7]=o,t[8]=s,t[9]=f,t[10]=p,t[11]=h,t[12]=g,t[13]=_}else f=t[9],p=t[10],h=t[11],g=t[12],_=t[13];if(_!==Symbol.for(`react.early_return_sentinel`))return _;let v;t[27]!==f||t[28]!==p?(v=(0,Q.jsx)(`ul`,{className:f,children:p}),t[27]=f,t[28]=p,t[29]=v):v=t[29];let y;return t[30]!==h||t[31]!==g||t[32]!==v?(y=(0,Q.jsxs)(`div`,{className:h,children:[g,v]}),t[30]=h,t[31]=g,t[32]=v,t[33]=y):y=t[33],y}function Vn(e){return(0,Q.jsx)(zn,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Hn(e){let t=(0,Z.c)(130),{open:n,onOpenChange:r,a,chat:o,busy:s,modalError:c,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:d,createAgentId:f,setCreateAgentId:m,createDescription:h,setCreateDescription:g,createWorkspace:_,setCreateWorkspace:v,createModel:y,setCreateModel:b,onCreate:x,onSuggestWorkspace:S,agents:C,duplicateSourceId:w,onSelectDuplicateSource:T}=e,E;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(Me,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,re)}),t[0]=E):E=t[0];let D;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(D=i(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,640px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,se,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=D):D=t[1];let O;t[2]===a.addAgent?O=t[3]:(O=(0,Q.jsx)(te,{className:`text-base font-semibold text-fg`,children:a.addAgent}),t[2]=a.addAgent,t[3]=O);let A;t[4]===a.addAgentHint?A=t[5]:(A=(0,Q.jsx)(p,{className:`mt-0.5 text-xs text-fg-muted`,children:a.addAgentHint}),t[4]=a.addAgentHint,t[5]=A);let j;t[6]!==O||t[7]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[O,A]}),t[6]=O,t[7]=A,t[8]=j):j=t[8];let M;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=i(be,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=M):M=t[9];let P;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),t[10]=P):P=t[10];let F;t[11]===a.closeDialogAria?F=t[12]:(F=(0,Q.jsx)(ee,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:M,"aria-label":a.closeDialogAria,children:P})}),t[11]=a.closeDialogAria,t[12]=F);let I;t[13]!==j||t[14]!==F?(I=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[j,F]}),t[13]=j,t[14]=F,t[15]=I):I=t[15];let L;t[16]!==a||t[17]!==C||t[18]!==w||t[19]!==T?(L=C.length>0?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.copyFromExistingAgent}),(0,Q.jsxs)(`select`,{className:i(Ct(),`bg-surface-panel`),value:w??``,onChange:e=>T(e.target.value||null),children:[(0,Q.jsx)(`option`,{value:``,children:a.copyFromExistingAgentNone}),C.map(e=>(0,Q.jsxs)(`option`,{value:e.id,children:[Se(e,a),` · `,e.id]},e.id))]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.duplicateAgentHint})]}):null,t[16]=a,t[17]=C,t[18]=w,t[19]=T,t[20]=L):L=t[20];let ne;t[21]===c?ne=t[22]:(ne=c?(0,Q.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:c}):null,t[21]=c,t[22]=ne);let R;t[23]!==a.newAgentLabel||t[24]!==l?(R=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.newAgentLabel,` (`,l,`)`]}),t[23]=a.newAgentLabel,t[24]=l,t[25]=R):R=t[25];let ie;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ie=Ct(),t[26]=ie):ie=t[26];let z;t[27]===d?z=t[28]:(z=e=>d(e.target.value),t[27]=d,t[28]=z);let B;t[29]===S?B=t[30]:(B=()=>S(),t[29]=S,t[30]=B);let ae;t[31]!==u||t[32]!==z||t[33]!==B?(ae=(0,Q.jsx)(`input`,{className:ie,value:u,onChange:z,onBlur:B,required:!0,autoComplete:`off`}),t[31]=u,t[32]=z,t[33]=B,t[34]=ae):ae=t[34];let V;t[35]!==R||t[36]!==ae?(V=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[R,ae]}),t[35]=R,t[36]=ae,t[37]=V):V=t[37];let H;t[38]===a.newAgentIdOptional?H=t[39]:(H=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newAgentIdOptional}),t[38]=a.newAgentIdOptional,t[39]=H);let U;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(U=i(Ct(),`font-mono text-xs`),t[40]=U):U=t[40];let W;t[41]===m?W=t[42]:(W=e=>m(e.target.value),t[41]=m,t[42]=W);let G;t[43]===S?G=t[44]:(G=()=>S(),t[43]=S,t[44]=G);let oe;t[45]!==a.newAgentIdPlaceholder||t[46]!==a.newAgentIdRules||t[47]!==f||t[48]!==W||t[49]!==G?(oe=(0,Q.jsx)(`input`,{className:U,value:f,onChange:W,onBlur:G,placeholder:a.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:a.newAgentIdRules}),t[45]=a.newAgentIdPlaceholder,t[46]=a.newAgentIdRules,t[47]=f,t[48]=W,t[49]=G,t[50]=oe):oe=t[50];let ce;t[51]===a.newAgentIdRules?ce=t[52]:(ce=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.newAgentIdRules}),t[51]=a.newAgentIdRules,t[52]=ce);let le;t[53]!==H||t[54]!==oe||t[55]!==ce?(le=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[H,oe,ce]}),t[53]=H,t[54]=oe,t[55]=ce,t[56]=le):le=t[56];let K;t[57]!==a.agentDescription||t[58]!==l?(K=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.agentDescription,` (`,l,`)`]}),t[57]=a.agentDescription,t[58]=l,t[59]=K):K=t[59];let ue;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ue=i(Ct(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[60]=ue):ue=t[60];let q;t[61]===g?q=t[62]:(q=e=>g(e.target.value),t[61]=g,t[62]=q);let de;t[63]!==a.agentDescriptionPlaceholder||t[64]!==h||t[65]!==q?(de=(0,Q.jsx)(`textarea`,{className:ue,value:h,onChange:q,placeholder:a.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[63]=a.agentDescriptionPlaceholder,t[64]=h,t[65]=q,t[66]=de):de=t[66];let fe;t[67]!==K||t[68]!==de?(fe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[K,de]}),t[67]=K,t[68]=de,t[69]=fe):fe=t[69];let pe;t[70]===a.newWorkspace?pe=t[71]:(pe=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newWorkspace}),t[70]=a.newWorkspace,t[71]=pe);let me;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(me=i(Ct(),`font-mono text-xs`),t[72]=me):me=t[72];let he;t[73]===v?he=t[74]:(he=e=>v(e.target.value),t[73]=v,t[74]=he);let ge;t[75]!==_||t[76]!==he?(ge=(0,Q.jsx)(`input`,{className:me,value:_,onChange:he,required:!0,autoComplete:`off`}),t[75]=_,t[76]=he,t[77]=ge):ge=t[77];let _e;t[78]!==pe||t[79]!==ge?(_e=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[pe,ge]}),t[78]=pe,t[79]=ge,t[80]=_e):_e=t[80];let ve;t[81]===a.newModelOptional?ve=t[82]:(ve=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newModelOptional}),t[81]=a.newModelOptional,t[82]=ve);let ye;t[83]===b?ye=t[84]:(ye=e=>b(e),t[83]=b,t[84]=ye);let xe;t[85]!==s||t[86]!==o.modelNoMatches||t[87]!==o.modelPlaceholder||t[88]!==o.modelSearchPlaceholder||t[89]!==y||t[90]!==ye?(xe=(0,Q.jsx)(J,{className:`min-w-0 flex-1`,value:y,disabled:s,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,onChange:ye}),t[85]=s,t[86]=o.modelNoMatches,t[87]=o.modelPlaceholder,t[88]=o.modelSearchPlaceholder,t[89]=y,t[90]=ye,t[91]=xe):xe=t[91];let Ce;t[92]!==a.modelClear||t[93]!==s||t[94]!==y||t[95]!==b?(Ce=y.trim()?(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:s,onClick:()=>b(``),children:a.modelClear}):null,t[92]=a.modelClear,t[93]=s,t[94]=y,t[95]=b,t[96]=Ce):Ce=t[96];let we;t[97]!==xe||t[98]!==Ce?(we=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[xe,Ce]}),t[97]=xe,t[98]=Ce,t[99]=we):we=t[99];let Te;t[100]!==ve||t[101]!==we?(Te=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[ve,we]}),t[100]=ve,t[101]=we,t[102]=Te):Te=t[102];let Ee;t[103]!==a.createModalCancel||t[104]!==s?(Ee=(0,Q.jsx)(ee,{asChild:!0,children:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:s,children:a.createModalCancel})}),t[103]=a.createModalCancel,t[104]=s,t[105]=Ee):Ee=t[105];let Oe;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Q.jsx)(De,{className:`mr-1 size-4`,"aria-hidden":!0}),t[106]=Oe):Oe=t[106];let ke;t[107]!==a.create||t[108]!==s?(ke=(0,Q.jsxs)(X,{type:`submit`,disabled:s,children:[Oe,a.create]}),t[107]=a.create,t[108]=s,t[109]=ke):ke=t[109];let Ae;t[110]!==Ee||t[111]!==ke?(Ae=(0,Q.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Ee,ke]}),t[110]=Ee,t[111]=ke,t[112]=Ae):Ae=t[112];let je;t[113]!==x||t[114]!==ne||t[115]!==V||t[116]!==le||t[117]!==fe||t[118]!==_e||t[119]!==Te||t[120]!==Ae||t[121]!==L?(je=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:x,children:[L,ne,V,le,fe,_e,Te,Ae]}),t[113]=x,t[114]=ne,t[115]=V,t[116]=le,t[117]=fe,t[118]=_e,t[119]=Te,t[120]=Ae,t[121]=L,t[122]=je):je=t[122];let Ne;t[123]!==je||t[124]!==I?(Ne=(0,Q.jsxs)(k,{children:[E,(0,Q.jsx)(Fe,{className:D,onOpenAutoFocus:Un,children:(0,Q.jsxs)(qe,{layer:`modal`,children:[I,je]})})]}),t[123]=je,t[124]=I,t[125]=Ne):Ne=t[125];let Pe;return t[126]!==r||t[127]!==n||t[128]!==Ne?(Pe=(0,Q.jsx)(N,{open:n,onOpenChange:r,children:Ne}),t[126]=r,t[127]=n,t[128]=Ne,t[129]=Pe):Pe=t[129],Pe}function Un(e){return e.preventDefault()}var Wn=`~/.xopc/workspace`;function Gn(e){let t=e.trim();return t?`${Wn}/${tt(t)}`:``}function Kn(e){let t=(0,Z.c)(18),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(H,{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[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e.target.value),t[1]=a,t[2]=c);let l;t[3]!==n.listSearchPlaceholder||t[4]!==i||t[5]!==c?(l=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[s,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:c,placeholder:n.listSearchPlaceholder,autoComplete:`off`,spellCheck:!1,"aria-label":n.listSearchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 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[3]=n.listSearchPlaceholder,t[4]=i,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=()=>o(),t[7]=o,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)($e,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=d):d=t[9];let f;t[10]!==n.addAgent||t[11]!==n.addAgentAria||t[12]!==r||t[13]!==u?(f=(0,Q.jsxs)(X,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":n.addAgentAria,disabled:r,onClick:u,children:[d,n.addAgent]}),t[10]=n.addAgent,t[11]=n.addAgentAria,t[12]=r,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function qn(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function Jn(e){let{agentId:t,enabled:n,saveRef:r}=e,i=v(async()=>{if(!t)return null;let[e,n]=await Promise.all([Te(t,`IDENTITY.md`).catch(()=>``),Te(t,`SOUL.md`).catch(()=>``)]),r=st(e);return{identity:r,soulTemplate:he(n),soulCustomContent:n,identityBaseline:JSON.stringify(r),soulBaseline:n}},[t],{enabled:n&&!!t,initial:null,errorData:null}),a=i.data,o=i.loading,s=(0,$.useRef)(!1),[c,l]=(0,$.useState)(null),u=t??``,d=(0,$.useRef)(u);d.current!==u&&(d.current=u,s.current=!1,l(null));let f=c??(a?qn(a):null),p=(0,$.useMemo)(()=>f?JSON.stringify(f.identity)!==f.identityBaseline||f.soulCustomContent!==f.soulBaseline:!1,[f]),m=(0,$.useRef)(t);m.current=t;let h=(0,$.useCallback)(e=>{s.current=!0,l(t=>{let n=t??(a?qn(a):null);return n?e(n):null})},[a]),g=(0,$.useCallback)(e=>{h(t=>({...t,identity:{...t.identity,...e}}))},[h]),y=(0,$.useCallback)(e=>{h(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=ue.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[h]),b=(0,$.useCallback)(e=>{h(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[h]),x=(0,$.useCallback)(e=>{h(t=>({...t,avatarDialogOpen:e}))},[h]),S=(0,$.useCallback)(()=>{h(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[h]),C=(0,$.useCallback)(async()=>{let e=m.current;!e||!f||(await Promise.all([V(e,`IDENTITY.md`,_(f.identity)),V(e,`SOUL.md`,f.soulCustomContent)]),s.current=!1,l(e=>{let t=e??f;return{...t,identityBaseline:JSON.stringify(t.identity),soulBaseline:t.soulCustomContent}}))},[f]);return(0,$.useLayoutEffect)(()=>{if(r)return r.current=C,()=>{r.current=null}},[C,r]),{profileMarkdownLoading:o,draft:f,dirty:p,updateIdentity:g,handleSoulTemplateChange:y,handleSoulContentChange:b,setAvatarDialogOpen:x,toggleSoulPreviewMode:S}}var Yn={draft:``,editorNonce:0,loadedKey:``};function Xn(e,t){switch(t.type){case`load`:return{draft:t.content,editorNonce:e.editorNonce+1,loadedKey:t.key};case`setDraft`:return{...e,draft:t.value};case`clear`:return{draft:``,editorNonce:e.editorNonce,loadedKey:``};case`resetViewMode`:return e}}function Zn(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=v(()=>n?le(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`behavior`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,f]=(0,$.useState)(null),[p,m]=(0,$.useReducer)(Xn,Yn),[h,g]=(0,$.useState)(!1),[_,y]=(0,$.useState)(`edit`),b=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==b.current&&(b.current=n,f(null))},[n]),(0,$.useEffect)(()=>{if(c&&c.files.length>0&&!d){let e=c.files.find(e=>e.name===`AGENTS.md`);f(e?e.name:c.files[0].name)}},[c,d]);let x=p.draft,S=p.editorNonce,C=(0,$.useRef)(x);C.current=x;let w=(0,$.useRef)(n);w.current=n;let T=(0,$.useRef)(d);T.current=d;let E=(0,$.useRef)(null),D=(0,$.useRef)(``),O=(0,$.useRef)(``),k=(0,$.useRef)(``),A=(0,$.useRef)(()=>{}),j=v(()=>d&&n?Te(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),M=j.loading,N=K(async()=>{let e=w.current,t=T.current;if(!e||!t||`${e}:${t}`!==D.current)return;let n=C.current;if(n!==O.current){g(!0),o(null);try{await V(e,t,n),O.current=n,l(n=>!n||n.agentId!==e?n:{...n,files:n.files.map(e=>e.name===t?{...e,missing:!1}:e)})}catch(e){o(e instanceof Error?e.message:a)}finally{g(!1)}}},800);A.current=N.flush,(0,$.useEffect)(()=>()=>{A.current()},[]);let P=(0,$.useRef)(t);P.current!==t&&(P.current===`behavior`&&A.current(),P.current=t);let F=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{F!==k.current&&(A.current(),k.current=F)},[F]),(0,$.useEffect)(()=>{if(!F){m({type:`clear`});return}M||(D.current=F,O.current=j.data,m({type:`load`,key:F,content:j.data}))},[F,M,j.data]);let ee=(0,$.useRef)({activeFile:d,selectedId:n});return(ee.current.activeFile!==d||ee.current.selectedId!==n)&&(ee.current={activeFile:d,selectedId:n},y(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{A.current(),f(e)},[]),fileDraft:x,setFileDraft:(0,$.useCallback)(e=>{m({type:`setDraft`,value:typeof e==`function`?e(C.current):e}),N()},[N]),fileSaving:h,filesViewMode:_,setFilesViewMode:y,profileFileLoading:M,profileEditorNonce:S,overviewSaveProfileMarkdownRef:E,saveProfileMarkdownDebounced:N}}function Qn(e){let{panel:t,hasToken:n,bindingsFromConfig:r,gatewayCfgLoading:i,selected:a,saveErrorMessage:o,setBusy:s,setError:c}=e,l=(0,$.useRef)(!1),[u,d]=(0,$.useState)(null),f=(0,$.useRef)(r);t===`connections`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let p=u??r,m=t===`connections`&&n,h=v(()=>vt(),[t,n],{enabled:m,initial:[],errorData:[]}),_=h.data,y=h.loading,b=(0,$.useMemo)(()=>y||_.length===0?``:_[0]?.name??``,[_,y]),[x,S]=(0,$.useState)(``),C=(0,$.useRef)(b);t===`connections`&&!y&&b&&C.current!==b&&(!x||!_.some(e=>e.name===x))&&(C.current=b,S(b)),C.current=b;let w=x.trim(),T=m&&w.length>0,E=v(()=>yt(w),[t,n,w],{enabled:T,initial:[],errorData:[]}),D=E.data,O=E.loading,k=E.setData,[A,j]=(0,$.useState)(null),[M,N]=(0,$.useState)(``),P=(0,$.useRef)(w);P.current!==w&&(P.current=w,j(null));let F=(0,$.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),ee=(0,$.useCallback)(()=>{let e=x.trim();e&&yt(e).then(e=>{k(e),j(t=>t!=null&&t<e.length?t:null)}).catch(()=>{k([]),j(null)})},[x,k]),I=!y&&_.length===0,L=t===`connections`&&n&&i,te=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await g(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,o,s,c]);return{agentBindings:F,allBindings:p,bindChannelStatuses:_,bindChannelsLoading:y,bindSessionChats:D,bindSessionsLoading:O,bindingsLoading:L,newBindChannel:x,setNewBindChannel:S,newBindSessionIdx:A,setNewBindSessionIdx:j,newBindCustomPeer:M,setNewBindCustomPeer:N,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!x.trim())return;let t=xt(x,M,A,D),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await g(n),l.current=!0,d(n),j(null),N(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,D,x,M,A,o,a,s,c]),onRemoveBinding:te,refreshBindSessions:ee,useManualChannel:I}}function $n(e,t){let n=(0,Z.c)(16),[r,i]=(0,$.useState)(0),a,o;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=e=>{let t=e.detail;t&&typeof t==`object`&&`section`in t&&t.section===`skills`&&i(nr)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},o=[],n[0]=a,n[1]=o):(a=n[0],o=n[1]),(0,$.useEffect)(a,o);let s;n[2]!==r||n[3]!==e||n[4]!==t?(s=[e,t,r],n[2]=r,n[3]=e,n[4]=t,n[5]=s):s=n[5];let c=e&&t,l;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],n[6]=l):l=n[6];let u;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[7]=u):u=n[7];let d;n[8]===c?d=n[9]:(d={enabled:c,initial:l,errorData:u},n[8]=c,n[9]=d);let{data:f,loading:p}=v(tr,s,d),m;n[10]===f?m=n[11]:(m=f.filter(er),n[10]=f,n[11]=m);let h=m,g;return n[12]!==h||n[13]!==f||n[14]!==p?(g={catalogForPick:h,skillCatalog:f,skillsCatalogLoading:p},n[12]=h,n[13]=f,n[14]=p,n[15]=g):g=n[15],g}function er(e){return e.enabled!==!1}function tr(){return pe()}function nr(e){return e+1}function rr(e){return $n(e.panel===`skills`,e.hasToken)}function ir(e){return new Set(e.tools.entryDisable)}function ar(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function or(e){let{panel:t,selected:n}=e,r=`${t}:${n?.id??``}`,i=(0,$.useRef)(r),[a,o]=(0,$.useState)(()=>new Set),[s,c]=(0,$.useState)(()=>new Set),[l,u]=(0,$.useState)(!0),[d,f]=(0,$.useState)(()=>[]);if(i.current!==r){if(i.current=r,n&&t===`tools`&&o(ir(n)),n&&t===`skills`){let e=ar(n);u(e.inherit),c(e.pick)}n&&t===`behavior`&&f(Tt(n.typedModels.effective))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:f}}function sr(e,t){let n=e.typedModels.defaultRole;return{defaultRole:n,roles:{[n]:{model:t}}}}function cr(e){let t=Tt(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Tt(e.typedModels.effective)}function lr(e){return Object.fromEntries(Array.from(e).map(e=>e.trim()).filter(Boolean).toSorted((e,t)=>e.localeCompare(t)).map(e=>[e,{mode:`deny`}]))}function ur(){let e=o(e=>e.language),t=a(e),n=t.agentsSettings,[r,i]=(0,$.useState)(!1),[s,l]=(0,$.useState)(null),[u,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(``),h=t.cron,g=t.chat,_=!!c(e=>e.token),[v,b]=ie(),x=W(),{agentId:S}=ce(),C=ut(e=>e.setPageHeader),w=ut(e=>e.clearPageHeader),{data:T,error:E,isLoading:D,mutate:O}=d(_?`settings-gateway-agents`:null,lt,{revalidateOnFocus:!1}),{data:k,mutate:A}=d(_?`settings-capability-presets`:null,jt,{revalidateOnFocus:!1}),j=Ue(_),{data:M}=j,N=(0,$.useMemo)(()=>ae(M?.payload?.config??{}),[M]),P=T??null,F=(0,$.useMemo)(()=>P?P.agents.find(e=>e.id===P.defaultId)??P.agents[0]??null:null,[P]),ee=!!(_&&D),[I,L]=(0,$.useState)(null),te=E instanceof Error?E.message:E?n.loadError:null,ne=I??te,[R,re]=(0,$.useState)(null),[z,B]=(0,$.useState)(`overview`),[V,H]=(0,$.useState)(``),[U,G]=(0,$.useState)(``),[oe,se]=(0,$.useState)(``),[le,K]=(0,$.useState)(``),[ue,q]=(0,$.useState)(``),[de,fe]=(0,$.useState)(null),[pe,me]=(0,$.useState)(!1),he=(0,$.useRef)(``),[ge,ve]=(0,$.useState)(null),[ye,J]=(0,$.useState)(!1),[be,xe]=(0,$.useState)(``),[Ce,we]=(0,$.useState)(``),[Te,Ee]=(0,$.useState)(``),[De,ke]=(0,$.useState)(``),[Ae,je]=(0,$.useState)(``),[Me,Ne]=(0,$.useState)(``),Pe=(0,$.useRef)(null),[Fe,Ie]=(0,$.useState)(!1),Le=(0,$.useRef)({data:null,routeAgentId:void 0});P&&(P!==Le.current.data||S!==Le.current.routeAgentId)&&(Le.current={data:P,routeAgentId:S},S&&P.agents.some(e=>e.id===S)?re(S):re(e=>e&&P.agents.some(t=>t.id===e)?e:P.defaultId)),(0,$.useEffect)(()=>{!P||!S||P.agents.some(e=>e.id===S)||x(Ze,{replace:!0})},[P,S,x]),(0,$.useEffect)(()=>{S&&B(`overview`)},[S]),(0,$.useEffect)(()=>{v.get(`panel`)===`defaults`&&x(S?He(S):Ze,{replace:!0,state:{[Ve]:S?He(S):Ze}})},[v,S,x]),(0,$.useEffect)(()=>{if(v.get(`focus`)!==`avatar`||!S||(B(`overview`),ee||!P?.agents.some(e=>e.id===S)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),b(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[v,S,ee,P,b]);let Y=(0,$.useMemo)(()=>P?.agents.find(e=>e.id===R)??null,[P,R]),Re=(0,$.useMemo)(()=>{let e=M?.payload?.config;if(!e||typeof e!=`object`||Array.isArray(e))return``;let t=e.tui;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaultAgent;return typeof n==`string`?n.trim().toLowerCase():``},[M]),ze=(0,$.useMemo)(()=>!P||Re&&P.agents.some(e=>e.id===Re)?Re:P.defaultId||P.agents[0]?.id||Re,[P,Re]),Be=!!(P&&Re&&!P.agents.some(e=>e.id===Re));(0,$.useEffect)(()=>{we(Be?``:Re)},[Re,Be]);let We=(0,$.useRef)(null),Ke=Y?Y.id:null;Y&&We.current!==Ke?(We.current=Ke,Ee(Y.workspace),ke(Y.model?.primary??``),je(Se(Y,a(e).agentsSettings)),Ne(Y.description??``)):!Y&&We.current!==null&&(We.current=null,Ee(``),ke(``),je(``),Ne(``));let qe=Jn({agentId:Y?.id??null,enabled:z===`behavior`&&!!Y,saveRef:Pe}),Je=Zn({panel:z,selectedId:R,hasToken:_,dataAgentsLength:P?.agents.length,saveErrorMessage:n.saveError,setError:L}),Ye=or({panel:z,selected:Y}),X=Qn({panel:z,hasToken:_,bindingsFromConfig:N,gatewayCfgLoading:M===void 0,selected:Y,saveErrorMessage:n.saveError,setBusy:J,setError:L}),Xe=rr({panel:z,hasToken:_}),Qe=(0,$.useCallback)(()=>{let e=Gn(U.trim()||V);K(t=>t===``||t===he.current?(he.current=e,e):t)},[U,V]),$e=(0,$.useCallback)(()=>{he.current=``,H(``),G(``),se(``),K(``),q(``),fe(null),ve(null),me(!0)},[]),et=(0,$.useCallback)(e=>{let t=new Set(P?.agents.map(e=>e.id.toLowerCase())??[]),r=e.trim();if(!t.has(r.toLowerCase()))return r;let i=`${r}${n.duplicateIdSuffix}`;if(!t.has(i.toLowerCase()))return i;for(let e=2;e<1e3;e+=1){let n=`${i}-${e}`;if(!t.has(n.toLowerCase()))return n}return i},[n.duplicateIdSuffix,P]),tt=(0,$.useCallback)(e=>{if(ve(e),!e)return;let t=P?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=et(t.id),o=t.description??``;he.current=``,H(i),G(a),se(o),K(t.workspace),q(t.model?.primary??``),fe(null)},[n.duplicateName,P,et]),nt=(0,$.useCallback)(e=>{tt(e),me(!0)},[tt]),rt=(0,$.useMemo)(()=>(0,Q.jsx)(Kn,{a:n,busy:ye,listSearchQuery:be,onListSearchQueryChange:xe,onAddAgent:()=>$e()}),[n,ye,be,$e]);(0,$.useLayoutEffect)(()=>_?(C({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title})}),end:rt}),()=>w()):(w(),()=>w()),[n.title,rt,w,_,C]);async function it(t){t.preventDefault();let r=V.trim();if(!r)return;let i=_e(U,r);if(i.ok===!1){fe(i.error);return}let a=le.trim()||Gn(U.trim()||r);if(a){J(!0),fe(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${oe.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
|
|
2
|
+
`),{createdAgentId:n,...i}=await Ge({workspace:a,...U.trim()?{id:U.trim()}:{},...ue.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:ue.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},...ge?{cloneFrom:ge}:{}});O(i,{revalidate:!1}),H(``),G(``),se(``),K(``),q(``),fe(null),me(!1),re(n),x(He(n))}catch(e){fe(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function at(){if(Y){J(!0),L(null);try{O(await y(Y.id,{workspace:Te.trim()||void 0,...De.trim()?{models:sr(Y,De.trim())}:{}}),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function st(e){J(!0),L(null);try{O(await y(e.id,{setDefault:!0}),{revalidate:!1}),re(e.id)}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function ct(){let e=Ce.trim().toLowerCase();if(e&&!P?.agents.some(t=>t.id===e)){L(n.tuiDefaultAgentInvalid);return}J(!0),L(null);try{await ot(e||null),await j.mutate()}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function ft(e){J(!0),L(null);try{await ot(e.id),we(e.id),await j.mutate()}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function pt(){J(!0),L(null);try{await ot(null),we(``),await j.mutate()}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function mt(e,t){J(!0),L(null);try{let n=await Oe(e.id,t);O(n,{revalidate:!1}),re(n.defaultId),B(`overview`),S===e.id&&x(Ze,{replace:!0}),i(!1),l(null),m(``)}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}function ht(e,t){e.id!==`main`&&(l(e),f(t),m(``),i(!0))}async function gt(){if(Y){J(!0),L(null);try{O(await y(Y.id,{tools:{builtin:lr(Ye.toolEntryDisable)}}),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function _t(){if(Y){J(!0),L(null);try{O(await y(Y.id,{tools:null}),{revalidate:!1}),Ye.setToolEntryDisable(new Set)}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function vt(){if(!Y)return;let e=wt(Ye.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){L(e);return}J(!0),L(null);try{O(await y(Y.id,{models:{roles:Ot(Ye.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function yt(){if(!Y)return;let e=cr(Y),t=Ot(e);if(!t?.roles?.[Y.typedModels.defaultRole]){L(n.typedModelsInvalidModel);return}J(!0),L(null);try{O(await y(Y.id,{models:{defaultRole:Y.typedModels.defaultRole,roles:t.roles}}),{revalidate:!1}),Ye.setModelRows(e)}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function bt(){if(Y){J(!0),L(null);try{O(await y(Y.id,{skills:Ye.skillsInherit?null:[...Ye.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function xt(e){if(Y){J(!0),L(null);try{O(await y(Y.id,{extends:e}),{revalidate:!1}),A()}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}let St=z!==`behavior`,Ct=(()=>{if(!Y||z!==`behavior`)return!1;let e=Y.workspace,t=Y.model?.primary??``;return Te.trim()!==e||De.trim()!==t})(),Tt=(()=>{if(St||!Y)return!1;switch(z){case`behavior`:return Ct||qe.dirty;default:return!0}})(),Et=St||!Tt;function Dt(){Ie(!0),setTimeout(()=>Ie(!1),2e3)}async function kt(){switch(z){case`behavior`:await Promise.all([at(),Pe.current?.()??Promise.resolve()]),Dt();break;default:break}}function At(e){e||x(Ze)}let Mt=Y?Ae.trim()||Se(Y,n):S??``,Z=Y?.id??S??``,Nt=(0,$.useCallback)(async()=>{if(Y){await kt(),Je.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(dt,Y.id)}catch{}x(`/chat/new`,{state:{agentId:Y.id,fromAgentEditor:!0}})}},[Y,kt,Je.saveProfileMarkdownDebounced,x]),Pt={a:n,chat:g,cCron:h,selected:Y,panel:z,data:P,busy:ye,editName:Ae,setEditName:je,editDescription:Me,setEditDescription:Ne,editWorkspace:Te,setEditWorkspace:Ee,editModel:De,setEditModel:ke,defaultModel:F?.model?.primary??``,defaultWorkspace:F?.workspace??``,onSetDefault:()=>{Y&&st(Y)},onSetTuiDefault:()=>{Y&&ft(Y)},isTuiDefault:!!(Y&&Y.id===ze),isTuiDefaultInherited:!!(Y&&Y.id===ze&&(!Re||Be)),onSaveAgentEdits:()=>void at(),onDelete:e=>{Y&&ht(Y,e)},onTryInChat:()=>void Nt(),capabilityPresets:k?.presets??[],defaultPresetId:k?.defaultPresetId,onUpdateAgentExtends:e=>void xt(e),onOpenCapabilityPreset:e=>{x(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewSaveProfileMarkdownRef:Pe,overviewProfile:qe,filesLoading:Je.filesLoading,files:Je.files,activeFile:Je.activeFile,setActiveFile:Je.setActiveFile,filesViewMode:Je.filesViewMode,setFilesViewMode:Je.setFilesViewMode,fileDraft:Je.fileDraft,setFileDraft:Je.setFileDraft,fileSaving:Je.fileSaving,profileFileLoading:Je.profileFileLoading,profileEditorNonce:Je.profileEditorNonce,toolEntryDisable:Ye.toolEntryDisable,setToolEntryDisable:Ye.setToolEntryDisable,onSaveTools:()=>void gt(),onClearToolsEntry:()=>void _t(),modelRows:Ye.modelRows,setModelRows:Ye.setModelRows,onSaveModels:()=>void vt(),onClearModelsEntry:()=>void yt(),skillsCatalogLoading:Xe.skillsCatalogLoading,catalogForPick:Xe.catalogForPick,skillsInherit:Ye.skillsInherit,setSkillsInherit:Ye.setSkillsInherit,skillsPick:Ye.skillsPick,setSkillsPick:Ye.setSkillsPick,onSaveSkills:()=>void bt(),bindingsLoading:X.bindingsLoading,agentBindings:X.agentBindings,bindChannelStatuses:X.bindChannelStatuses,bindChannelsLoading:X.bindChannelsLoading,useManualChannel:X.useManualChannel,newBindChannel:X.newBindChannel,setNewBindChannel:X.setNewBindChannel,bindSessionChats:X.bindSessionChats,bindSessionsLoading:X.bindSessionsLoading,newBindSessionIdx:X.newBindSessionIdx,setNewBindSessionIdx:X.setNewBindSessionIdx,newBindCustomPeer:X.newBindCustomPeer,setNewBindCustomPeer:X.setNewBindCustomPeer,refreshBindSessions:X.refreshBindSessions,onRemoveBinding:e=>void X.onRemoveBinding(e),onAddBinding:X.onAddBinding};return{hasToken:_,a:n,chat:g,language:e,data:P,savedTuiDefaultAgentId:Re,effectiveTuiDefaultAgentId:ze,tuiDefaultAgentDraft:Ce,setTuiDefaultAgentDraft:we,tuiDefaultAgentUnavailable:Be,onSaveTuiDefaultAgent:ct,onSetTuiDefaultAgent:ft,onClearTuiDefaultAgent:pt,onSetDefaultAgent:st,loading:ee,displayError:ne,navigate:x,routeAgentId:S,busy:ye,listSearchQuery:be,openAddAgentModal:$e,openDuplicateAgentModal:nt,duplicateSourceId:ge,onSelectDuplicateSource:tt,panel:z,setPanel:B,modalTitle:Mt,modalSubtitle:Z,footerSaveDisabled:Et,savedFlash:Fe,handleModalFooterSave:kt,onAgentModalOpenChange:At,addAgentModalOpen:pe,setAddAgentModalOpen:me,createWorkspaceSuggestedRef:he,createModalError:de,setCreateModalError:fe,createDisplayName:V,setCreateDisplayName:H,createAgentId:U,setCreateAgentId:G,createDescription:oe,setCreateDescription:se,createWorkspace:le,setCreateWorkspace:K,createModel:ue,setCreateModel:q,onCreate:it,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:Qe,deleteDialogOpen:r,setDeleteDialogOpen:i,deletePurge:u,deleteTarget:s,setDeleteTarget:l,deleteConfirmText:p,setDeleteConfirmText:m,performDelete:mt,editorPanelProps:Pt}}function dr(){let e=ur();return e.hasToken?(0,Q.jsxs)(gt,{gap:`gap-6`,padding:`px-4 py-8`,children:[e.displayError?(0,Q.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:e.displayError}):null,e.loading?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.loading}):e.data?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Q.jsx)(Bn,{a:e.a,agents:e.data.agents,defaultAgentId:e.data.defaultId,tuiDefaultAgentId:e.effectiveTuiDefaultAgentId,tuiDefaultInherited:!e.savedTuiDefaultAgentId||e.tuiDefaultAgentUnavailable,searchQuery:e.listSearchQuery,onOpenAgent:t=>e.navigate(He(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(dt,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(Lt,{open:!!e.routeAgentId,onOpenChange:e.onAgentModalOpenChange,a:e.a,title:e.modalTitle,subtitle:e.modalSubtitle,panel:e.panel,onPanelChange:e.setPanel,onFooterSave:()=>void e.handleModalFooterSave(),footerSaveDisabled:e.footerSaveDisabled,footerSavedFlash:e.savedFlash,showFooter:e.panel===`behavior`,busy:e.busy,children:e.loading||!e.data?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.loading}):(0,Q.jsx)(Pn,{...e.editorPanelProps})}):null,(0,Q.jsx)(Hn,{open:e.addAgentModalOpen,onOpenChange:t=>{e.setAddAgentModalOpen(t),t||(e.createWorkspaceSuggestedRef.current=``,e.setCreateDisplayName(``),e.setCreateAgentId(``),e.setCreateDescription(``),e.setCreateWorkspace(``),e.setCreateModel(``),e.setCreateModalError(null),e.onSelectDuplicateSource(null))},a:e.a,chat:e.chat,busy:e.busy,modalError:e.createModalError,profileLanguageLabel:e.currentLanguageLabel,createDisplayName:e.createDisplayName,setCreateDisplayName:e.setCreateDisplayName,createAgentId:e.createAgentId,setCreateAgentId:e.setCreateAgentId,createDescription:e.createDescription,setCreateDescription:e.setCreateDescription,createWorkspace:e.createWorkspace,setCreateWorkspace:e.setCreateWorkspace,createModel:e.createModel,setCreateModel:e.setCreateModel,onCreate:e.onCreate,onSuggestWorkspace:()=>e.applyCreateWorkspaceSuggestion(),agents:e.data?.agents??[],duplicateSourceId:e.duplicateSourceId,onSelectDuplicateSource:e.onSelectDuplicateSource}),(0,Q.jsx)(Nt,{open:e.deleteDialogOpen,onOpenChange:t=>{e.setDeleteDialogOpen(t),t||(e.setDeleteTarget(null),e.setDeleteConfirmText(``))},busy:e.busy,deletePurge:e.deletePurge,deleteTarget:e.deleteTarget,deleteConfirmText:e.deleteConfirmText,onDeleteConfirmTextChange:e.setDeleteConfirmText,onConfirm:()=>{e.deleteTarget&&e.performDelete(e.deleteTarget,e.deletePurge)},onCancel:()=>e.setDeleteDialogOpen(!1),a:e.a})]}):(0,Q.jsxs)(gt,{gap:`gap-3`,padding:`px-4 py-8`,children:[(0,Q.jsx)(ht,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{dr as AgentsSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CISb1HLv.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{i as s,n as c}from"./fetch-B3ME5Eri.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{Ai as u,Bi as d,Mi as f,Ni as p,Pi as m,Qn as h,Xo as g,Zi as _,Zn as v,ct as y,ji as b,ki as x,sa as S,ss as C,ta as w,uo as T}from"./index-CnjzMw5i.js";import{r as E,t as D}from"./settings-form-section-DBkGwpIN.js";import{n as O,t as k}from"./settings-page-layout-NxoW5Y57.js";var A=n(),j=e(t(),1),M=r();function N(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function P(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function F(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var I={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function L({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,j.useReducer)(y,I),{info:o,loadError:s,actionError:c,copiedField:l,clearDialogOpen:d,clearConfirmChecked:E,clearConfirmText:O,uninstallDialogOpen:k,removeUserDataOnUninstall:A,busy:L}=r,R=(0,j.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,j.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await _(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async e=>{let t=window.electronAPI?.shell;if(!t)return;let n=await t.openPath(e);n.error&&a({type:`patch`,patch:{actionError:n.error}})},V=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:P(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},H=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:A});n.ok||a({type:`patch`,patch:{actionError:P(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(s)return(0,M.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:s});if(!o)return(0,M.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.loading});let U=!o.packaged,W=L||o.pendingUpdate||U,G=!U&&o.uninstallMode!==`unsupported`,K=F(o,t),q=E&&O.trim()===t.clearDataConfirmPhrase;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(D,{children:[n?(0,M.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,M.jsx)(T,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,c?(0,M.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c}):null,U?(0,M.jsxs)(`div`,{className:`mb-4 rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 py-2.5`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,o.pendingUpdate?(0,M.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,o.hasSeparateCliData&&o.cliDataPath?(0,M.jsxs)(`div`,{className:`mb-4 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2.5`,children:[(0,M.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:t.cliDataWarning}),(0,M.jsxs)(`button`,{type:`button`,className:i(`mt-2 inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,w.press),onClick:()=>void B(o.cliDataPath),children:[(0,M.jsx)(g,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t.openCliData]})]}):null,(0,M.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,M.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,M.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,M.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,M.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.appPath}),(0,M.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,w.press),onClick:()=>void z(o.appPath,`app`),children:[(0,M.jsx)(C,{className:`size-3`,"aria-hidden":!0}),l===`app`?t.copied:t.copyPath]})]})]}),(0,M.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,M.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,M.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,M.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.userDataPath}),(0,M.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,w.press),onClick:()=>void z(o.userDataPath,`data`),children:[(0,M.jsx)(C,{className:`size-3`,"aria-hidden":!0}),l===`data`?t.copied:t.copyPath]})]}),(0,M.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,N(o.userDataSizeBytes,t.dataSizeUnknown)]})]})]}),(0,M.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-panel/60 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,M.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,M.jsx)(`button`,{type:`button`,disabled:W,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,w.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),G?(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-panel/60 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,M.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:K})]}),(0,M.jsx)(`button`,{type:`button`,disabled:W,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,w.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,M.jsx)(p,{open:d,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,M.jsxs)(f,{children:[(0,M.jsx)(b,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,h)}),(0,M.jsxs)(x,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,v,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,M.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,M.jsx)(u,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,M.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,M.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:E,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,M.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,M.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,M.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:O,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,M.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,M.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,M.jsx)(S,{type:`button`,variant:`secondary`,disabled:L,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,M.jsx)(S,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:L||!q,onClick:()=>void V(),children:t.confirmClear})]})]})]})}),G?(0,M.jsx)(p,{open:k,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,M.jsxs)(f,{children:[(0,M.jsx)(b,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,h)}),(0,M.jsxs)(x,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,v,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,M.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,M.jsx)(u,{className:`mt-2 text-sm text-fg-muted`,children:K}),(0,M.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,M.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:A,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,M.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),A?(0,M.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,M.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,M.jsx)(S,{type:`button`,variant:`secondary`,disabled:L,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,M.jsx)(S,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:L,onClick:()=>void H(),children:t.confirmUninstall})]})]})]})}):null]})}async function R(){return(await c(s(`/api/migrations/status`))).payload}async function z(){await c(s(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function B({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=l(`settings-migration-status`,R,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(null);async function u(){o(!0),c(null);try{await z(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,M.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checking})]});if(n)return(0,M.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let d=t?.items??[],f=d.filter(e=>e.status===`conflict`||e.status===`error`),p=d.filter(e=>e.safety===`auto`&&e.status===`planned`),m=f.length>0||d.some(e=>e.safety!==`auto`);return(0,M.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:d.length===0?e.upToDate:m?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(p.length))})]}),p.length>0&&!m?(0,M.jsx)(S,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void u(),disabled:a,children:a?e.applying:e.apply}):null]}),d.length>0?(0,M.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,M.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,M.jsx)(`span`,{className:`rounded-full border border-edge px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,M.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function V(){let e=(0,A.c)(28),t=o(H),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.appManagement,s=typeof window<`u`?window.electronAPI?.system:void 0;if(!d()||!s){let t;e[2]===i.title?t=e[3]:(t=(0,M.jsx)(O,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,M.jsx)(B,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=E(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,M.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,M.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,M.jsxs)(k,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,M.jsx)(O,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,M.jsx)(B,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,M.jsx)(L,{api:s,messages:i,embedded:!1}),e[22]=i,e[23]=u);let f;return e[24]!==c||e[25]!==l||e[26]!==u?(f=(0,M.jsxs)(k,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=f):f=e[27],f}function H(e){return e.language}export{V as AppManagementSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{t as r}from"./messages-CISb1HLv.js";import{n as i}from"./locale-store-Ba72bFmP.js";import{i as a}from"./theme-store-Bt6vAkSB.js";import{H as o,Ki as s,ta as c}from"./index-CnjzMw5i.js";import{t as l}from"./settings-advanced-gate-BVy_TawT.js";import{n as u,t as d}from"./settings-page-layout-NxoW5Y57.js";var f=e(),p=t();function m(){return n(`rounded-xl border border-edge-subtle bg-surface-base px-4 py-1 sm:px-5`)}var h={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function g(e){let t=(0,f.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,p.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,p.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let m;t[12]===o?m=t[13]:(m=(0,p.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,p.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,p.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,m,h]}),t[16]=c,t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,p.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function _(e){let t=(0,f.c)(8),{scheme:n}=e,{light:r,dark:i}=h[n],a;t[0]===r?a=t[1]:(a=(0,p.jsx)(g,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,p.jsx)(g,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,p.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var v=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function y(){let e=(0,f.c)(18),t=i(S),o;e[0]===t?o=e[1]:(o=r(t),e[0]=t,e[1]=o);let s=o.appearanceSettings,l=a(x),u=a(b),d;e[2]===s.colorSchemeTitle?d=e[3]:(d=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:s.colorSchemeTitle}),e[2]=s.colorSchemeTitle,e[3]=d);let m;e[4]===s.colorSchemeDescription?m=e[5]:(m=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.colorSchemeDescription}),e[4]=s.colorSchemeDescription,e[5]=m);let h;e[6]!==d||e[7]!==m?(h=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),e[6]=d,e[7]=m,e[8]=h):h=e[8];let g;e[9]!==s||e[10]!==l||e[11]!==u?(g=v.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>u(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,c.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,p.jsx)(_,{scheme:t}),(0,p.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:s[r]})]},t)}),e[9]=s,e[10]=l,e[11]=u,e[12]=g):g=e[12];let y;e[13]===g?y=e[14]:(y=(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:g}),e[13]=g,e[14]=y);let C;return e[15]!==h||e[16]!==y?(C=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-edge-subtle py-3.5 last:border-b-0 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,s=o(T),c=o(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===c?_=e[17]:(_=e=>c(e.target.checked),e[16]=c,e[17]=_);let v;e[18]!==s||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:s,onChange:_}),e[18]=s,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o;e[2]!==a.pageTitle||e[3]!==a.subtitle?(o=(0,p.jsx)(u,{title:a.pageTitle,subtitle:a.subtitle}),e[2]=a.pageTitle,e[3]=a.subtitle,e[4]=o):o=e[4];let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=m(),e[5]=c):c=e[5];let h;e[6]===a.languageTitle?h=e[7]:(h=(0,p.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[6]=a.languageTitle,e[7]=h);let g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,p.jsx)(s,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:c,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[9]=h,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=m(),e[11]=v):v=e[11];let b;e[12]===a.themeTitle?b=e[13]:(b=(0,p.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[12]=a.themeTitle,e[13]=b);let x,S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,p.jsx)(s,{variant:`page`,sections:[`theme`,`font`]}),S=(0,p.jsx)(y,{}),e[14]=x,e[15]=S):(x=e[14],S=e[15]);let w;e[16]===b?w=e[17]:(w=(0,p.jsxs)(`section`,{className:v,"aria-labelledby":`pref-appearance-heading`,children:[b,x,S]}),e[16]=b,e[17]=w);let T;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(),e[18]=T):T=e[18];let E;e[19]===a.developerGroupTitle?E=e[20]:(E=(0,p.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[19]=a.developerGroupTitle,e[20]=E);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,p.jsx)(C,{}),e[21]=D):D=e[21];let k;e[22]===E?k=e[23]:(k=(0,p.jsx)(l,{children:(0,p.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[E,D]})}),e[22]=E,e[23]=k);let A;return e[24]!==o||e[25]!==w||e[26]!==k||e[27]!==_?(A=(0,p.jsxs)(d,{gap:`gap-6`,children:[o,_,w,k]}),e[24]=o,e[25]=w,e[26]=k,e[27]=_,e[28]=A):A=e[28],A}function O(e){return e.language}export{D as AppearanceSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-B1iSKjiw.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{c as s,i as c,n as l,t as u}from"./fetch-B7xDPu-R.js";import{a as d,i as f}from"./vendor-swr-BIWyz7Rc.js";import{Ci as p,Di as m,Ei as h,Es as g,Gs as _,Ni as v,Oi as y,Pa as b,Ra as x,Rs as S,Ti as C,Xa as w,Xs as T,Zo as E,_o as D,ai as O,an as k,ao as A,ha as j,ia as M,ii as N,mr as P,na as F,ni as I,oi as L,ri as R,rt as z,wi as B,xs as V}from"./index-Cc41r16l.js";var H=e(t(),1),U=n();function W(e){return e===`builtin`||e===`user`?e:`marketplace`}async function G(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ee(e){let t=await u(c(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function K(e){let t=await u(c(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await u(c(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function J(e){let t=await u(c(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Y=r();function X(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function te({className:e}){let t=a(o(e=>e.language)).appsPage,n=s(e=>!!e.token),r=R(),{mutate:u}=d(),[p,m]=(0,H.useReducer)(z,Z),{q:h,debounced:g,detailPkg:_,rowBusy:v,actionError:y,restartHint:b}=p,S=n?`marketplace-${g}`:null;(0,H.useEffect)(()=>{let e=window.setTimeout(()=>m({type:`patch`,patch:{debounced:h.trim()}}),300);return()=>window.clearTimeout(e)},[h]);let{data:C,isLoading:w,error:T}=f(S,async()=>l(g.length>0?c(`/api/marketplace?q=${encodeURIComponent(g)}`):c(`/api/marketplace`)),{revalidateOnFocus:!1}),E=(0,H.useCallback)(()=>{u(`gateway-extensions-list`),k()},[u]),O=(0,H.useCallback)(async(e,n)=>{m({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await K({name:e,overwrite:n});E(),r.requiresGatewayRestart&&m({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw m({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{m({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,E]),M=(0,H.useCallback)(async e=>{m({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await J(e);E(),n.requiresGatewayRestart&&m({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw m({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{m({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,E]),N=C?.extensions??[];return(0,Y.jsxs)(`div`,{className:i(`flex flex-col gap-4`,e),children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(x,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:h,onChange:e=>m({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),T?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:T instanceof Error?T.message:t.marketplaceLoadFailed}):null,y?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:y}):null,b?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:b}):null,w&&!C?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):(0,Y.jsx)(`ul`,{className:`flex flex-col gap-3`,children:N.length===0?(0,Y.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):N.map(e=>{let n=X(r,e.id),a=v===e.id;return(0,Y.jsx)(`li`,{className:`list-none`,children:(0,Y.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>m({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),m({type:`patch`,patch:{detailPkg:e.id}}))},className:i(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl border border-edge bg-surface-base p-4 text-left shadow-surface`,`transition-[transform,background-color,border-color,box-shadow] duration-150 ease-out`,`hover:border-edge-subtle hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Y.jsx)(V,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Y.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,Y.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Y.jsx)(A,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Y.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Y.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&M(e.id).catch(()=>{})},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,Y.jsx)(D,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(j,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Y.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{O(e.id,!1).catch(()=>{})},className:i(`inline-flex w-full items-center justify-center rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white`,`shadow-surface transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,Y.jsx)(D,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t.marketplaceInstall]})})]})},e.id)})}),_?(0,Y.jsx)(ne,{packageName:_,copy:t,extensions:r,onClose:()=>m({type:`patch`,patch:{detailPkg:null}}),onInstall:O,onUninstall:M}):null]})}function ne(e){let t=(0,U.c)(61),{packageName:n,copy:r,extensions:a,onClose:o,onInstall:c,onUninstall:l}=e,[u,d]=(0,H.useState)(!1),g=s(oe)?`ext-mp-detail-${n}`:null,v;t[0]===n?v=t[1]:(v=async()=>ee(n),t[0]=n,t[1]=v);let b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b={revalidateOnFocus:!1},t[2]=b):b=t[2];let{data:x,error:w,isLoading:T}=f(g,v,b),E;t[3]!==a||t[4]!==n?(E=X(a,n),t[3]=a,t[4]=n,t[5]=E):E=t[5];let O=E,k=O===`user`,A;t[6]!==r.marketplaceNoReadme||t[7]!==x?(A=x?.readme?.trim()||(x?.description?.trim()?`### ${x.name}\n\n${x.description}`:`*${r.marketplaceNoReadme}*`),t[6]=r.marketplaceNoReadme,t[7]=x,t[8]=A):A=t[8];let N=A,F;t[9]===o?F=t[10]:(F=e=>!e&&o(),t[9]=o,t[10]=F);let I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Y.jsx)(C,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[11]=I):I=t[11];let L;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Y.jsx)(S,{className:`size-5`}),t[12]=L):L=t[12];let R;t[13]!==r.detailBack||t[14]!==o?(R=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:L}),t[13]=r.detailBack,t[14]=o,t[15]=R):R=t[15];let z;t[16]===r.marketplaceDetailTitle?z=t[17]:(z=(0,Y.jsx)(y,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[16]=r.marketplaceDetailTitle,t[17]=z);let B;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Y.jsx)(M,{className:`size-5`}),t[18]=B):B=t[18];let V;t[19]!==r.detailClose||t[20]!==o?(V=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:B}),t[19]=r.detailClose,t[20]=o,t[21]=V):V=t[21];let W;t[22]!==V||t[23]!==R||t[24]!==z?(W=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[R,z,V]}),t[22]=V,t[23]=R,t[24]=z,t[25]=W):W=t[25];let G;t[26]!==r.marketplaceAuthor||t[27]!==r.marketplaceDetailLoadFailed||t[28]!==r.marketplaceDetailReadmeHeading||t[29]!==r.marketplaceDownloads||t[30]!==r.marketplaceVersion||t[31]!==x||t[32]!==w||t[33]!==T||t[34]!==N?(G=T&&!x?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):w?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.marketplaceDetailLoadFailed}):x?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:x.name}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:x.id})}),(0,Y.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Y.jsx)(`dd`,{children:x.author.username})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Y.jsx)(`dd`,{children:x.latestVersion.version})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Y.jsx)(`dd`,{children:x.downloads})]})]}),x.readme?.trim()?(0,Y.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Y.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Y.jsx)(P,{content:N})})]}):null,t[26]=r.marketplaceAuthor,t[27]=r.marketplaceDetailLoadFailed,t[28]=r.marketplaceDetailReadmeHeading,t[29]=r.marketplaceDownloads,t[30]=r.marketplaceVersion,t[31]=x,t[32]=w,t[33]=T,t[34]=N,t[35]=G):G=t[35];let K;t[36]===G?K=t[37]:(K=(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:G}),t[36]=G,t[37]=K);let q;t[38]!==u||t[39]!==r.marketplaceBuiltinGoBuiltin||t[40]!==r.marketplaceBuiltinManageHint||t[41]!==r.marketplaceInstall||t[42]!==r.marketplaceReinstall||t[43]!==r.marketplaceReinstallConfirm||t[44]!==r.marketplaceUninstall||t[45]!==r.marketplaceUninstallConfirm||t[46]!==x||t[47]!==O||t[48]!==o||t[49]!==c||t[50]!==l||t[51]!==n||t[52]!==k?(q=x?(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:O===`bundled`?(0,Y.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Y.jsx)(_,{to:`/apps?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{k&&!window.confirm(r.marketplaceReinstallConfirm)||(d(!0),c(n,k).catch(ie).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[u?(0,Y.jsx)(D,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,k?r.marketplaceReinstall:r.marketplaceInstall]}),k?(0,Y.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(d(!0),l(n).then(()=>o()).catch(re).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,Y.jsx)(j,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[38]=u,t[39]=r.marketplaceBuiltinGoBuiltin,t[40]=r.marketplaceBuiltinManageHint,t[41]=r.marketplaceInstall,t[42]=r.marketplaceReinstall,t[43]=r.marketplaceReinstallConfirm,t[44]=r.marketplaceUninstall,t[45]=r.marketplaceUninstallConfirm,t[46]=x,t[47]=O,t[48]=o,t[49]=c,t[50]=l,t[51]=n,t[52]=k,t[53]=q):q=t[53];let J;t[54]!==W||t[55]!==K||t[56]!==q?(J=(0,Y.jsxs)(h,{children:[I,(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:ae,children:[W,K,q]})]}),t[54]=W,t[55]=K,t[56]=q,t[57]=J):J=t[57];let Z;return t[58]!==J||t[59]!==F?(Z=(0,Y.jsx)(m,{defaultOpen:!0,onOpenChange:F,children:J}),t[58]=J,t[59]=F,t[60]=Z):Z=t[60],Z}function re(){}function ie(){}function ae(e){return e.preventDefault()}function oe(e){return!!e.token}function se(){let e=o(e=>e.language),t=a(e),n=v(e=>e.setPageHeader),r=v(e=>e.clearPageHeader),s=R(),c=N(),[l,u]=T(),d=W(l.get(`tab`)),f=l.get(`q`)??``,[p,m]=(0,H.useState)(d),[h,g]=(0,H.useState)(f),[_,y]=(0,H.useState)(null),b=l.toString(),S=(0,H.useRef)(b);if(S.current!==b){S.current=b;let e=W(l.get(`tab`)),t=l.get(`q`)??``;m(t=>t===e?t:e),g(e=>e===t?e:t)}(0,H.useEffect)(()=>{u(e=>{let t=new URLSearchParams(e),n=h.trim();return n?t.set(`q`,n):t.delete(`q`),p===`marketplace`?t.delete(`tab`):t.set(`tab`,p),t.toString()===e.toString()?e:t},{replace:!0})},[p,h,u]);let C=(0,H.useMemo)(()=>s.filter(e=>e.source===`bundled`),[s]),w=(0,H.useMemo)(()=>s.filter(e=>e.source!==`bundled`),[s]),E=p===`builtin`?C:w,D=(0,H.useMemo)(()=>{let t=h.trim().toLowerCase(),n=E;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[E,h,e]);if((0,H.useEffect)(()=>{y(e=>{if(!e)return e;let t=s.find(t=>t.id===e.id);return t?Q(e)===Q(t)&&e.active===t.active?e:t:null})},[s]),(0,H.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.appsPage.title})}),end:null}),()=>r()),[r,t.appsPage.title,n]),c&&p!==`marketplace`)return(0,Y.jsx)(pe,{});let O=p!==`marketplace`&&E.length>0;return(0,Y.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[(0,Y.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-x-1 gap-y-1`,role:`tablist`,"aria-label":t.appsPage.appsNavAria,children:[(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`marketplace`,className:i(`relative max-w-full rounded-md px-3 py-2 text-left text-sm font-medium transition-colors sm:text-center`,p===`marketplace`?`text-fg`:`text-fg-muted hover:text-fg`,p===`marketplace`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`marketplace`),children:t.appsPage.tabMarketplace}),(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`builtin`,className:i(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,p===`builtin`?`text-fg`:`text-fg-muted hover:text-fg`,p===`builtin`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`builtin`),children:[t.appsPage.tabBuiltin,(0,Y.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,C.length,`)`]})]}),(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`user`,className:i(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,p===`user`?`text-fg`:`text-fg-muted hover:text-fg`,p===`user`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`user`),children:[t.appsPage.tabUser,(0,Y.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,w.length,`)`]})]})]}),O?(0,Y.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Y.jsx)(x,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:h,onChange:e=>g(e.target.value),placeholder:t.appsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),p===`marketplace`?(0,Y.jsx)(te,{}):p===`builtin`&&C.length===0?(0,Y.jsx)(he,{message:t.appsPage.emptyBuiltin}):p===`user`&&w.length===0?(0,Y.jsx)(he,{message:t.appsPage.emptyUser}):D.length===0?(0,Y.jsx)(`p`,{className:`rounded-xl border border-dashed border-edge-subtle bg-surface-hover/30 px-4 py-8 text-center text-sm text-fg-muted dark:bg-surface-hover/15`,children:t.appsPage.noSearchResults}):(0,Y.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:D.map(e=>(0,Y.jsx)(de,{extension:e,copy:t.appsPage,showSourceBadge:p===`user`,onOpen:()=>y(e)},e.id))})]}),_?(0,Y.jsx)(fe,{extension:_,copy:t.appsPage,onClose:()=>y(null)},_.id):null]})}function Q(e){return e.activationEligible??e.active}function ce(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function le(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function ue(e,t){let n=Q(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function de(e){let t=(0,U.c)(45),{extension:n,copy:r,showSourceBadge:a,onOpen:o}=e,s;t[0]===n?s=t[1]:(s=Q(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(`group flex w-full flex-col rounded-xl border border-edge bg-surface-base p-4 text-left shadow-sm transition-colors`,`hover:border-edge-subtle hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=u):u=t[2];let d=n.name||n.id,f;t[3]===d?f=t[4]:(f=d.charAt(0).toUpperCase(),t[3]=d,t[4]=f);let p;t[5]===f?p=t[6]:(p=(0,Y.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:f}),t[5]=f,t[6]=p);let m;t[7]===n.name?m=t[8]:(m=(0,Y.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=m);let h;t[9]===n.version?h=t[10]:(h=n.version?(0,Y.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=h);let _;t[11]!==m||t[12]!==h?(_=(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[11]=m,t[12]=h,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==c?(v=c?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,Y.jsx)(g,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Y.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,Y.jsx)(w,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==l?(C=(0,Y.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=l,t[27]=C):C=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==a?(T=n.source===`bundled`?(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):a?(0,Y.jsx)(`span`,{title:ce(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:le(n,r)}):null,t[28]=r,t[29]=n,t[30]=a,t[31]=T):T=t[31];let E;t[32]!==C||t[33]!==T?(E=(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,T]}),t[32]=C,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==y||t[36]!==x||t[37]!==E?(D=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,E]}),t[35]=y,t[36]=x,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==p?(O=(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[p,D]}),t[39]=D,t[40]=p,t[41]=O):O=t[41];let k;return t[42]!==o||t[43]!==O?(k=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:u,children:O}),t[42]=o,t[43]=O,t[44]=k):k=t[44],k}function fe({extension:e,copy:t,onClose:n}){let{mutate:r}=d(),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(!1),f=e.activationEligible===!0,g=(0,H.useCallback)(async()=>{if(e.source===`bundled`){c(null),u(!1),o(!0);try{let{requiresGatewayRestart:t}=await q({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),k(),u(t)}catch(e){c(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),v=e.ui?.contributions?.pages??[],x=e.ui?.contributions?.settingsPanels??[],w=e.ui?.contributions?.chatWidgets??[],T=e.ui?.contributions?.sidebarPanels??[],A=v.find(e=>e.showInNav)??v[0],j=x[0],N=A?I(e.id,A):null,P=j?`/settings/ext/${e.id}/${j.id}`:e.hasConfigSchema||O(e)?`/settings/ext/${e.id}`:null;return(0,Y.jsx)(m,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Y.jsxs)(h,{children:[(0,Y.jsx)(C,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,Y.jsx)(S,{className:`size-5`})}),(0,Y.jsx)(y,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Y.jsxs)(B,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,Y.jsx)(M,{className:`size-5`})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Y.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,ce(e,t)]}),e.version?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Y.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:ue(e,t)}),e.source===`bundled`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,Y.jsxs)(`div`,{className:`mt-3 rounded-lg border border-edge-subtle bg-surface-hover/40 p-3 dark:bg-surface-hover/20`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Y.jsx)(F,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void g(),className:`shrink-0 py-1.5 text-xs`,children:a?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(D,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,l?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(v.length>0||x.length>0||w.length>0)?(0,Y.jsxs)(`section`,{className:`mt-8`,children:[(0,Y.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Y.jsx)($,{template:t.badgePages,count:v.length,hidden:v.length===0}),(0,Y.jsx)($,{template:t.badgeSettings,count:x.length,hidden:x.length===0}),(0,Y.jsx)($,{template:t.badgeWidgets,count:w.length,hidden:w.length===0}),(0,Y.jsx)($,{template:t.badgeSidebar,count:T.length,hidden:T.length===0})]})]}):null,L(e)&&(N||P)?(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[N?(0,Y.jsxs)(_,{to:N,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Y.jsx)(E,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,P?(0,Y.jsxs)(_,{to:P,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Y.jsx)(b,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Y.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function $(e){let t=(0,U.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,Y.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function pe(){let e=(0,U.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Y.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Y.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[t,n,r,(0,Y.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(me)})]})}),e[4]=a):a=e[4],a}function me(e){return(0,Y.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge bg-surface-base`},e)}function he(e){let t=(0,U.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Y.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-dashed border-edge-subtle bg-surface-hover/40 px-4 py-12 text-center dark:bg-surface-hover/20`,children:(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{se as AppsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CISb1HLv.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{c as s,i as c,n as l,t as u}from"./fetch-B3ME5Eri.js";import{a as d,i as f}from"./vendor-swr-BIWyz7Rc.js";import{Ai as p,As as m,Mi as h,Ni as g,Pi as _,Qs as v,So as y,Ts as b,Ua as x,Vs as S,ba as C,br as w,ci as T,ct as E,di as D,fi as O,ji as k,ki as A,la as j,li as M,qs as N,sa as P,to as F,ts as I,ui as L,un as R,uo as z,za as B,zi as V}from"./index-CnjzMw5i.js";var H=e(t(),1),U=n();function W(e){return e===`builtin`||e===`user`?e:`marketplace`}async function G(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ee(e){let t=await u(c(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function K(e){let t=await u(c(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await u(c(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function J(e){let t=await u(c(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Y=r();function X(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function te({className:e}){let t=a(o(e=>e.language)).appsPage,n=s(e=>!!e.token),r=M(),{mutate:u}=d(),[p,m]=(0,H.useReducer)(E,Z),{q:h,debounced:g,detailPkg:_,rowBusy:v,actionError:S,restartHint:w}=p,T=n?`marketplace-${g}`:null;(0,H.useEffect)(()=>{let e=window.setTimeout(()=>m({type:`patch`,patch:{debounced:h.trim()}}),300);return()=>window.clearTimeout(e)},[h]);let{data:D,isLoading:O,error:k}=f(T,async()=>l(g.length>0?c(`/api/marketplace?q=${encodeURIComponent(g)}`):c(`/api/marketplace`)),{revalidateOnFocus:!1}),A=(0,H.useCallback)(()=>{u(`gateway-extensions-list`),R()},[u]),j=(0,H.useCallback)(async(e,n)=>{m({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await K({name:e,overwrite:n});A(),r.requiresGatewayRestart&&m({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw m({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{m({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,A]),N=(0,H.useCallback)(async e=>{m({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await J(e);A(),n.requiresGatewayRestart&&m({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw m({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{m({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,A]),P=D?.extensions??[];return(0,Y.jsxs)(`div`,{className:i(`flex flex-col gap-4`,e),children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(x,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:h,onChange:e=>m({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),k?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:k instanceof Error?k.message:t.marketplaceLoadFailed}):null,S?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:S}):null,w?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:w}):null,O&&!D?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):(0,Y.jsx)(`ul`,{className:`flex flex-col gap-3`,children:P.length===0?(0,Y.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):P.map(e=>{let n=X(r,e.id),a=v===e.id;return(0,Y.jsx)(`li`,{className:`list-none`,children:(0,Y.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>m({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),m({type:`patch`,patch:{detailPkg:e.id}}))},className:i(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl border border-edge bg-surface-base p-4 text-left shadow-surface`,`transition-[transform,background-color,border-color,box-shadow] duration-150 ease-out`,`hover:border-edge-subtle hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Y.jsx)(b,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Y.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,Y.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Y.jsx)(z,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Y.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Y.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&N(e.id).catch(()=>{})},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,Y.jsx)(y,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(C,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Y.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{j(e.id,!1).catch(()=>{})},className:i(`inline-flex w-full items-center justify-center rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white`,`shadow-surface transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,Y.jsx)(y,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t.marketplaceInstall]})})]})},e.id)})}),_?(0,Y.jsx)(ne,{packageName:_,copy:t,extensions:r,onClose:()=>m({type:`patch`,patch:{detailPkg:null}}),onInstall:j,onUninstall:N}):null]})}function ne(e){let t=(0,U.c)(61),{packageName:n,copy:r,extensions:a,onClose:o,onInstall:c,onUninstall:l}=e,[u,d]=(0,H.useState)(!1),p=s(oe)?`ext-mp-detail-${n}`:null,m;t[0]===n?m=t[1]:(m=async()=>ee(n),t[0]=n,t[1]=m);let v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1},t[2]=v):v=t[2];let{data:b,error:x,isLoading:T}=f(p,m,v),E;t[3]!==a||t[4]!==n?(E=X(a,n),t[3]=a,t[4]=n,t[5]=E):E=t[5];let D=E,O=D===`user`,M;t[6]!==r.marketplaceNoReadme||t[7]!==b?(M=b?.readme?.trim()||(b?.description?.trim()?`### ${b.name}\n\n${b.description}`:`*${r.marketplaceNoReadme}*`),t[6]=r.marketplaceNoReadme,t[7]=b,t[8]=M):M=t[8];let P=M,F;t[9]===o?F=t[10]:(F=e=>!e&&o(),t[9]=o,t[10]=F);let I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Y.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[11]=I):I=t[11];let L;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Y.jsx)(S,{className:`size-5`}),t[12]=L):L=t[12];let R;t[13]!==r.detailBack||t[14]!==o?(R=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:L}),t[13]=r.detailBack,t[14]=o,t[15]=R):R=t[15];let z;t[16]===r.marketplaceDetailTitle?z=t[17]:(z=(0,Y.jsx)(_,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[16]=r.marketplaceDetailTitle,t[17]=z);let B;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Y.jsx)(j,{className:`size-5`}),t[18]=B):B=t[18];let V;t[19]!==r.detailClose||t[20]!==o?(V=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:B}),t[19]=r.detailClose,t[20]=o,t[21]=V):V=t[21];let W;t[22]!==V||t[23]!==R||t[24]!==z?(W=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[R,z,V]}),t[22]=V,t[23]=R,t[24]=z,t[25]=W):W=t[25];let G;t[26]!==r.marketplaceAuthor||t[27]!==r.marketplaceDetailLoadFailed||t[28]!==r.marketplaceDetailReadmeHeading||t[29]!==r.marketplaceDownloads||t[30]!==r.marketplaceVersion||t[31]!==b||t[32]!==x||t[33]!==T||t[34]!==P?(G=T&&!b?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):x?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.marketplaceDetailLoadFailed}):b?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:b.name}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:b.id})}),(0,Y.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Y.jsx)(`dd`,{children:b.author.username})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Y.jsx)(`dd`,{children:b.latestVersion.version})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Y.jsx)(`dd`,{children:b.downloads})]})]}),b.readme?.trim()?(0,Y.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Y.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Y.jsx)(w,{content:P})})]}):null,t[26]=r.marketplaceAuthor,t[27]=r.marketplaceDetailLoadFailed,t[28]=r.marketplaceDetailReadmeHeading,t[29]=r.marketplaceDownloads,t[30]=r.marketplaceVersion,t[31]=b,t[32]=x,t[33]=T,t[34]=P,t[35]=G):G=t[35];let K;t[36]===G?K=t[37]:(K=(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:G}),t[36]=G,t[37]=K);let q;t[38]!==u||t[39]!==r.marketplaceBuiltinGoBuiltin||t[40]!==r.marketplaceBuiltinManageHint||t[41]!==r.marketplaceInstall||t[42]!==r.marketplaceReinstall||t[43]!==r.marketplaceReinstallConfirm||t[44]!==r.marketplaceUninstall||t[45]!==r.marketplaceUninstallConfirm||t[46]!==b||t[47]!==D||t[48]!==o||t[49]!==c||t[50]!==l||t[51]!==n||t[52]!==O?(q=b?(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:D===`bundled`?(0,Y.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Y.jsx)(N,{to:`/apps?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{O&&!window.confirm(r.marketplaceReinstallConfirm)||(d(!0),c(n,O).catch(ie).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[u?(0,Y.jsx)(y,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,O?r.marketplaceReinstall:r.marketplaceInstall]}),O?(0,Y.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(d(!0),l(n).then(()=>o()).catch(re).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,Y.jsx)(C,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[38]=u,t[39]=r.marketplaceBuiltinGoBuiltin,t[40]=r.marketplaceBuiltinManageHint,t[41]=r.marketplaceInstall,t[42]=r.marketplaceReinstall,t[43]=r.marketplaceReinstallConfirm,t[44]=r.marketplaceUninstall,t[45]=r.marketplaceUninstallConfirm,t[46]=b,t[47]=D,t[48]=o,t[49]=c,t[50]=l,t[51]=n,t[52]=O,t[53]=q):q=t[53];let J;t[54]!==W||t[55]!==K||t[56]!==q?(J=(0,Y.jsxs)(h,{children:[I,(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:ae,children:[W,K,q]})]}),t[54]=W,t[55]=K,t[56]=q,t[57]=J):J=t[57];let Z;return t[58]!==J||t[59]!==F?(Z=(0,Y.jsx)(g,{defaultOpen:!0,onOpenChange:F,children:J}),t[58]=J,t[59]=F,t[60]=Z):Z=t[60],Z}function re(){}function ie(){}function ae(e){return e.preventDefault()}function oe(e){return!!e.token}function se(){let e=o(e=>e.language),t=a(e),n=V(e=>e.setPageHeader),r=V(e=>e.clearPageHeader),s=M(),c=L(),[l,u]=v(),d=W(l.get(`tab`)),f=l.get(`q`)??``,[p,m]=(0,H.useState)(d),[h,g]=(0,H.useState)(f),[_,y]=(0,H.useState)(null),b=l.toString(),S=(0,H.useRef)(b);if(S.current!==b){S.current=b;let e=W(l.get(`tab`)),t=l.get(`q`)??``;m(t=>t===e?t:e),g(e=>e===t?e:t)}(0,H.useEffect)(()=>{u(e=>{let t=new URLSearchParams(e),n=h.trim();return n?t.set(`q`,n):t.delete(`q`),p===`marketplace`?t.delete(`tab`):t.set(`tab`,p),t.toString()===e.toString()?e:t},{replace:!0})},[p,h,u]);let C=(0,H.useMemo)(()=>s.filter(e=>e.source===`bundled`),[s]),w=(0,H.useMemo)(()=>s.filter(e=>e.source!==`bundled`),[s]),T=p===`builtin`?C:w,E=(0,H.useMemo)(()=>{let t=h.trim().toLowerCase(),n=T;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[T,h,e]);if((0,H.useEffect)(()=>{y(e=>{if(!e)return e;let t=s.find(t=>t.id===e.id);return t?Q(e)===Q(t)&&e.active===t.active?e:t:null})},[s]),(0,H.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.appsPage.title})}),end:null}),()=>r()),[r,t.appsPage.title,n]),c&&p!==`marketplace`)return(0,Y.jsx)(pe,{});let D=p!==`marketplace`&&T.length>0;return(0,Y.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[(0,Y.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-x-1 gap-y-1`,role:`tablist`,"aria-label":t.appsPage.appsNavAria,children:[(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`marketplace`,className:i(`relative max-w-full rounded-md px-3 py-2 text-left text-sm font-medium transition-colors sm:text-center`,p===`marketplace`?`text-fg`:`text-fg-muted hover:text-fg`,p===`marketplace`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`marketplace`),children:t.appsPage.tabMarketplace}),(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`builtin`,className:i(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,p===`builtin`?`text-fg`:`text-fg-muted hover:text-fg`,p===`builtin`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`builtin`),children:[t.appsPage.tabBuiltin,(0,Y.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,C.length,`)`]})]}),(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`user`,className:i(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,p===`user`?`text-fg`:`text-fg-muted hover:text-fg`,p===`user`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>m(`user`),children:[t.appsPage.tabUser,(0,Y.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,w.length,`)`]})]})]}),D?(0,Y.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Y.jsx)(x,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:h,onChange:e=>g(e.target.value),placeholder:t.appsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),p===`marketplace`?(0,Y.jsx)(te,{}):p===`builtin`&&C.length===0?(0,Y.jsx)(he,{message:t.appsPage.emptyBuiltin}):p===`user`&&w.length===0?(0,Y.jsx)(he,{message:t.appsPage.emptyUser}):E.length===0?(0,Y.jsx)(`p`,{className:`rounded-xl border border-dashed border-edge-subtle bg-surface-hover/30 px-4 py-8 text-center text-sm text-fg-muted dark:bg-surface-hover/15`,children:t.appsPage.noSearchResults}):(0,Y.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:E.map(e=>(0,Y.jsx)(de,{extension:e,copy:t.appsPage,showSourceBadge:p===`user`,onOpen:()=>y(e)},e.id))})]}),_?(0,Y.jsx)(fe,{extension:_,copy:t.appsPage,onClose:()=>y(null)},_.id):null]})}function Q(e){return e.activationEligible??e.active}function ce(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function le(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function ue(e,t){let n=Q(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function de(e){let t=(0,U.c)(45),{extension:n,copy:r,showSourceBadge:a,onOpen:o}=e,s;t[0]===n?s=t[1]:(s=Q(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(`group flex w-full flex-col rounded-xl border border-edge bg-surface-base p-4 text-left shadow-sm transition-colors`,`hover:border-edge-subtle hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=u):u=t[2];let d=n.name||n.id,f;t[3]===d?f=t[4]:(f=d.charAt(0).toUpperCase(),t[3]=d,t[4]=f);let p;t[5]===f?p=t[6]:(p=(0,Y.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:f}),t[5]=f,t[6]=p);let h;t[7]===n.name?h=t[8]:(h=(0,Y.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=h);let g;t[9]===n.version?g=t[10]:(g=n.version?(0,Y.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=g);let _;t[11]!==h||t[12]!==g?(_=(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==c?(v=c?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,Y.jsx)(m,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Y.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,Y.jsx)(F,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==l?(C=(0,Y.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=l,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==a?(w=n.source===`bundled`?(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):a?(0,Y.jsx)(`span`,{title:ce(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:le(n,r)}):null,t[28]=r,t[29]=n,t[30]=a,t[31]=w):w=t[31];let T;t[32]!==C||t[33]!==w?(T=(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==y||t[36]!==x||t[37]!==T?(E=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,T]}),t[35]=y,t[36]=x,t[37]=T,t[38]=E):E=t[38];let D;t[39]!==E||t[40]!==p?(D=(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[p,E]}),t[39]=E,t[40]=p,t[41]=D):D=t[41];let O;return t[42]!==o||t[43]!==D?(O=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:u,children:D}),t[42]=o,t[43]=D,t[44]=O):O=t[44],O}function fe({extension:e,copy:t,onClose:n}){let{mutate:r}=d(),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(!1),f=e.activationEligible===!0,m=(0,H.useCallback)(async()=>{if(e.source===`bundled`){c(null),u(!1),o(!0);try{let{requiresGatewayRestart:t}=await q({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),R(),u(t)}catch(e){c(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),v=e.ui?.contributions?.pages??[],b=e.ui?.contributions?.settingsPanels??[],x=e.ui?.contributions?.chatWidgets??[],C=e.ui?.contributions?.sidebarPanels??[],w=v.find(e=>e.showInNav)??v[0],E=b[0],M=w?T(e.id,w):null,F=E?`/settings/ext/${e.id}/${E.id}`:e.hasConfigSchema||D(e)?`/settings/ext/${e.id}`:null;return(0,Y.jsx)(g,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Y.jsxs)(h,{children:[(0,Y.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,Y.jsx)(S,{className:`size-5`})}),(0,Y.jsx)(_,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Y.jsxs)(p,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,Y.jsx)(j,{className:`size-5`})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Y.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,ce(e,t)]}),e.version?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Y.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:ue(e,t)}),e.source===`bundled`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,Y.jsxs)(`div`,{className:`mt-3 rounded-lg border border-edge-subtle bg-surface-hover/40 p-3 dark:bg-surface-hover/20`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Y.jsx)(P,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void m(),className:`shrink-0 py-1.5 text-xs`,children:a?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(y,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,l?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(v.length>0||b.length>0||x.length>0)?(0,Y.jsxs)(`section`,{className:`mt-8`,children:[(0,Y.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Y.jsx)($,{template:t.badgePages,count:v.length,hidden:v.length===0}),(0,Y.jsx)($,{template:t.badgeSettings,count:b.length,hidden:b.length===0}),(0,Y.jsx)($,{template:t.badgeWidgets,count:x.length,hidden:x.length===0}),(0,Y.jsx)($,{template:t.badgeSidebar,count:C.length,hidden:C.length===0})]})]}):null,O(e)&&(M||F)?(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[M?(0,Y.jsxs)(N,{to:M,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Y.jsx)(I,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,F?(0,Y.jsxs)(N,{to:F,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Y.jsx)(B,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Y.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function $(e){let t=(0,U.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,Y.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function pe(){let e=(0,U.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Y.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Y.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[t,n,r,(0,Y.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(me)})]})}),e[4]=a):a=e[4],a}function me(e){return(0,Y.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge bg-surface-base`},e)}function he(e){let t=(0,U.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Y.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-dashed border-edge-subtle bg-surface-hover/40 px-4 py-12 text-center dark:bg-surface-hover/20`,children:(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{se as AppsPage};
|
package/dist/gateway/static/root/assets/{archive-plugin-Cki4SfU2.js → archive-plugin-CiHaUMII.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-CISb1HLv.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-BbA7sRd_.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
|