@xopcai/xopc 0.0.119 → 0.0.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/dashscope/src/image-generation-provider.d.ts +6 -5
- package/dist/extensions/dashscope/src/image-generation-provider.js +40 -64
- package/dist/extensions/dashscope/src/image-generation-provider.js.map +1 -1
- package/dist/extensions/dashscope/src/index.d.ts +1 -1
- package/dist/extensions/dashscope/src/index.js +2 -2
- package/dist/extensions/dashscope/xopc.extension.json +3 -2
- package/dist/extensions/minimax/src/image-generation-provider.d.ts +7 -5
- package/dist/extensions/minimax/src/image-generation-provider.js +43 -37
- package/dist/extensions/minimax/src/image-generation-provider.js.map +1 -1
- package/dist/extensions/minimax/src/index.d.ts +1 -1
- package/dist/extensions/minimax/src/index.js +2 -2
- package/dist/extensions/minimax/xopc.extension.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/Combination-HAlzriaz.js +41 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CU8J6zou.js → agent-avatar-dicebear-4AW4JgSU.js} +1 -1
- package/dist/gateway/static/root/assets/agents-2SVUUPlp.js +2 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B9vfYoEr.js → app-management-settings-panel-CE6GkGU2.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-ClOzIO24.js → appearance-settings-BmaUjghw.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DU0dz9Zo.js → apps-page-BWeQ1I49.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BkVIgZzA.js → archive-plugin-CX4_KWut.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CaCMWh1D.js → attachment-load-jf-PIIUU.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-DhGDpKP3.js → automation-suggestion-card-BHk5rtJz.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-QHotl53D.js +1 -0
- package/dist/gateway/static/root/assets/{binary-plugins-B4TO_bsn.js → binary-plugins-DG9XQikd.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DJRWwWNI.js → block-editor-Up_VIxLJ.js} +6 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Cmwi6IIQ.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-Befi89CL.js → capability-presets-api-CGM4OyMw.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-_G8eb2vJ.js → capability-presets-settings-panel-CzWt0LBb.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-BNSuJb5f.js → channel-recipient-api-BEByL4_o.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BOMCUe2J.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-C-Dexk_F.js +2 -0
- package/dist/gateway/static/root/assets/dist-Mys7eFJ5.js +1 -0
- package/dist/gateway/static/root/assets/dist-wO9a2_ID.js +1 -0
- package/dist/gateway/static/root/assets/dreaming-settings-WPEj8pir.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DYh402XV.js → extension-debug-page-DZxa_j7-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Cr_TizrN.js → extension-page-CseziW53.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-B_9J-xyo.js +1 -0
- package/dist/gateway/static/root/assets/{fetch-Y7AEX4H3.js → fetch-Cs4ck8zA.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-RbMmAOpX.js → gateway-config-api-Dl223a7r.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-DdzbtW9R.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DiD_Tx4N.js → gateway-startup-retry-IvePwjFE.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-Dxldogms.js +1 -0
- package/dist/gateway/static/root/assets/{goals-config-api-DqxVi0p5.js → goals-config-api-CUCP6yCl.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-DU5Nd6Xp.js +2 -0
- package/dist/gateway/static/root/assets/goals-settings-Dj87qPxv.js +1 -0
- package/dist/gateway/static/root/assets/heartbeat-settings-Cgm5JmwH.js +1 -0
- package/dist/gateway/static/root/assets/index-BU1pvxmS.js +191 -0
- package/dist/gateway/static/root/assets/index-l54WfSqe.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Dvg53qnd.js → keyboard-shortcuts-settings-DJgYw0nB.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DjbfSsfA.js → locale-store-Ba72bFmP.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-C10aS4XO.js +2 -0
- package/dist/gateway/static/root/assets/{markdown-split-CpHxbtWJ.js → markdown-split-gnQ_EiGo.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-SFPQRSxq.js → media-plugins-CQV-mgJn.js} +1 -1
- package/dist/gateway/static/root/assets/messages-C6Kc4Jhf.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-panel-B35CAfg6.js +2 -0
- package/dist/gateway/static/root/assets/note-detail-page-Brlwse8x.js +2 -0
- package/dist/gateway/static/root/assets/{note-image-lightbox-BUYURRgn.js → note-image-lightbox-BthwKjLA.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BsIBSFyZ.js → notes-page-CoAwRc7L.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BHz9iWYA.js → preview-open-alternatives-BPMXC-2u.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-B36RQ05h.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-CefkOlRg.js → save-bar-controls-BEHqwZjz.js} +1 -1
- package/dist/gateway/static/root/assets/schedule-field-CMY25m97.js +1 -0
- package/dist/gateway/static/root/assets/schema-form-CxjxsFfg.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-73THChnj.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CR9VsY-R.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-BouO6JTi.js → settings-collapsible-section-s-kiLAxP.js} +1 -1
- package/dist/gateway/static/root/assets/settings-form-section-CIxIEYxU.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-BJ1AhfKI.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-BJ4Gsef5.js → settings-page-layout--6qT7ZJa.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CrUjHPQo.js → setup-status-panel-C1TtS1vJ.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BDy2btRN.js → share-preview-page-BZADSbS1.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-gqC8Rmhy.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-C9P-WYvS.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CEpSvOhF.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-CRngrlnZ.js → system-settings-panel-Czjf0kLJ.js} +1 -1
- 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-BltBc0b-.js → typed-models-lib-Cmt8SYdI.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CjN-51e6.js → use-channel-catalog-DyM-ckEQ.js} +1 -1
- package/dist/gateway/static/root/assets/user-profile-settings-panel-BygLv8vm.js +1 -0
- package/dist/gateway/static/root/assets/{utils-B5M5-YvK.js → utils-CloW8coB.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BsoqJba6.js +1 -0
- package/dist/gateway/static/root/assets/{voice-player-store-B7ykUlHM.js → voice-player-store-DduWlJYV.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CcQeX6l5.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-CeA8A9Ef.js +18 -0
- package/dist/gateway/static/root/index.html +9 -10
- package/dist/package.js +1 -1
- package/dist/src/agent/context/workspace-templates/AGENTS.md +3 -2
- package/dist/src/agent/embedded/xopc-auth-storage.d.ts +1 -5
- package/dist/src/agent/embedded/xopc-auth-storage.js +2 -8
- package/dist/src/agent/embedded/xopc-auth-storage.js.map +1 -1
- package/dist/src/agent/embedded/xopc-tools-bridge.js +23 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js.map +1 -1
- package/dist/src/agent/goals/checklist-judge.js +1 -1
- package/dist/src/agent/goals/checklist-judge.js.map +1 -1
- package/dist/src/agent/goals/judge.js +1 -1
- package/dist/src/agent/goals/judge.js.map +1 -1
- package/dist/src/agent/image/tool-model-config.d.ts +2 -0
- package/dist/src/agent/image/tool-model-config.js +2 -2
- package/dist/src/agent/image/tool-model-config.js.map +1 -1
- package/dist/src/agent/image/understanding/pi-ai-provider.js +1 -1
- package/dist/src/agent/image/understanding/pi-ai-provider.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/compaction.d.ts +1 -1
- package/dist/src/agent/memory/compaction.js +1 -1
- package/dist/src/agent/memory/compaction.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 +3 -0
- package/dist/src/agent/middleware/self-verify.js +18 -0
- package/dist/src/agent/middleware/self-verify.js.map +1 -1
- package/dist/src/agent/orchestration/agent-event-handler.js +28 -3
- package/dist/src/agent/orchestration/agent-event-handler.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 +23 -7
- package/dist/src/agent/prompt/sections/tooling.js.map +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +1 -0
- package/dist/src/agent/prompt/service-prompt-builder.js.map +1 -1
- package/dist/src/agent/prompt/system-prompt.d.ts +1 -0
- package/dist/src/agent/prompt/system-prompt.js +13 -1
- package/dist/src/agent/prompt/system-prompt.js.map +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/sandbox/path-policy.js +30 -6
- package/dist/src/agent/sandbox/path-policy.js.map +1 -1
- package/dist/src/agent/service/btw-query.js +1 -1
- package/dist/src/agent/service/btw-query.js.map +1 -1
- package/dist/src/agent/service.d.ts +0 -3
- package/dist/src/agent/service.js +0 -41
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/starter-agents.js +16 -16
- package/dist/src/agent/starter-agents.js.map +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +12 -1
- package/dist/src/agent/tools/image-generate-tool.js.map +1 -1
- 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/tools/session-search-tool.js +1 -1
- package/dist/src/agent/tools/session-search-tool.js.map +1 -1
- package/dist/src/agent/tools/web-extract.js +1 -1
- package/dist/src/agent/tools/web-extract.js.map +1 -1
- package/dist/src/agent-manifest/index.js +2 -2
- package/dist/src/agent-manifest/schema.d.ts +66 -0
- package/dist/src/agent-manifest/schema.js +28 -2
- package/dist/src/agent-manifest/schema.js.map +1 -1
- package/dist/src/automations/draft/automation-draft-service.js +1 -1
- package/dist/src/automations/draft/automation-draft-service.js.map +1 -1
- package/dist/src/cli/commands/agent.js +2 -2
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +161 -11
- package/dist/src/cli/commands/onboard/model.js.map +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/profile.js +1 -1
- package/dist/src/cli/commands/tunnel.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/cli/templates.js +3 -2
- package/dist/src/cli/templates.js.map +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/default-model.d.ts +11 -0
- package/dist/src/config/default-model.js +19 -0
- package/dist/src/config/default-model.js.map +1 -0
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/schema.d.ts +73 -13
- package/dist/src/config/schema.js +59 -24
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/connectors/registries/smithery.js +10 -9
- package/dist/src/connectors/registries/smithery.js.map +1 -1
- package/dist/src/daemon/install-plan.js +2 -1
- package/dist/src/daemon/install-plan.js.map +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/global-defaults-admin.js +6 -16
- package/dist/src/gateway/global-defaults-admin.js.map +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +24 -0
- package/dist/src/gateway/hono/routes/agents.js +1 -79
- package/dist/src/gateway/hono/routes/agents.js.map +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +4 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js.map +1 -1
- package/dist/src/gateway/hono/routes/models.js +132 -14
- package/dist/src/gateway/hono/routes/models.js.map +1 -1
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js.map +1 -1
- package/dist/src/gateway/image-capabilities.d.ts +11 -1
- package/dist/src/gateway/image-capabilities.js +32 -43
- package/dist/src/gateway/image-capabilities.js.map +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/workspace-editor-path.js +9 -1
- package/dist/src/gateway/workspace-editor-path.js.map +1 -1
- package/dist/src/generated/bundled-image-generation-providers.d.ts +4 -2
- package/dist/src/generated/bundled-image-generation-providers.js +6 -4
- package/dist/src/generated/bundled-image-generation-providers.js.map +1 -1
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/media/paths.js +3 -4
- package/dist/src/media/paths.js.map +1 -1
- package/dist/src/notes/service.js +1 -1
- package/dist/src/notes/service.js.map +1 -1
- package/dist/src/providers/domestic-presets.d.ts +615 -0
- package/dist/src/providers/domestic-presets.js +834 -0
- package/dist/src/providers/domestic-presets.js.map +1 -0
- package/dist/src/providers/env-keys.js +29 -5
- package/dist/src/providers/env-keys.js.map +1 -1
- package/dist/src/providers/extension-stream-bridge.js +1 -1
- package/dist/src/providers/extension-stream-bridge.js.map +1 -1
- package/dist/src/providers/index.d.ts +5 -5
- package/dist/src/providers/index.js +101 -21
- package/dist/src/providers/index.js.map +1 -1
- package/dist/src/providers/model-discovery.d.ts +17 -0
- package/dist/src/providers/model-discovery.js +61 -0
- package/dist/src/providers/model-discovery.js.map +1 -0
- package/dist/src/providers/model-registry.d.ts +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/model-registry.js.map +1 -1
- package/dist/src/providers/presentation.js +185 -14
- package/dist/src/providers/presentation.js.map +1 -1
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/session-title.js.map +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/tui/backends/embedded-backend.js +1 -2
- package/dist/src/tui/backends/embedded-backend.js.map +1 -1
- package/dist/src/tui/xopc-tui-keybindings.d.ts +1 -1
- package/dist/src/voice/tts/summarize.js +1 -1
- package/dist/src/voice/tts/summarize.js.map +1 -1
- package/dist/src/workflows/draft/workflow-draft-service.js +1 -1
- package/dist/src/workflows/draft/workflow-draft-service.js.map +1 -1
- package/package.json +6 -6
- package/dist/gateway/static/root/assets/Combination-BzaXOLd9.js +0 -41
- package/dist/gateway/static/root/assets/agents-B0hkpLhP.js +0 -2
- package/dist/gateway/static/root/assets/automations-page-CTedroVo.js +0 -1
- package/dist/gateway/static/root/assets/browser-settings-page-FCDwOOBK.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-C3d5JBJX.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-yaUNvt5u.js +0 -2
- package/dist/gateway/static/root/assets/dist-By6Rh2ee.js +0 -1
- package/dist/gateway/static/root/assets/dist-CkobR7mk.js +0 -1
- package/dist/gateway/static/root/assets/dist-DokQNVMQ.js +0 -1
- package/dist/gateway/static/root/assets/dreaming-settings-DNrdg1Ve.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BU1KoKRj.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-C79wkXef.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-9paXuHdo.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-CS0R-Af2.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-CSuzZ8Ae.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DXPaYJm3.js +0 -1
- package/dist/gateway/static/root/assets/index-BoKafJIZ.js +0 -191
- package/dist/gateway/static/root/assets/index-CArhCcYn.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-DLXPcksQ.js +0 -2
- package/dist/gateway/static/root/assets/messages-CrDHEbss.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-BDF2iyRk.js +0 -2
- package/dist/gateway/static/root/assets/note-detail-page-CSb_hwig.js +0 -2
- package/dist/gateway/static/root/assets/remote-access-hub-CwzSovcS.js +0 -1
- package/dist/gateway/static/root/assets/schedule-field-CmTRoOcE.js +0 -1
- package/dist/gateway/static/root/assets/schema-form-FMKv1vGu.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-PHmX-NmA.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BRAeKJN4.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-D-4lBl6X.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-KKrbFjy8.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-B18OBmH5.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-C28-2uKQ.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Bm2ebkwl.js +0 -2
- package/dist/gateway/static/root/assets/user-profile-settings-panel-DJ1dKwZy.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-CeEevm7z.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-C4PzUQjB.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-BL84_-Ky.js +0 -18
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.121",
|
|
4
4
|
"description": "Local-first AI system that remembers context, coordinates AI, and sustains long-term progress.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
},
|
|
63
63
|
"homepage": "https://xopc.ai",
|
|
64
64
|
"engines": {
|
|
65
|
-
"node": ">=22.
|
|
65
|
+
"node": ">=22.19.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@earendil-works/pi-agent-core": "^0.
|
|
69
|
-
"@earendil-works/pi-ai": "^0.
|
|
70
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
71
|
-
"@earendil-works/pi-tui": "^0.
|
|
68
|
+
"@earendil-works/pi-agent-core": "^0.80.3",
|
|
69
|
+
"@earendil-works/pi-ai": "^0.80.3",
|
|
70
|
+
"@earendil-works/pi-coding-agent": "^0.80.3",
|
|
71
|
+
"@earendil-works/pi-tui": "^0.80.3",
|
|
72
72
|
"@grammyjs/runner": "^2.0.3",
|
|
73
73
|
"@hono/node-server": "^2.0.4",
|
|
74
74
|
"@inquirer/prompts": "^8.5.0",
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,t as a}from"./dist-DokQNVMQ.js";var o=e(t(),1),s=r();typeof window<`u`&&window.document&&window.document.createElement;function c(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function l(e,t){let n=o.createContext(t),r=e=>{let{children:t,...r}=e,i=o.useMemo(()=>r,Object.values(r));return(0,s.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=o.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function u(e,t=[]){let n=[];function r(t,r){let i=o.createContext(r),a=n.length;n=[...n,r];let c=t=>{let{scope:n,children:r,...c}=t,l=n?.[e]?.[a]||i,u=o.useMemo(()=>c,Object.values(c));return(0,s.jsx)(l.Provider,{value:u,children:r})};c.displayName=t+`Provider`;function l(n,s){let c=s?.[e]?.[a]||i,l=o.useContext(c);if(l)return l;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[c,l]}let i=()=>{let t=n.map(e=>o.createContext(e));return function(n){let r=n?.[e]||t;return o.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,d(i,...t)]}function d(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return o.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var f=e(n(),1);function p(e){let t=m(e),n=o.forwardRef((e,n)=>{let{children:r,...i}=e,a=o.Children.toArray(r),c=a.find(_);if(c){let e=c.props.children,r=a.map(t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t);return(0,s.jsx)(t,{...i,ref:n,children:o.isValidElement(e)?o.cloneElement(e,void 0,r):null})}return(0,s.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function m(e){let t=o.forwardRef((e,t)=>{let{children:n,...r}=e;if(o.isValidElement(n)){let e=y(n),i=v(r,n.props);return n.type!==o.Fragment&&(i.ref=t?a(t,e):e),o.cloneElement(n,i)}return o.Children.count(n)>1?o.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var h=Symbol(`radix.slottable`);function g(e){let t=({children:e})=>(0,s.jsx)(s.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=h,t}function _(e){return o.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===h}function v(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function y(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var b=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=p(`Primitive.${t}`),r=o.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,s.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function x(e,t){e&&f.flushSync(()=>e.dispatchEvent(t))}function S(e){let t=o.useRef(e);return o.useEffect(()=>{t.current=e}),o.useMemo(()=>(...e)=>t.current?.(...e),[])}function C(e,t=globalThis?.document){let n=S(e);o.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var w=`DismissableLayer`,T=`dismissableLayer.update`,ee=`dismissableLayer.pointerDownOutside`,E=`dismissableLayer.focusOutside`,te,ne=o.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),D=o.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...f}=e,p=o.useContext(ne),[m,h]=o.useState(null),g=m?.ownerDocument??globalThis?.document,[,_]=o.useState({}),v=i(t,e=>h(e)),y=Array.from(p.layers),[x]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),S=y.indexOf(x),w=m?y.indexOf(m):-1,ee=p.layersWithOutsidePointerEventsDisabled.size>0,E=w>=S,D=ie(e=>{let t=e.target,n=[...p.branches].some(e=>e.contains(t));!E||n||(a?.(e),u?.(e),e.defaultPrevented||d?.())},g),O=ae(e=>{let t=e.target;[...p.branches].some(e=>e.contains(t))||(l?.(e),u?.(e),e.defaultPrevented||d?.())},g);return C(e=>{w===p.layers.size-1&&(r?.(e),!e.defaultPrevented&&d&&(e.preventDefault(),d()))},g),o.useEffect(()=>{if(m)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(te=g.body.style.pointerEvents,g.body.style.pointerEvents=`none`),p.layersWithOutsidePointerEventsDisabled.add(m)),p.layers.add(m),oe(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=te)}},[m,g,n,p]),o.useEffect(()=>()=>{m&&(p.layers.delete(m),p.layersWithOutsidePointerEventsDisabled.delete(m),oe())},[m,p]),o.useEffect(()=>{let e=()=>_({});return document.addEventListener(T,e),()=>document.removeEventListener(T,e)},[]),(0,s.jsx)(b.div,{...f,ref:v,style:{pointerEvents:ee?E?`auto`:`none`:void 0,...e.style},onFocusCapture:c(e.onFocusCapture,O.onFocusCapture),onBlurCapture:c(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:c(e.onPointerDownCapture,D.onPointerDownCapture)})});D.displayName=w;var O=`DismissableLayerBranch`,re=o.forwardRef((e,t)=>{let n=o.useContext(ne),r=o.useRef(null),a=i(t,r);return o.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,s.jsx)(b.div,{...e,ref:a})});re.displayName=O;function ie(e,t=globalThis?.document){let n=S(e),r=o.useRef(!1),i=o.useRef(()=>{});return o.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){se(ee,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ae(e,t=globalThis?.document){let n=S(e),r=o.useRef(!1);return o.useEffect(()=>{let e=e=>{e.target&&!r.current&&se(E,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function oe(){let e=new CustomEvent(T);document.dispatchEvent(e)}function se(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?x(i,a):i.dispatchEvent(a)}var k=0;function ce(){o.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??le()),document.body.insertAdjacentElement(`beforeend`,e[1]??le()),k++,()=>{k===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),k--}},[])}function le(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var A=`focusScope.autoFocusOnMount`,j=`focusScope.autoFocusOnUnmount`,ue={bubbles:!1,cancelable:!0},de=`FocusScope`,fe=o.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:c,...l}=e,[u,d]=o.useState(null),f=S(a),p=S(c),m=o.useRef(null),h=i(t,e=>d(e)),g=o.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;o.useEffect(()=>{if(r){let e=function(e){if(g.paused||!u)return;let t=e.target;u.contains(t)?m.current=t:M(m.current,{select:!0})},t=function(e){if(g.paused||!u)return;let t=e.relatedTarget;t!==null&&(u.contains(t)||M(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&M(u)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return u&&r.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,u,g.paused]),o.useEffect(()=>{if(u){ye.add(g);let e=document.activeElement;if(!u.contains(e)){let t=new CustomEvent(A,ue);u.addEventListener(A,f),u.dispatchEvent(t),t.defaultPrevented||(pe(xe(he(u)),{select:!0}),document.activeElement===e&&M(u))}return()=>{u.removeEventListener(A,f),setTimeout(()=>{let t=new CustomEvent(j,ue);u.addEventListener(j,p),u.dispatchEvent(t),t.defaultPrevented||M(e??document.body,{select:!0}),u.removeEventListener(j,p),ye.remove(g)},0)}}},[u,f,p,g]);let _=o.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=me(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&M(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&M(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,s.jsx)(b.div,{tabIndex:-1,...l,ref:h,onKeyDown:_})});fe.displayName=de;function pe(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(M(r,{select:t}),document.activeElement!==n)return}function me(e){let t=he(e);return[ge(t,e),ge(t.reverse(),e)]}function he(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ge(e,t){for(let n of e)if(!_e(n,{upTo:t}))return n}function _e(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function ve(e){return e instanceof HTMLInputElement&&`select`in e}function M(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ve(e)&&t&&e.select()}}var ye=be();function be(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=N(e,t),e.unshift(t)},remove(t){e=N(e,t),e[0]?.resume()}}}function N(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function xe(e){return e.filter(e=>e.tagName!==`A`)}var P=globalThis?.document?o.useLayoutEffect:()=>{},Se=o.useId||(()=>void 0),Ce=0;function we(e){let[t,n]=o.useState(Se());return P(()=>{e||n(e=>e??String(Ce++))},[e]),e||(t?`radix-${t}`:``)}var Te=`Portal`,Ee=o.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=o.useState(!1);P(()=>a(!0),[]);let c=n||i&&globalThis?.document?.body;return c?f.createPortal((0,s.jsx)(b.div,{...r,ref:t}),c):null});Ee.displayName=Te;function De(e,t){return o.useReducer((e,n)=>t[e][n]??e,e)}var Oe=e=>{let{present:t,children:n}=e,r=ke(t),a=typeof n==`function`?n({present:r.isPresent}):o.Children.only(n),s=i(r.ref,Ae(a));return typeof n==`function`||r.isPresent?o.cloneElement(a,{ref:s}):null};Oe.displayName=`Presence`;function ke(e){let[t,n]=o.useState(),r=o.useRef(null),i=o.useRef(e),a=o.useRef(`none`),[s,c]=De(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return o.useEffect(()=>{let e=F(r.current);a.current=s===`mounted`?e:`none`},[s]),P(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=F(t);e?c(`MOUNT`):o===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),P(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=F(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=F(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:o.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function F(e){return e?.animationName||`none`}function Ae(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var je=o.useInsertionEffect||P;function Me({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,s]=Ne({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:i;{let t=o.useRef(e!==void 0);o.useEffect(()=>{let e=t.current;e!==c&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${c?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=c},[c,r])}return[l,o.useCallback(t=>{if(c){let n=Pe(t)?t(e):t;n!==e&&s.current?.(n)}else a(t)},[c,e,a,s])]}function Ne({defaultProp:e,onChange:t}){let[n,r]=o.useState(e),i=o.useRef(n),a=o.useRef(t);return je(()=>{a.current=t},[t]),o.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Pe(e){return typeof e==`function`}var Fe=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},I=new WeakMap,L=new WeakMap,R={},z=0,Ie=function(e){return e&&(e.host||Ie(e.parentNode))},Le=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Ie(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Re=function(e,t,n,r){var i=Le(t,Array.isArray(e)?e:[e]);R[n]||(R[n]=new WeakMap);var a=R[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(I.get(e)||0)+1,l=(a.get(e)||0)+1;I.set(e,c),a.set(e,l),o.push(e),c===1&&i&&L.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),z++,function(){o.forEach(function(e){var t=I.get(e)-1,i=a.get(e)-1;I.set(e,t),a.set(e,i),t||(L.has(e)||e.removeAttribute(r),L.delete(e)),i||e.removeAttribute(n)}),z--,z||(I=new WeakMap,I=new WeakMap,L=new WeakMap,R={})}},ze=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Fe(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Re(r,i,n,`aria-hidden`)):function(){return null}},B=function(){return B=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},B.apply(this,arguments)};function Be(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ve(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var V=`right-scroll-bar-position`,H=`width-before-scroll-bar`,He=`with-scroll-bars-hidden`,Ue=`--removed-body-scroll-bar-size`;function U(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function We(e,t){var n=(0,o.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Ge=typeof window<`u`?o.useLayoutEffect:o.useEffect,Ke=new WeakMap;function qe(e,t){var n=We(t||null,function(t){return e.forEach(function(e){return U(e,t)})});return Ge(function(){var t=Ke.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||U(e,null)}),i.forEach(function(e){r.has(e)||U(e,a)})}Ke.set(n,e)},[e]),n}function Je(e){return e}function Ye(e,t){t===void 0&&(t=Je);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Xe(e){e===void 0&&(e={});var t=Ye(null);return t.options=B({async:!0,ssr:!1},e),t}var Ze=function(e){var t=e.sideCar,n=Be(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return o.createElement(r,B({},n))};Ze.isSideCarExport=!0;function Qe(e,t){return e.useMedium(t),Ze}var $e=Xe(),W=function(){},G=o.forwardRef(function(e,t){var n=o.useRef(null),r=o.useState({onScrollCapture:W,onWheelCapture:W,onTouchMoveCapture:W}),i=r[0],a=r[1],s=e.forwardProps,c=e.children,l=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Be(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=qe([n,t]),w=B(B({},x),i);return o.createElement(o.Fragment,null,d&&o.createElement(S,{sideCar:$e,removeScrollBar:u,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),s?o.cloneElement(o.Children.only(c),B(B({},w),{ref:C})):o.createElement(y,B({},w,{className:l,ref:C}),c))});G.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},G.classNames={fullWidth:H,zeroRight:V};var et,tt=function(){if(et)return et;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function nt(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=tt();return t&&e.setAttribute(`nonce`,t),e}function rt(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function it(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var at=function(){var e=0,t=null;return{add:function(n){e==0&&(t=nt())&&(rt(t,n),it(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ot=function(){var e=at();return function(t,n){o.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},st=function(){var e=ot();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},ct={left:0,top:0,right:0,gap:0},K=function(e){return parseInt(e||``,10)||0},lt=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[K(n),K(r),K(i)]},ut=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return ct;var t=lt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},dt=st(),q=`data-scroll-locked`,ft=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
|
-
.${He} {
|
|
3
|
-
overflow: hidden ${r};
|
|
4
|
-
padding-right: ${s}px ${r};
|
|
5
|
-
}
|
|
6
|
-
body[${q}] {
|
|
7
|
-
overflow: hidden ${r};
|
|
8
|
-
overscroll-behavior: contain;
|
|
9
|
-
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
10
|
-
padding-left: ${i}px;
|
|
11
|
-
padding-top: ${a}px;
|
|
12
|
-
padding-right: ${o}px;
|
|
13
|
-
margin-left:0;
|
|
14
|
-
margin-top:0;
|
|
15
|
-
margin-right: ${s}px ${r};
|
|
16
|
-
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.${V} {
|
|
20
|
-
right: ${s}px ${r};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.${H} {
|
|
24
|
-
margin-right: ${s}px ${r};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.${V} .${V} {
|
|
28
|
-
right: 0 ${r};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.${H} .${H} {
|
|
32
|
-
margin-right: 0 ${r};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
body[${q}] {
|
|
36
|
-
${Ue}: ${s}px;
|
|
37
|
-
}
|
|
38
|
-
`},pt=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},mt=function(){o.useEffect(function(){return document.body.setAttribute(q,(pt()+1).toString()),function(){var e=pt()-1;e<=0?document.body.removeAttribute(q):document.body.setAttribute(q,e.toString())}},[])},ht=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;mt();var a=o.useMemo(function(){return ut(i)},[i]);return o.createElement(dt,{styles:ft(a,!t,i,n?``:`!important`)})},J=!1;if(typeof window<`u`)try{var Y=Object.defineProperty({},"passive",{get:function(){return J=!0,!0}});window.addEventListener(`test`,Y,Y),window.removeEventListener(`test`,Y,Y)}catch{J=!1}var X=J?{passive:!1}:!1,gt=function(e){return e.tagName===`TEXTAREA`},_t=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!gt(e)&&n[t]===`visible`)},vt=function(e){return _t(e,`overflowY`)},yt=function(e){return _t(e,`overflowX`)},bt=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Ct(e,r)){var i=wt(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},xt=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},St=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Ct=function(e,t){return e===`v`?vt(t):yt(t)},wt=function(e,t){return e===`v`?xt(t):St(t)},Tt=function(e,t){return e===`h`&&t===`rtl`?-1:1},Et=function(e,t,n,r,i){var a=Tt(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=wt(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Ct(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Z=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Q=function(e){return[e.deltaX,e.deltaY]},Dt=function(e){return e&&`current`in e?e.current:e},Ot=function(e,t){return e[0]===t[0]&&e[1]===t[1]},kt=function(e){return`
|
|
39
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
40
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
41
|
-
`},At=0,$=[];function jt(e){var t=o.useRef([]),n=o.useRef([0,0]),r=o.useRef(),i=o.useState(At++)[0],a=o.useState(st)[0],s=o.useRef(e);o.useEffect(function(){s.current=e},[e]),o.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ve([e.lockRef.current],(e.shards||[]).map(Dt),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var c=o.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!s.current.allowPinchZoom;var i=Z(e),a=n.current,o=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(o)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=bt(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=bt(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(o||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Et(h,t,e,h===`h`?o:c,!0)},[]),l=o.useCallback(function(e){var n=e;if(!(!$.length||$[$.length-1]!==a)){var r=`deltaY`in n?Q(n):Z(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Ot(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var o=(s.current.shards||[]).map(Dt).filter(Boolean).filter(function(e){return e.contains(n.target)});(o.length>0?c(n,o[0]):!s.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=o.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Mt(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=o.useCallback(function(e){n.current=Z(e),r.current=void 0},[]),f=o.useCallback(function(t){u(t.type,Q(t),t.target,c(t,e.lockRef.current))},[]),p=o.useCallback(function(t){u(t.type,Z(t),t.target,c(t,e.lockRef.current))},[]);o.useEffect(function(){return $.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,l,X),document.addEventListener(`touchmove`,l,X),document.addEventListener(`touchstart`,d,X),function(){$=$.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,l,X),document.removeEventListener(`touchmove`,l,X),document.removeEventListener(`touchstart`,d,X)}},[]);var m=e.removeScrollBar,h=e.inert;return o.createElement(o.Fragment,null,h?o.createElement(a,{styles:kt(i)}):null,m?o.createElement(ht,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Mt(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Nt=Qe($e,jt),Pt=o.forwardRef(function(e,t){return o.createElement(G,B({},e,{ref:t,sideCar:Nt}))});Pt.classNames=G.classNames;export{u as _,Ee as a,fe as c,S as d,b as f,l as g,g as h,Oe as i,ce as l,p as m,ze as n,we as o,x as p,Me as r,P as s,Pt as t,D as u,c as v};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CrDHEbss.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{i as s}from"./theme-store-CD2wtgZV.js";import{c,i as l,n as u}from"./fetch-Y7AEX4H3.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$a as f,$n as p,Ai as m,Ar as h,Cn as g,Ct as _,Di as v,Dn as y,Fi as b,Fr as x,Fs as S,Ii as C,Ir as w,Ks as T,Li as E,Lr as D,Mi as O,Mr as k,Na as A,Ni as j,No as M,Nr as N,Oi as P,On as F,Oo as I,Pi as ee,Pr as L,Qn as te,Ri as ne,Rr as R,Sn as re,Tn as z,Ua as B,Vs as V,Wi as H,Xs as U,Ya as W,Ys as ie,Zn as ae,Zo as oe,Zs as se,_n as G,_r as ce,_t as le,aa as ue,at as de,ba as fe,bn as pe,br as me,bt as he,d as ge,dn as K,dr as _e,dt as ve,ea as ye,es as be,fn as xe,fr as q,ga as Se,gn as Ce,gr as we,ha as Te,hn as Ee,hr as De,ht as Oe,ja as ke,ji as Ae,jr as je,js as Me,ki as Ne,ko as Pe,la as Fe,ls as Ie,lt as Le,mn as Re,mr as J,mt as ze,n as Be,ni as Ve,no as He,pa as Ue,pn as We,pr as Ge,pt as Ke,sa as Y,so as qe,t as Je,ta as Ye,to as Xe,ts as Ze,u as X,ua as Qe,ut as $e,vn as et,vo as tt,wn as nt,xt as rt,ya as it,yn as at,zi as ot,zr as st,zs as ct}from"./index-BoKafJIZ.js";import{t as lt}from"./markdown-editor-AssmZFx4.js";import{n as ut,t as dt}from"./settings-form-section-D-4lBl6X.js";import{n as ft,t as pt}from"./settings-page-layout-BJ4Gsef5.js";import{n as mt}from"./agent-avatar-dicebear-CU8J6zou.js";import{n as ht,r as gt,t as _t}from"./channel-recipient-api-BNSuJb5f.js";import{n as vt,r as yt,t as bt}from"./utils-B5M5-YvK.js";import{a as xt,i as St,n as Ct,o as wt,t as Tt}from"./typed-models-lib-BltBc0b-.js";import{a as Et,o as Dt,r as Ot,s as kt}from"./capability-presets-api-Befi89CL.js";var Z=n(),Q=r();function At(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,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(Ae,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=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)(ee,{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)(m,{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)(Y,{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)(Y,{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)(O,{children:[p,(0,Q.jsxs)(Ne,{className:h,onOpenAutoFocus:jt,children:[_,y,b,E]})]}),t[31]=E,t[32]=_,t[33]=y,t[34]=b,t[35]=D):D=t[35];let k;return t[36]!==r||t[37]!==n||t[38]!==D?(k=(0,Q.jsx)(j,{open:n,onOpenChange:r,children:D}),t[36]=r,t[37]=n,t[38]=D,t[39]=k):k=t[39],k}function jt(e){return e.preventDefault()}var Mt=[{id:`overview`,labelKey:`navIdentity`,icon:Ue},{id:`models`,labelKey:`navModels`,icon:M},{id:`tools`,labelKey:`navTools`,icon:Qe},{id:`skills`,labelKey:`navSkills`,icon:f},{id:`memory`,labelKey:`tabMemory`,icon:Me},{id:`effective`,labelKey:`navEffective`,icon:I},{id:`files`,labelKey:`navCoreFiles`,icon:oe}],Nt=[{id:`channels`,labelKey:`tabChannels`,icon:He}];function Pt(e){let t=(0,Z.c)(20),{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`,Ye.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=Mt.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;t[8]===n.navAdvanced?d=t[9]:(d=(0,Q.jsx)(`p`,{className:`mt-4 px-3 text-[10px] font-semibold uppercase tracking-wide text-fg-subtle`,children:n.navAdvanced}),t[8]=n.navAdvanced,t[9]=d);let f;t[10]!==n||t[11]!==s?(f=Nt.map(e=>{let{id:t,labelKey:r,icon:i}=e;return s(t,n[r],i)}),t[10]=n,t[11]=s,t[12]=f):f=t[12];let p;t[13]===f?p=t[14]:(p=(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:f}),t[13]=f,t[14]=p);let m;return t[15]!==n.editorNavAria||t[16]!==u||t[17]!==d||t[18]!==p?(m=(0,Q.jsxs)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":c,children:[u,d,p]}),t[15]=n.editorNavAria,t[16]=u,t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function Ft(e){let t=(0,Z.c)(49),{open:n,onOpenChange:r,a,title:o,subtitle:s,panel:c,onPanelChange:l,onFooterSave:u,footerSaveDisabled:d,footerSavedFlash:f,busy:p,children:h}=e,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(Ae,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,te)}),t[0]=g):g=t[0];let _;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=i(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,ae,`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]=_):_=t[1];let v;t[2]===o?v=t[3]:(v=(0,Q.jsx)(ee,{className:`text-base font-semibold leading-snug text-fg`,children:o}),t[2]=o,t[3]=v);let y;t[4]===s?y=t[5]:(y=(0,Q.jsx)(m,{className:`mt-1 font-mono text-xs text-fg-muted`,children:s}),t[4]=s,t[5]=y);let b;t[6]!==v||t[7]!==y?(b=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[v,y]}),t[6]=v,t[7]=y,t[8]=b):b=t[8];let x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=i(ye,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=x):x=t[9];let S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(Fe,{className:`size-4`,"aria-hidden":!0}),t[10]=S):S=t[10];let C;t[11]===a.closeDialogAria?C=t[12]:(C=(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:x,"aria-label":a.closeDialogAria,children:S})}),t[11]=a.closeDialogAria,t[12]=C);let w;t[13]!==b||t[14]!==C?(w=(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:[b,C]}),t[13]=b,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==a||t[17]!==l||t[18]!==c?(T=(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)(Pt,{a,panel:c,onPanelChange:l})}),t[16]=a,t[17]=l,t[18]=c,t[19]=T):T=t[19];let E;t[20]===h?E=t[21]:(E=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:h}),t[20]=h,t[21]=E);let D;t[22]!==a.footerSaveNotApplicable||t[23]!==a.personaSaved||t[24]!==d||t[25]!==f?(D=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,t[22]=a.footerSaveNotApplicable,t[23]=a.personaSaved,t[24]=d,t[25]=f,t[26]=D):D=t[26];let k=p||d,A;t[27]===u?A=t[28]:(A=()=>void u(),t[27]=u,t[28]=A);let M;t[29]!==a.save||t[30]!==k||t[31]!==A?(M=(0,Q.jsx)(Y,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:k,onClick:A,children:a.save}),t[29]=a.save,t[30]=k,t[31]=A,t[32]=M):M=t[32];let N;t[33]!==D||t[34]!==M?(N=(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:[D,M]}),t[33]=D,t[34]=M,t[35]=N):N=t[35];let F;t[36]!==E||t[37]!==N?(F=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[E,N]}),t[36]=E,t[37]=N,t[38]=F):F=t[38];let I;t[39]!==F||t[40]!==T?(I=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[T,F]}),t[39]=F,t[40]=T,t[41]=I):I=t[41];let L;t[42]!==I||t[43]!==w?(L=(0,Q.jsxs)(O,{children:[g,(0,Q.jsx)(Ne,{className:_,onOpenAutoFocus:It,children:(0,Q.jsxs)(Ke,{layer:`modal`,children:[w,I]})})]}),t[42]=I,t[43]=w,t[44]=L):L=t[44];let ne;return t[45]!==r||t[46]!==n||t[47]!==L?(ne=(0,Q.jsx)(j,{open:n,onOpenChange:r,children:L}),t[45]=r,t[46]=n,t[47]=L,t[48]=ne):ne=t[48],ne}function It(e){return e.preventDefault()}var $=e(t(),1),Lt=e=>u(e);function Rt(e){return!e||e.total<=0?null:Math.round(e.helpful/e.total*100)}function zt(e){let t=Rt(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 Bt({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`),Lt),{data:y,mutate:b}=d(l(`/api/memory/records?status=active&limit=80`),Lt),{data:x,mutate:S}=d(l(`/api/memory/records?status=candidate&limit=80`),Lt),{data:C}=d(l(`/api/memory/signals?limit=50`),Lt),{data:w,mutate:T}=d(l(`/api/memory/traces?limit=80`),Lt),{data:E}=d(l(`/api/memory/feedback-summary?limit=1000`),Lt),{data:D,mutate:O}=d(l(`/api/memory/config${t?`?agentId=${encodeURIComponent(t)}`:``}`),Lt),{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,I=w?.traces.length??0,ee=E?.summaries??[],L=(0,$.useMemo)(()=>new Map(ee.map(e=>[e.recordId,e])),[ee]),te=ee.reduce((e,t)=>e+t.total,0),ne=ee.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:I},{label:n.recallQuality,value:R==null?`—`:`${R}%`}],[P,R,M,N,F,n.inbox,n.providers,n.recallQuality,n.records,n.signals,n.traceEvents,I]);(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 z(){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 B(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 V(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)(Y,{type:`button`,variant:`primary`,onClick:z,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)(Y,{type:`button`,variant:`primary`,onClick:()=>V(e.id,`active`),children:n.approve}),(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,onClick:()=>V(e.id,`rejected`),children:n.reject}),(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,onClick:()=>V(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)(Y,{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=Rt(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 ${zt(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)(Y,{type:`button`,variant:`secondary`,onClick:()=>B(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:[ee.slice(0,8).map(e=>{let t=(y?.records??[]).find(t=>t.id===e.recordId),r=Rt(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 ${zt(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)}),ee.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))})]})]})]})]})}var Vt=i(ue,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function Ht(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)(ut,{className:`shrink-0`,icon:Pe,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:yt(e.match)}),(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void s(e),children:n.removeBinding})]},`${e.match.channel}-${yt(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:bt(),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(bt(),`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)(Y,{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)(W,{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(bt(),`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:_t(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(bt(),`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:Vt,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:_t(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)(Y,{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)(dt,{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 Ut(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Wt(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 Gt(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)(Wt,{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 Kt(e,t){return e&&e.length>0?e.join(`, `):t}function qt(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=()=>et(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(Yt),i=Object.entries(u?.tools?.builtin??{}).sort(Jt),a=u?.skills,o=u?.memory,d=u?.boundaries,f;t[27]!==n.effectiveHint||t[28]!==n.effectiveTitle?(f=(0,Q.jsx)(ut,{className:`shrink-0`,icon:I,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[27]=n.effectiveHint,t[28]=n.effectiveTitle,t[29]=f):f=t[29],m=(0,Q.jsxs)(dt,{className:`flex min-h-0 flex-1 flex-col`,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`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1`,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)(Gt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Ut(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(Gt,{name:n,value:r.model,monoValue:!0,source:Ut(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)(Gt,{name:n,value:r.mode,source:Ut(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)(Gt,{name:`mode`,value:a?.mode??`all`,source:Ut(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(Gt,{name:`allow`,value:Kt(a.allow,`—`),source:Ut(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(Gt,{name:`deny`,value:Kt(a.deny,`—`),source:Ut(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)(Gt,{name:`mode`,value:o?.mode??`off`,source:Ut(e,[`memory.mode`,`memory`])}),(0,Q.jsx)(Gt,{name:`sources`,value:Kt(o?.sources,`—`),source:Ut(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)(Gt,{name:`requiresConfirmation`,value:Kt(d?.requiresConfirmation,`—`),source:Ut(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(Gt,{name:`forbidden`,value:Kt(d?.forbidden,`—`),source:Ut(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(Gt,{name:`escalation`,value:Kt(d?.escalation,`—`),source:Ut(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 Jt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Yt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Xt(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(Zt),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.filesSavingStatus||t[8]!==n.missing||t[9]!==n.navCoreFiles||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.navCoreFiles,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`,Ye.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`,Ye.press,l===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`edit`),children:[(0,Q.jsx)(ke,{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`,Ye.press,l===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`preview`),children:[(0,Q.jsx)(be,{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)(Y,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(tt,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),l===`edit`?(0,Q.jsx)(`div`,{className:i(bt(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(lt,{initialContent:d,onChange:f,isDark:_,className:`min-h-0 flex-1`},`${o??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:i(bt(),`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.filesSavingStatus,t[8]=n.missing,t[9]=n.navCoreFiles,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 Zt(e){return e.resolved===`dark`}function Qt(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)(ut,{className:`shrink-0`,icon:M,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=Ct(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=Ct(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)(kt,{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)(Y,{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)(Y,{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)(dt,{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 $t(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=Le(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)($e,{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 en(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 tn(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)(ut,{icon:Pe,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)(en,{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)(en,{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)(dt,{children:[g,C]}),t[35]=g,t[36]=C,t[37]=w):w=t[37],w}function nn(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 rn(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),m=(0,$.useMemo)(()=>{let e=D(n.trim());return e&&w(e.styleId)?e.styleId:N[0]??`adventurer`},[n]),g=(0,$.useCallback)(async(e,n)=>{try{await Re(t)}catch{}r(x(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 F(t,n),R(t),r(L)}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=D(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)(Y,{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)(Se,{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:N.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void g(e,k[0]??t),className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,Ye.press,m===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:nn(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:[k.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void g(m,e),className:i(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,Ye.press,v(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:mt(m,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(E,{open:f,onOpenChange:p,children:[(0,Q.jsx)(ne,{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`,Ye.press),children:a.avatarMore})}),(0,Q.jsx)(C,{children:(0,Q.jsxs)(b,{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:nn(m,a)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:je.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void g(m,e),className:i(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,Ye.press,v(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:mt(m,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)(h,{agentId:t,avatar:n,size:40}),n.trim()&&!D(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 an(e){let t=(0,Z.c)(264),{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:g,editModel:_,setEditModel:v,onSetDefault:y,onSaveAgentEdits:b,onDelete:x,capabilityPresets:S,onUpdateAgentExtends:C,onOpenCapabilityPreset:w,hideInlineSave:T,profileMarkdownLoading:E,profileDraft:D,updateIdentity:k,handleSoulTemplateChange:M,handleSoulContentChange:N,setAvatarDialogOpen:F,toggleSoulPreviewMode:I,defaultModel:L,defaultWorkspace:ne,defaultPresetId:R,onTryInChat:re,onEditModelStrategy:z}=e,B=L===void 0?``:L,H=ne===void 0?``:ne,U=R===void 0?`default`:R,W=o(dn),ie=s(un),oe=(0,$.useRef)(null),se;t[0]===D?.identity?se=t[1]:(se=D?.identity??{name:``,description:``,language:``,creature:``,emoji:``,avatar:``},t[0]=D?.identity,t[1]=se);let G=se,ce=D?.soulTemplate??`professional`,ue=D?.soulCustomContent??``,de=D?.soulEditorNonce??0,pe=D?.soulPreviewMode??!1,he=D?.avatarDialogOpen??!1,ge;t[2]===W?ge=t[3]:(ge=(e,t)=>W===`zh`?t:e,t[2]=W,t[3]=ge);let K=ge,_e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_e=bt(),t[4]=_e):_e=t[4];let xe=_e,q;t[5]===S?q=t[6]:(q=new Map(S.map(ln)),t[5]=S,t[6]=q);let Se=q,Ce;t[7]!==n.capabilityPresetsGlobalDefault||t[8]!==n.capabilityPresetsGlobalDefaultHint||t[9]!==U||t[10]!==Se?(Ce=Se.get(U)??{id:U,name:n.capabilityPresetsGlobalDefault,description:n.capabilityPresetsGlobalDefaultHint},t[7]=n.capabilityPresetsGlobalDefault,t[8]=n.capabilityPresetsGlobalDefaultHint,t[9]=U,t[10]=Se,t[11]=Ce):Ce=t[11];let we=Ce,Te,Ee,De,ke,je,Me,Pe;if(t[12]!==n||t[13]!==c||t[14]!==S||t[15]!==B||t[16]!==U||t[17]!==H||t[18]!==_||t[19]!==p||t[20]!==we||t[21]!==z||t[22]!==w||t[23]!==C||t[24]!==Se||t[25]!==a){je=Symbol.for(`react.early_return_sentinel`);bb0:{let e=a?.extends.filter(e=>e!==U)??[],r=S.map(cn).filter(t=>t!==U&&!e.includes(t)),i=r[0]??``,o;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=oe.current;e?.scrollIntoView({behavior:`smooth`,block:`center`}),window.setTimeout(()=>{e?.querySelector(`input`)?.focus()},180)},t[33]=o):o=t[33];let s=o;if(!a){let e;t[34]===n.selectAgentHint?e=t[35]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[34]=n.selectAgentHint,t[35]=e),je=e;break bb0}De=`flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto`,t[36]!==n||t[37]!==B||t[38]!==H||t[39]!==_||t[40]!==p||t[41]!==z?(ke=(0,Q.jsx)(tn,{a:n,defaultModel:B,defaultWorkspace:H,agentModel:_,agentWorkspace:p,onEditModelStrategy:z,onEditWorkspace:s}),t[36]=n,t[37]=B,t[38]=H,t[39]=_,t[40]=p,t[41]=z,t[42]=ke):ke=t[42],Te=dt;let l;t[43]===w?l=t[44]:(l=()=>w(``),t[43]=w,t[44]=l);let u;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(Ze,{className:`size-3.5`,"aria-hidden":!0}),t[45]=u):u=t[45];let d;t[46]!==n.capabilityPresetsManage||t[47]!==c||t[48]!==l?(d=(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:c,onClick:l,children:[u,n.capabilityPresetsManage]}),t[46]=n.capabilityPresetsManage,t[47]=c,t[48]=l,t[49]=d):d=t[49],t[50]!==n.capabilityPresetsHint||t[51]!==n.capabilityPresetsTitle||t[52]!==d?(Me=(0,Q.jsx)(ut,{icon:A,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:d}),t[50]=n.capabilityPresetsHint,t[51]=n.capabilityPresetsTitle,t[52]=d,t[53]=Me):Me=t[53];let f;t[54]!==n.capabilityPresetsGlobalDefault||t[55]!==n.capabilityPresetsGlobalDefaultHint||t[56]!==we||t[57]!==w?(f=we?(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(we.id),children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:we.name||n.capabilityPresetsGlobalDefault}),(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})]}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:we.id}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:we.description||n.capabilityPresetsGlobalDefaultHint})]})}):null,t[54]=n.capabilityPresetsGlobalDefault,t[55]=n.capabilityPresetsGlobalDefaultHint,t[56]=we,t[57]=w,t[58]=f):f=t[58],Pe=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[f,e.length>0?e.map((t,r)=>{let i=Se.get(t);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:()=>w(t),children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:i?.name??t}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:t}),i?.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:i.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:c||r===0,"aria-label":n.capabilityPresetMoveUp,onClick:()=>{let t=[...e],[n,i]=[t[r],t[r-1]];t[r-1]=n,t[r]=i,C(t)},children:(0,Q.jsx)(ct,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:c||r===e.length-1,"aria-label":n.capabilityPresetMoveDown,onClick:()=>{let t=[...e],[n,i]=[t[r+1],t[r]];t[r]=n,t[r+1]=i,C(t)},children:(0,Q.jsx)(V,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:c,"aria-label":n.capabilityPresetRemove,onClick:()=>C(e.filter(e=>e!==t)),children:(0,Q.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0})})]})]},t)}):we?(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}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-3 text-sm text-fg-muted`,children:n.capabilityPresetsEmpty})]}),Ee=r.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:c,defaultValue:i,onChange:sn,children:r.map(e=>(0,Q.jsx)(`option`,{value:e,children:Se.get(e)?.name??e},e))}),(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:c||!i,onClick:t=>{let n=t.currentTarget.parentElement?.querySelector(`select`)?.value||i;n&&C([...e,n])},children:[(0,Q.jsx)(Xe,{className:`size-4`,"aria-hidden":!0}),n.capabilityPresetAdd]})]}):null}t[12]=n,t[13]=c,t[14]=S,t[15]=B,t[16]=U,t[17]=H,t[18]=_,t[19]=p,t[20]=we,t[21]=z,t[22]=w,t[23]=C,t[24]=Se,t[25]=a,t[26]=Te,t[27]=Ee,t[28]=De,t[29]=ke,t[30]=je,t[31]=Me,t[32]=Pe}else Te=t[26],Ee=t[27],De=t[28],ke=t[29],je=t[30],Me=t[31],Pe=t[32];if(je!==Symbol.for(`react.early_return_sentinel`))return je;let Le;t[59]!==Te||t[60]!==Ee||t[61]!==Me||t[62]!==Pe?(Le=(0,Q.jsxs)(Te,{children:[Me,Pe,Ee]}),t[59]=Te,t[60]=Ee,t[61]=Me,t[62]=Pe,t[63]=Le):Le=t[63];let Re;t[64]!==G.avatar||t[65]!==a.id?(Re=(0,Q.jsx)(h,{agentId:a.id,avatar:G.avatar,size:36,className:`size-9 rounded-lg`}),t[64]=G.avatar,t[65]=a.id,t[66]=Re):Re=t[66];let J;t[67]===F?J=t[68]:(J=()=>F(!0),t[67]=F,t[68]=J);let ze;t[69]!==n.avatarOpenSettingsAria||t[70]!==J?(ze={onClick:J,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[69]=n.avatarOpenSettingsAria,t[70]=J,t[71]=ze):ze=t[71];let Be;t[72]!==n.setDefault||t[73]!==c||t[74]!==y||t[75]!==a.isDefault?(Be=a.isDefault?null:(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:c,onClick:()=>void y(),children:n.setDefault}),t[72]=n.setDefault,t[73]=c,t[74]=y,t[75]=a.isDefault,t[76]=Be):Be=t[76];let Ve;t[77]!==n.personaSectionIdentity||t[78]!==n.personaSectionIdentityHint||t[79]!==Re||t[80]!==ze||t[81]!==Be?(Ve=(0,Q.jsx)(ut,{icon:A,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:Re,iconInteractive:ze,trailing:Be}),t[77]=n.personaSectionIdentity,t[78]=n.personaSectionIdentityHint,t[79]=Re,t[80]=ze,t[81]=Be,t[82]=Ve):Ve=t[82];let He;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Q.jsx)(Ae,{className:i(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,te)}),t[83]=He):He=t[83];let We;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(We=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`,ae),t[84]=We):We=t[84];let Ge;t[85]===n.avatarPickerTitle?Ge=t[86]:(Ge=(0,Q.jsx)(ee,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[85]=n.avatarPickerTitle,t[86]=Ge);let Ke;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=i(ye,`shrink-0 p-1.5 hover:bg-surface-base`),t[87]=Ke):Ke=t[87];let Je;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Q.jsx)(Fe,{className:`size-4`,"aria-hidden":!0}),t[88]=Je):Je=t[88];let X;t[89]===n.closeDialogAria?X=t[90]:(X=(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:Ke,"aria-label":n.closeDialogAria,children:Je})}),t[89]=n.closeDialogAria,t[90]=X);let Qe;t[91]!==Ge||t[92]!==X?(Qe=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[Ge,X]}),t[91]=Ge,t[92]=X,t[93]=Qe):Qe=t[93];let $e;t[94]===n.avatarRowHint?$e=t[95]:($e=(0,Q.jsx)(m,{className:`sr-only`,children:n.avatarRowHint}),t[94]=n.avatarRowHint,t[95]=$e);let et;t[96]===k?et=t[97]:(et=e=>k({avatar:e}),t[96]=k,t[97]=et);let nt;t[98]!==n||t[99]!==G.avatar||t[100]!==a.id||t[101]!==et?(nt=(0,Q.jsx)(rn,{agentId:a.id,value:G.avatar,onChange:et,a:n}),t[98]=n,t[99]=G.avatar,t[100]=a.id,t[101]=et,t[102]=nt):nt=t[102];let rt;t[103]!==Qe||t[104]!==$e||t[105]!==nt?(rt=(0,Q.jsxs)(O,{children:[He,(0,Q.jsxs)(Ne,{className:We,onOpenAutoFocus:on,children:[Qe,$e,nt]})]}),t[103]=Qe,t[104]=$e,t[105]=nt,t[106]=rt):rt=t[106];let at;t[107]!==he||t[108]!==F||t[109]!==rt?(at=(0,Q.jsx)(j,{open:he,onOpenChange:F,children:rt}),t[107]=he,t[108]=F,t[109]=rt,t[110]=at):at=t[110];let ot;t[111]===n.displayName?ot=t[112]:(ot=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[111]=n.displayName,t[112]=ot);let st;t[113]!==u||t[114]!==k?(st=e=>{u(e.target.value),k({name:e.target.value})},t[113]=u,t[114]=k,t[115]=st):st=t[115];let ft;t[116]!==n.personaNamePlaceholder||t[117]!==l||t[118]!==st?(ft=(0,Q.jsx)(`input`,{className:xe,value:l,onChange:st,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[116]=n.personaNamePlaceholder,t[117]=l,t[118]=st,t[119]=ft):ft=t[119];let pt;t[120]!==ot||t[121]!==ft?(pt=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[ot,ft]}),t[120]=ot,t[121]=ft,t[122]=pt):pt=t[122];let mt;t[123]===n.personaEmoji?mt=t[124]:(mt=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[123]=n.personaEmoji,t[124]=mt);let ht;t[125]===k?ht=t[126]:(ht=e=>k({emoji:e.target.value}),t[125]=k,t[126]=ht);let gt;t[127]!==n.personaEmojiPlaceholder||t[128]!==G.emoji||t[129]!==ht?(gt=(0,Q.jsx)(`input`,{className:xe,value:G.emoji,onChange:ht,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[127]=n.personaEmojiPlaceholder,t[128]=G.emoji,t[129]=ht,t[130]=gt):gt=t[130];let _t;t[131]!==mt||t[132]!==gt?(_t=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[mt,gt]}),t[131]=mt,t[132]=gt,t[133]=_t):_t=t[133];let vt;t[134]===n.agentDescription?vt=t[135]:(vt=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[134]=n.agentDescription,t[135]=vt);let yt;t[136]===Symbol.for(`react.memo_cache_sentinel`)?(yt=i(xe,`min-h-16 resize-y text-sm leading-relaxed`),t[136]=yt):yt=t[136];let xt;t[137]!==f||t[138]!==k?(xt=e=>{f(e.target.value),k({description:e.target.value})},t[137]=f,t[138]=k,t[139]=xt):xt=t[139];let St;t[140]!==n.agentDescriptionPlaceholder||t[141]!==d||t[142]!==xt?(St=(0,Q.jsx)(`textarea`,{className:yt,value:d,onChange:xt,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[140]=n.agentDescriptionPlaceholder,t[141]=d,t[142]=xt,t[143]=St):St=t[143];let Ct;t[144]!==vt||t[145]!==St?(Ct=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[vt,St]}),t[144]=vt,t[145]=St,t[146]=Ct):Ct=t[146];let wt;t[147]===n.personaCreature?wt=t[148]:(wt=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[147]=n.personaCreature,t[148]=wt);let Tt;t[149]===G.creature?Tt=t[150]:(Tt=Oe.some(e=>e.value===G.creature)?G.creature:`__custom__`,t[149]=G.creature,t[150]=Tt);let Et;t[151]===k?Et=t[152]:(Et=e=>{if(e.target.value===`__custom__`){k({creature:``});return}k({creature:e.target.value})},t[151]=k,t[152]=Et);let Dt;t[153]===K?Dt=t[154]:(Dt=Oe.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:K(e.labelEn,e.labelZh)},e.value)),t[153]=K,t[154]=Dt);let Ot;t[155]===K?Ot=t[156]:(Ot=K(`Custom…`,`自定义…`),t[155]=K,t[156]=Ot);let kt;t[157]===Ot?kt=t[158]:(kt=(0,Q.jsx)(`option`,{value:`__custom__`,children:Ot}),t[157]=Ot,t[158]=kt);let At;t[159]!==Tt||t[160]!==Et||t[161]!==Dt||t[162]!==kt?(At=(0,Q.jsxs)(`select`,{className:xe,value:Tt,onChange:Et,children:[Dt,kt]}),t[159]=Tt,t[160]=Et,t[161]=Dt,t[162]=kt,t[163]=At):At=t[163];let jt;t[164]!==n.personaCreaturePlaceholder||t[165]!==G.creature||t[166]!==k?(jt=Oe.some(e=>e.value===G.creature)?null:(0,Q.jsx)(`input`,{className:i(xe,`mt-1 text-xs`),value:G.creature,onChange:e=>k({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[164]=n.personaCreaturePlaceholder,t[165]=G.creature,t[166]=k,t[167]=jt):jt=t[167];let Mt;t[168]!==wt||t[169]!==At||t[170]!==jt?(Mt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[wt,At,jt]}),t[168]=wt,t[169]=At,t[170]=jt,t[171]=Mt):Mt=t[171];let Nt;t[172]!==pt||t[173]!==_t||t[174]!==Ct||t[175]!==Mt?(Nt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[pt,_t,Ct,Mt]}),t[172]=pt,t[173]=_t,t[174]=Ct,t[175]=Mt,t[176]=Nt):Nt=t[176];let Pt;t[177]!==Ve||t[178]!==at||t[179]!==Nt?(Pt=(0,Q.jsxs)(dt,{children:[Ve,at,Nt]}),t[177]=Ve,t[178]=at,t[179]=Nt,t[180]=Pt):Pt=t[180];let Ft;t[181]!==n.editAgent||t[182]!==n.editAgentHint?(Ft=(0,Q.jsx)(ut,{icon:Ie,title:n.editAgent,subtitle:n.editAgentHint}),t[181]=n.editAgent,t[182]=n.editAgentHint,t[183]=Ft):Ft=t[183];let It;t[184]===n.modelPrimary?It=t[185]:(It=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[184]=n.modelPrimary,t[185]=It);let Lt;t[186]===v?Lt=t[187]:(Lt=e=>v(e),t[186]=v,t[187]=Lt);let Rt;t[188]!==c||t[189]!==r.modelNoMatches||t[190]!==r.modelPlaceholder||t[191]!==r.modelSearchPlaceholder||t[192]!==_||t[193]!==Lt?(Rt=(0,Q.jsx)(ve,{className:`min-w-0 flex-1`,value:_,disabled:c,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:Lt}),t[188]=c,t[189]=r.modelNoMatches,t[190]=r.modelPlaceholder,t[191]=r.modelSearchPlaceholder,t[192]=_,t[193]=Lt,t[194]=Rt):Rt=t[194];let zt;t[195]!==n.modelClear||t[196]!==c||t[197]!==_||t[198]!==v?(zt=_.trim()?(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:c,onClick:()=>v(``),children:n.modelClear}):null,t[195]=n.modelClear,t[196]=c,t[197]=_,t[198]=v,t[199]=zt):zt=t[199];let Bt;t[200]!==Rt||t[201]!==zt?(Bt=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[Rt,zt]}),t[200]=Rt,t[201]=zt,t[202]=Bt):Bt=t[202];let Vt;t[203]!==It||t[204]!==Bt?(Vt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[It,Bt]}),t[203]=It,t[204]=Bt,t[205]=Vt):Vt=t[205];let Ht;t[206]===n.workspacePath?Ht=t[207]:(Ht=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[206]=n.workspacePath,t[207]=Ht);let Ut=r.workingDirectory,Wt=r.workingDirectory.notSet,Gt;t[208]===Symbol.for(`react.memo_cache_sentinel`)?(Gt=i(xe,`font-mono text-xs`),t[208]=Gt):Gt=t[208];let Kt;t[209]!==c||t[210]!==r.workingDirectory||t[211]!==p||t[212]!==g?(Kt=(0,Q.jsx)($t,{value:p,onChange:g,disabled:c,wd:Ut,placeholder:Wt,inputClassName:Gt}),t[209]=c,t[210]=r.workingDirectory,t[211]=p,t[212]=g,t[213]=Kt):Kt=t[213];let qt;t[214]!==Ht||t[215]!==Kt?(qt=(0,Q.jsxs)(`div`,{ref:oe,className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[Ht,Kt]}),t[214]=Ht,t[215]=Kt,t[216]=qt):qt=t[216];let Jt;t[217]!==Vt||t[218]!==qt?(Jt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[Vt,qt]}),t[217]=Vt,t[218]=qt,t[219]=Jt):Jt=t[219];let Yt;t[220]!==n.save||t[221]!==n.tryInChat||t[222]!==c||t[223]!==T||t[224]!==b||t[225]!==re?(Yt=T?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(Y,{type:`button`,disabled:c,onClick:()=>void b(),children:n.save}),re?(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:c,onClick:re,children:[(0,Q.jsx)(tt,{className:`mr-1.5 size-4`,"aria-hidden":!0}),n.tryInChat]}):null]}),t[220]=n.save,t[221]=n.tryInChat,t[222]=c,t[223]=T,t[224]=b,t[225]=re,t[226]=Yt):Yt=t[226];let Xt;t[227]!==Ft||t[228]!==Jt||t[229]!==Yt?(Xt=(0,Q.jsxs)(dt,{children:[Ft,Jt,Yt]}),t[227]=Ft,t[228]=Jt,t[229]=Yt,t[230]=Xt):Xt=t[230];let Zt;t[231]!==n.loading||t[232]!==n.personaSectionSoul||t[233]!==n.personaSectionSoulHint||t[234]!==n.personaSoulCustomEdit||t[235]!==n.personaSoulEdit||t[236]!==n.personaSoulPreview||t[237]!==n.personaSoulTemplate||t[238]!==N||t[239]!==M||t[240]!==ie||t[241]!==K||t[242]!==E||t[243]!==ue||t[244]!==de||t[245]!==pe||t[246]!==ce||t[247]!==I?(Zt=E?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.loading}):(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(ut,{icon:Ue,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:le.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`,Ye.pressCard,ce===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>M(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:K(e.labelEn,e.labelZh)})]},e.id))})]}),ce===`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(ye,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:pe?n.personaSoulEdit:n.personaSoulPreview,"aria-label":pe?n.personaSoulEdit:n.personaSoulPreview,onClick:I,children:pe?(0,Q.jsx)(qe,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(be,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:i(xe,`flex min-h-64 flex-col overflow-hidden p-0`),children:pe?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(me,{content:ue})}):(0,Q.jsx)(lt,{initialContent:ue,onChange:N,isDark:ie,className:`min-h-0 flex-1`},`soul-${de}`)})]}):null]}),t[231]=n.loading,t[232]=n.personaSectionSoul,t[233]=n.personaSectionSoulHint,t[234]=n.personaSoulCustomEdit,t[235]=n.personaSoulEdit,t[236]=n.personaSoulPreview,t[237]=n.personaSoulTemplate,t[238]=N,t[239]=M,t[240]=ie,t[241]=K,t[242]=E,t[243]=ue,t[244]=de,t[245]=pe,t[246]=ce,t[247]=I,t[248]=Zt):Zt=t[248];let Qt;t[249]!==n.purgeDisk||t[250]!==n.removeFromConfig||t[251]!==c||t[252]!==K||t[253]!==x||t[254]!==a.id?(Qt=a.id===`main`?null:(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(ut,{icon:it,title:K(`Danger Zone`,`危险操作`),subtitle:K(`Actions that cannot be undone. Be careful.`,`以下操作不可撤销,请谨慎操作。`)}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>void x(!1),children:[(0,Q.jsx)(fe,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`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`,disabled:c,onClick:()=>void x(!0),children:n.purgeDisk})]})]}),t[249]=n.purgeDisk,t[250]=n.removeFromConfig,t[251]=c,t[252]=K,t[253]=x,t[254]=a.id,t[255]=Qt):Qt=t[255];let en;return t[256]!==De||t[257]!==ke||t[258]!==Le||t[259]!==Pt||t[260]!==Xt||t[261]!==Zt||t[262]!==Qt?(en=(0,Q.jsxs)(`div`,{className:De,children:[ke,Le,Pt,Xt,Zt,Qt]}),t[256]=De,t[257]=ke,t[258]=Le,t[259]=Pt,t[260]=Xt,t[261]=Zt,t[262]=Qt,t[263]=en):en=t[263],en}function on(e){return e.preventDefault()}function sn(e){e.currentTarget.dataset.value=e.target.value}function cn(e){return e.id}function ln(e){return[e.id,e]}function un(e){return e.resolved===`dark`}function dn(e){return e.language}function fn(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(pn)):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)(ut,{className:`shrink-0`,icon:S,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)(Y,{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 C;t[18]!==n.skillsCustomize||t[19]!==a||t[20]!==x?(C=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,disabled:a,onClick:x,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=a,t[20]=x,t[21]=C):C=t[21];let w;t[22]!==b||t[23]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b,C]}),t[22]=b,t[23]=C,t[24]=w):w=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=H(`skills`),t[25]=E):E=t[25];let D;t[26]===n.skillsLibraryLink?D=t[27]:(D=(0,Q.jsx)(T,{to:E,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=D);let O;t[28]!==w||t[29]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=O):O=t[30];let k;t[31]===r.skills.preset?k=t[32]:(k=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=k);let A;t[33]!==n.skillsPresetLabel||t[34]!==k?(A=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,k]}),t[33]=n.skillsPresetLabel,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==c?(j=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]=j):j=t[39];let M;t[40]!==n.skillsEffectiveLabel||t[41]!==j?(M=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,j]}),t[40]=n.skillsEffectiveLabel,t[41]=j,t[42]=M):M=t[42];let N;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?(N=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]=N):N=t[53];let P;t[54]!==n.skillsSave||t[55]!==a||t[56]!==p||t[57]!==f?(P=p?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(Y,{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]=P):P=t[58];let F;return t[59]!==O||t[60]!==A||t[61]!==M||t[62]!==N||t[63]!==P||t[64]!==v?(F=(0,Q.jsxs)(dt,{className:`flex min-h-0 flex-1 flex-col`,children:[v,O,A,M,N,P]}),t[59]=O,t[60]=A,t[61]=M,t[62]=N,t[63]=P,t[64]=v,t[65]=F):F=t[65],F}function pn(e){return e.name||e.directoryId}var mn=[`write_file`,`edit_file`,`shell`],hn=[`shell`,`image_generate`,`extensions`],gn=[`send_message`,`send_media`];function _n(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=Dt(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(yn),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 Et){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(vn),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 I=P||r.length===0&&h.length===0,ee;t[35]!==E||t[36]!==f.quickEnableAll||t[37]!==I?(ee=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:wt,disabled:I,onClick:E,children:f.quickEnableAll}),t[35]=E,t[36]=f.quickEnableAll,t[37]=I,t[38]=ee):ee=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)(Y,{type:`button`,variant:`secondary`,className:wt,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(mn),t[43]=w,t[44]=R);let re;t[45]!==f.quickReadOnlyWorkspace||t[46]!==ne||t[47]!==R?(re=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:wt,disabled:ne,onClick:R,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=ne,t[47]=R,t[48]=re):re=t[48];let z=P||r.length===0,B;t[49]===w?B=t[50]:(B=()=>w(hn),t[49]=w,t[50]=B);let V;t[51]!==f.quickHighRiskOff||t[52]!==z||t[53]!==B?(V=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:wt,disabled:z,onClick:B,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=z,t[53]=B,t[54]=V):V=t[54];let H=P||r.length===0,U;t[55]===w?U=t[56]:(U=()=>w(gn),t[55]=w,t[56]=U);let W;t[57]!==f.quickNoOutbound||t[58]!==H||t[59]!==U?(W=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:wt,disabled:H,onClick:U,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=H,t[59]=U,t[60]=W):W=t[60];let ie;t[61]!==ee||t[62]!==te||t[63]!==re||t[64]!==V||t[65]!==W?(ie=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[ee,te,re,V,W]}),t[61]=ee,t[62]=te,t[63]=re,t[64]=V,t[65]=W,t[66]=ie):ie=t[66];let ae;t[67]!==F||t[68]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[F,ie]}),t[67]=F,t[68]=ie,t[69]=ae):ae=t[69];let oe;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?(oe=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]=oe):oe=t[84];let se;return t[85]!==ae||t[86]!==oe?(se=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[ae,oe]}),t[85]=ae,t[86]=oe,t[87]=se):se=t[87],se}function vn(e){return e.ids.length>0}function yn(e,t){return e.localeCompare(t)}function bn(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(Sn),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(xn)),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)(ut,{className:`shrink-0`,icon:Qe,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)(_n,{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)(Y,{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)(Y,{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)(dt,{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 xn(e){let t=String(e).trim();return t?[t]:[]}function Sn(e){return e.language}function Cn(e){let t=(0,Z.c)(106),{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,onSaveAgentEdits:b,onDelete:x,capabilityPresets:S,defaultPresetId:C,onUpdateAgentExtends:w,onOpenCapabilityPreset:T,overviewProfile:E,filesLoading:D,files:O,activeFile:k,setActiveFile:A,filesViewMode:j,setFilesViewMode:M,fileDraft:N,setFileDraft:P,fileSaving:F,profileFileLoading:I,profileEditorNonce:ee,toolEntryDisable:L,setToolEntryDisable:te,onSaveTools:ne,onClearToolsEntry:R,modelRows:re,setModelRows:z,onSaveModels:B,onClearModelsEntry:V,skillsCatalogLoading:H,catalogForPick:U,skillsInherit:W,setSkillsInherit:ie,skillsPick:ae,setSkillsPick:oe,onSaveSkills:se,bindingsLoading:G,agentBindings:ce,bindChannelStatuses:le,bindChannelsLoading:ue,useManualChannel:de,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,bindSessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:K,newBindCustomPeer:_e,setNewBindCustomPeer:ve,refreshBindSessions:ye,onRemoveBinding:be,onAddBinding:xe,onTryInChat:q,onPanelChange:Se}=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;t[2]===Se?e=t[3]:(e=()=>Se?.(`models`),t[2]=Se,t[3]=e);let i;return t[4]!==n||t[5]!==c||t[6]!==S||t[7]!==r||t[8]!==_||t[9]!==C||t[10]!==v||t[11]!==d||t[12]!==h||t[13]!==l||t[14]!==p||t[15]!==x||t[16]!==T||t[17]!==b||t[18]!==y||t[19]!==q||t[20]!==w||t[21]!==E.draft||t[22]!==E.handleSoulContentChange||t[23]!==E.handleSoulTemplateChange||t[24]!==E.profileMarkdownLoading||t[25]!==E.setAvatarDialogOpen||t[26]!==E.toggleSoulPreviewMode||t[27]!==E.updateIdentity||t[28]!==a||t[29]!==f||t[30]!==g||t[31]!==u||t[32]!==m||t[33]!==e?(i=(0,Q.jsx)(an,{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,onSaveAgentEdits:b,onDelete:x,capabilityPresets:S,defaultPresetId:C,onUpdateAgentExtends:w,onOpenCapabilityPreset:T,hideInlineSave:!0,profileMarkdownLoading:E.profileMarkdownLoading,profileDraft:E.draft,updateIdentity:E.updateIdentity,handleSoulTemplateChange:E.handleSoulTemplateChange,handleSoulContentChange:E.handleSoulContentChange,setAvatarDialogOpen:E.setAvatarDialogOpen,toggleSoulPreviewMode:E.toggleSoulPreviewMode,defaultModel:_,defaultWorkspace:v,onTryInChat:q,onEditModelStrategy:e}),t[4]=n,t[5]=c,t[6]=S,t[7]=r,t[8]=_,t[9]=C,t[10]=v,t[11]=d,t[12]=h,t[13]=l,t[14]=p,t[15]=x,t[16]=T,t[17]=b,t[18]=y,t[19]=q,t[20]=w,t[21]=E.draft,t[22]=E.handleSoulContentChange,t[23]=E.handleSoulTemplateChange,t[24]=E.profileMarkdownLoading,t[25]=E.setAvatarDialogOpen,t[26]=E.toggleSoulPreviewMode,t[27]=E.updateIdentity,t[28]=a,t[29]=f,t[30]=g,t[31]=u,t[32]=m,t[33]=e,t[34]=i):i=t[34],i}if(o===`files`){let e;return t[35]!==n||t[36]!==k||t[37]!==N||t[38]!==F||t[39]!==O||t[40]!==D||t[41]!==j||t[42]!==q||t[43]!==ee||t[44]!==I||t[45]!==A||t[46]!==P||t[47]!==M?(e=(0,Q.jsx)(Xt,{a:n,filesLoading:D,files:O,activeFile:k,setActiveFile:A,filesViewMode:j,setFilesViewMode:M,fileDraft:N,setFileDraft:P,fileSaving:F,profileFileLoading:I,profileEditorNonce:ee,onTryInChat:q}),t[35]=n,t[36]=k,t[37]=N,t[38]=F,t[39]=O,t[40]=D,t[41]=j,t[42]=q,t[43]=ee,t[44]=I,t[45]=A,t[46]=P,t[47]=M,t[48]=e):e=t[48],e}if(o===`tools`){let e;return t[49]!==n||t[50]!==c||t[51]!==s||t[52]!==R||t[53]!==ne||t[54]!==a||t[55]!==te||t[56]!==L?(e=(0,Q.jsx)(bn,{a:n,data:s,selected:a,busy:c,toolEntryDisable:L,setToolEntryDisable:te,onSaveTools:ne,onClearToolsEntry:R,hideInlineSave:!0}),t[49]=n,t[50]=c,t[51]=s,t[52]=R,t[53]=ne,t[54]=a,t[55]=te,t[56]=L,t[57]=e):e=t[57],e}if(o===`models`){let e;return t[58]!==n||t[59]!==c||t[60]!==r||t[61]!==re||t[62]!==V||t[63]!==B||t[64]!==a||t[65]!==z?(e=(0,Q.jsx)(Qt,{a:n,chat:r,selected:a,busy:c,modelRows:re,setModelRows:z,onSaveModels:B,onClearModelsEntry:V,hideInlineSave:!0}),t[58]=n,t[59]=c,t[60]=r,t[61]=re,t[62]=V,t[63]=B,t[64]=a,t[65]=z,t[66]=e):e=t[66],e}if(o===`skills`){let e;return t[67]!==n||t[68]!==c||t[69]!==U||t[70]!==se||t[71]!==a||t[72]!==ie||t[73]!==oe||t[74]!==H||t[75]!==W||t[76]!==ae?(e=(0,Q.jsx)(fn,{a:n,selected:a,busy:c,skillsCatalogLoading:H,catalogForPick:U,skillsInherit:W,setSkillsInherit:ie,skillsPick:ae,setSkillsPick:oe,onSaveSkills:se,hideInlineSave:!0}),t[67]=n,t[68]=c,t[69]=U,t[70]=se,t[71]=a,t[72]=ie,t[73]=oe,t[74]=H,t[75]=W,t[76]=ae,t[77]=e):e=t[77],e}if(o===`memory`){let e;return t[78]===a.id?e=t[79]:(e=(0,Q.jsx)(Bt,{embedded:!0,agentId:a.id}),t[78]=a.id,t[79]=e),e}if(o===`effective`){let e;return t[80]!==n||t[81]!==a?(e=(0,Q.jsx)(qt,{a:n,selected:a}),t[80]=n,t[81]=a,t[82]=e):e=t[82],e}if(o===`channels`){let e;return t[83]!==n||t[84]!==ce||t[85]!==le||t[86]!==ue||t[87]!==me||t[88]!==he||t[89]!==G||t[90]!==c||t[91]!==i.lastActiveLabels||t[92]!==i.selectRecipient||t[93]!==fe||t[94]!==_e||t[95]!==ge||t[96]!==xe||t[97]!==be||t[98]!==ye||t[99]!==pe||t[100]!==ve||t[101]!==K||t[102]!==de?(e=(0,Q.jsx)(Ht,{a:n,busy:c,bindingsLoading:G,agentBindings:ce,channelStatuses:le,channelsStatusLoading:ue,useManualChannel:de,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,sessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:K,newBindCustomPeer:_e,setNewBindCustomPeer:ve,onRefreshSessions:ye,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:be,onAddBinding:xe}),t[83]=n,t[84]=ce,t[85]=le,t[86]=ue,t[87]=me,t[88]=he,t[89]=G,t[90]=c,t[91]=i.lastActiveLabels,t[92]=i.selectRecipient,t[93]=fe,t[94]=_e,t[95]=ge,t[96]=xe,t[97]=be,t[98]=ye,t[99]=pe,t[100]=ve,t[101]=K,t[102]=de,t[103]=e):e=t[103],e}let Ce;return t[104]===n.selectAgentHint?Ce=t[105]:(Ce=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[104]=n.selectAgentHint,t[105]=Ce),Ce}function wn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=xe(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=K(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function Tn(e,t){return e.replace(`{{count}}`,String(t))}function En(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Tn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Tn(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function Dn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Tn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Tn(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function On(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)(we,{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`,p),t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(_e,{className:`fill-surface-panel`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(Ge,{children:(0,Q.jsxs)(q,{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)(J,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(De,{children:[o,l]})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}function kn(e){let t=(0,Z.c)(28),{a:n,agents:r,searchQuery:a,onOpenAgent:o,onChatWithAgent:s,busy:c}=e,l,u,d,f,p;if(t[0]!==n||t[1]!==r||t[2]!==c||t[3]!==s||t[4]!==o||t[5]!==a){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=wn(r,a,n),m=r.length>0&&e.length===0&&a.trim().length>0;if(r.length===0){let e;t[11]===n.listNoAgentsYet?e=t[12]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listNoAgentsYet}),t[11]=n.listNoAgentsYet,t[12]=e),p=e;break bb0}d=`flex flex-col gap-4`,t[13]!==n||t[14]!==m?(f=m?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listEmpty}):null,t[13]=n,t[14]=m,t[15]=f):f=t[15],l=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let g;t[16]!==n||t[17]!==c||t[18]!==s||t[19]!==o?(g=e=>{let t=xe(e,n),r=e.id,a=K(e,n),l=En(e,n),u=Dn(e,n);return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{role:`button`,tabIndex:c?-1:0,"aria-disabled":c,"aria-label":`${t} ${r}`,onClick:()=>{c||o(e.id)},onKeyDown:t=>{c||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),o(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`,Ye.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)(h,{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})]})]}),e.isDefault?(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.defaultBadge}):(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:n.listCustomBadge})]}),(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`,a?`text-fg`:`text-fg-muted`),title:a||void 0,children:a||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:l,children:u.map(An)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:c,onClick:t=>{t.stopPropagation(),s(e.id)},className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(tt,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[16]=n,t[17]=c,t[18]=s,t[19]=o,t[20]=g):g=t[20],u=e.map(g)}t[0]=n,t[1]=r,t[2]=c,t[3]=s,t[4]=o,t[5]=a,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[21]!==l||t[22]!==u?(m=(0,Q.jsx)(`ul`,{className:l,children:u}),t[21]=l,t[22]=u,t[23]=m):m=t[23];let g;return t[24]!==d||t[25]!==f||t[26]!==m?(g=(0,Q.jsxs)(`div`,{className:d,children:[f,m]}),t[24]=d,t[25]=f,t[26]=m,t[27]=g):g=t[27],g}function An(e){return(0,Q.jsx)(On,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function jn(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:p,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)(Ae,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,te)}),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`,ae,`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 k;t[2]===a.addAgent?k=t[3]:(k=(0,Q.jsx)(ee,{className:`text-base font-semibold text-fg`,children:a.addAgent}),t[2]=a.addAgent,t[3]=k);let A;t[4]===a.addAgentHint?A=t[5]:(A=(0,Q.jsx)(m,{className:`mt-0.5 text-xs text-fg-muted`,children:a.addAgentHint}),t[4]=a.addAgentHint,t[5]=A);let M;t[6]!==k||t[7]!==A?(M=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[k,A]}),t[6]=k,t[7]=A,t[8]=M):M=t[8];let N;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=i(ye,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=N):N=t[9];let F;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(Fe,{className:`size-4`,"aria-hidden":!0}),t[10]=F):F=t[10];let I;t[11]===a.closeDialogAria?I=t[12]:(I=(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:N,"aria-label":a.closeDialogAria,children:F})}),t[11]=a.closeDialogAria,t[12]=I);let L;t[13]!==M||t[14]!==I?(L=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[M,I]}),t[13]=M,t[14]=I,t[15]=L):L=t[15];let ne;t[16]!==a||t[17]!==C||t[18]!==w||t[19]!==T?(ne=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(bt(),`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:[xe(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]=ne):ne=t[20];let R;t[21]===c?R=t[22]:(R=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]=R);let re;t[23]!==a.newAgentLabel||t[24]!==l?(re=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.newAgentLabel,` (`,l,`)`]}),t[23]=a.newAgentLabel,t[24]=l,t[25]=re):re=t[25];let z;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(z=bt(),t[26]=z):z=t[26];let B;t[27]===d?B=t[28]:(B=e=>d(e.target.value),t[27]=d,t[28]=B);let V;t[29]===S?V=t[30]:(V=()=>S(),t[29]=S,t[30]=V);let H;t[31]!==u||t[32]!==B||t[33]!==V?(H=(0,Q.jsx)(`input`,{className:z,value:u,onChange:B,onBlur:V,required:!0,autoComplete:`off`}),t[31]=u,t[32]=B,t[33]=V,t[34]=H):H=t[34];let U;t[35]!==re||t[36]!==H?(U=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[re,H]}),t[35]=re,t[36]=H,t[37]=U):U=t[37];let W;t[38]===a.newAgentIdOptional?W=t[39]:(W=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newAgentIdOptional}),t[38]=a.newAgentIdOptional,t[39]=W);let ie;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ie=i(bt(),`font-mono text-xs`),t[40]=ie):ie=t[40];let oe;t[41]===p?oe=t[42]:(oe=e=>p(e.target.value),t[41]=p,t[42]=oe);let se;t[43]===S?se=t[44]:(se=()=>S(),t[43]=S,t[44]=se);let G;t[45]!==a.newAgentIdPlaceholder||t[46]!==a.newAgentIdRules||t[47]!==f||t[48]!==oe||t[49]!==se?(G=(0,Q.jsx)(`input`,{className:ie,value:f,onChange:oe,onBlur:se,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]=oe,t[49]=se,t[50]=G):G=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]!==W||t[54]!==G||t[55]!==ce?(le=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[W,G,ce]}),t[53]=W,t[54]=G,t[55]=ce,t[56]=le):le=t[56];let ue;t[57]!==a.agentDescription||t[58]!==l?(ue=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.agentDescription,` (`,l,`)`]}),t[57]=a.agentDescription,t[58]=l,t[59]=ue):ue=t[59];let de;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(de=i(bt(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[60]=de):de=t[60];let fe;t[61]===g?fe=t[62]:(fe=e=>g(e.target.value),t[61]=g,t[62]=fe);let pe;t[63]!==a.agentDescriptionPlaceholder||t[64]!==h||t[65]!==fe?(pe=(0,Q.jsx)(`textarea`,{className:de,value:h,onChange:fe,placeholder:a.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[63]=a.agentDescriptionPlaceholder,t[64]=h,t[65]=fe,t[66]=pe):pe=t[66];let me;t[67]!==ue||t[68]!==pe?(me=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ue,pe]}),t[67]=ue,t[68]=pe,t[69]=me):me=t[69];let he;t[70]===a.newWorkspace?he=t[71]:(he=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newWorkspace}),t[70]=a.newWorkspace,t[71]=he);let ge;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(ge=i(bt(),`font-mono text-xs`),t[72]=ge):ge=t[72];let K;t[73]===v?K=t[74]:(K=e=>v(e.target.value),t[73]=v,t[74]=K);let _e;t[75]!==_||t[76]!==K?(_e=(0,Q.jsx)(`input`,{className:ge,value:_,onChange:K,required:!0,autoComplete:`off`}),t[75]=_,t[76]=K,t[77]=_e):_e=t[77];let be;t[78]!==he||t[79]!==_e?(be=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[he,_e]}),t[78]=he,t[79]=_e,t[80]=be):be=t[80];let q;t[81]===a.newModelOptional?q=t[82]:(q=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newModelOptional}),t[81]=a.newModelOptional,t[82]=q);let Se;t[83]===b?Se=t[84]:(Se=e=>b(e),t[83]=b,t[84]=Se);let Ce;t[85]!==s||t[86]!==o.modelNoMatches||t[87]!==o.modelPlaceholder||t[88]!==o.modelSearchPlaceholder||t[89]!==y||t[90]!==Se?(Ce=(0,Q.jsx)(ve,{className:`min-w-0 flex-1`,value:y,disabled:s,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,onChange:Se}),t[85]=s,t[86]=o.modelNoMatches,t[87]=o.modelPlaceholder,t[88]=o.modelSearchPlaceholder,t[89]=y,t[90]=Se,t[91]=Ce):Ce=t[91];let we;t[92]!==a.modelClear||t[93]!==s||t[94]!==y||t[95]!==b?(we=y.trim()?(0,Q.jsx)(Y,{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]=we):we=t[96];let Ee;t[97]!==Ce||t[98]!==we?(Ee=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[Ce,we]}),t[97]=Ce,t[98]=we,t[99]=Ee):Ee=t[99];let De;t[100]!==q||t[101]!==Ee?(De=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[q,Ee]}),t[100]=q,t[101]=Ee,t[102]=De):De=t[102];let Oe;t[103]!==a.createModalCancel||t[104]!==s?(Oe=(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,disabled:s,children:a.createModalCancel})}),t[103]=a.createModalCancel,t[104]=s,t[105]=Oe):Oe=t[105];let ke;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Q.jsx)(Te,{className:`mr-1 size-4`,"aria-hidden":!0}),t[106]=ke):ke=t[106];let je;t[107]!==a.create||t[108]!==s?(je=(0,Q.jsxs)(Y,{type:`submit`,disabled:s,children:[ke,a.create]}),t[107]=a.create,t[108]=s,t[109]=je):je=t[109];let Me;t[110]!==Oe||t[111]!==je?(Me=(0,Q.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Oe,je]}),t[110]=Oe,t[111]=je,t[112]=Me):Me=t[112];let Pe;t[113]!==x||t[114]!==R||t[115]!==U||t[116]!==le||t[117]!==me||t[118]!==be||t[119]!==De||t[120]!==Me||t[121]!==ne?(Pe=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:x,children:[ne,R,U,le,me,be,De,Me]}),t[113]=x,t[114]=R,t[115]=U,t[116]=le,t[117]=me,t[118]=be,t[119]=De,t[120]=Me,t[121]=ne,t[122]=Pe):Pe=t[122];let Ie;t[123]!==Pe||t[124]!==L?(Ie=(0,Q.jsxs)(O,{children:[E,(0,Q.jsx)(Ne,{className:D,onOpenAutoFocus:Mn,children:(0,Q.jsxs)(Ke,{layer:`modal`,children:[L,Pe]})})]}),t[123]=Pe,t[124]=L,t[125]=Ie):Ie=t[125];let Le;return t[126]!==r||t[127]!==n||t[128]!==Ie?(Le=(0,Q.jsx)(j,{open:n,onOpenChange:r,children:Ie}),t[126]=r,t[127]=n,t[128]=Ie,t[129]=Le):Le=t[129],Le}function Mn(e){return e.preventDefault()}function Nn(e){let t=(0,Z.c)(37),{a:n,agents:r,savedAgentId:a,draftAgentId:o,unavailable:s,busy:c,onDraftChange:l,onSave:u}=e;if(r.length===0)return null;let d=o!==a,f;t[0]===n.tuiDefaultAgentTitle?f=t[1]:(f=(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.tuiDefaultAgentTitle}),t[0]=n.tuiDefaultAgentTitle,t[1]=f);let p;t[2]===n.tuiDefaultAgentHint?p=t[3]:(p=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.tuiDefaultAgentHint}),t[2]=n.tuiDefaultAgentHint,t[3]=p);let m;t[4]!==n.tuiDefaultAgentUnavailable||t[5]!==a||t[6]!==s?(m=s?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-amber-700 dark:text-amber-300`,children:n.tuiDefaultAgentUnavailable.replace(`{{agentId}}`,a)}):null,t[4]=n.tuiDefaultAgentUnavailable,t[5]=a,t[6]=s,t[7]=m):m=t[7];let h;t[8]!==f||t[9]!==p||t[10]!==m?(h=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[f,p,m]}),t[8]=f,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===l?g=t[13]:(g=e=>l(e.target.value),t[12]=l,t[13]=g);let _=n.tuiDefaultAgentTitle,v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=i(bt(),`min-w-48 bg-surface-base py-2`),t[14]=v):v=t[14];let y;if(t[15]!==n||t[16]!==r){let e;t[18]===n?e=t[19]:(e=e=>{let t=xe(e,n);return(0,Q.jsx)(`option`,{value:e.id,children:`${t} · ${e.id}`},e.id)},t[18]=n,t[19]=e),y=r.map(e),t[15]=n,t[16]=r,t[17]=y}else y=t[17];let b;t[20]!==n.tuiDefaultAgentTitle||t[21]!==c||t[22]!==o||t[23]!==g||t[24]!==v||t[25]!==y?(b=(0,Q.jsx)(`select`,{value:o,disabled:c,onChange:g,"aria-label":_,className:v,children:y}),t[20]=n.tuiDefaultAgentTitle,t[21]=c,t[22]=o,t[23]=g,t[24]=v,t[25]=y,t[26]=b):b=t[26];let x=c||!d,S=c?n.tuiDefaultAgentSaving:d?n.tuiDefaultAgentSave:n.tuiDefaultAgentSaved,C;t[27]!==u||t[28]!==x||t[29]!==S?(C=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,disabled:x,onClick:u,className:`shrink-0`,children:S}),t[27]=u,t[28]=x,t[29]=S,t[30]=C):C=t[30];let w;t[31]!==C||t[32]!==b?(w=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:items-center`,children:[b,C]}),t[31]=C,t[32]=b,t[33]=w):w=t[33];let T;return t[34]!==w||t[35]!==h?(T=(0,Q.jsx)(`section`,{className:`rounded-lg border border-edge bg-surface-panel px-4 py-3 shadow-surface`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-center md:justify-between`,children:[h,w]})}),t[34]=w,t[35]=h,t[36]=T):T=t[36],T}var Pn=`~/.xopc/workspace`;function Fn(e){let t=e.trim();return t?`${Pn}/${X(t)}`:``}function In(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)(B,{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)(Xe,{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)(Y,{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 Ln(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function Rn(e){let{agentId:t,enabled:n,saveRef:r}=e,i=v(async()=>{if(!t)return null;let[e,n]=await Promise.all([Ce(t,`IDENTITY.md`).catch(()=>``),Ce(t,`SOUL.md`).catch(()=>``)]),r=rt(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?Ln(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?Ln(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=le.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([z(e,`IDENTITY.md`,_(f.identity)),z(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 zn={draft:``,editorNonce:0,loadedKey:``};function Bn(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 Vn(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=v(()=>n?G(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`files`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,f]=(0,$.useState)(null),[p,m]=(0,$.useReducer)(Bn,zn),[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?Ce(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),M=j.loading,N=ce(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 z(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===`files`&&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 I=(0,$.useRef)({activeFile:d,selectedId:n});return(I.current.activeFile!==d||I.current.selectedId!==n)&&(I.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 Hn(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===`channels`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let p=u??r,m=t===`channels`&&n,h=v(()=>ht(),[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===`channels`&&!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(()=>gt(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]),I=(0,$.useCallback)(()=>{let e=x.trim();e&>(e).then(e=>{k(e),j(t=>t!=null&&t<e.length?t:null)}).catch(()=>{k([]),j(null)})},[x,k]),ee=!y&&_.length===0,L=t===`channels`&&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=vt(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:I,useManualChannel:ee}}function Un(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(Kn)};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(Gn,s,d),m;n[10]===f?m=n[11]:(m=f.filter(Wn),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 Wn(e){return e.enabled!==!1}function Gn(){return pe()}function Kn(e){return e+1}function qn(e){return Un(e.panel===`skills`,e.hasToken)}function Jn(e){return new Set(e.tools.entryDisable)}function Yn(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function Xn(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(Jn(n)),n&&t===`skills`){let e=Yn(n);u(e.inherit),c(e.pick)}n&&t===`models`&&f(St(n.typedModels.effective))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:f}}function Zn(e,t){let n=e.typedModels.defaultRole;return{defaultRole:n,roles:{[n]:{model:t}}}}function Qn(e){let t=St(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:St(e.typedModels.effective)}function $n(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 er(){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]=se(),x=ie(),{agentId:S}=U(),C=ot(e=>e.setPageHeader),w=ot(e=>e.clearPageHeader),{data:T,error:E,isLoading:D,mutate:O}=d(_?`settings-gateway-agents`:null,at,{revalidateOnFocus:!1}),{data:k,mutate:A}=d(_?`settings-capability-presets`:null,Ot,{revalidateOnFocus:!1}),j=Ve(_),{data:M}=j,N=(0,$.useMemo)(()=>re(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]),I=!!(_&&D),[ee,L]=(0,$.useState)(null),te=E instanceof Error?E.message:E?n.loadError:null,ne=ee??te,[R,z]=(0,$.useState)(null),[B,V]=(0,$.useState)(`overview`),[H,W]=(0,$.useState)(``),[ae,oe]=(0,$.useState)(``),[G,ce]=(0,$.useState)(``),[le,ue]=(0,$.useState)(``),[de,fe]=(0,$.useState)(``),[pe,me]=(0,$.useState)(null),[he,K]=(0,$.useState)(!1),_e=(0,$.useRef)(``),[ve,ye]=(0,$.useState)(null),[be,q]=(0,$.useState)(!1),[Se,Ce]=(0,$.useState)(``),[we,Te]=(0,$.useState)(``),[De,Oe]=(0,$.useState)(``),[ke,Ae]=(0,$.useState)(``),[je,Me]=(0,$.useState)(``),[Ne,Pe]=(0,$.useState)(``),Fe=(0,$.useRef)(null),[Ie,Le]=(0,$.useState)(!1),Re=(0,$.useRef)({data:null,routeAgentId:void 0});P&&(P!==Re.current.data||S!==Re.current.routeAgentId)&&(Re.current={data:P,routeAgentId:S},S&&P.agents.some(e=>e.id===S)?z(S):z(e=>e&&P.agents.some(t=>t.id===e)?e:P.defaultId)),(0,$.useEffect)(()=>{!P||!S||P.agents.some(e=>e.id===S)||x(Je,{replace:!0})},[P,S,x]),(0,$.useEffect)(()=>{S&&V(`overview`)},[S]),(0,$.useEffect)(()=>{v.get(`panel`)===`defaults`&&x(S?Be(S):Je,{replace:!0,state:{[ze]:S?Be(S):Je}})},[v,S,x]),(0,$.useEffect)(()=>{if(v.get(`focus`)!==`avatar`||!S||(V(`overview`),I||!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,I,P,b]);let J=(0,$.useMemo)(()=>P?.agents.find(e=>e.id===R)??null,[P,R]),He=(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]),Ue=(0,$.useMemo)(()=>P?He&&P.agents.some(e=>e.id===He)?He:P.defaultId||P.agents[0]?.id||He||`coder`:He||`coder`,[P,He]),Ge=!!(P&&He&&!P.agents.some(e=>e.id===He)),Ke=Ge?He:Ue;(0,$.useEffect)(()=>{Te(Ue)},[Ue]);let Y=(0,$.useRef)(null),qe=J?J.id:null;J&&Y.current!==qe?(Y.current=qe,Oe(J.workspace),Ae(J.model?.primary??``),Me(xe(J,a(e).agentsSettings)),Pe(J.description??``)):!J&&Y.current!==null&&(Y.current=null,Oe(``),Ae(``),Me(``),Pe(``));let Ye=Rn({agentId:J?.id??null,enabled:B===`overview`&&!!J,saveRef:Fe}),Xe=Vn({panel:B,selectedId:R,hasToken:_,dataAgentsLength:P?.agents.length,saveErrorMessage:n.saveError,setError:L}),Ze=Xn({panel:B,selected:J}),X=Hn({panel:B,hasToken:_,bindingsFromConfig:N,gatewayCfgLoading:M===void 0,selected:J,saveErrorMessage:n.saveError,setBusy:q,setError:L}),Qe=qn({panel:B,hasToken:_}),$e=(0,$.useCallback)(()=>{let e=Fn(ae.trim()||H);ue(t=>t===``||t===_e.current?(_e.current=e,e):t)},[ae,H]),et=(0,$.useCallback)(()=>{_e.current=``,W(``),oe(``),ce(``),ue(``),fe(``),me(null),ye(null),K(!0)},[]),tt=(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]),rt=(0,$.useCallback)(e=>{if(ye(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=tt(t.id),o=t.description??``;_e.current=``,W(i),oe(a),ce(o),ue(t.workspace),fe(t.model?.primary??``),me(null)},[n.duplicateName,P,tt]),it=(0,$.useCallback)(e=>{rt(e),K(!0)},[rt]),ct=(0,$.useMemo)(()=>(0,Q.jsx)(In,{a:n,busy:be,listSearchQuery:Se,onListSearchQueryChange:Ce,onAddAgent:()=>et()}),[n,be,Se,et]);(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:ct}),()=>w()):(w(),()=>w()),[n.title,ct,w,_,C]);async function lt(t){t.preventDefault();let r=H.trim();if(!r)return;let i=ge(ae,r);if(i.ok===!1){me(i.error);return}let a=le.trim()||Fn(ae.trim()||r);if(a){q(!0),me(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${G.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
|
|
2
|
-
`),{createdAgentId:n,...i}=await We({workspace:a,...ae.trim()?{id:ae.trim()}:{},...de.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:de.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},...ve?{cloneFrom:ve}:{}});O(i,{revalidate:!1}),W(``),oe(``),ce(``),ue(``),fe(``),me(null),K(!1),z(n),x(Be(n))}catch(e){me(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}}async function ut(){if(J){q(!0),L(null);try{O(await y(J.id,{workspace:De.trim()||void 0,...ke.trim()?{models:Zn(J,ke.trim())}:{}}),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}}async function dt(e){q(!0),L(null);try{O(await y(e.id,{setDefault:!0}),{revalidate:!1}),z(e.id)}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}async function ft(){let e=we.trim().toLowerCase();if(!e||!P?.agents.some(t=>t.id===e)){L(n.tuiDefaultAgentInvalid);return}q(!0),L(null);try{await nt(e),await j.mutate()}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}async function pt(e,t){q(!0),L(null);try{let n=await Ee(e.id,t);O(n,{revalidate:!1}),z(n.defaultId),V(`overview`),S===e.id&&x(Je,{replace:!0}),i(!1),l(null),m(``)}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}function mt(e,t){e.id!==`main`&&(l(e),f(t),m(``),i(!0))}async function ht(){if(J){q(!0),L(null);try{O(await y(J.id,{tools:{builtin:$n(Ze.toolEntryDisable)}}),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}}async function gt(){if(J){q(!0),L(null);try{O(await y(J.id,{tools:null}),{revalidate:!1}),Ze.setToolEntryDisable(new Set)}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}}async function _t(){if(!J)return;let e=xt(Ze.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){L(e);return}q(!0),L(null);try{O(await y(J.id,{models:{roles:Tt(Ze.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}async function vt(){if(!J)return;let e=Qn(J),t=Tt(e);if(!t?.roles?.[J.typedModels.defaultRole]){L(n.typedModelsInvalidModel);return}q(!0),L(null);try{O(await y(J.id,{models:{defaultRole:J.typedModels.defaultRole,roles:t.roles}}),{revalidate:!1}),Ze.setModelRows(e)}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}async function yt(){if(J){q(!0),L(null);try{O(await y(J.id,{skills:Ze.skillsInherit?null:[...Ze.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}}async function bt(e){if(J){q(!0),L(null);try{O(await y(J.id,{extends:e}),{revalidate:!1}),A()}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{q(!1)}}}let St=B===`channels`||B===`effective`||B===`memory`,Ct=(()=>{if(!J||B!==`overview`)return!1;let e=J.workspace,t=J.model?.primary??``;return De.trim()!==e||ke.trim()!==t})(),wt=(()=>{if(St||!J)return!1;switch(B){case`overview`:return Ct||Ye.dirty;default:return!0}})(),Et=St||!wt;function Dt(){Le(!0),setTimeout(()=>Le(!1),2e3)}async function kt(){switch(B){case`overview`:await Promise.all([ut(),Fe.current?.()??Promise.resolve()]),Dt();break;case`tools`:await ht(),Dt();break;case`models`:await _t(),Dt();break;case`skills`:await yt(),Dt();break;case`files`:Xe.saveProfileMarkdownDebounced.flush(),Dt();break;default:break}}function Z(e){e||x(Je)}let At=J?je.trim()||xe(J,n):S??``,jt=J?.id??S??``,Mt=(0,$.useCallback)(async()=>{if(J){await kt();try{globalThis.localStorage?.setItem(st,J.id)}catch{}x(`/chat/new`,{state:{agentId:J.id,fromAgentEditor:!0}})}},[J,kt,x]),Nt={a:n,chat:g,cCron:h,selected:J,panel:B,data:P,busy:be,editName:je,setEditName:Me,editDescription:Ne,setEditDescription:Pe,editWorkspace:De,setEditWorkspace:Oe,editModel:ke,setEditModel:Ae,defaultModel:F?.model?.primary??``,defaultWorkspace:F?.workspace??``,onSetDefault:()=>{J&&dt(J)},onSaveAgentEdits:()=>void ut(),onDelete:e=>{J&&mt(J,e)},onTryInChat:()=>void Mt(),capabilityPresets:k?.presets??[],defaultPresetId:k?.defaultPresetId,onUpdateAgentExtends:e=>void bt(e),onOpenCapabilityPreset:e=>{x(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewSaveProfileMarkdownRef:Fe,overviewProfile:Ye,filesLoading:Xe.filesLoading,files:Xe.files,activeFile:Xe.activeFile,setActiveFile:Xe.setActiveFile,filesViewMode:Xe.filesViewMode,setFilesViewMode:Xe.setFilesViewMode,fileDraft:Xe.fileDraft,setFileDraft:Xe.setFileDraft,fileSaving:Xe.fileSaving,profileFileLoading:Xe.profileFileLoading,profileEditorNonce:Xe.profileEditorNonce,toolEntryDisable:Ze.toolEntryDisable,setToolEntryDisable:Ze.setToolEntryDisable,onSaveTools:()=>void ht(),onClearToolsEntry:()=>void gt(),modelRows:Ze.modelRows,setModelRows:Ze.setModelRows,onSaveModels:()=>void _t(),onClearModelsEntry:()=>void vt(),skillsCatalogLoading:Qe.skillsCatalogLoading,catalogForPick:Qe.catalogForPick,skillsInherit:Ze.skillsInherit,setSkillsInherit:Ze.setSkillsInherit,skillsPick:Ze.skillsPick,setSkillsPick:Ze.setSkillsPick,onSaveSkills:()=>void yt(),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,onPanelChange:V};return{hasToken:_,a:n,chat:g,language:e,data:P,savedTuiDefaultAgentId:Ke,tuiDefaultAgentDraft:we,setTuiDefaultAgentDraft:Te,tuiDefaultAgentUnavailable:Ge,onSaveTuiDefaultAgent:ft,loading:I,displayError:ne,navigate:x,routeAgentId:S,busy:be,listSearchQuery:Se,openAddAgentModal:et,openDuplicateAgentModal:it,duplicateSourceId:ve,onSelectDuplicateSource:rt,panel:B,setPanel:V,modalTitle:At,modalSubtitle:jt,footerSaveDisabled:Et,savedFlash:Ie,handleModalFooterSave:kt,onAgentModalOpenChange:Z,addAgentModalOpen:he,setAddAgentModalOpen:K,createWorkspaceSuggestedRef:_e,createModalError:pe,setCreateModalError:me,createDisplayName:H,setCreateDisplayName:W,createAgentId:ae,setCreateAgentId:oe,createDescription:G,setCreateDescription:ce,createWorkspace:le,setCreateWorkspace:ue,createModel:de,setCreateModel:fe,onCreate:lt,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:$e,deleteDialogOpen:r,setDeleteDialogOpen:i,deletePurge:u,deleteTarget:s,setDeleteTarget:l,deleteConfirmText:p,setDeleteConfirmText:m,performDelete:pt,editorPanelProps:Nt}}function tr(){let e=er();return e.hasToken?(0,Q.jsxs)(pt,{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.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(Nn,{a:e.a,agents:e.data.agents,savedAgentId:e.savedTuiDefaultAgentId,draftAgentId:e.tuiDefaultAgentDraft,unavailable:e.tuiDefaultAgentUnavailable,busy:e.busy,onDraftChange:e.setTuiDefaultAgentDraft,onSave:()=>void e.onSaveTuiDefaultAgent()}),(0,Q.jsx)(kn,{a:e.a,agents:e.data.agents,searchQuery:e.listSearchQuery,onOpenAgent:t=>e.navigate(Be(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(st,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})]}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(Ft,{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,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)(Cn,{...e.editorPanelProps})}):null,(0,Q.jsx)(jn,{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)(At,{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)(pt,{gap:`gap-3`,padding:`px-4 py-8`,children:[(0,Q.jsx)(ft,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{tr as AgentsSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CrDHEbss.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{r as s}from"./toast-z0toXu32.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{$r as l,Dr as u,Gs as d,Ko as f,Ks as p,Mi as m,Na as h,Ni as g,Oi as _,Pi as v,Ya as y,Z as b,Zs as x,ba as S,c as C,ca as w,co as T,ji as E,ki as D,la as O,ro as k,sa as A,to as ee,ts as j,ws as M,zi as N}from"./index-BoKafJIZ.js";import{t as te}from"./format-cron-label-arqgGlVV.js";import{i as P,n as F,o as ne,r as I,t as L}from"./dist-By6Rh2ee.js";import{i as re,n as R,r as ie,t as ae}from"./workflow-run-setup-panel-C4PzUQjB.js";var z=n(),B=e(t(),1),V=r(),H={name:``,description:``,triggerMode:`daily`,time:`09:00`,weekday:`1`,intervalMinutes:`60`,cronExpr:`0 9 * * *`,webhookSecretId:``,actionMode:`agent`,agentId:``,instruction:``,workflowId:``,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0,safetyMode:`suggest_only`,timeoutSeconds:`300`,afterRunMode:`none`,webhookUrl:``,disableAfterFailures:`3`};function U(e){return e===`zh`?`zh-CN`:`en-US`}function oe(e,t,n){return e?new Intl.DateTimeFormat(U(n),{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e)):t.never}function se(e,t,n,r){if(e.kind===`manual`)return t.trigger.manual;if(e.kind===`webhook`)return t.trigger.webhook;if(e.kind===`event`)return t.trigger.eventWithType.replace(`{type}`,e.eventType);let i=e.schedule;return i.kind===`once`?t.trigger.onceAt.replace(`{time}`,oe(Date.parse(i.at),t,r)):i.kind===`interval`?t.trigger.everyMinutes.replace(`{minutes}`,String(Math.round(i.everyMs/6e4))):te(i.expr,U(r),n.scheduleBadge,{timezone:i.tz})}function ce(e,t){return e.kind===`workflow`?t.action.workflowWithId.replace(`{id}`,e.workflowId):e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function W(e){return e.safety?.mode??`auto_apply`}function G(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`?`bg-blue-500/10 text-blue-700 dark:text-blue-300`:`bg-surface-hover text-fg-muted`}function le(e,t){if(e==null)return t.never;if(e<1e3)return`${e}ms`;let n=Math.round(e/1e3);return n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`}function K(e){return e.status===`running`||e.status===`queued`}function ue(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}function q(e){return K(e)?0:ue(e)?1:e.status===`succeeded`?2:3}function de(e){return[...e].sort((e,t)=>{let n=q(e)-q(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function fe(e){let t=(0,z.c)(5),n;t[0]===e?n=t[1]:(n=()=>typeof window>`u`?!1:window.matchMedia(e).matches,t[0]=e,t[1]=n);let[r,i]=(0,B.useState)(n),a,o;return t[2]===e?(a=t[3],o=t[4]):(a=()=>{if(typeof window>`u`)return;let t=window.matchMedia(e),n=()=>i(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},o=[e],t[2]=e,t[3]=a,t[4]=o),(0,B.useEffect)(a,o),r}function pe(e,t){let[n,r]=e.time.split(`:`),i=Number.parseInt(n||`9`,10),a=Number.parseInt(r||`0`,10),o;o=e.triggerMode===`manual`?{kind:`manual`}:e.triggerMode===`webhook`?{kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}}:e.triggerMode===`goalBlocked`?{kind:`event`,eventType:`goal.status_changed`,source:`goals`,payloadMatch:{status:`blocked`}}:e.triggerMode===`noteCreated`?{kind:`event`,eventType:`note.created`,source:`notes`}:e.triggerMode===`workflowFailed`?{kind:`event`,eventType:`workflow.run.completed`,source:`workflows`,payloadMatch:{status:`failed`}}:e.triggerMode===`sessionUpdated`?{kind:`event`,eventType:`session.transcript.updated`,source:`sessions`}:e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:Math.max(1,Number.parseInt(e.intervalMinutes,10)||60)*6e4}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * *`}};let s=R(t,e.workflowInput),c=e.workflowInput.goal.trim()||e.workflowGoal.trim(),l=e.safetyMode===`auto_apply`?e.afterRunMode:`none`,u=e.actionMode===`workflow`?{kind:`workflow`,workflowId:e.workflowId.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...s===void 0?{}:{input:s},...c?{goal:c}:{},...e.workflowInput.concurrency.trim()?{concurrency:Math.max(1,Number.parseInt(e.workflowInput.concurrency,10)||1)}:{},...e.workflowInput.maxSubagents.trim()?{maxSubagents:Math.max(1,Number.parseInt(e.workflowInput.maxSubagents,10)||1)}:{},timeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||300)}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},timeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||300)};return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},trigger:o,action:u,safety:{mode:e.safetyMode},afterRun:l===`webhook`?{kind:`webhook`,url:e.webhookUrl.trim()}:{kind:l},reliability:{timeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||300),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function J(){let e=o(e=>e.language),t=a(e),n=t.automations,r=t.cron,d=N(e=>e.setPageHeader),f=N(e=>e.clearPageHeader),[p,h]=x(),y=p.get(`run`)?.trim()??``,S=p.get(`draft`)?.trim()??``,w=p.get(`action`)?.trim()??``,T=p.get(`autogenerate`)===`1`,k=(0,B.useRef)(``),j=fe(`(min-width: 1280px)`),[M,te]=(0,B.useState)(`activity`),[re,R]=(0,B.useState)(!1),[ae,z]=(0,B.useState)(`blank`),[U,se]=(0,B.useState)(H),[ce,W]=(0,B.useState)(null),[G,le]=(0,B.useState)(null),[K,q]=(0,B.useState)(!1),[J,he]=(0,B.useState)(null),[X,be]=(0,B.useState)(``),[xe,Z]=(0,B.useState)(null),[Se,we]=(0,B.useState)(!1),[Te,Q]=(0,B.useState)(!1),[$,Ee]=(0,B.useState)(null),[De,Oe]=(0,B.useState)(!1),[ke,Ae]=(0,B.useState)(!1),[je,Me]=(0,B.useState)(!1),[Ne,Pe]=(0,B.useState)(null),Fe=c(`automations`,()=>C.list(),{refreshInterval:15e3}),Ie=c(`automation-runs`,()=>C.runs(50),{refreshInterval:1e4}),Le=c(`automation-metrics`,()=>C.metrics(),{refreshInterval:15e3}),Re=c(G?`automation-run-events:${G}`:null,()=>C.runEvents(G),{refreshInterval:5e3}),ze=c(`automation-workflow-definitions`,b),Be=c(`automation-chat-agents`,l),Ve=Fe.data?.automations??[],He=(0,B.useMemo)(()=>de(Ie.data?.runs??[]),[Ie.data?.runs]),Ue=(0,B.useMemo)(()=>He.find(e=>e.id===G)??null,[He,G]),We=(0,B.useMemo)(()=>Ve.find(e=>e.id===J)??null,[Ve,J]),Ge=(0,B.useMemo)(()=>He.filter(e=>e.automationId===J),[He,J]),Ke=Re.data?.events??[],qe=Le.data,Je=(0,B.useMemo)(()=>He.filter(ue),[He]),Ye=He[0]??null,Xe=(0,B.useMemo)(()=>ze.data??[],[ze.data]),Ze=Be.data?.items??[],Qe=(0,B.useMemo)(()=>Xe.find(e=>e.id===U.workflowId.trim())??null,[U.workflowId,Xe]),$e=U.actionMode===`workflow`&&(!U.workflowId.trim()||Xe.length>0&&!Xe.some(e=>e.id===U.workflowId)),et=U.actionMode===`workflow`&&Qe?!ie(Qe,U.workflowInput,U.workflowInputValid).valid:!1,tt=!!U.name.trim()&&(U.actionMode===`workflow`?!$e&&!et:!!U.instruction.trim())&&(U.afterRunMode!==`webhook`||!!U.webhookUrl.trim()),nt=(0,B.useMemo)(()=>[{name:n.templates.dailyAgent.name,description:n.templates.dailyAgent.description,form:{...H,name:n.templates.dailyAgent.name,instruction:n.templates.dailyAgent.instruction,triggerMode:`daily`}},{name:n.templates.morningWorkflow.name,description:n.templates.morningWorkflow.description,form:{...H,name:n.templates.morningWorkflow.formName,actionMode:`workflow`,workflowId:Xe[0]?.id??``}},{name:n.templates.webhookAgent.name,description:n.templates.webhookAgent.description,form:{...H,name:n.templates.webhookAgent.formName,triggerMode:`webhook`}},{name:n.templates.blockedGoal.name,description:n.templates.blockedGoal.description,form:{...H,name:n.templates.blockedGoal.formName,triggerMode:`goalBlocked`,instruction:n.templates.blockedGoal.instruction}},{name:n.templates.noteCreated.name,description:n.templates.noteCreated.description,form:{...H,name:n.templates.noteCreated.formName,triggerMode:`noteCreated`,instruction:n.templates.noteCreated.instruction}}],[n,Xe]),rt=(0,B.useCallback)(async()=>{await Promise.all([Fe.mutate(),Ie.mutate(),Le.mutate(),Re.mutate()])},[Fe.mutate,Le.mutate,Re.mutate,Ie.mutate]),it=(0,B.useCallback)(e=>{z(e),R(!0),e===`blank`&&se(H)},[]),at=(0,B.useCallback)(async()=>{Me(!0),W(null);try{await rt()}catch(e){let t=e instanceof Error?e.message:String(e);W(t),s({type:`error`,title:n.feedback.actionFailed,message:t})}finally{Me(!1)}},[n.feedback.actionFailed,rt]);(0,B.useEffect)(()=>{y&&(te(`activity`),le(y),j||q(!0))},[y,j]),(0,B.useEffect)(()=>{j&&q(!1)},[j]),(0,B.useEffect)(()=>{w===`create`&&(it(`blank`),h(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[w,it,h]),(0,B.useEffect)(()=>{if(!S)return;let t=`${e}:${T?`auto`:`seed`}:${S}`;k.current!==t&&(k.current=t,be(S),Z(null),Q(!1),z(`draft`),R(!0),h(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),T&&(W(null),we(!0),C.draft({prompt:S,language:e}).then(e=>{Z(e.draft),Q(!1)}).catch(e=>{W(e instanceof Error?e.message:String(e))}).finally(()=>{we(!1)})))},[T,S,e,h]);let ot=(0,B.useCallback)(e=>{le(e),j||q(!0),h(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[h,j]);(0,B.useEffect)(()=>{Ee(null),Ae(!1)},[G]);async function st(){if(W(null),tt)try{await C.create(pe(U,Qe)),se(H),R(!1),await rt(),s({type:`success`,title:n.dashboard.created})}catch(e){let t=e instanceof Error?e.message:String(e);W(t),s({type:`error`,title:n.feedback.actionFailed,message:t})}}async function ct(e,t,r){W(null),Pe(e);try{return await t(),await rt(),r&&s({type:`success`,title:r}),!0}catch(e){let t=e instanceof Error?e.message:String(e);return W(t),s({type:`error`,title:n.feedback.actionFailed,message:t}),!1}finally{Pe(null)}}async function lt(){let t=X.trim();if(t){W(null),we(!0);try{Z((await C.draft({prompt:t,language:e})).draft),Q(!1)}catch(e){W(e instanceof Error?e.message:String(e))}finally{we(!1)}}}async function ut(){xe&&await ct(`draft:publish`,async()=>{await C.create(xe.automation),Z(null),be(``),Q(!1),R(!1)},n.dashboard.created)}async function dt(t){W(null),Oe(!0),Ee(null),Ae(!1);try{Ee((await C.repairDraft(t.id,{language:e})).repair)}catch(e){W(e instanceof Error?e.message:String(e))}finally{Oe(!1)}}async function ft(e){$&&await ct(`run:${e.id}:repair`,async()=>{await C.update(e.automationId,$.patch),Ee(null),Ae(!1)},n.feedback.repairApplied)}let pt=(0,B.useMemo)(()=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(u,{className:`size-9 shrink-0 p-0`,loading:je,label:n.refresh,onClick:at}),(0,V.jsxs)(P,{children:[(0,V.jsx)(ne,{asChild:!0,children:(0,V.jsxs)(A,{variant:`primary`,children:[(0,V.jsx)(ee,{className:`size-4`}),n.new]})}),(0,V.jsx)(I,{children:(0,V.jsxs)(L,{align:`end`,className:`z-70 min-w-52 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,V.jsx)(F,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>it(`draft`),children:n.createMenu.draft}),(0,V.jsx)(F,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>it(`template`),children:n.createMenu.template}),(0,V.jsx)(F,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>it(`blank`),children:n.createMenu.blank})]})})]})]}),[n.createMenu.blank,n.createMenu.draft,n.createMenu.template,n.new,n.refresh,it,je,at]);return(0,B.useLayoutEffect)(()=>(d({startExtra:null,main:(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,V.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:pt}),()=>f()),[f,pt,n.subtitle,n.title,d]),(0,V.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,V.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-5 px-4 py-6`,children:[(0,V.jsxs)(`section`,{className:`grid gap-3 sm:grid-cols-4`,children:[(0,V.jsx)(Y,{label:n.dashboard.needsAttention,value:qe?.failedLastHour??Je.length,tone:Je.length>0?`danger`:`neutral`}),(0,V.jsx)(Y,{label:n.metrics.running,value:qe?.runningRuns??He.filter(e=>e.status===`running`).length}),(0,V.jsx)(Y,{label:n.dashboard.latestResult,value:Ye?n.status[Ye.status]:n.none,tone:Ye&&ue(Ye)?`danger`:`neutral`}),(0,V.jsx)(Y,{label:n.metrics.next,value:qe?.nextRun?oe(qe.nextRun.runAtMs,n,e):n.none})]}),(0,V.jsx)(`nav`,{className:`inline-flex w-fit rounded-lg border border-edge bg-surface-panel p-1`,children:[{id:`activity`,label:n.dashboard.activity,count:He.length},{id:`automations`,label:n.dashboard.manage,count:Ve.length}].map(e=>(0,V.jsxs)(`button`,{className:i(`inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-sm font-medium text-fg-muted`,M===e.id&&`bg-surface-hover text-fg`),onClick:()=>{te(e.id),e.id!==`activity`&&q(!1)},children:[(0,V.jsx)(`span`,{children:e.label}),(0,V.jsx)(`span`,{className:`rounded-full border border-edge/70 px-1.5 py-0.5 text-[0.6875rem] leading-none text-fg-muted`,children:e.count})]},e.id))}),ce?(0,V.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:ce}):null,M===`activity`?(0,V.jsxs)(`section`,{className:`grid h-[min(42rem,calc(100vh-17rem))] min-h-[28rem] items-stretch gap-4 xl:grid-cols-[minmax(0,1fr)_26rem]`,children:[(0,V.jsx)(`div`,{className:`min-h-0 min-w-0`,children:(0,V.jsx)(_e,{runs:He.slice(0,12),labels:n,cronLabels:r,language:e,selectedRunId:G,busyAction:Ne,className:`h-full overflow-y-auto`,onSelectRun:ot,onAction:ct})}),(0,V.jsx)(ve,{className:`hidden h-full xl:block`,run:Ue,events:Ke,labels:n,cronLabels:r,language:e,loading:Re.isLoading,repairDraft:$,repairLoading:De,repairApproved:ke,busyAction:Ne,onRepairApprovedChange:Ae,onSuggestRepair:dt,onApplyRepair:ft})]}):(0,V.jsx)(`section`,{children:(0,V.jsx)(ge,{automations:Ve,runs:He,labels:n,cronLabels:r,language:e,busyAction:Ne,onOpenDetails:he,onAction:ct})})]}),(0,V.jsx)(g,{open:re,onOpenChange:R,children:(0,V.jsxs)(m,{children:[(0,V.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,V.jsxs)(D,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,48rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,V.jsx)(v,{className:`text-base font-semibold text-fg`,children:ae===`draft`?n.draft.title:ae===`template`?n.createMenu.templatesTitle:n.createTitle}),(0,V.jsx)(_,{asChild:!0,children:(0,V.jsx)(A,{variant:`ghost`,"aria-label":n.close,children:(0,V.jsx)(O,{className:`size-4`})})})]}),ae===`draft`?(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,V.jsx)(me,{labels:n,prompt:X,draft:xe,loading:Se,approved:Te,publishBusy:Ne===`draft:publish`,onPromptChange:be,onGenerate:lt,onPublish:ut,onApprovedChange:Q,onDiscard:()=>{Z(null),Q(!1)}})}):ae===`template`?(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,V.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:nt.map(e=>(0,V.jsxs)(`button`,{className:`rounded-lg border border-edge bg-surface-base p-4 text-left hover:bg-surface-hover`,onClick:()=>{se(e.form),z(`blank`)},children:[(0,V.jsx)(`div`,{className:`font-medium text-fg`,children:e.name}),(0,V.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:e.description})]},e.name))})}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ce,{form:U,labels:n,setForm:se,workflowDefinitions:Xe,selectedWorkflow:Qe,workflowsLoading:ze.isLoading,agentOptions:Ze,agentsLoading:Be.isLoading,language:e}),(0,V.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,V.jsx)(_,{asChild:!0,children:(0,V.jsx)(A,{variant:`ghost`,children:n.cancel})}),(0,V.jsx)(A,{variant:`primary`,onClick:st,disabled:!tt,children:n.create})]})]})]})]})}),(0,V.jsx)(ye,{automation:We,runs:Ge,labels:n,cronLabels:r,language:e,busyAction:Ne,onClose:()=>he(null),onSelectRun:e=>{ot(e),he(null)},onAction:ct}),(0,V.jsx)(g,{open:!j&&K&&!!Ue,onOpenChange:q,children:(0,V.jsxs)(m,{children:[(0,V.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,V.jsxs)(D,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,V.jsx)(v,{className:`truncate text-base font-semibold text-fg`,children:Ue?.automationName??n.dashboard.result}),(0,V.jsx)(_,{asChild:!0,children:(0,V.jsx)(A,{variant:`ghost`,"aria-label":n.close,children:(0,V.jsx)(O,{className:`size-4`})})})]}),(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,V.jsx)(ve,{className:`h-full rounded-none border-0`,run:Ue,events:Ke,labels:n,cronLabels:r,language:e,loading:Re.isLoading,repairDraft:$,repairLoading:De,repairApproved:ke,busyAction:Ne,onRepairApprovedChange:Ae,onSuggestRepair:dt,onApplyRepair:ft})})]})]})})]})}function Y(e){let t=(0,z.c)(13),{label:n,value:r,tone:a}=e,o=a===void 0?`neutral`:a,s=o===`danger`?`border-red-500/30`:`border-edge`,c;t[0]===s?c=t[1]:(c=i(`rounded-lg border bg-surface-panel px-4 py-3`,s),t[0]=s,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,V.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[2]=n,t[3]=l);let u=o===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,d;t[4]===u?d=t[5]:(d=i(`mt-1 truncate text-lg font-semibold`,u),t[4]=u,t[5]=d);let f;t[6]!==d||t[7]!==r?(f=(0,V.jsx)(`div`,{className:d,children:r}),t[6]=d,t[7]=r,t[8]=f):f=t[8];let p;return t[9]!==c||t[10]!==l||t[11]!==f?(p=(0,V.jsxs)(`div`,{className:c,children:[l,f]}),t[9]=c,t[10]=l,t[11]=f,t[12]=p):p=t[12],p}function me(e){let t=(0,z.c)(47),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,onPromptChange:c,onGenerate:l,onPublish:u,onApprovedChange:d,onDiscard:f}=e,p=s===void 0?!1:s,m=!!(i&&i.simulation.requiredConfirmations.length>0),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,V.jsx)(h,{className:`size-4 text-accent`}),t[0]=g):g=t[0];let _;t[1]===n.draft.title?_=t[2]:(_=(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[g,n.draft.title]}),t[1]=n.draft.title,t[2]=_);let v;t[3]===n.draft.subtitle?v=t[4]:(v=(0,V.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[3]=n.draft.subtitle,t[4]=v);let y;t[5]!==_||t[6]!==v?(y=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[_,v]}),t[5]=_,t[6]=v,t[7]=y):y=t[7];let b;t[8]!==a||t[9]!==r?(b=a||!r.trim(),t[8]=a,t[9]=r,t[10]=b):b=t[10];let x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,V.jsx)(h,{className:`size-4`}),t[11]=x):x=t[11];let S=a?n.draft.generating:n.draft.generate,C;t[12]!==l||t[13]!==b||t[14]!==S?(C=(0,V.jsxs)(A,{variant:`primary`,onClick:l,disabled:b,children:[x,S]}),t[12]=l,t[13]=b,t[14]=S,t[15]=C):C=t[15];let w;t[16]!==y||t[17]!==C?(w=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[y,C]}),t[16]=y,t[17]=C,t[18]=w):w=t[18];let T;t[19]===c?T=t[20]:(T=e=>c(e.target.value),t[19]=c,t[20]=T);let E;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==T?(E=(0,V.jsx)(`textarea`,{className:`mt-4 min-h-20 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:T,placeholder:n.draft.placeholder}),t[21]=n.draft.placeholder,t[22]=r,t[23]=T,t[24]=E):E=t[24];let D;t[25]!==o||t[26]!==i||t[27]!==n.draft.approval||t[28]!==n.draft.assumptions||t[29]!==n.draft.discard||t[30]!==n.draft.publish||t[31]!==n.draft.review||t[32]!==n.draft.risks||t[33]!==n.draft.safety||t[34]!==n.feedback||t[35]!==n.info||t[36]!==n.none||t[37]!==d||t[38]!==f||t[39]!==u||t[40]!==p||t[41]!==m?(D=i?(0,V.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg border border-edge bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,V.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,V.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,V.jsx)(Z,{label:n.info.when,value:i.simulation.triggerSummary}),(0,V.jsx)(Z,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,V.jsx)(he,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,V.jsx)(he,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,V.jsx)(he,{title:n.draft.risks,items:i.risks,empty:n.none}),m?(0,V.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,V.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:o,onChange:e=>d(e.target.checked)}),(0,V.jsx)(`span`,{children:n.draft.approval})]}):null,(0,V.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,V.jsx)(A,{variant:`ghost`,onClick:f,children:n.draft.discard}),(0,V.jsx)(A,{variant:`primary`,onClick:u,disabled:p||m&&!o,children:p?n.feedback.working:n.draft.publish})]})]})]}):null,t[25]=o,t[26]=i,t[27]=n.draft.approval,t[28]=n.draft.assumptions,t[29]=n.draft.discard,t[30]=n.draft.publish,t[31]=n.draft.review,t[32]=n.draft.risks,t[33]=n.draft.safety,t[34]=n.feedback,t[35]=n.info,t[36]=n.none,t[37]=d,t[38]=f,t[39]=u,t[40]=p,t[41]=m,t[42]=D):D=t[42];let O;return t[43]!==w||t[44]!==E||t[45]!==D?(O=(0,V.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-panel p-4`,children:[w,E,D]}),t[43]=w,t[44]=E,t[45]=D,t[46]=O):O=t[46],O}function he(e){let t=(0,z.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,V.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r?(o=r.length>0?r.map(X):(0,V.jsx)(`li`,{className:`text-fg-muted`,children:i}),t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===o?s=t[6]:(s=(0,V.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm text-fg`,children:o}),t[5]=o,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,V.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function X(e){return(0,V.jsxs)(`li`,{children:[`- `,e]},e)}function ge(e){let t=(0,z.c)(22),{automations:n,runs:r,labels:a,cronLabels:o,language:s,busyAction:c,onOpenDetails:l,onAction:u}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(w,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===a.empty.automations?n=t[2]:(n=(0,V.jsx)(Se,{icon:e,title:a.empty.automations}),t[1]=a.empty.automations,t[2]=n),n}let d;if(t[3]!==n||t[4]!==c||t[5]!==o||t[6]!==a||t[7]!==s||t[8]!==u||t[9]!==l||t[10]!==r){let e;t[12]!==c||t[13]!==o||t[14]!==a||t[15]!==s||t[16]!==u||t[17]!==l||t[18]!==r?(e=e=>{let t=r.filter(t=>t.automationId===e.id),n=t.find(K),d=t[0],f=c===`automation:${e.id}:run`,p=c===`automation:${e.id}:toggle`,m=c===`automation:${e.id}:delete`;return(0,V.jsxs)(`article`,{className:`flex min-h-44 cursor-pointer flex-col rounded-lg border border-edge bg-surface-panel p-3.5 outline-none hover:bg-surface-hover`,role:`button`,tabIndex:0,onClick:()=>l(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&l(e.id)},children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.name}),n?(0,V.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-blue-500`}):null]}),e.description?(0,V.jsx)(`div`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null]}),(0,V.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?a.enabled:a.paused})]}),(0,V.jsxs)(`div`,{className:`mt-3 space-y-2 text-sm`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-fg`,children:[(0,V.jsx)(`span`,{className:`shrink-0 text-xs font-medium uppercase text-fg-muted`,children:a.info.when}),(0,V.jsx)(`span`,{className:`truncate`,children:se(e.trigger,a,o,s)})]}),(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-fg-muted`,children:[(0,V.jsx)(`span`,{className:`shrink-0 text-xs font-medium uppercase`,children:a.info.run}),(0,V.jsx)(`span`,{className:`truncate`,children:ce(e.action,a)})]})]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,V.jsxs)(`span`,{children:[a.last,`: `,oe(e.state.lastRunAtMs,a,s)]}),(0,V.jsxs)(`span`,{children:[a.next,`: `,oe(e.state.nextRunAtMs,a,s)]}),(0,V.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5`,G(e.state.lastRunStatus)),children:e.state.lastRunStatus?a.status[e.state.lastRunStatus]:a.status.notRun}),d?.error?(0,V.jsx)(`p`,{className:`basis-full line-clamp-1 text-red-700 dark:text-red-300`,children:d.error}):null]}),(0,V.jsx)(`div`,{className:`mt-auto flex justify-end pt-3`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(A,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":a.dashboard.runNow,disabled:c!==null,onClick:t=>{t.stopPropagation(),u(`automation:${e.id}:run`,()=>C.runNow(e.id),a.feedback.rerunQueued)},children:(0,V.jsx)(k,{className:i(`size-4`,f&&`animate-pulse`)})}),(0,V.jsx)(A,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":e.enabled?a.dashboard.pause:a.dashboard.resume,disabled:c!==null,onClick:t=>{t.stopPropagation(),u(`automation:${e.id}:toggle`,()=>e.enabled?C.pause(e.id):C.resume(e.id),e.enabled?a.feedback.paused:a.dashboard.resumed)},children:p?(0,V.jsx)(y,{className:`size-4 animate-spin`}):e.enabled?(0,V.jsx)(T,{className:`size-4`}):(0,V.jsx)(k,{className:`size-4`})}),(0,V.jsx)(A,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":a.dashboard.delete,disabled:c!==null,onClick:t=>{t.stopPropagation(),u(`automation:${e.id}:delete`,()=>C.remove(e.id),a.dashboard.deleted)},children:m?(0,V.jsx)(y,{className:`size-4 animate-spin`}):(0,V.jsx)(S,{className:`size-4`})})]})})]},e.id)},t[12]=c,t[13]=o,t[14]=a,t[15]=s,t[16]=u,t[17]=l,t[18]=r,t[19]=e):e=t[19],d=n.map(e),t[3]=n,t[4]=c,t[5]=o,t[6]=a,t[7]=s,t[8]=u,t[9]=l,t[10]=r,t[11]=d}else d=t[11];let f;return t[20]===d?f=t[21]:(f=(0,V.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:d}),t[20]=d,t[21]=f),f}function _e(e){let t=(0,z.c)(25),{runs:n,labels:r,cronLabels:a,language:o,selectedRunId:s,busyAction:c,className:l,onSelectRun:u,onAction:f}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(d,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===r.empty.runs?n=t[2]:(n=(0,V.jsx)(Se,{icon:e,title:r.empty.runs}),t[1]=r.empty.runs,t[2]=n),n}let p;t[3]===l?p=t[4]:(p=i(`rounded-lg border border-edge bg-surface-panel`,l),t[3]=l,t[4]=p);let m;if(t[5]!==c||t[6]!==a||t[7]!==r||t[8]!==o||t[9]!==f||t[10]!==u||t[11]!==n||t[12]!==s){let e;t[14]!==c||t[15]!==a||t[16]!==r||t[17]!==o||t[18]!==f||t[19]!==u||t[20]!==s?(e=e=>(0,V.jsxs)(`div`,{className:i(`grid cursor-pointer gap-3 border-b border-edge p-4 outline-none last:border-b-0 hover:bg-surface-hover md:grid-cols-[1fr_auto]`,s===e.id&&`bg-surface-hover`),role:`button`,tabIndex:0,onClick:()=>u(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&u(e.id)},children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`font-medium text-fg`,children:e.automationName}),(0,V.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs`,G(e.status)),children:r.status[e.status]}),e.workflowRunId?(0,V.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[r.workflowPrefix,` `,e.workflowRunId.slice(0,8)]}):null]}),(0,V.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:e.error||e.summary||ce(e.actionSnapshot,r)}),(0,V.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[oe(e.createdAtMs,r,o),` · `,e.manual?r.trigger.manual:se(e.triggerSnapshot,r,a,o)]})]}),e.status===`running`||e.status===`queued`?(0,V.jsx)(A,{variant:`ghost`,disabled:c!==null,onClick:t=>{t.stopPropagation(),f(`run:${e.id}:cancel`,()=>C.cancelRun(e.id),r.dashboard.cancelled)},children:c===`run:${e.id}:cancel`?r.feedback.working:r.cancel}):null]},e.id),t[14]=c,t[15]=a,t[16]=r,t[17]=o,t[18]=f,t[19]=u,t[20]=s,t[21]=e):e=t[21],m=n.map(e),t[5]=c,t[6]=a,t[7]=r,t[8]=o,t[9]=f,t[10]=u,t[11]=n,t[12]=s,t[13]=m}else m=t[13];let h;return t[22]!==p||t[23]!==m?(h=(0,V.jsx)(`div`,{className:p,children:m}),t[22]=p,t[23]=m,t[24]=h):h=t[24],h}function ve(e){let t=(0,z.c)(127),{className:n,run:r,events:a,labels:o,cronLabels:s,language:c,loading:l,repairDraft:u,repairLoading:m,repairApproved:g,busyAction:_,onRepairApprovedChange:v,onSuggestRepair:y,onApplyRepair:b}=e;if(!r){let e;t[0]===n?e=t[1]:(e=i(`flex min-h-64 flex-col justify-center rounded-lg border border-edge bg-surface-panel px-4 text-center text-sm text-fg-muted`,n),t[0]=n,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,V.jsx)(d,{className:`mx-auto size-5`}),t[2]=r):r=t[2];let a;t[3]===o.selectRun?a=t[4]:(a=(0,V.jsx)(`div`,{className:`mt-2`,children:o.selectRun}),t[3]=o.selectRun,t[4]=a);let s;return t[5]!==e||t[6]!==a?(s=(0,V.jsxs)(`aside`,{className:e,children:[r,a]}),t[5]=e,t[6]=a,t[7]=s):s=t[7],s}let x;t[8]===n?x=t[9]:(x=i(`min-h-0 overflow-y-auto rounded-lg border border-edge bg-surface-panel`,n),t[8]=n,t[9]=x);let S;t[10]===r.automationName?S=t[11]:(S=(0,V.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=S);let C;t[12]===r.id?C=t[13]:(C=r.id.slice(0,8),t[12]=r.id,t[13]=C);let w;t[14]===C?w=t[15]:(w=(0,V.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:C}),t[14]=C,t[15]=w);let T;t[16]!==S||t[17]!==w?(T=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[S,w]}),t[16]=S,t[17]=w,t[18]=T):T=t[18];let E;t[19]===r.status?E=t[20]:(E=i(`shrink-0 rounded-full px-2 py-0.5 text-xs`,G(r.status)),t[19]=r.status,t[20]=E);let D=o.status[r.status],O;t[21]!==E||t[22]!==D?(O=(0,V.jsx)(`span`,{className:E,children:D}),t[21]=E,t[22]=D,t[23]=O):O=t[23];let k;t[24]!==T||t[25]!==O?(k=(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[T,O]}),t[24]=T,t[25]=O,t[26]=k):k=t[26];let ee=o.details.created,M;t[27]!==o||t[28]!==c||t[29]!==r.createdAtMs?(M=oe(r.createdAtMs,o,c),t[27]=o,t[28]=c,t[29]=r.createdAtMs,t[30]=M):M=t[30];let N;t[31]!==o.details.created||t[32]!==M?(N=(0,V.jsx)(be,{label:ee,value:M}),t[31]=o.details.created,t[32]=M,t[33]=N):N=t[33];let te=o.details.started,P;t[34]!==o||t[35]!==c||t[36]!==r.startedAtMs?(P=oe(r.startedAtMs,o,c),t[34]=o,t[35]=c,t[36]=r.startedAtMs,t[37]=P):P=t[37];let F;t[38]!==o.details.started||t[39]!==P?(F=(0,V.jsx)(be,{label:te,value:P}),t[38]=o.details.started,t[39]=P,t[40]=F):F=t[40];let ne=o.details.duration,I;t[41]!==o||t[42]!==r.durationMs?(I=le(r.durationMs,o),t[41]=o,t[42]=r.durationMs,t[43]=I):I=t[43];let L;t[44]!==o.details.duration||t[45]!==I?(L=(0,V.jsx)(be,{label:ne,value:I}),t[44]=o.details.duration,t[45]=I,t[46]=L):L=t[46];let re;t[47]!==o.details.model||t[48]!==r.model?(re=r.model?(0,V.jsx)(be,{label:o.details.model,value:r.model}):null,t[47]=o.details.model,t[48]=r.model,t[49]=re):re=t[49];let R;t[50]!==N||t[51]!==F||t[52]!==L||t[53]!==re?(R=(0,V.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[N,F,L,re]}),t[50]=N,t[51]=F,t[52]=L,t[53]=re,t[54]=R):R=t[54];let ie;t[55]===o.dashboard.result?ie=t[56]:(ie=(0,V.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.dashboard.result}),t[55]=o.dashboard.result,t[56]=ie);let ae;t[57]===r?ae=t[58]:(ae=ue(r)?`text-red-700 dark:text-red-300`:`text-fg`,t[57]=r,t[58]=ae);let B;t[59]===ae?B=t[60]:(B=i(`mt-1 break-words text-sm`,ae),t[59]=ae,t[60]=B);let H;t[61]!==o||t[62]!==r.actionSnapshot||t[63]!==r.error||t[64]!==r.summary?(H=r.error||r.summary||ce(r.actionSnapshot,o),t[61]=o,t[62]=r.actionSnapshot,t[63]=r.error,t[64]=r.summary,t[65]=H):H=t[65];let U;t[66]!==B||t[67]!==H?(U=(0,V.jsx)(`p`,{className:B,children:H}),t[66]=B,t[67]=H,t[68]=U):U=t[68];let W;t[69]!==s||t[70]!==o||t[71]!==c||t[72]!==r.manual||t[73]!==r.triggerSnapshot?(W=r.manual?o.trigger.manual:se(r.triggerSnapshot,o,s,c),t[69]=s,t[70]=o,t[71]=c,t[72]=r.manual,t[73]=r.triggerSnapshot,t[74]=W):W=t[74];let K;t[75]!==o.explain.whyRan||t[76]!==W?(K=(0,V.jsx)(be,{label:o.explain.whyRan,value:W}),t[75]=o.explain.whyRan,t[76]=W,t[77]=K):K=t[77];let q;t[78]!==o.dashboard.openSession||t[79]!==r.sessionKey?(q=r.sessionKey?(0,V.jsx)(A,{asChild:!0,variant:`secondary`,className:`h-8 justify-start rounded-md px-2 text-xs`,children:(0,V.jsxs)(p,{to:`/chat/${encodeURIComponent(r.sessionKey)}`,children:[(0,V.jsx)(j,{className:`size-3.5`}),o.dashboard.openSession]})}):null,t[78]=o.dashboard.openSession,t[79]=r.sessionKey,t[80]=q):q=t[80];let de;t[81]!==o.feedback||t[82]!==r.workflowRunId?(de=r.workflowRunId?(0,V.jsx)(A,{asChild:!0,variant:`secondary`,className:`h-8 justify-start rounded-md px-2 text-xs`,children:(0,V.jsxs)(p,{to:`/workflows?run=${encodeURIComponent(r.workflowRunId)}`,children:[(0,V.jsx)(f,{className:`size-3.5`}),o.feedback.workflow]})}):null,t[81]=o.feedback,t[82]=r.workflowRunId,t[83]=de):de=t[83];let fe;t[84]!==K||t[85]!==q||t[86]!==de?(fe=(0,V.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[K,q,de]}),t[84]=K,t[85]=q,t[86]=de,t[87]=fe):fe=t[87];let pe;t[88]!==ie||t[89]!==U||t[90]!==fe?(pe=(0,V.jsxs)(`div`,{className:`mt-3 rounded-md border border-edge/70 bg-surface-base/50 p-3`,children:[ie,U,fe]}),t[88]=ie,t[89]=U,t[90]=fe,t[91]=pe):pe=t[91];let J;t[92]!==o.repair||t[93]!==y||t[94]!==m||t[95]!==r?(J=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,V.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,V.jsxs)(A,{variant:`secondary`,onClick:()=>y(r),disabled:m,children:[(0,V.jsx)(h,{className:`size-4`}),m?o.repair.generating:o.repair.suggest]})}):null,t[92]=o.repair,t[93]=y,t[94]=m,t[95]=r,t[96]=J):J=t[96];let Y;t[97]!==R||t[98]!==pe||t[99]!==J||t[100]!==k?(Y=(0,V.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[k,R,pe,J]}),t[97]=R,t[98]=pe,t[99]=J,t[100]=k,t[101]=Y):Y=t[101];let me;t[102]!==_||t[103]!==o.feedback||t[104]!==o.none||t[105]!==o.repair||t[106]!==b||t[107]!==v||t[108]!==g||t[109]!==u||t[110]!==r?(me=u?(0,V.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.repair.title}),(0,V.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:u.explanation}),u.expectedEffect?(0,V.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:u.expectedEffect}):null,(0,V.jsx)(he,{title:o.repair.risks,items:u.risks,empty:o.none}),(0,V.jsx)(`pre`,{className:`mt-3 max-h-36 overflow-auto rounded-md bg-surface-base p-2 text-xs text-fg-muted`,children:JSON.stringify(u.patch,null,2)}),u.requiresApproval?(0,V.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,V.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:g,onChange:e=>v(e.target.checked)}),(0,V.jsx)(`span`,{children:o.repair.approval})]}):null,(0,V.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,V.jsx)(A,{variant:`primary`,onClick:()=>b(r),disabled:_===`run:${r.id}:repair`||u.requiresApproval&&!g,children:_===`run:${r.id}:repair`?o.feedback.working:o.repair.apply})})]}):null,t[102]=_,t[103]=o.feedback,t[104]=o.none,t[105]=o.repair,t[106]=b,t[107]=v,t[108]=g,t[109]=u,t[110]=r,t[111]=me):me=t[111];let X;t[112]===o.timeline?X=t[113]:(X=(0,V.jsx)(`div`,{className:`mb-3 text-xs font-semibold uppercase text-fg-muted`,children:o.timeline}),t[112]=o.timeline,t[113]=X);let ge;t[114]!==a||t[115]!==o||t[116]!==c||t[117]!==l?(ge=l?(0,V.jsx)(`div`,{className:`text-sm text-fg-muted`,children:o.loading}):a.length===0?(0,V.jsx)(`div`,{className:`text-sm text-fg-muted`,children:o.empty.events}):(0,V.jsx)(`ol`,{className:`space-y-3`,children:a.map(e=>(0,V.jsxs)(`li`,{className:`grid grid-cols-[0.75rem_1fr] gap-3`,children:[(0,V.jsx)(`span`,{className:i(`mt-1 size-2 rounded-full`,xe(e.type))}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-sm text-fg`,children:e.message}),(0,V.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[oe(e.createdAtMs,o,c),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,V.jsx)(`pre`,{className:`mt-2 max-h-28 overflow-auto rounded-md bg-surface-base p-2 text-xs text-fg-muted`,children:JSON.stringify(e.data,null,2)}):null]})]},e.id))}),t[114]=a,t[115]=o,t[116]=c,t[117]=l,t[118]=ge):ge=t[118];let _e;t[119]!==X||t[120]!==ge?(_e=(0,V.jsxs)(`div`,{className:`px-4 py-3`,children:[X,ge]}),t[119]=X,t[120]=ge,t[121]=_e):_e=t[121];let ve;return t[122]!==x||t[123]!==Y||t[124]!==me||t[125]!==_e?(ve=(0,V.jsxs)(`aside`,{className:x,children:[Y,me,_e]}),t[122]=x,t[123]=Y,t[124]=me,t[125]=_e,t[126]=ve):ve=t[126],ve}function ye(e){let t=(0,z.c)(25),{automation:n,runs:r,labels:a,cronLabels:o,language:s,busyAction:c,onClose:l,onSelectRun:u,onAction:h}=e,b;t[0]===n?b=t[1]:(b=n?W(n):`suggest_only`,t[0]=n,t[1]=b);let x=b,w=n?c===`automation:${n.id}:run`:!1,ee=n?c===`automation:${n.id}:toggle`:!1,N=n?c===`automation:${n.id}:delete`:!1,te=!!n,P;t[2]===l?P=t[3]:(P=e=>!e&&l(),t[2]=l,t[3]=P);let F;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,V.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),t[4]=F):F=t[4];let ne;t[5]!==n||t[6]!==c||t[7]!==o||t[8]!==N||t[9]!==a||t[10]!==s||t[11]!==x||t[12]!==h||t[13]!==l||t[14]!==u||t[15]!==w||t[16]!==r||t[17]!==ee?(ne=n?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(v,{className:`truncate text-base font-semibold text-fg`,children:n.name}),n.description?(0,V.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:n.description}):null]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs`,n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:n.enabled?a.enabled:a.paused}),(0,V.jsx)(_,{asChild:!0,children:(0,V.jsx)(A,{variant:`ghost`,"aria-label":a.close,children:(0,V.jsx)(O,{className:`size-4`})})})]})]}),(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,V.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[18rem_1fr]`,children:[(0,V.jsxs)(`aside`,{className:`grid h-fit gap-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,V.jsx)(Z,{label:a.info.when,value:se(n.trigger,a,o,s)}),(0,V.jsx)(Z,{label:a.info.run,value:ce(n.action,a)}),(0,V.jsx)(Z,{label:a.info.safety,value:a.safety[x]}),(0,V.jsx)(be,{label:a.last,value:oe(n.state.lastRunAtMs,a,s)}),(0,V.jsx)(be,{label:a.next,value:oe(n.state.nextRunAtMs,a,s)}),n.state.consecutiveFailures?(0,V.jsx)(be,{label:a.dashboard.failures,value:String(n.state.consecutiveFailures)}):null,n.state.lastError?(0,V.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null]}),(0,V.jsxs)(`section`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.dashboard.runHistory}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.dashboard.runHistoryDescription})]}),(0,V.jsx)(`span`,{className:`rounded-full border border-edge bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length})]}),r.length===0?(0,V.jsx)(Se,{icon:(0,V.jsx)(d,{className:`size-5`}),title:a.empty.runs}):(0,V.jsx)(`div`,{className:`grid gap-2`,children:r.map(e=>(0,V.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,V.jsxs)(`button`,{className:`min-w-0 text-left outline-none`,onClick:()=>u(e.id),children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,V.jsx)(M,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,V.jsx)(d,{className:`size-4 shrink-0 text-fg-muted`}),(0,V.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:oe(e.createdAtMs,a,s)}),(0,V.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs`,G(e.status)),children:a.status[e.status]})]}),(0,V.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.error||e.summary||ce(e.actionSnapshot,a)})]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-1`,children:[e.sessionKey?(0,V.jsx)(A,{asChild:!0,variant:`ghost`,className:`h-8 rounded-md px-2 text-xs`,children:(0,V.jsxs)(p,{to:`/chat/${encodeURIComponent(e.sessionKey)}`,children:[(0,V.jsx)(j,{className:`size-3.5`}),a.dashboard.openSession]})}):null,e.workflowRunId?(0,V.jsx)(A,{asChild:!0,variant:`ghost`,className:`h-8 rounded-md px-2 text-xs`,children:(0,V.jsxs)(p,{to:`/workflows?run=${encodeURIComponent(e.workflowRunId)}`,children:[(0,V.jsx)(f,{className:`size-3.5`}),a.feedback.workflow]})}):null]})]})},e.id))})]})]})}),(0,V.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-2 border-t border-edge px-5 py-4`,children:[(0,V.jsxs)(A,{variant:`ghost`,disabled:c!==null,onClick:()=>void h(`automation:${n.id}:delete`,()=>C.remove(n.id),a.dashboard.deleted).then(e=>{e&&l()}),children:[N?(0,V.jsx)(y,{className:`size-4 animate-spin`}):(0,V.jsx)(S,{className:`size-4`}),a.dashboard.delete]}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsxs)(A,{variant:`secondary`,disabled:c!==null,onClick:()=>void h(`automation:${n.id}:toggle`,()=>n.enabled?C.pause(n.id):C.resume(n.id),n.enabled?a.feedback.paused:a.dashboard.resumed),children:[ee?(0,V.jsx)(y,{className:`size-4 animate-spin`}):n.enabled?(0,V.jsx)(T,{className:`size-4`}):(0,V.jsx)(k,{className:`size-4`}),n.enabled?a.dashboard.pause:a.dashboard.resume]}),(0,V.jsxs)(A,{variant:`primary`,disabled:c!==null,onClick:()=>void h(`automation:${n.id}:run`,()=>C.runNow(n.id),a.feedback.rerunQueued),children:[w?(0,V.jsx)(y,{className:`size-4 animate-spin`}):(0,V.jsx)(k,{className:`size-4`}),a.dashboard.runNow]})]})]})]}):null,t[5]=n,t[6]=c,t[7]=o,t[8]=N,t[9]=a,t[10]=s,t[11]=x,t[12]=h,t[13]=l,t[14]=u,t[15]=w,t[16]=r,t[17]=ee,t[18]=ne):ne=t[18];let I;t[19]===ne?I=t[20]:(I=(0,V.jsxs)(m,{children:[F,(0,V.jsx)(D,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,56rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:ne})]}),t[19]=ne,t[20]=I);let L;return t[21]!==te||t[22]!==P||t[23]!==I?(L=(0,V.jsx)(g,{open:te,onOpenChange:P,children:I}),t[21]=te,t[22]=P,t[23]=I,t[24]=L):L=t[24],L}function be(e){let t=(0,z.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,V.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,V.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,V.jsxs)(`div`,{className:`grid grid-cols-[5rem_1fr] gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function xe(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function Z(e){let t=(0,z.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,V.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,V.jsx)(`div`,{className:`mt-1 truncate text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Se(e){let t=(0,z.c)(5),{icon:n,title:r}=e,i;t[0]===r?i=t[1]:(i=(0,V.jsx)(`div`,{className:`mt-2 text-sm`,children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,V.jsxs)(`div`,{className:`flex min-h-48 flex-col items-center justify-center rounded-lg border border-edge bg-surface-panel text-fg-muted`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Ce(e){let t=(0,z.c)(218),{form:n,labels:r,setForm:a,workflowDefinitions:o,selectedWorkflow:s,workflowsLoading:c,agentOptions:l,agentsLoading:u,language:d}=e,f;t[0]===a?f=t[1]:(f=e=>a(t=>({...t,...e})),t[0]=a,t[1]=f);let p=f,m,h;t[2]!==n.actionMode||t[3]!==n.workflowId||t[4]!==a||t[5]!==o?(m=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=o[0]?.id;e&&a(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},h=[n.actionMode,n.workflowId,a,o],t[2]=n.actionMode,t[3]=n.workflowId,t[4]=a,t[5]=o,t[6]=m,t[7]=h):(m=t[6],h=t[7]),(0,B.useEffect)(m,h);let g;t[8]===p?g=t[9]:(g=e=>p({name:e.target.value}),t[8]=p,t[9]=g);let _;t[10]!==n.name||t[11]!==g?(_=(0,V.jsx)(`input`,{className:Q,value:n.name,onChange:g}),t[10]=n.name,t[11]=g,t[12]=_):_=t[12];let v;t[13]!==r.form.name||t[14]!==_?(v=(0,V.jsx)($,{label:r.form.name,children:_}),t[13]=r.form.name,t[14]=_,t[15]=v):v=t[15];let y;t[16]===p?y=t[17]:(y=e=>p({description:e.target.value}),t[16]=p,t[17]=y);let b;t[18]!==n.description||t[19]!==y?(b=(0,V.jsx)(`input`,{className:Q,value:n.description,onChange:y}),t[18]=n.description,t[19]=y,t[20]=b):b=t[20];let x;t[21]!==r.form.description||t[22]!==b?(x=(0,V.jsx)($,{label:r.form.description,children:b}),t[21]=r.form.description,t[22]=b,t[23]=x):x=t[23];let S;t[24]===r.form.trigger?S=t[25]:(S=(0,V.jsx)(Ee,{title:r.form.trigger}),t[24]=r.form.trigger,t[25]=S);let C;t[26]===p?C=t[27]:(C=e=>p({triggerMode:e.target.value}),t[26]=p,t[27]=C);let w;t[28]===r.trigger.manual?w=t[29]:(w=(0,V.jsx)(`option`,{value:`manual`,children:r.trigger.manual}),t[28]=r.trigger.manual,t[29]=w);let T;t[30]===r.trigger.daily?T=t[31]:(T=(0,V.jsx)(`option`,{value:`daily`,children:r.trigger.daily}),t[30]=r.trigger.daily,t[31]=T);let E;t[32]===r.trigger.weekly?E=t[33]:(E=(0,V.jsx)(`option`,{value:`weekly`,children:r.trigger.weekly}),t[32]=r.trigger.weekly,t[33]=E);let D;t[34]===r.trigger.interval?D=t[35]:(D=(0,V.jsx)(`option`,{value:`interval`,children:r.trigger.interval}),t[34]=r.trigger.interval,t[35]=D);let O;t[36]===r.trigger.customCron?O=t[37]:(O=(0,V.jsx)(`option`,{value:`cron`,children:r.trigger.customCron}),t[36]=r.trigger.customCron,t[37]=O);let k;t[38]===r.trigger.webhook?k=t[39]:(k=(0,V.jsx)(`option`,{value:`webhook`,children:r.trigger.webhook}),t[38]=r.trigger.webhook,t[39]=k);let A;t[40]===r.trigger.goalBlocked?A=t[41]:(A=(0,V.jsx)(`option`,{value:`goalBlocked`,children:r.trigger.goalBlocked}),t[40]=r.trigger.goalBlocked,t[41]=A);let ee;t[42]===r.trigger.noteCreated?ee=t[43]:(ee=(0,V.jsx)(`option`,{value:`noteCreated`,children:r.trigger.noteCreated}),t[42]=r.trigger.noteCreated,t[43]=ee);let j;t[44]===r.trigger.workflowFailed?j=t[45]:(j=(0,V.jsx)(`option`,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[44]=r.trigger.workflowFailed,t[45]=j);let M;t[46]===r.trigger.sessionUpdated?M=t[47]:(M=(0,V.jsx)(`option`,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[46]=r.trigger.sessionUpdated,t[47]=M);let N;t[48]!==n.triggerMode||t[49]!==C||t[50]!==w||t[51]!==T||t[52]!==E||t[53]!==D||t[54]!==O||t[55]!==k||t[56]!==A||t[57]!==ee||t[58]!==j||t[59]!==M?(N=(0,V.jsxs)(`select`,{className:Q,value:n.triggerMode,onChange:C,children:[w,T,E,D,O,k,A,ee,j,M]}),t[48]=n.triggerMode,t[49]=C,t[50]=w,t[51]=T,t[52]=E,t[53]=D,t[54]=O,t[55]=k,t[56]=A,t[57]=ee,t[58]=j,t[59]=M,t[60]=N):N=t[60];let te;t[61]!==n.time||t[62]!==n.triggerMode||t[63]!==n.weekday||t[64]!==r.form.day||t[65]!==r.form.time||t[66]!==r.weekdays||t[67]!==p?(te=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)($,{label:r.form.time,children:(0,V.jsx)(`input`,{className:Q,type:`time`,value:n.time,onChange:e=>p({time:e.target.value})})}),n.triggerMode===`weekly`?(0,V.jsx)($,{label:r.form.day,children:(0,V.jsxs)(`select`,{className:Q,value:n.weekday,onChange:e=>p({weekday:e.target.value}),children:[(0,V.jsx)(`option`,{value:`1`,children:r.weekdays.monday}),(0,V.jsx)(`option`,{value:`2`,children:r.weekdays.tuesday}),(0,V.jsx)(`option`,{value:`3`,children:r.weekdays.wednesday}),(0,V.jsx)(`option`,{value:`4`,children:r.weekdays.thursday}),(0,V.jsx)(`option`,{value:`5`,children:r.weekdays.friday}),(0,V.jsx)(`option`,{value:`6`,children:r.weekdays.saturday}),(0,V.jsx)(`option`,{value:`0`,children:r.weekdays.sunday})]})}):null]}):null,t[61]=n.time,t[62]=n.triggerMode,t[63]=n.weekday,t[64]=r.form.day,t[65]=r.form.time,t[66]=r.weekdays,t[67]=p,t[68]=te):te=t[68];let P;t[69]!==n.intervalMinutes||t[70]!==n.triggerMode||t[71]!==r.form.everyMinutes||t[72]!==p?(P=n.triggerMode===`interval`?(0,V.jsx)($,{label:r.form.everyMinutes,children:(0,V.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.intervalMinutes,onChange:e=>p({intervalMinutes:e.target.value})})}):null,t[69]=n.intervalMinutes,t[70]=n.triggerMode,t[71]=r.form.everyMinutes,t[72]=p,t[73]=P):P=t[73];let F;t[74]!==n.cronExpr||t[75]!==n.triggerMode||t[76]!==r.form.expression||t[77]!==p?(F=n.triggerMode===`cron`?(0,V.jsx)($,{label:r.form.expression,children:(0,V.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>p({cronExpr:e.target.value})})}):null,t[74]=n.cronExpr,t[75]=n.triggerMode,t[76]=r.form.expression,t[77]=p,t[78]=F):F=t[78];let ne;t[79]!==n.triggerMode||t[80]!==n.webhookSecretId||t[81]!==r.form.secretId||t[82]!==p?(ne=n.triggerMode===`webhook`?(0,V.jsx)($,{label:r.form.secretId,children:(0,V.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>p({webhookSecretId:e.target.value})})}):null,t[79]=n.triggerMode,t[80]=n.webhookSecretId,t[81]=r.form.secretId,t[82]=p,t[83]=ne):ne=t[83];let I;t[84]===r.form.action?I=t[85]:(I=(0,V.jsx)(Ee,{title:r.form.action}),t[84]=r.form.action,t[85]=I);let L;t[86]!==n.workflowId||t[87]!==p||t[88]!==o?(L=e=>{let t=e.target.value;p({actionMode:t,...t===`workflow`&&!n.workflowId.trim()&&o[0]?{workflowId:o[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[86]=n.workflowId,t[87]=p,t[88]=o,t[89]=L):L=t[89];let R;t[90]===r.action.runAgent?R=t[91]:(R=(0,V.jsx)(`option`,{value:`agent`,children:r.action.runAgent}),t[90]=r.action.runAgent,t[91]=R);let ie;t[92]===r.action.runWorkflow?ie=t[93]:(ie=(0,V.jsx)(`option`,{value:`workflow`,children:r.action.runWorkflow}),t[92]=r.action.runWorkflow,t[93]=ie);let H;t[94]!==n.actionMode||t[95]!==L||t[96]!==R||t[97]!==ie?(H=(0,V.jsxs)(`select`,{className:Q,value:n.actionMode,onChange:L,children:[R,ie]}),t[94]=n.actionMode,t[95]=L,t[96]=R,t[97]=ie,t[98]=H):H=t[98];let U=r.form.agent,oe=n.agentId,se;t[99]===p?se=t[100]:(se=e=>p({agentId:e.target.value}),t[99]=p,t[100]=se);let ce=u?r.form.loadingAgents:r.form.defaultAgent,W;t[101]===ce?W=t[102]:(W=(0,V.jsx)(`option`,{value:``,children:ce}),t[101]=ce,t[102]=W);let G;t[103]===l?G=t[104]:(G=l.map(Te),t[103]=l,t[104]=G);let le;t[105]!==n.agentId||t[106]!==se||t[107]!==W||t[108]!==G?(le=(0,V.jsxs)(`select`,{className:Q,value:oe,onChange:se,children:[W,G]}),t[105]=n.agentId,t[106]=se,t[107]=W,t[108]=G,t[109]=le):le=t[109];let K;t[110]!==r.form.agent||t[111]!==le?(K=(0,V.jsx)($,{label:U,children:le}),t[110]=r.form.agent,t[111]=le,t[112]=K):K=t[112];let ue;t[113]!==n.actionMode||t[114]!==n.agentId||t[115]!==n.description||t[116]!==n.instruction||t[117]!==n.name||t[118]!==n.triggerMode||t[119]!==n.workflowId||t[120]!==n.workflowInput||t[121]!==r.form.instruction||t[122]!==r.form.loadingWorkflows||t[123]!==r.form.noWorkflows||t[124]!==r.form.triggeredRun||t[125]!==r.form.workflow||t[126]!==d||t[127]!==s||t[128]!==p||t[129]!==o||t[130]!==c?(ue=n.actionMode===`agent`?(0,V.jsxs)($,{label:r.form.instruction,children:[(0,V.jsx)(`div`,{className:`flex justify-end`,children:(0,V.jsx)(re,{value:n.instruction,onApply:e=>p({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:d,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId},showLabel:!1})}),(0,V.jsx)(`textarea`,{className:i(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>p({instruction:e.target.value})})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)($,{label:r.form.workflow,children:(0,V.jsxs)(`select`,{className:Q,value:n.workflowId,onChange:e=>p({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:c||o.length===0,children:[c?(0,V.jsx)(`option`,{value:``,children:r.form.loadingWorkflows}):null,!c&&o.length===0?(0,V.jsx)(`option`,{value:``,children:r.form.noWorkflows}):null,o.map(we)]})}),s?(0,V.jsx)(ae,{definition:s,language:d,value:n.workflowInput,onChange:e=>p({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>p({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:s.id,workflowTitle:s.title,workflowDescription:s.description}},inputClassName:`rounded-lg`}):null]}),t[113]=n.actionMode,t[114]=n.agentId,t[115]=n.description,t[116]=n.instruction,t[117]=n.name,t[118]=n.triggerMode,t[119]=n.workflowId,t[120]=n.workflowInput,t[121]=r.form.instruction,t[122]=r.form.loadingWorkflows,t[123]=r.form.noWorkflows,t[124]=r.form.triggeredRun,t[125]=r.form.workflow,t[126]=d,t[127]=s,t[128]=p,t[129]=o,t[130]=c,t[131]=ue):ue=t[131];let q;t[132]===r.form.safety?q=t[133]:(q=(0,V.jsx)(Ee,{title:r.form.safety}),t[132]=r.form.safety,t[133]=q);let de;t[134]!==n.afterRunMode||t[135]!==p?(de=e=>{let t=e.target.value;p({safetyMode:t,...t!==`auto_apply`&&n.afterRunMode===`webhook`?{afterRunMode:`none`,webhookUrl:``}:{}})},t[134]=n.afterRunMode,t[135]=p,t[136]=de):de=t[136];let fe;t[137]===r.safety.suggest_only?fe=t[138]:(fe=(0,V.jsx)(`option`,{value:`suggest_only`,children:r.safety.suggest_only}),t[137]=r.safety.suggest_only,t[138]=fe);let pe;t[139]===r.safety.ask_before_apply?pe=t[140]:(pe=(0,V.jsx)(`option`,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),t[139]=r.safety.ask_before_apply,t[140]=pe);let J;t[141]===r.safety.auto_apply?J=t[142]:(J=(0,V.jsx)(`option`,{value:`auto_apply`,children:r.safety.auto_apply}),t[141]=r.safety.auto_apply,t[142]=J);let Y;t[143]!==n.safetyMode||t[144]!==de||t[145]!==fe||t[146]!==pe||t[147]!==J?(Y=(0,V.jsxs)(`select`,{className:Q,value:n.safetyMode,onChange:de,children:[fe,pe,J]}),t[143]=n.safetyMode,t[144]=de,t[145]=fe,t[146]=pe,t[147]=J,t[148]=Y):Y=t[148];let me=n.safetyMode===`suggest_only`?r.safety.suggestOnlyDescription:n.safetyMode===`ask_before_apply`?r.safety.askBeforeApplyDescription:r.safety.autoApplyDescription,he;t[149]===me?he=t[150]:(he=(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:me}),t[149]=me,t[150]=he);let X;t[151]!==r.form.safety||t[152]!==Y||t[153]!==he?(X=(0,V.jsxs)($,{label:r.form.safety,children:[Y,he]}),t[151]=r.form.safety,t[152]=Y,t[153]=he,t[154]=X):X=t[154];let ge;t[155]===r.form.afterRun?ge=t[156]:(ge=(0,V.jsx)(Ee,{title:r.form.afterRun}),t[155]=r.form.afterRun,t[156]=ge);let _e;t[157]===p?_e=t[158]:(_e=e=>p({afterRunMode:e.target.value}),t[157]=p,t[158]=_e);let ve;t[159]===r.afterRun.none?ve=t[160]:(ve=(0,V.jsx)(`option`,{value:`none`,children:r.afterRun.none}),t[159]=r.afterRun.none,t[160]=ve);let ye;t[161]===r.afterRun.saveToSession?ye=t[162]:(ye=(0,V.jsx)(`option`,{value:`saveToSession`,children:r.afterRun.saveToSession}),t[161]=r.afterRun.saveToSession,t[162]=ye);let be=n.safetyMode!==`auto_apply`,xe;t[163]!==r.afterRun.webhook||t[164]!==be?(xe=(0,V.jsx)(`option`,{value:`webhook`,disabled:be,children:r.afterRun.webhook}),t[163]=r.afterRun.webhook,t[164]=be,t[165]=xe):xe=t[165];let Z;t[166]!==n.afterRunMode||t[167]!==_e||t[168]!==ve||t[169]!==ye||t[170]!==xe?(Z=(0,V.jsxs)(`select`,{className:Q,value:n.afterRunMode,onChange:_e,children:[ve,ye,xe]}),t[166]=n.afterRunMode,t[167]=_e,t[168]=ve,t[169]=ye,t[170]=xe,t[171]=Z):Z=t[171];let Se;t[172]!==n.afterRunMode||t[173]!==n.webhookUrl||t[174]!==r.form.webhookUrl||t[175]!==p?(Se=n.afterRunMode===`webhook`?(0,V.jsx)($,{label:r.form.webhookUrl,children:(0,V.jsx)(`input`,{className:Q,value:n.webhookUrl,onChange:e=>p({webhookUrl:e.target.value})})}):null,t[172]=n.afterRunMode,t[173]=n.webhookUrl,t[174]=r.form.webhookUrl,t[175]=p,t[176]=Se):Se=t[176];let Ce;t[177]===r.form.reliability?Ce=t[178]:(Ce=(0,V.jsx)(Ee,{title:r.form.reliability}),t[177]=r.form.reliability,t[178]=Ce);let De;t[179]===p?De=t[180]:(De=e=>p({timeoutSeconds:e.target.value}),t[179]=p,t[180]=De);let Oe;t[181]!==n.timeoutSeconds||t[182]!==De?(Oe=(0,V.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:De}),t[181]=n.timeoutSeconds,t[182]=De,t[183]=Oe):Oe=t[183];let ke;t[184]!==r.form.timeoutSeconds||t[185]!==Oe?(ke=(0,V.jsx)($,{label:r.form.timeoutSeconds,children:Oe}),t[184]=r.form.timeoutSeconds,t[185]=Oe,t[186]=ke):ke=t[186];let Ae;t[187]===p?Ae=t[188]:(Ae=e=>p({disableAfterFailures:e.target.value}),t[187]=p,t[188]=Ae);let je;t[189]!==n.disableAfterFailures||t[190]!==Ae?(je=(0,V.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:Ae}),t[189]=n.disableAfterFailures,t[190]=Ae,t[191]=je):je=t[191];let Me;t[192]!==r.form.disableAfterFailures||t[193]!==je?(Me=(0,V.jsx)($,{label:r.form.disableAfterFailures,children:je}),t[192]=r.form.disableAfterFailures,t[193]=je,t[194]=Me):Me=t[194];let Ne;t[195]!==ke||t[196]!==Me?(Ne=(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ke,Me]}),t[195]=ke,t[196]=Me,t[197]=Ne):Ne=t[197];let Pe;return t[198]!==S||t[199]!==N||t[200]!==te||t[201]!==P||t[202]!==F||t[203]!==ne||t[204]!==I||t[205]!==H||t[206]!==K||t[207]!==ue||t[208]!==q||t[209]!==X||t[210]!==ge||t[211]!==Z||t[212]!==Se||t[213]!==Ce||t[214]!==v||t[215]!==Ne||t[216]!==x?(Pe=(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,V.jsxs)(`div`,{className:`grid gap-4`,children:[v,x,S,N,te,P,F,ne,I,H,K,ue,q,X,ge,Z,Se,Ce,Ne]})}),t[198]=S,t[199]=N,t[200]=te,t[201]=P,t[202]=F,t[203]=ne,t[204]=I,t[205]=H,t[206]=K,t[207]=ue,t[208]=q,t[209]=X,t[210]=ge,t[211]=Z,t[212]=Se,t[213]=Ce,t[214]=v,t[215]=Ne,t[216]=x,t[217]=Pe):Pe=t[217],Pe}function we(e){return(0,V.jsx)(`option`,{value:e.id,children:e.title||e.name},e.id)}function Te(e){return(0,V.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id)}var Q=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,z.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,V.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,V.jsxs)(`div`,{className:`grid gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Ee(e){let t=(0,z.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,V.jsx)(f,{className:`size-4 text-fg-muted`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,V.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 text-sm font-semibold text-fg`,children:[r,n]}),t[1]=n,t[2]=i),i}export{J as AutomationsPage};
|