@xopcai/xopc 0.0.121 → 0.0.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -3
- package/README.zh-CN.md +23 -3
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-4AW4JgSU.js → agent-avatar-dicebear-CK3s5cJo.js} +1 -1
- package/dist/gateway/static/root/assets/agents-SsQrj9B-.js +2 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CE6GkGU2.js → app-management-settings-panel-CWsNHtTs.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BmaUjghw.js → appearance-settings-C4b8y6iZ.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-CYb6fame.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CX4_KWut.js → archive-plugin-DAtNW3Ia.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-jf-PIIUU.js → attachment-load-Dm-RY54y.js} +1 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-BKHewSVT.js +1 -0
- package/dist/gateway/static/root/assets/automations-page-DpOOq1nk.js +1 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DG9XQikd.js → binary-plugins-BG6Xnk71.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Up_VIxLJ.js → block-editor-DfndiO3h.js} +28 -28
- package/dist/gateway/static/root/assets/browser-settings-page-9nXxgh4u.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-CGM4OyMw.js → capability-presets-api-Cx93GLdw.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-CzWt0LBb.js → capability-presets-settings-panel-D528_YFy.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-BEByL4_o.js → channel-recipient-api-DdPTtEs8.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Ck-3h5lI.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-DL-fAqE_.js +2 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-D835EHJd.js +1 -0
- package/dist/gateway/static/root/assets/dreaming-settings-CCa1F7Fg.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DZxa_j7-.js → extension-debug-page-W2ITCPSA.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CseziW53.js → extension-page-DrvUytvn.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-B_9J-xyo.js → extension-settings-page-qM8aLT5u.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-Cs4ck8zA.js → fetch-ovkvM8KQ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Dl223a7r.js → gateway-config-api-BB3biuD0.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-mmmnIH27.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-IvePwjFE.js → gateway-startup-retry-CanQ8UcR.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-CNqNdEkQ.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-Ceu5zrN6.js +1 -0
- package/dist/gateway/static/root/assets/{goals-config-api-CUCP6yCl.js → goals-config-api-BBOX6mUl.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BP1kfvWv.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-Dj87qPxv.js → goals-settings-Bh3A7OZV.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-YoYgKlfX.js +1 -0
- package/dist/gateway/static/root/assets/index-DdqSO9R2.js +191 -0
- package/dist/gateway/static/root/assets/index-jGB-2nI-.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DJgYw0nB.js → keyboard-shortcuts-settings-B4TKJHla.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-BgVk5DvZ.js +2 -0
- package/dist/gateway/static/root/assets/{markdown-split-gnQ_EiGo.js → markdown-split-DcFtdLci.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CQV-mgJn.js → media-plugins-B6SmeLVB.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B5O4OIEo.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-panel-BU0x8PGP.js +2 -0
- package/dist/gateway/static/root/assets/notes-page-D6JYVP4I.js +1 -0
- package/dist/gateway/static/root/assets/notes-workbench-mqRJYnJS.js +2 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BPMXC-2u.js → preview-open-alternatives-C29O19s7.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DOTgzoeh.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DGUIb4y5.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-DVKKUj3u.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BEHqwZjz.js → save-bar-controls-B4ad9GfB.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-CMY25m97.js → schedule-field-DdYncfLR.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CxjxsFfg.js → schema-form-BMTrDE-7.js} +1 -1
- package/dist/gateway/static/root/assets/segmented-styles-BL8oLBEp.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-BVbzUWxW.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DrNNoSqE.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-s-kiLAxP.js → settings-collapsible-section-MwTW2eK4.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-CIxIEYxU.js → settings-form-section-Dg6LBbcr.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-CMDqgeMR.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-layout-BX4T-OLF.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-Ce1pcFtR.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-DWE-dUFh.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-aKSraR8l.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CS-FU_B-.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BaF3u0LA.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-Czjf0kLJ.js → system-settings-panel-Dd6Y35Cm.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-Cmt8SYdI.js → typed-models-lib-Cx6XV5A2.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-DyM-ckEQ.js → use-channel-catalog-D4sMbmy7.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-BygLv8vm.js → user-profile-settings-panel-Bx-hjMQc.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-CloW8coB.js → utils-D7b_vZnv.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-CkhbRt1q.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel--TdohF5N.js +3 -0
- package/dist/gateway/static/root/assets/workflow-start-dialog-B0lavx_o.js +1 -0
- package/dist/gateway/static/root/assets/workflows-page-CZR05Bu_.js +18 -0
- package/dist/gateway/static/root/index.html +5 -5
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +2 -0
- package/dist/src/agent/agent-manager.js +47 -7
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/context/project-context.d.ts +19 -0
- package/dist/src/agent/context/project-context.js +90 -0
- package/dist/src/agent/context/project-context.js.map +1 -0
- package/dist/src/agent/goals/goal-locale.js +2 -2
- package/dist/src/agent/memory/types.d.ts +1 -0
- package/dist/src/agent/prompt/service-prompt-builder.d.ts +1 -0
- package/dist/src/agent/prompt/service-prompt-builder.js +2 -0
- package/dist/src/agent/prompt/service-prompt-builder.js.map +1 -1
- package/dist/src/agent/prompt/system-prompt-params.d.ts +2 -0
- package/dist/src/agent/prompt/system-prompt-params.js +1 -0
- package/dist/src/agent/prompt/system-prompt-params.js.map +1 -1
- package/dist/src/agent/prompt/system-prompt.d.ts +1 -0
- package/dist/src/agent/prompt/system-prompt.js +2 -1
- package/dist/src/agent/prompt/system-prompt.js.map +1 -1
- package/dist/src/agent/service.js +4 -3
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/session/session-config-service.js +6 -1
- package/dist/src/agent/session/session-config-service.js.map +1 -1
- package/dist/src/agent/session/session-hydrator.js +7 -3
- package/dist/src/agent/session/session-hydrator.js.map +1 -1
- package/dist/src/agent/session/session-inspector.js +9 -5
- package/dist/src/agent/session/session-inspector.js.map +1 -1
- package/dist/src/agent/starter-agents.js +5 -34
- package/dist/src/agent/starter-agents.js.map +1 -1
- package/dist/src/agent/workflow/index.js +2 -2
- package/dist/src/agent/workflow/runtime.js +1 -1
- package/dist/src/automations/api/routes.js +13 -2
- package/dist/src/automations/api/routes.js.map +1 -1
- package/dist/src/automations/domain/types.d.ts +2 -0
- package/dist/src/automations/domain/validation.d.ts +3 -0
- package/dist/src/automations/domain/validation.js +1 -0
- package/dist/src/automations/domain/validation.js.map +1 -1
- package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -0
- package/dist/src/automations/service/action-executor.js +3 -1
- package/dist/src/automations/service/action-executor.js.map +1 -1
- package/dist/src/automations/service/automation-service.d.ts +4 -1
- package/dist/src/automations/service/automation-service.js +2 -2
- package/dist/src/automations/service/automation-service.js.map +1 -1
- package/dist/src/automations/storage/automation-repository.d.ts +3 -1
- package/dist/src/automations/storage/automation-repository.js +7 -5
- package/dist/src/automations/storage/automation-repository.js.map +1 -1
- package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
- package/dist/src/automations/storage/automation-run-repository.js +12 -1
- package/dist/src/automations/storage/automation-run-repository.js.map +1 -1
- package/dist/src/chat-commands/context.js +2 -1
- package/dist/src/chat-commands/context.js.map +1 -1
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-loaders.js.map +1 -1
- package/dist/src/cli/command-manifest.js +4 -0
- package/dist/src/cli/command-manifest.js.map +1 -1
- package/dist/src/cli/commands/agent.js +2 -2
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/goal.js +27 -4
- package/dist/src/cli/commands/goal.js.map +1 -1
- package/dist/src/cli/commands/models.js +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/project.d.ts +4 -0
- package/dist/src/cli/commands/project.js +239 -0
- package/dist/src/cli/commands/project.js.map +1 -0
- 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/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/routes/goals.js +51 -4
- package/dist/src/gateway/hono/routes/goals.js.map +1 -1
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/index.js.map +1 -1
- package/dist/src/gateway/hono/routes/memory.js +5 -1
- package/dist/src/gateway/hono/routes/memory.js.map +1 -1
- package/dist/src/gateway/hono/routes/notes.js +5 -0
- package/dist/src/gateway/hono/routes/notes.js.map +1 -1
- package/dist/src/gateway/hono/routes/projects.d.ts +3 -0
- package/dist/src/gateway/hono/routes/projects.js +578 -0
- package/dist/src/gateway/hono/routes/projects.js.map +1 -0
- package/dist/src/gateway/hono/routes/sessions.js +47 -7
- package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +27 -4
- package/dist/src/gateway/hono/routes/workflows.js.map +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/service.d.ts +3 -0
- package/dist/src/gateway/service.js +10 -3
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/goals/goal-service.d.ts +1 -1
- package/dist/src/goals/goal-service.js +2 -1
- package/dist/src/goals/goal-service.js.map +1 -1
- package/dist/src/goals/goal-store.d.ts +1 -1
- package/dist/src/goals/goal-store.js +12 -6
- package/dist/src/goals/goal-store.js.map +1 -1
- package/dist/src/goals/goal-workflow-judge.js +1 -1
- package/dist/src/goals/types.d.ts +3 -0
- package/dist/src/i18n/goals-bundle.js +1 -1
- package/dist/src/i18n/index.js +1 -1
- package/dist/src/i18n/share-tool-bundle.js +2 -2
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/notes/agent-context.js +2 -2
- package/dist/src/projects/automation-bind.d.ts +1 -0
- package/dist/src/projects/automation-bind.js +16 -0
- package/dist/src/projects/automation-bind.js.map +1 -0
- package/dist/src/projects/goal-bind.d.ts +4 -0
- package/dist/src/projects/goal-bind.js +40 -0
- package/dist/src/projects/goal-bind.js.map +1 -0
- package/dist/src/projects/index.d.ts +11 -0
- package/dist/src/projects/index.js +11 -0
- package/dist/src/projects/memory-bind.d.ts +1 -0
- package/dist/src/projects/memory-bind.js +16 -0
- package/dist/src/projects/memory-bind.js.map +1 -0
- package/dist/src/projects/project-agent.d.ts +10 -0
- package/dist/src/projects/project-agent.js +27 -0
- package/dist/src/projects/project-agent.js.map +1 -0
- package/dist/src/projects/project-loop.d.ts +58 -0
- package/dist/src/projects/project-loop.js +118 -0
- package/dist/src/projects/project-loop.js.map +1 -0
- package/dist/src/projects/project-service.d.ts +26 -0
- package/dist/src/projects/project-service.js +94 -0
- package/dist/src/projects/project-service.js.map +1 -0
- package/dist/src/projects/project-store.d.ts +31 -0
- package/dist/src/projects/project-store.js +193 -0
- package/dist/src/projects/project-store.js.map +1 -0
- package/dist/src/projects/session-bind.d.ts +5 -0
- package/dist/src/projects/session-bind.js +46 -0
- package/dist/src/projects/session-bind.js.map +1 -0
- package/dist/src/projects/types.d.ts +60 -0
- package/dist/src/projects/types.js +1 -0
- package/dist/src/projects/workflow-bind.d.ts +1 -0
- package/dist/src/projects/workflow-bind.js +16 -0
- package/dist/src/projects/workflow-bind.js.map +1 -0
- package/dist/src/projects/workspace.d.ts +5 -0
- package/dist/src/projects/workspace.js +25 -0
- package/dist/src/projects/workspace.js.map +1 -0
- package/dist/src/session/index.d.ts +1 -1
- package/dist/src/session/index.js +3 -3
- package/dist/src/session/session-workspace.d.ts +4 -2
- package/dist/src/session/session-workspace.js +10 -3
- package/dist/src/session/session-workspace.js.map +1 -1
- package/dist/src/session/types.d.ts +3 -0
- package/dist/src/session/types.js.map +1 -1
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/memory-records-repository.js +16 -5
- package/dist/src/storage/sqlite/memory-records-repository.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/019_projects.sql +40 -0
- package/dist/src/storage/sqlite/migrations/020_project_default_agent.sql +1 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/notes-repository.js +20 -4
- package/dist/src/storage/sqlite/notes-repository.js.map +1 -1
- package/dist/src/storage/sqlite/row-mappers.d.ts +2 -0
- package/dist/src/storage/sqlite/row-mappers.js +2 -0
- package/dist/src/storage/sqlite/row-mappers.js.map +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-repository.js +10 -5
- package/dist/src/storage/sqlite/session-repository.js.map +1 -1
- package/dist/src/storage/sqlite/transcript-repository.js +8 -0
- package/dist/src/storage/sqlite/transcript-repository.js.map +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +145 -0
- package/dist/src/tui/tui-commands.js.map +1 -1
- package/dist/src/workflows/domain/run.d.ts +1 -0
- package/dist/src/workflows/domain/run.js.map +1 -1
- package/dist/src/workflows/index.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.d.ts +1 -0
- package/dist/src/workflows/service/workflow-run-service.js +18 -4
- package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
- package/dist/src/workflows/service/workflow-run-service.types.d.ts +2 -0
- package/dist/src/workflows/service/workflow-session-bridge.d.ts +1 -0
- package/dist/src/workflows/service/workflow-session-bridge.js +3 -0
- package/dist/src/workflows/service/workflow-session-bridge.js.map +1 -1
- package/dist/src/workflows/store/run-index-store.d.ts +1 -0
- package/dist/src/workflows/store/run-index-store.js +13 -3
- package/dist/src/workflows/store/run-index-store.js.map +1 -1
- package/dist/src/workflows/store/run-store.d.ts +3 -1
- package/dist/src/workflows/store/run-store.js +5 -2
- package/dist/src/workflows/store/run-store.js.map +1 -1
- package/package.json +10 -1
- package/dist/gateway/static/root/assets/agents-2SVUUPlp.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-BWeQ1I49.js +0 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-BHk5rtJz.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-QHotl53D.js +0 -1
- package/dist/gateway/static/root/assets/browser-settings-page-Cmwi6IIQ.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-BOMCUe2J.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-C-Dexk_F.js +0 -2
- package/dist/gateway/static/root/assets/dreaming-settings-WPEj8pir.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DdzbtW9R.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-Dxldogms.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-DU5Nd6Xp.js +0 -2
- package/dist/gateway/static/root/assets/heartbeat-settings-Cgm5JmwH.js +0 -1
- package/dist/gateway/static/root/assets/index-BU1pvxmS.js +0 -191
- package/dist/gateway/static/root/assets/index-l54WfSqe.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-C10aS4XO.js +0 -2
- package/dist/gateway/static/root/assets/messages-C6Kc4Jhf.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-B35CAfg6.js +0 -2
- package/dist/gateway/static/root/assets/note-detail-page-Brlwse8x.js +0 -2
- package/dist/gateway/static/root/assets/note-image-lightbox-BthwKjLA.js +0 -1
- package/dist/gateway/static/root/assets/note-time-hm6JO_Wi.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-CoAwRc7L.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-B36RQ05h.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-73THChnj.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CR9VsY-R.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BJ1AhfKI.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-layout--6qT7ZJa.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C1TtS1vJ.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-BZADSbS1.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-gqC8Rmhy.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-C9P-WYvS.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-CEpSvOhF.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-BsoqJba6.js +0 -1
- package/dist/gateway/static/root/assets/voice-player-store-DduWlJYV.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CcQeX6l5.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-CeA8A9Ef.js +0 -18
|
@@ -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-C6Kc4Jhf.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{i as s}from"./theme-store-Bt6vAkSB.js";import{c,i as l,n as u}from"./fetch-Cs4ck8zA.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$r as f,$s as p,Aa as m,An as h,Ar as g,As as _,Ba as v,Bn as y,Ct as b,Dr as x,Ea as S,Er as C,Fn as w,Gi as T,Gn as E,Gr as D,Hi as O,Hn as k,Ia as A,In as j,Ji as M,Jr as N,Ki as P,Kr as F,La as I,Ln as L,Mn as ee,Nn as R,Oa as z,On as B,Oo as te,Or as ne,Pa as re,Pn as V,Pr as H,Qa as ie,Qr as U,Qs as ae,Sa as W,So as G,Ss as K,Tr as oe,Ui as se,Va as q,Vi as J,Vn as ce,Wi as le,Wn as ue,Wr as de,Xo as fe,Xr as pe,Yi as me,Yo as he,Yr as ge,Zr as _e,_c as ve,_t as ye,at as be,bt as Y,ca as xe,d as Se,da as Ce,dt as we,ea as Te,eo as Ee,es as De,fa as Oe,gi as ke,go as Ae,gs as je,ht as Me,ia as Ne,ja as Pe,jn as Fe,jr as Ie,ka as Le,kn as Re,kr as ze,la as X,lc as Be,lt as Ve,mc as He,ms as Ue,mt as We,n as Ge,no as Ke,oa as qe,pa as Je,pt as Ye,qi as Xe,qr as Ze,rc as Qe,sa as $e,sc as et,t as tt,tc as nt,u as rt,ua as it,uo as at,ut as ot,vc as st,xa as ct,xs as lt,xt as ut,yc as dt,zn as ft,zo as pt}from"./index-BU1pvxmS.js";import{t as mt}from"./markdown-editor-AssmZFx4.js";import{n as ht,t as gt}from"./settings-form-section-CIxIEYxU.js";import{n as _t,t as vt}from"./settings-page-layout--6qT7ZJa.js";import{n as yt}from"./agent-avatar-dicebear-4AW4JgSU.js";import{n as bt,r as xt,t as St}from"./channel-recipient-api-BEByL4_o.js";import{n as Ct,r as wt,t as Tt}from"./utils-CloW8coB.js";import{a as Et,i as Dt,n as Ot,o as kt,t as At}from"./typed-models-lib-Cmt8SYdI.js";import{a as jt,o as Mt,r as Nt,s as Pt}from"./capability-presets-api-CGM4OyMw.js";var Z=n(),Q=r();function Ft(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)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=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]=m):m=t[1];let h=o?f.purgeDisk:f.removeFromConfig,g;t[2]===h?g=t[3]:(g=(0,Q.jsx)(M,{className:`text-base font-semibold text-fg`,children:h}),t[2]=h,t[3]=g);let _=o?f.confirmDeletePurge:f.confirmDelete,v;t[4]===_?v=t[5]:(v=(0,Q.jsx)(le,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==f.purgeConfirmHint||t[7]!==f.purgeConfirmLabel||t[8]!==f.purgeConfirmPlaceholder||t[9]!==c||t[10]!==o||t[11]!==s||t[12]!==l?(y=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]=y):y=t[13];let b;t[14]!==f.createModalCancel||t[15]!==a||t[16]!==d?(b=(0,Q.jsx)(z,{type:`button`,variant:`ghost`,disabled:a,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=a,t[16]=d,t[17]=b):b=t[17];let x=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,S;t[18]!==a||t[19]!==c||t[20]!==o||t[21]!==s?(S=a||!s||o&&c.trim().toLowerCase()!==s.id.toLowerCase(),t[18]=a,t[19]=c,t[20]=o,t[21]=s,t[22]=S):S=t[22];let C=o?f.purgeDisk:f.removeFromConfig,w;t[23]!==u||t[24]!==S||t[25]!==C||t[26]!==x?(w=(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:x,disabled:S,onClick:u,children:C}),t[23]=u,t[24]=S,t[25]=C,t[26]=x,t[27]=w):w=t[27];let E;t[28]!==w||t[29]!==b?(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:[b,w]}),t[28]=w,t[29]=b,t[30]=E):E=t[30];let D;t[31]!==E||t[32]!==g||t[33]!==v||t[34]!==y?(D=(0,Q.jsxs)(P,{children:[p,(0,Q.jsxs)(se,{className:m,onOpenAutoFocus:It,children:[g,v,y,E]})]}),t[31]=E,t[32]=g,t[33]=v,t[34]=y,t[35]=D):D=t[35];let O;return t[36]!==r||t[37]!==n||t[38]!==D?(O=(0,Q.jsx)(Xe,{open:n,onOpenChange:r,children:D}),t[36]=r,t[37]=n,t[38]=D,t[39]=O):O=t[39],O}function It(e){return e.preventDefault()}var Lt=[{id:`overview`,labelKey:`navOverview`,icon:Ue},{id:`behavior`,labelKey:`navBehavior`,icon:Ee},{id:`tools`,labelKey:`navTools`,icon:Pe},{id:`skills`,labelKey:`navSkills`,icon:Le},{id:`memory`,labelKey:`navMemory`,icon:p},{id:`connections`,labelKey:`navConnections`,icon:ae},{id:`config`,labelKey:`navConfig`,icon:Ke},{id:`dangerZone`,labelKey:`navDangerZone`,icon:v}];function Rt(e){let t=(0,Z.c)(11),{a:n,panel:r,onPanelChange:a}=e,o;t[0]!==a||t[1]!==r?(o=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:i(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,W.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=Lt.map(e=>{let{id:t,labelKey:r,icon:i}=e;return s(t,n[r],i)}),t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l}),t[6]=l,t[7]=u);let d;return t[8]!==n.editorNavAria||t[9]!==u?(d=(0,Q.jsx)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":c,children:u}),t[8]=n.editorNavAria,t[9]=u,t[10]=d):d=t[10],d}function zt(e){let t=(0,Z.c)(44),{open:n,onOpenChange:r,a,title:o,subtitle:s,panel:c,onPanelChange:l,onFooterSave:u,footerSaveDisabled:d,footerSavedFlash:f,showFooter:p,busy:h,children:g}=e,_=p===void 0?!0:p,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(T,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,xe)}),t[0]=v):v=t[0];let y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=i(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,$e,`inset-4 h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] min-h-0`,`sm:inset-auto sm:left-1/2 sm:top-1/2 sm:h-[min(88vh,48rem)] sm:max-h-[min(88vh,48rem)] sm:min-h-[32rem] sm:w-[min(100%-2rem,58rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=y):y=t[1];let b;t[2]===o?b=t[3]:(b=(0,Q.jsx)(M,{className:`text-base font-semibold leading-snug text-fg`,children:o}),t[2]=o,t[3]=b);let x;t[4]===s?x=t[5]:(x=(0,Q.jsx)(le,{className:`mt-1 font-mono text-xs text-fg-muted`,children:s}),t[4]=s,t[5]=x);let S;t[6]!==b||t[7]!==x?(S=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[b,x]}),t[6]=b,t[7]=x,t[8]=S):S=t[8];let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=i(ct,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=C):C=t[9];let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t[10]=w):w=t[10];let E;t[11]===a.closeDialogAria?E=t[12]:(E=(0,Q.jsx)(O,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:C,"aria-label":a.closeDialogAria,children:w})}),t[11]=a.closeDialogAria,t[12]=E);let D;t[13]!==S||t[14]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-edge-subtle px-4 pb-3 pt-4 dark:border-edge`,children:[S,E]}),t[13]=S,t[14]=E,t[15]=D):D=t[15];let k;t[16]!==a||t[17]!==l||t[18]!==c?(k=(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)(Rt,{a,panel:c,onPanelChange:l})}),t[16]=a,t[17]=l,t[18]=c,t[19]=k):k=t[19];let A;t[20]===g?A=t[21]:(A=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:g}),t[20]=g,t[21]=A);let j;t[22]!==a.footerSaveNotApplicable||t[23]!==a.personaSaved||t[24]!==a.save||t[25]!==h||t[26]!==d||t[27]!==f||t[28]!==u||t[29]!==_?(j=_?(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[f?(0,Q.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,a.personaSaved]}):d?(0,Q.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:a.footerSaveNotApplicable}):null,(0,Q.jsx)(z,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:h||d,onClick:()=>void u(),children:a.save})]}):null,t[22]=a.footerSaveNotApplicable,t[23]=a.personaSaved,t[24]=a.save,t[25]=h,t[26]=d,t[27]=f,t[28]=u,t[29]=_,t[30]=j):j=t[30];let N;t[31]!==A||t[32]!==j?(N=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[A,j]}),t[31]=A,t[32]=j,t[33]=N):N=t[33];let F;t[34]!==k||t[35]!==N?(F=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[k,N]}),t[34]=k,t[35]=N,t[36]=F):F=t[36];let I;t[37]!==F||t[38]!==D?(I=(0,Q.jsxs)(P,{children:[v,(0,Q.jsx)(se,{className:y,onOpenAutoFocus:Bt,children:(0,Q.jsxs)(Ye,{layer:`modal`,children:[D,F]})})]}),t[37]=F,t[38]=D,t[39]=I):I=t[39];let L;return t[40]!==r||t[41]!==n||t[42]!==I?(L=(0,Q.jsx)(Xe,{open:n,onOpenChange:r,children:I}),t[40]=r,t[41]=n,t[42]=I,t[43]=L):L=t[43],L}function Bt(e){return e.preventDefault()}var $=e(t(),1),Vt=e=>u(e);function Ht(e){return!e||e.total<=0?null:Math.round(e.helpful/e.total*100)}function Ut(e){let t=Ht(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 Wt({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`),Vt),{data:y,mutate:b}=d(l(`/api/memory/records?status=active&limit=80`),Vt),{data:x,mutate:S}=d(l(`/api/memory/records?status=candidate&limit=80`),Vt),{data:C}=d(l(`/api/memory/signals?limit=50`),Vt),{data:w,mutate:T}=d(l(`/api/memory/traces?limit=80`),Vt),{data:E}=d(l(`/api/memory/feedback-summary?limit=1000`),Vt),{data:D,mutate:O}=d(l(`/api/memory/config${t?`?agentId=${encodeURIComponent(t)}`:``}`),Vt),{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,L=E?.summaries??[],ee=(0,$.useMemo)(()=>new Map(L.map(e=>[e.recordId,e])),[L]),R=L.reduce((e,t)=>e+t.total,0),B=L.reduce((e,t)=>e+t.helpful,0),te=R>0?Math.round(B/R*100):null,ne=(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:te==null?`—`:`${te}%`}],[P,te,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 re(){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 V(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 H(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:ne.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)(Ne,{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)(qe,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.writeStrategy,(0,Q.jsx)(Ne,{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)(qe,{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)(z,{type:`button`,variant:`primary`,onClick:re,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)(z,{type:`button`,variant:`primary`,onClick:()=>H(e.id,`active`),children:n.approve}),(0,Q.jsx)(z,{type:`button`,variant:`secondary`,onClick:()=>H(e.id,`rejected`),children:n.reject}),(0,Q.jsx)(z,{type:`button`,variant:`secondary`,onClick:()=>H(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)(z,{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=ee.get(e.id),r=Ht(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 ${Ut(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)(z,{type:`button`,variant:`secondary`,onClick:()=>V(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:[L.slice(0,8).map(e=>{let t=(y?.records??[]).find(t=>t.id===e.recordId),r=Ht(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 ${Ut(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)}),L.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecallFeedback}):null]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.signals}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:(C?.signals??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`div`,{className:`font-medium text-fg`,children:e.source}),(0,Q.jsxs)(`div`,{children:[e.providerId??`local`,` · `,new Date(e.createdAt).toLocaleString()]})]},e.signalId))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.trace}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:(w?.traces??[]).slice(0,20).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`font-medium text-fg`,children:[e.phase,` · `,e.providerId]}),(0,Q.jsxs)(`div`,{children:[e.resultCount??0,` `,(e.resultCount??0)===1?n.result:n.results,` · `,e.durationMs,` ms`]}),e.skippedReason?(0,Q.jsxs)(`div`,{children:[n.skipped,`: `,e.skippedReason]}):null,e.error?(0,Q.jsx)(`div`,{className:`text-danger`,children:e.error}):null]},e.traceId))})]})]})]})]})}function Gt(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 Kt(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)(ht,{icon:fe,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)(Gt,{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)(Gt,{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)(gt,{children:[g,C]}),t[35]=g,t[36]=C,t[37]=w):w=t[37],w}function qt(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Jt(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 Yt(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)(Jt,{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 Xt(e,t){return e&&e.length>0?e.join(`, `):t}function Zt(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=()=>w(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($t),i=Object.entries(u?.tools?.builtin??{}).sort(Qt),a=u?.skills,o=u?.memory,d=u?.boundaries,f;t[27]!==n.effectiveHint||t[28]!==n.effectiveTitle?(f=(0,Q.jsx)(ht,{icon:he,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[27]=n.effectiveHint,t[28]=n.effectiveTitle,t[29]=f):f=t[29],m=(0,Q.jsxs)(gt,{children:[f,l?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveLoading}):c?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c instanceof Error?c.message:n.effectiveError}):u?(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectivePresetChain}),(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-sm text-fg`,children:p.length?p.join(` -> `):n.effectiveNoPresets})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveModelsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Yt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:qt(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(Yt,{name:n,value:r.model,monoValue:!0,source:qt(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)(Yt,{name:n,value:r.mode,source:qt(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)(Yt,{name:`mode`,value:a?.mode??`all`,source:qt(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(Yt,{name:`allow`,value:Xt(a.allow,`—`),source:qt(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(Yt,{name:`deny`,value:Xt(a.deny,`—`),source:qt(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)(Yt,{name:`mode`,value:o?.mode??`off`,source:qt(e,[`memory.mode`,`memory`])}),(0,Q.jsx)(Yt,{name:`sources`,value:Xt(o?.sources,`—`),source:qt(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)(Yt,{name:`requiresConfirmation`,value:Xt(d?.requiresConfirmation,`—`),source:qt(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(Yt,{name:`forbidden`,value:Xt(d?.forbidden,`—`),source:qt(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(Yt,{name:`escalation`,value:Xt(d?.escalation,`—`),source:qt(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 Qt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function $t(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function en(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1`,children:(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-5 pb-6`,children:n})}),t[0]=n,t[1]=r),r}function tn(e){let t=(0,Z.c)(4),{active:n,children:r,onClick:i}=e,a=n?`rounded-md bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg`:`rounded-md px-3 py-1.5 text-sm font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,Q.jsx)(`button`,{type:`button`,onClick:i,className:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function nn(e){let t=(0,Z.c)(41),{a:n,selected:r,busy:i,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}=e,[p,m]=(0,$.useState)(`sources`),h=p===`sources`,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>m(`sources`),t[0]=g):g=t[0];let _;t[1]!==n.configSubtabSources||t[2]!==h?(_=(0,Q.jsx)(tn,{active:h,onClick:g,children:n.configSubtabSources}),t[1]=n.configSubtabSources,t[2]=h,t[3]=_):_=t[3];let v=p===`shared`,y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(`shared`),t[4]=y):y=t[4];let b;t[5]!==n.configSubtabShared||t[6]!==v?(b=(0,Q.jsx)(tn,{active:v,onClick:y,children:n.configSubtabShared}),t[5]=n.configSubtabShared,t[6]=v,t[7]=b):b=t[7];let x=p===`effective`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>m(`effective`),t[8]=S):S=t[8];let C;t[9]!==n.configSubtabEffective||t[10]!==x?(C=(0,Q.jsx)(tn,{active:x,onClick:S,children:n.configSubtabEffective}),t[9]=n.configSubtabEffective,t[10]=x,t[11]=C):C=t[11];let w;t[12]!==_||t[13]!==b||t[14]!==C?(w=(0,Q.jsx)(`div`,{className:`shrink-0 rounded-lg border border-edge bg-surface-panel p-1`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[_,b,C]})}),t[12]=_,t[13]=b,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==n||t[17]!==s||t[18]!==c||t[19]!==a||t[20]!==o||t[21]!==p?(T=p===`sources`?(0,Q.jsx)(rn,{a:n,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c}):null,t[16]=n,t[17]=s,t[18]=c,t[19]=a,t[20]=o,t[21]=p,t[22]=T):T=t[22];let E;t[23]!==n||t[24]!==i||t[25]!==l||t[26]!==u||t[27]!==f||t[28]!==d||t[29]!==r||t[30]!==p?(E=p===`shared`?(0,Q.jsx)(an,{a:n,selected:r,busy:i,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}):null,t[23]=n,t[24]=i,t[25]=l,t[26]=u,t[27]=f,t[28]=d,t[29]=r,t[30]=p,t[31]=E):E=t[31];let D;t[32]!==n||t[33]!==r||t[34]!==p?(D=p===`effective`?(0,Q.jsx)(cn,{a:n,selected:r}):null,t[32]=n,t[33]=r,t[34]=p,t[35]=D):D=t[35];let O;return t[36]!==w||t[37]!==T||t[38]!==E||t[39]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[w,T,E,D]}),t[36]=w,t[37]=T,t[38]=E,t[39]=D,t[40]=O):O=t[40],O}function rn(e){let t=(0,Z.c)(7),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s}=e,c;return t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==r||t[4]!==i||t[5]!==s?(c=(0,Q.jsx)(en,{children:(0,Q.jsx)(Kt,{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s})}),t[0]=n,t[1]=a,t[2]=o,t[3]=r,t[4]=i,t[5]=s,t[6]=c):c=t[6],c}function an(e){let t=(0,Z.c)(72),{a:n,selected:r,busy:i,capabilityPresets:a,defaultPresetId:o,onUpdateAgentExtends:s,onOpenCapabilityPreset:c}=e,l=o===void 0?`default`:o,u;t[0]===a?u=t[1]:(u=new Map(a.map(sn)),t[0]=a,t[1]=u);let d=u,f;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==d?(f=d.get(l)??{id:l,name:n.capabilityPresetsGlobalDefault,description:n.capabilityPresetsGlobalDefaultHint},t[2]=n.capabilityPresetsGlobalDefault,t[3]=n.capabilityPresetsGlobalDefaultHint,t[4]=l,t[5]=d,t[6]=f):f=t[6];let p=f,m,h,g,_,v;if(t[7]!==n.capabilityPresetAdd||t[8]!==n.capabilityPresetMoveDown||t[9]!==n.capabilityPresetMoveUp||t[10]!==n.capabilityPresetRemove||t[11]!==n.capabilityPresetsEmptyAdditional||t[12]!==n.capabilityPresetsGlobalDefault||t[13]!==n.capabilityPresetsGlobalDefaultHint||t[14]!==n.capabilityPresetsHint||t[15]!==n.capabilityPresetsManage||t[16]!==n.capabilityPresetsTitle||t[17]!==i||t[18]!==a||t[19]!==l||t[20]!==p.description||t[21]!==p.id||t[22]!==p.name||t[23]!==c||t[24]!==s||t[25]!==d||t[26]!==r.extends){let e;t[32]===l?e=t[33]:(e=e=>e!==l,t[32]=l,t[33]=e);let o=r.extends.filter(e),u=a.map(on).filter(e=>e!==l&&!o.includes(e)),f=u[0]??``;h=en,m=gt;let y;t[34]===c?y=t[35]:(y=()=>c(``),t[34]=c,t[35]=y);let b;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),t[36]=b):b=t[36];let x;t[37]!==n.capabilityPresetsManage||t[38]!==i||t[39]!==y?(x=(0,Q.jsxs)(z,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:i,onClick:y,children:[b,n.capabilityPresetsManage]}),t[37]=n.capabilityPresetsManage,t[38]=i,t[39]=y,t[40]=x):x=t[40],t[41]!==n.capabilityPresetsHint||t[42]!==n.capabilityPresetsTitle||t[43]!==x?(g=(0,Q.jsx)(ht,{icon:Ee,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:x}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=x,t[44]=g):g=t[44];let S;t[45]!==p.id||t[46]!==c?(S=()=>c(p.id),t[45]=p.id,t[46]=c,t[47]=S):S=t[47];let C=p.name||n.capabilityPresetsGlobalDefault,w;t[48]===C?w=t[49]:(w=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:C}),t[48]=C,t[49]=w);let T;t[50]===n.capabilityPresetsGlobalDefault?T=t[51]:(T=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full border border-accent/25 bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:n.capabilityPresetsGlobalDefault}),t[50]=n.capabilityPresetsGlobalDefault,t[51]=T);let E;t[52]!==w||t[53]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[w,T]}),t[52]=w,t[53]=T,t[54]=E):E=t[54];let D;t[55]===p.id?D=t[56]:(D=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:p.id}),t[55]=p.id,t[56]=D);let O=p.description||n.capabilityPresetsGlobalDefaultHint,k;t[57]===O?k=t[58]:(k=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:O}),t[57]=O,t[58]=k);let A;t[59]!==S||t[60]!==E||t[61]!==D||t[62]!==k?(A=(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:S,children:[E,D,k]})}),t[59]=S,t[60]=E,t[61]=D,t[62]=k,t[63]=A):A=t[63],_=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[A,o.length>0?o.map((e,t)=>{let r=d.get(e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:r?.name??e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:e}),r?.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:r.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===0,"aria-label":n.capabilityPresetMoveUp,onClick:()=>{let e=[...o],[n,r]=[e[t],e[t-1]];e[t-1]=n,e[t]=r,s(e)},children:(0,Q.jsx)(et,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===o.length-1,"aria-label":n.capabilityPresetMoveDown,onClick:()=>{let e=[...o],[n,r]=[e[t+1],e[t]];e[t]=n,e[t+1]=r,s(e)},children:(0,Q.jsx)(Be,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i,"aria-label":n.capabilityPresetRemove,onClick:()=>s(o.filter(t=>t!==e)),children:(0,Q.jsx)(q,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-3 text-sm text-fg-muted`,children:n.capabilityPresetsEmptyAdditional})]}),v=u.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,Q.jsx)(Ne,{className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,disabled:i,defaultValue:f,children:u.map(e=>(0,Q.jsx)(qe,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(z,{type:`button`,variant:`secondary`,disabled:i||!f,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||f;t&&s([...o,t])},children:[(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0}),n.capabilityPresetAdd]})]}):null,t[7]=n.capabilityPresetAdd,t[8]=n.capabilityPresetMoveDown,t[9]=n.capabilityPresetMoveUp,t[10]=n.capabilityPresetRemove,t[11]=n.capabilityPresetsEmptyAdditional,t[12]=n.capabilityPresetsGlobalDefault,t[13]=n.capabilityPresetsGlobalDefaultHint,t[14]=n.capabilityPresetsHint,t[15]=n.capabilityPresetsManage,t[16]=n.capabilityPresetsTitle,t[17]=i,t[18]=a,t[19]=l,t[20]=p.description,t[21]=p.id,t[22]=p.name,t[23]=c,t[24]=s,t[25]=d,t[26]=r.extends,t[27]=m,t[28]=h,t[29]=g,t[30]=_,t[31]=v}else m=t[27],h=t[28],g=t[29],_=t[30],v=t[31];let y;t[64]!==m||t[65]!==g||t[66]!==_||t[67]!==v?(y=(0,Q.jsxs)(m,{children:[g,_,v]}),t[64]=m,t[65]=g,t[66]=_,t[67]=v,t[68]=y):y=t[68];let b;return t[69]!==h||t[70]!==y?(b=(0,Q.jsx)(h,{children:y}),t[69]=h,t[70]=y,t[71]=b):b=t[71],b}function on(e){return e.id}function sn(e){return[e.id,e]}function cn(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(en,{children:(0,Q.jsx)(Zt,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function ln(e){let t=(0,Z.c)(10),{a:n,selected:r,busy:i,onDelete:a}=e,o;return t[0]!==n.dangerZoneBody||t[1]!==n.dangerZoneHint||t[2]!==n.dangerZoneMainUnavailable||t[3]!==n.dangerZoneTitle||t[4]!==n.purgeDisk||t[5]!==n.removeFromConfig||t[6]!==i||t[7]!==a||t[8]!==r.id?(o=(0,Q.jsx)(en,{children:r.id===`main`?(0,Q.jsx)(gt,{children:(0,Q.jsx)(ht,{icon:v,title:n.dangerZoneTitle,subtitle:n.dangerZoneMainUnavailable})}):(0,Q.jsxs)(gt,{className:`border border-red-200/70 bg-red-50/60 dark:border-red-900/50 dark:bg-red-950/25`,children:[(0,Q.jsx)(ht,{icon:v,title:n.dangerZoneTitle,subtitle:n.dangerZoneHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`max-w-xl text-sm text-red-800 dark:text-red-200`,children:n.dangerZoneBody}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,Q.jsxs)(z,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(q,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:`border-red-200 text-red-700 hover:bg-red-100 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/50`,disabled:i,onClick:()=>void a(!0),children:n.purgeDisk})]})]})]})}),t[0]=n.dangerZoneBody,t[1]=n.dangerZoneHint,t[2]=n.dangerZoneMainUnavailable,t[3]=n.dangerZoneTitle,t[4]=n.purgeDisk,t[5]=n.removeFromConfig,t[6]=i,t[7]=a,t[8]=r.id,t[9]=o):o=t[9],o}var un=i(S,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function dn(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)(ht,{className:`shrink-0`,icon:fe,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:wt(e.match)}),(0,Q.jsx)(z,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void s(e),children:n.removeBinding})]},`${e.match.channel}-${wt(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:Tt(),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)(Ne,{className:i(Tt(),`py-2`),value:f,onChange:e=>{p(e.target.value),_(null),y(``)},children:l.map(e=>(0,Q.jsxs)(qe,{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)(z,{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)(Ae,{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)(Ne,{className:i(Tt(),`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)(qe,{value:``,children:n.channelsPeerAny}),m.map((e,t)=>(0,Q.jsx)(qe,{value:String(t),children:St(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(Tt(),`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)(Ne,{className:un,value:v,onChange:e=>{let t=e.target.value;y(t||``),_(null)},children:[(0,Q.jsx)(qe,{value:``,children:S}),m.map(e=>(0,Q.jsx)(qe,{value:e.chatId,children:St(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)(z,{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)(gt,{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 fn(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(pn),v;t[0]===n.filesHint?v=t[1]:(v=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[0]=n.filesHint,t[1]=v);let y;t[2]!==n.filesAutoSaveHint||t[3]!==n.filesEmpty||t[4]!==n.filesLoading||t[5]!==n.filesMarkdownEdit||t[6]!==n.filesMarkdownPreview||t[7]!==n.filesNavAria||t[8]!==n.filesSavingStatus||t[9]!==n.missing||t[10]!==n.pickFile||t[11]!==n.tryInChat||t[12]!==o||t[13]!==d||t[14]!==p||t[15]!==a||t[16]!==r||t[17]!==l||t[18]!==_||t[19]!==g||t[20]!==h||t[21]!==m||t[22]!==c||t[23]!==f||t[24]!==u?(y=r?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesLoading}):a?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(`nav`,{className:`-mx-1 flex shrink-0 flex-wrap gap-1 px-1 pb-1`,role:`tablist`,"aria-label":n.filesNavAria,children:a.files.map(e=>{let t=o===e.name;return(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:i(`inline-flex shrink-0 items-center rounded-lg px-3 py-2 font-mono text-xs font-medium whitespace-nowrap transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,W.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`,W.press,l===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`edit`),children:[(0,Q.jsx)(ie,{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`,W.press,l===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`preview`),children:[(0,Q.jsx)(lt,{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)(z,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(pt,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),l===`edit`?(0,Q.jsx)(`div`,{className:i(Tt(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(mt,{initialContent:d,onChange:f,isDark:_,className:`min-h-0 flex-1`},`${o??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:i(Tt(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(H,{content:d,className:`text-sm`})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[2]=n.filesAutoSaveHint,t[3]=n.filesEmpty,t[4]=n.filesLoading,t[5]=n.filesMarkdownEdit,t[6]=n.filesMarkdownPreview,t[7]=n.filesNavAria,t[8]=n.filesSavingStatus,t[9]=n.missing,t[10]=n.pickFile,t[11]=n.tryInChat,t[12]=o,t[13]=d,t[14]=p,t[15]=a,t[16]=r,t[17]=l,t[18]=_,t[19]=g,t[20]=h,t[21]=m,t[22]=c,t[23]=f,t[24]=u,t[25]=y):y=t[25];let b;return t[26]!==v||t[27]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[v,y]}),t[26]=v,t[27]=y,t[28]=b):b=t[28],b}function pn(e){return e.resolved===`dark`}function mn(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)(ht,{className:`shrink-0`,icon:De,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=Ot(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=Ot(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)(Pt,{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)(z,{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)(z,{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)(gt,{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 hn(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=Ve(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)(ot,{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)(be,{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 gn(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 _n(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=_e(n.trim());return e&&pe(e.styleId)?e.styleId:Ze[0]??`adventurer`},[n]),h=(0,$.useCallback)(async(e,n)=>{try{await Fe(t)}catch{}r(ge(e,n)),p(!1)},[t,r]),g=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){d(null),l(!0);try{await E(t,n),U(t),r(N)}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]),_=(e,t)=>{let r=_e(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 g(e)}),(0,Q.jsxs)(z,{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)(I,{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:Ze.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void h(e,F[0]??t),className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,W.press,m===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:gn(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:[F.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:i(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,W.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:yt(m,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(Oe,{open:f,onOpenChange:p,children:[(0,Q.jsx)(Je,{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`,W.press),children:a.avatarMore})}),(0,Q.jsx)(Ce,{children:(0,Q.jsxs)(it,{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:gn(m,a)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:D.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:i(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,W.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:yt(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)(de,{agentId:t,avatar:n,size:40}),n.trim()&&!_e(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 vn(e){let t=(0,Z.c)(207),{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:h,editModel:g,setEditModel:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:w,profileMarkdownLoading:E,profileDraft:D,updateIdentity:k,handleSoulTemplateChange:A,handleSoulContentChange:j,setAvatarDialogOpen:N,toggleSoulPreviewMode:F,onTryInChat:I}=e,L=o(xn),ee=s(bn),R;t[0]===D?.identity?R=t[1]:(R=D?.identity??{name:``,description:``,language:``,creature:``,emoji:``,avatar:``},t[0]=D?.identity,t[1]=R);let B=R,ne=D?.soulTemplate??`professional`,V=D?.soulCustomContent??``,ie=D?.soulEditorNonce??0,U=D?.soulPreviewMode??!1,ae=D?.avatarDialogOpen??!1,G;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(G=Tt(),t[2]=G):G=t[2];let K=G,oe;t[3]===L?oe=t[4]:(oe=(e,t)=>L===`zh`?t:e,t[3]=L,t[4]=oe);let q=oe;if(!a){let e;return t[5]===n.selectAgentHint?e=t[6]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[5]=n.selectAgentHint,t[6]=e),e}let J;t[7]!==B.avatar||t[8]!==a.id?(J=(0,Q.jsx)(de,{agentId:a.id,avatar:B.avatar,size:36,className:`size-9 rounded-lg`}),t[7]=B.avatar,t[8]=a.id,t[9]=J):J=t[9];let ce;t[10]===N?ce=t[11]:(ce=()=>N(!0),t[10]=N,t[11]=ce);let ue;t[12]!==n.avatarOpenSettingsAria||t[13]!==ce?(ue={onClick:ce,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[12]=n.avatarOpenSettingsAria,t[13]=ce,t[14]=ue):ue=t[14];let fe;t[15]!==n.globalDefaultBadge||t[16]!==n.tuiDefaultBadge||t[17]!==n.tuiDefaultInheritedBadge||t[18]!==x||t[19]!==S||t[20]!==a.isDefault?(fe=a.isDefault||x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[a.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,x?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:S?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null]}):null,t[15]=n.globalDefaultBadge,t[16]=n.tuiDefaultBadge,t[17]=n.tuiDefaultInheritedBadge,t[18]=x,t[19]=S,t[20]=a.isDefault,t[21]=fe):fe=t[21];let pe;t[22]!==n.setDefault||t[23]!==n.setTuiDefault||t[24]!==c||t[25]!==x||t[26]!==y||t[27]!==b||t[28]!==a.isDefault?(pe=!a.isDefault||!x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[a.isDefault?null:(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:c,onClick:()=>void y(),children:n.setDefault}),x?null:(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:c,onClick:()=>void b(),children:n.setTuiDefault})]}):null,t[22]=n.setDefault,t[23]=n.setTuiDefault,t[24]=c,t[25]=x,t[26]=y,t[27]=b,t[28]=a.isDefault,t[29]=pe):pe=t[29];let me;t[30]!==n.personaSectionIdentity||t[31]!==n.personaSectionIdentityHint||t[32]!==J||t[33]!==ue||t[34]!==fe||t[35]!==pe?(me=(0,Q.jsx)(ht,{icon:Ee,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:J,iconInteractive:ue,titleAccessory:fe,trailing:pe}),t[30]=n.personaSectionIdentity,t[31]=n.personaSectionIdentityHint,t[32]=J,t[33]=ue,t[34]=fe,t[35]=pe,t[36]=me):me=t[36];let he;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Q.jsx)(T,{className:i(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,xe)}),t[37]=he):he=t[37];let ge;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ge=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`,$e),t[38]=ge):ge=t[38];let _e;t[39]===n.avatarPickerTitle?_e=t[40]:(_e=(0,Q.jsx)(M,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[39]=n.avatarPickerTitle,t[40]=_e);let ve;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ve=i(ct,`shrink-0 p-1.5 hover:bg-surface-base`),t[41]=ve):ve=t[41];let be;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Q.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t[42]=be):be=t[42];let Y;t[43]===n.closeDialogAria?Y=t[44]:(Y=(0,Q.jsx)(O,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:ve,"aria-label":n.closeDialogAria,children:be})}),t[43]=n.closeDialogAria,t[44]=Y);let Se;t[45]!==_e||t[46]!==Y?(Se=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[_e,Y]}),t[45]=_e,t[46]=Y,t[47]=Se):Se=t[47];let Ce;t[48]===n.avatarRowHint?Ce=t[49]:(Ce=(0,Q.jsx)(le,{className:`sr-only`,children:n.avatarRowHint}),t[48]=n.avatarRowHint,t[49]=Ce);let Te;t[50]===k?Te=t[51]:(Te=e=>k({avatar:e}),t[50]=k,t[51]=Te);let De;t[52]!==n||t[53]!==B.avatar||t[54]!==a.id||t[55]!==Te?(De=(0,Q.jsx)(_n,{agentId:a.id,value:B.avatar,onChange:Te,a:n}),t[52]=n,t[53]=B.avatar,t[54]=a.id,t[55]=Te,t[56]=De):De=t[56];let Oe;t[57]!==Se||t[58]!==Ce||t[59]!==De?(Oe=(0,Q.jsxs)(P,{children:[he,(0,Q.jsxs)(se,{className:ge,onOpenAutoFocus:yn,children:[Se,Ce,De]})]}),t[57]=Se,t[58]=Ce,t[59]=De,t[60]=Oe):Oe=t[60];let ke;t[61]!==ae||t[62]!==N||t[63]!==Oe?(ke=(0,Q.jsx)(Xe,{open:ae,onOpenChange:N,children:Oe}),t[61]=ae,t[62]=N,t[63]=Oe,t[64]=ke):ke=t[64];let Ae;t[65]===n.displayName?Ae=t[66]:(Ae=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[65]=n.displayName,t[66]=Ae);let je;t[67]!==u||t[68]!==k?(je=e=>{u(e.target.value),k({name:e.target.value})},t[67]=u,t[68]=k,t[69]=je):je=t[69];let Pe;t[70]!==n.personaNamePlaceholder||t[71]!==l||t[72]!==je?(Pe=(0,Q.jsx)(`input`,{className:K,value:l,onChange:je,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[70]=n.personaNamePlaceholder,t[71]=l,t[72]=je,t[73]=Pe):Pe=t[73];let Fe;t[74]!==Ae||t[75]!==Pe?(Fe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Ae,Pe]}),t[74]=Ae,t[75]=Pe,t[76]=Fe):Fe=t[76];let Ie;t[77]===n.personaEmoji?Ie=t[78]:(Ie=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[77]=n.personaEmoji,t[78]=Ie);let Le;t[79]===k?Le=t[80]:(Le=e=>k({emoji:e.target.value}),t[79]=k,t[80]=Le);let Re;t[81]!==n.personaEmojiPlaceholder||t[82]!==B.emoji||t[83]!==Le?(Re=(0,Q.jsx)(`input`,{className:K,value:B.emoji,onChange:Le,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[81]=n.personaEmojiPlaceholder,t[82]=B.emoji,t[83]=Le,t[84]=Re):Re=t[84];let ze;t[85]!==Ie||t[86]!==Re?(ze=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Ie,Re]}),t[85]=Ie,t[86]=Re,t[87]=ze):ze=t[87];let X;t[88]===n.agentDescription?X=t[89]:(X=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[88]=n.agentDescription,t[89]=X);let Be;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Be=i(K,`min-h-16 resize-y text-sm leading-relaxed`),t[90]=Be):Be=t[90];let Ve;t[91]!==f||t[92]!==k?(Ve=e=>{f(e.target.value),k({description:e.target.value})},t[91]=f,t[92]=k,t[93]=Ve):Ve=t[93];let He;t[94]!==n.agentDescriptionPlaceholder||t[95]!==d||t[96]!==Ve?(He=(0,Q.jsx)(`textarea`,{className:Be,value:d,onChange:Ve,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[94]=n.agentDescriptionPlaceholder,t[95]=d,t[96]=Ve,t[97]=He):He=t[97];let Ue;t[98]!==X||t[99]!==He?(Ue=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[X,He]}),t[98]=X,t[99]=He,t[100]=Ue):Ue=t[100];let We;t[101]===n.personaCreature?We=t[102]:(We=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[101]=n.personaCreature,t[102]=We);let Ge;t[103]===B.creature?Ge=t[104]:(Ge=Me.some(e=>e.value===B.creature)?B.creature:`__custom__`,t[103]=B.creature,t[104]=Ge);let Ke;t[105]===k?Ke=t[106]:(Ke=e=>{if(e.target.value===`__custom__`){k({creature:``});return}k({creature:e.target.value})},t[105]=k,t[106]=Ke);let Je;t[107]===q?Je=t[108]:(Je=Me.map(e=>(0,Q.jsx)(qe,{value:e.value,children:q(e.labelEn,e.labelZh)},e.value)),t[107]=q,t[108]=Je);let Ye;t[109]===q?Ye=t[110]:(Ye=q(`Custom…`,`自定义…`),t[109]=q,t[110]=Ye);let Ze;t[111]===Ye?Ze=t[112]:(Ze=(0,Q.jsx)(qe,{value:`__custom__`,children:Ye}),t[111]=Ye,t[112]=Ze);let Qe;t[113]!==Ge||t[114]!==Ke||t[115]!==Je||t[116]!==Ze?(Qe=(0,Q.jsxs)(Ne,{className:K,value:Ge,onChange:Ke,children:[Je,Ze]}),t[113]=Ge,t[114]=Ke,t[115]=Je,t[116]=Ze,t[117]=Qe):Qe=t[117];let et;t[118]!==n.personaCreaturePlaceholder||t[119]!==B.creature||t[120]!==k?(et=Me.some(e=>e.value===B.creature)?null:(0,Q.jsx)(`input`,{className:i(K,`mt-1 text-xs`),value:B.creature,onChange:e=>k({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[118]=n.personaCreaturePlaceholder,t[119]=B.creature,t[120]=k,t[121]=et):et=t[121];let tt;t[122]!==We||t[123]!==Qe||t[124]!==et?(tt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[We,Qe,et]}),t[122]=We,t[123]=Qe,t[124]=et,t[125]=tt):tt=t[125];let nt;t[126]!==Fe||t[127]!==ze||t[128]!==Ue||t[129]!==tt?(nt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[Fe,ze,Ue,tt]}),t[126]=Fe,t[127]=ze,t[128]=Ue,t[129]=tt,t[130]=nt):nt=t[130];let rt;t[131]!==ke||t[132]!==nt||t[133]!==me?(rt=(0,Q.jsxs)(gt,{children:[me,ke,nt]}),t[131]=ke,t[132]=nt,t[133]=me,t[134]=rt):rt=t[134];let it;t[135]!==n.editAgent||t[136]!==n.editAgentHint?(it=(0,Q.jsx)(ht,{icon:_,title:n.editAgent,subtitle:n.editAgentHint}),t[135]=n.editAgent,t[136]=n.editAgentHint,t[137]=it):it=t[137];let at;t[138]===n.modelPrimary?at=t[139]:(at=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[138]=n.modelPrimary,t[139]=at);let ot;t[140]===v?ot=t[141]:(ot=e=>v(e),t[140]=v,t[141]=ot);let st;t[142]!==c||t[143]!==r.modelNoMatches||t[144]!==r.modelPlaceholder||t[145]!==r.modelSearchPlaceholder||t[146]!==g||t[147]!==ot?(st=(0,Q.jsx)(we,{className:`min-w-0 flex-1`,value:g,disabled:c,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:ot}),t[142]=c,t[143]=r.modelNoMatches,t[144]=r.modelPlaceholder,t[145]=r.modelSearchPlaceholder,t[146]=g,t[147]=ot,t[148]=st):st=t[148];let ut;t[149]!==n.modelClear||t[150]!==c||t[151]!==g||t[152]!==v?(ut=g.trim()?(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:c,onClick:()=>v(``),children:n.modelClear}):null,t[149]=n.modelClear,t[150]=c,t[151]=g,t[152]=v,t[153]=ut):ut=t[153];let dt;t[154]!==st||t[155]!==ut?(dt=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[st,ut]}),t[154]=st,t[155]=ut,t[156]=dt):dt=t[156];let ft;t[157]!==at||t[158]!==dt?(ft=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[at,dt]}),t[157]=at,t[158]=dt,t[159]=ft):ft=t[159];let _t;t[160]===n.workspacePath?_t=t[161]:(_t=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[160]=n.workspacePath,t[161]=_t);let vt=r.workingDirectory,yt=r.workingDirectory.notSet,bt;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(bt=i(K,`font-mono text-xs`),t[162]=bt):bt=t[162];let xt;t[163]!==c||t[164]!==r.workingDirectory||t[165]!==p||t[166]!==h?(xt=(0,Q.jsx)(hn,{value:p,onChange:h,disabled:c,wd:vt,placeholder:yt,inputClassName:bt}),t[163]=c,t[164]=r.workingDirectory,t[165]=p,t[166]=h,t[167]=xt):xt=t[167];let St;t[168]!==_t||t[169]!==xt?(St=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[_t,xt]}),t[168]=_t,t[169]=xt,t[170]=St):St=t[170];let Ct;t[171]!==ft||t[172]!==St?(Ct=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[ft,St]}),t[171]=ft,t[172]=St,t[173]=Ct):Ct=t[173];let wt;t[174]!==n.save||t[175]!==n.tryInChat||t[176]!==c||t[177]!==w||t[178]!==C||t[179]!==I?(wt=w?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(z,{type:`button`,disabled:c,onClick:()=>void C(),children:n.save}),I?(0,Q.jsxs)(z,{type:`button`,variant:`secondary`,disabled:c,onClick:I,children:[(0,Q.jsx)(pt,{className:`mr-1.5 size-4`,"aria-hidden":!0}),n.tryInChat]}):null]}),t[174]=n.save,t[175]=n.tryInChat,t[176]=c,t[177]=w,t[178]=C,t[179]=I,t[180]=wt):wt=t[180];let Et;t[181]!==it||t[182]!==Ct||t[183]!==wt?(Et=(0,Q.jsxs)(gt,{children:[it,Ct,wt]}),t[181]=it,t[182]=Ct,t[183]=wt,t[184]=Et):Et=t[184];let Dt;t[185]!==n.loading||t[186]!==n.personaSectionSoul||t[187]!==n.personaSectionSoulHint||t[188]!==n.personaSoulCustomEdit||t[189]!==n.personaSoulEdit||t[190]!==n.personaSoulPreview||t[191]!==n.personaSoulTemplate||t[192]!==j||t[193]!==A||t[194]!==ee||t[195]!==q||t[196]!==E||t[197]!==V||t[198]!==ie||t[199]!==U||t[200]!==ne||t[201]!==F?(Dt=E?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.loading}):(0,Q.jsxs)(gt,{children:[(0,Q.jsx)(ht,{icon:re,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:ye.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`,W.pressCard,ne===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>A(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:q(e.labelEn,e.labelZh)})]},e.id))})]}),ne===`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(ct,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:U?n.personaSoulEdit:n.personaSoulPreview,"aria-label":U?n.personaSoulEdit:n.personaSoulPreview,onClick:F,children:U?(0,Q.jsx)(te,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(lt,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:i(K,`flex min-h-64 flex-col overflow-hidden p-0`),children:U?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(H,{content:V})}):(0,Q.jsx)(mt,{initialContent:V,onChange:j,isDark:ee,className:`min-h-0 flex-1`},`soul-${ie}`)})]}):null]}),t[185]=n.loading,t[186]=n.personaSectionSoul,t[187]=n.personaSectionSoulHint,t[188]=n.personaSoulCustomEdit,t[189]=n.personaSoulEdit,t[190]=n.personaSoulPreview,t[191]=n.personaSoulTemplate,t[192]=j,t[193]=A,t[194]=ee,t[195]=q,t[196]=E,t[197]=V,t[198]=ie,t[199]=U,t[200]=ne,t[201]=F,t[202]=Dt):Dt=t[202];let Ot;return t[203]!==rt||t[204]!==Et||t[205]!==Dt?(Ot=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[rt,Et,Dt]}),t[203]=rt,t[204]=Et,t[205]=Dt,t[206]=Ot):Ot=t[206],Ot}function yn(e){return e.preventDefault()}function bn(e){return e.resolved===`dark`}function xn(e){return e.language}function Sn(e){let t=(0,Z.c)(13),{label:n,value:r,badge:i,mono:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s;t[2]===i?s=t[3]:(s=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:i}),t[2]=i,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l=a?`mt-2 truncate font-mono text-xs text-fg`:`mt-2 truncate text-sm font-medium text-fg`,u;t[7]!==l||t[8]!==r?(u=(0,Q.jsx)(`p`,{className:l,children:r}),t[7]=l,t[8]=r,t[9]=u):u=t[9];let d;return t[10]!==c||t[11]!==u?(d=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function Cn(e){let t=(0,Z.c)(12),{icon:n,label:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.8,"aria-hidden":!0})}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:i}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function wn(e){let t=(0,Z.c)(121),{a:n,selected:r,defaultModel:i,defaultWorkspace:a,isTuiDefault:o,isTuiDefaultInherited:s,busy:c,onSetDefault:l,onSetTuiDefault:u,onTryInChat:d}=e,f;t[0]!==n||t[1]!==r?(f=Re(r,n),t[0]=n,t[1]=r,t[2]=f):f=t[2];let m=f,h;t[3]!==n||t[4]!==r?(h=B(r,n)||n.listNoDescription,t[3]=n,t[4]=r,t[5]=h):h=t[5];let g=h,_;t[6]!==n.listUnsetValue||t[7]!==i||t[8]!==r.model?.primary?(_=r.model?.primary?.trim()||i||n.listUnsetValue,t[6]=n.listUnsetValue,t[7]=i,t[8]=r.model?.primary,t[9]=_):_=t[9];let v=_,y;t[10]!==n.listUnsetValue||t[11]!==a||t[12]!==r.workspace?(y=r.workspace?.trim()||a||n.listUnsetValue,t[10]=n.listUnsetValue,t[11]=a,t[12]=r.workspace,t[13]=y):y=t[13];let b=y,x=r.model?.primary?.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,S=r.workspace?.trim()&&r.workspace.trim()!==a.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,C=r.tools.effectiveDisable.length,w=r.skills.effectiveAllowlist?.length,T;t[14]!==r.avatar||t[15]!==r.id?(T=(0,Q.jsx)(`div`,{className:`flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base ring-1 ring-edge-subtle/50`,children:(0,Q.jsx)(de,{agentId:r.id,avatar:r.avatar,size:56,className:`size-full`})}),t[14]=r.avatar,t[15]=r.id,t[16]=T):T=t[16];let E;t[17]===m?E=t[18]:(E=(0,Q.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:m}),t[17]=m,t[18]=E);let D;t[19]!==n.globalDefaultBadge||t[20]!==r.isDefault?(D=r.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,t[19]=n.globalDefaultBadge,t[20]=r.isDefault,t[21]=D):D=t[21];let O;t[22]!==n.tuiDefaultBadge||t[23]!==n.tuiDefaultInheritedBadge||t[24]!==o||t[25]!==s?(O=o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:s?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null,t[22]=n.tuiDefaultBadge,t[23]=n.tuiDefaultInheritedBadge,t[24]=o,t[25]=s,t[26]=O):O=t[26];let k;t[27]!==E||t[28]!==D||t[29]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[E,D,O]}),t[27]=E,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]===r.id?A=t[32]:(A=(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r.id}),t[31]=r.id,t[32]=A);let j;t[33]!==A||t[34]!==k?(j=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[33]=A,t[34]=k,t[35]=j):j=t[35];let M;t[36]!==j||t[37]!==T?(M=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[T,j]}),t[36]=j,t[37]=T,t[38]=M):M=t[38];let N;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(N=d?(0,Q.jsxs)(z,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=N):N=t[42];let P;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(P=r.isDefault?null:(0,Q.jsx)(z,{type:`button`,variant:`secondary`,disabled:c,onClick:l,children:n.setDefault}),t[43]=n.setDefault,t[44]=c,t[45]=l,t[46]=r.isDefault,t[47]=P):P=t[47];let F;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(F=o?null:(0,Q.jsx)(z,{type:`button`,variant:`secondary`,disabled:c,onClick:u,children:n.setTuiDefault}),t[48]=n.setTuiDefault,t[49]=c,t[50]=o,t[51]=u,t[52]=F):F=t[52];let I;t[53]!==N||t[54]!==P||t[55]!==F?(I=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[N,P,F]}),t[53]=N,t[54]=P,t[55]=F,t[56]=I):I=t[56];let L;t[57]!==M||t[58]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[M,I]}),t[57]=M,t[58]=I,t[59]=L):L=t[59];let ee;t[60]===g?ee=t[61]:(ee=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:g}),t[60]=g,t[61]=ee);let R;t[62]!==L||t[63]!==ee?(R=(0,Q.jsx)(gt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[L,ee]})}),t[62]=L,t[63]=ee,t[64]=R):R=t[64];let te;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(te=(0,Q.jsx)(ht,{icon:Ee,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=te):te=t[67];let ne;t[68]!==n.modelPrimary||t[69]!==x||t[70]!==v?(ne=(0,Q.jsx)(Sn,{label:n.modelPrimary,value:v,badge:x,mono:!0}),t[68]=n.modelPrimary,t[69]=x,t[70]=v,t[71]=ne):ne=t[71];let re;t[72]!==n.workspacePath||t[73]!==S||t[74]!==b?(re=(0,Q.jsx)(Sn,{label:n.workspacePath,value:b,badge:S,mono:!0}),t[72]=n.workspacePath,t[73]=S,t[74]=b,t[75]=re):re=t[75];let V;t[76]!==ne||t[77]!==re?(V=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ne,re]}),t[76]=ne,t[77]=re,t[78]=V):V=t[78];let H;t[79]!==te||t[80]!==V?(H=(0,Q.jsxs)(gt,{children:[te,V]}),t[79]=te,t[80]=V,t[81]=H):H=t[81];let ie;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(ie=(0,Q.jsx)(ht,{icon:nt,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=ie):ie=t[84];let U;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==C?(U=C>0?n.listToolsDisabledCount.replace(`{{count}}`,String(C)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=C,t[88]=U):U=t[88];let W;t[89]!==n.listToolsLabel||t[90]!==U?(W=(0,Q.jsx)(Cn,{icon:Pe,label:n.listToolsLabel,value:U}),t[89]=n.listToolsLabel,t[90]=U,t[91]=W):W=t[91];let G;t[92]!==n.listInheritedValue||t[93]!==n.listSkillsCount||t[94]!==w?(G=w?n.listSkillsCount.replace(`{{count}}`,String(w)):n.listInheritedValue,t[92]=n.listInheritedValue,t[93]=n.listSkillsCount,t[94]=w,t[95]=G):G=t[95];let K;t[96]!==n.listSkillsLabel||t[97]!==G?(K=(0,Q.jsx)(Cn,{icon:Ee,label:n.listSkillsLabel,value:G}),t[96]=n.listSkillsLabel,t[97]=G,t[98]=K):K=t[98];let oe;t[99]!==n.memoryTitle||t[100]!==n.overviewMemoryManaged?(oe=(0,Q.jsx)(Cn,{icon:p,label:n.memoryTitle,value:n.overviewMemoryManaged}),t[99]=n.memoryTitle,t[100]=n.overviewMemoryManaged,t[101]=oe):oe=t[101];let se;t[102]!==n.connectionsTitle||t[103]!==n.overviewConnectionsManaged?(se=(0,Q.jsx)(Cn,{icon:ae,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[102]=n.connectionsTitle,t[103]=n.overviewConnectionsManaged,t[104]=se):se=t[104];let q;t[105]!==n.listWorkspaceLabel||t[106]!==b?(q=(0,Q.jsx)(Cn,{icon:je,label:n.listWorkspaceLabel,value:b}),t[105]=n.listWorkspaceLabel,t[106]=b,t[107]=q):q=t[107];let J;t[108]!==W||t[109]!==K||t[110]!==oe||t[111]!==se||t[112]!==q?(J=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[W,K,oe,se,q]}),t[108]=W,t[109]=K,t[110]=oe,t[111]=se,t[112]=q,t[113]=J):J=t[113];let ce;t[114]!==ie||t[115]!==J?(ce=(0,Q.jsxs)(gt,{children:[ie,J]}),t[114]=ie,t[115]=J,t[116]=ce):ce=t[116];let le;return t[117]!==R||t[118]!==H||t[119]!==ce?(le=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[R,H,ce]}),t[117]=R,t[118]=H,t[119]=ce,t[120]=le):le=t[120],le}function Tn(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(En)):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)(ht,{className:`shrink-0`,icon:Qe,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)(z,{type:`button`,variant:`secondary`,disabled:a,onClick:y,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=a,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==_||t[15]!==l||t[16]!==d?(x=()=>{l(!1),d(_())},t[14]=_,t[15]=l,t[16]=d,t[17]=x):x=t[17];let S;t[18]!==n.skillsCustomize||t[19]!==a||t[20]!==x?(S=(0,Q.jsx)(z,{type:`button`,variant:`secondary`,disabled:a,onClick:x,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=a,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==b||t[23]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b,S]}),t[22]=b,t[23]=S,t[24]=C):C=t[24];let w;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(w=Te(`skills`),t[25]=w):w=t[25];let T;t[26]===n.skillsLibraryLink?T=t[27]:(T=(0,Q.jsx)(He,{to:w,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=T);let E;t[28]!==C||t[29]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[C,T]}),t[28]=C,t[29]=T,t[30]=E):E=t[30];let D;t[31]===r.skills.preset?D=t[32]:(D=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=D);let O;t[33]!==n.skillsPresetLabel||t[34]!==D?(O=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,D]}),t[33]=n.skillsPresetLabel,t[34]=D,t[35]=O):O=t[35];let k;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==c?(k=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]=k):k=t[39];let A;t[40]!==n.skillsEffectiveLabel||t[41]!==k?(A=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,k]}),t[40]=n.skillsEffectiveLabel,t[41]=k,t[42]=A):A=t[42];let j;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?(j=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]=j):j=t[53];let M;t[54]!==n.skillsSave||t[55]!==a||t[56]!==p||t[57]!==f?(M=p?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(z,{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]=M):M=t[58];let N;return t[59]!==E||t[60]!==O||t[61]!==A||t[62]!==j||t[63]!==M||t[64]!==v?(N=(0,Q.jsxs)(gt,{className:`flex min-h-0 flex-1 flex-col`,children:[v,E,O,A,j,M]}),t[59]=E,t[60]=O,t[61]=A,t[62]=j,t[63]=M,t[64]=v,t[65]=N):N=t[65],N}function En(e){return e.name||e.directoryId}var Dn=[`write_file`,`edit_file`,`shell`],On=[`shell`,`image_generate`,`extensions`],kn=[`send_message`,`send_media`];function An(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=Mt(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(Mn),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 jt){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(jn),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,L;t[35]!==E||t[36]!==f.quickEnableAll||t[37]!==I?(L=(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:kt,disabled:I,onClick:E,children:f.quickEnableAll}),t[35]=E,t[36]=f.quickEnableAll,t[37]=I,t[38]=L):L=t[38];let ee=P||r.length===0&&h.length===0,R;t[39]!==O||t[40]!==f.quickDisableAll||t[41]!==ee?(R=(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:kt,disabled:ee,onClick:O,children:f.quickDisableAll}),t[39]=O,t[40]=f.quickDisableAll,t[41]=ee,t[42]=R):R=t[42];let B=P||r.length===0,te;t[43]===w?te=t[44]:(te=()=>w(Dn),t[43]=w,t[44]=te);let ne;t[45]!==f.quickReadOnlyWorkspace||t[46]!==B||t[47]!==te?(ne=(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:kt,disabled:B,onClick:te,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=B,t[47]=te,t[48]=ne):ne=t[48];let re=P||r.length===0,V;t[49]===w?V=t[50]:(V=()=>w(On),t[49]=w,t[50]=V);let H;t[51]!==f.quickHighRiskOff||t[52]!==re||t[53]!==V?(H=(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:kt,disabled:re,onClick:V,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=re,t[53]=V,t[54]=H):H=t[54];let ie=P||r.length===0,U;t[55]===w?U=t[56]:(U=()=>w(kn),t[55]=w,t[56]=U);let ae;t[57]!==f.quickNoOutbound||t[58]!==ie||t[59]!==U?(ae=(0,Q.jsx)(z,{type:`button`,variant:`secondary`,className:kt,disabled:ie,onClick:U,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=ie,t[59]=U,t[60]=ae):ae=t[60];let W;t[61]!==L||t[62]!==R||t[63]!==ne||t[64]!==H||t[65]!==ae?(W=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[L,R,ne,H,ae]}),t[61]=L,t[62]=R,t[63]=ne,t[64]=H,t[65]=ae,t[66]=W):W=t[66];let G;t[67]!==F||t[68]!==W?(G=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[F,W]}),t[67]=F,t[68]=W,t[69]=G):G=t[69];let K;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?(K=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]=K):K=t[84];let oe;return t[85]!==G||t[86]!==K?(oe=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[G,K]}),t[85]=G,t[86]=K,t[87]=oe):oe=t[87],oe}function jn(e){return e.ids.length>0}function Mn(e,t){return e.localeCompare(t)}function Nn(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(Fn),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(Pn)),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)(ht,{className:`shrink-0`,icon:Pe,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)(An,{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)(z,{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)(z,{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)(gt,{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 Pn(e){let t=String(e).trim();return t?[t]:[]}function Fn(e){return e.language}function In(e){let t=(0,Z.c)(128),{a:n,chat:r,cCron:i,selected:a,panel:o,data:s,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,defaultModel:_,defaultWorkspace:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,onDelete:w,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O,overviewProfile:k,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:L,fileSaving:ee,profileFileLoading:R,profileEditorNonce:z,toolEntryDisable:B,setToolEntryDisable:te,onSaveTools:ne,onClearToolsEntry:re,modelRows:V,setModelRows:H,onSaveModels:ie,onClearModelsEntry:U,skillsCatalogLoading:ae,catalogForPick:W,skillsInherit:G,setSkillsInherit:K,skillsPick:oe,setSkillsPick:se,onSaveSkills:q,bindingsLoading:J,agentBindings:ce,bindChannelStatuses:le,bindChannelsLoading:ue,useManualChannel:de,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,bindSessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:_e,newBindCustomPeer:ve,setNewBindCustomPeer:ye,refreshBindSessions:be,onRemoveBinding:Y,onAddBinding:xe,onTryInChat: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;return t[2]!==n||t[3]!==c||t[4]!==_||t[5]!==v||t[6]!==x||t[7]!==S||t[8]!==y||t[9]!==b||t[10]!==Se||t[11]!==a?(e=(0,Q.jsx)(wn,{a:n,selected:a,defaultModel:_,defaultWorkspace:v,isTuiDefault:x,isTuiDefaultInherited:S,busy:c,onSetDefault:y,onSetTuiDefault:b,onTryInChat:Se}),t[2]=n,t[3]=c,t[4]=_,t[5]=v,t[6]=x,t[7]=S,t[8]=y,t[9]=b,t[10]=Se,t[11]=a,t[12]=e):e=t[12],e}if(o===`behavior`){let e;t[13]!==n||t[14]!==c||t[15]!==r||t[16]!==d||t[17]!==h||t[18]!==l||t[19]!==p||t[20]!==x||t[21]!==S||t[22]!==C||t[23]!==y||t[24]!==b||t[25]!==Se||t[26]!==k.draft||t[27]!==k.handleSoulContentChange||t[28]!==k.handleSoulTemplateChange||t[29]!==k.profileMarkdownLoading||t[30]!==k.setAvatarDialogOpen||t[31]!==k.toggleSoulPreviewMode||t[32]!==k.updateIdentity||t[33]!==a||t[34]!==f||t[35]!==g||t[36]!==u||t[37]!==m?(e=(0,Q.jsx)(vn,{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:!0,profileMarkdownLoading:k.profileMarkdownLoading,profileDraft:k.draft,updateIdentity:k.updateIdentity,handleSoulTemplateChange:k.handleSoulTemplateChange,handleSoulContentChange:k.handleSoulContentChange,setAvatarDialogOpen:k.setAvatarDialogOpen,toggleSoulPreviewMode:k.toggleSoulPreviewMode,onTryInChat:Se}),t[13]=n,t[14]=c,t[15]=r,t[16]=d,t[17]=h,t[18]=l,t[19]=p,t[20]=x,t[21]=S,t[22]=C,t[23]=y,t[24]=b,t[25]=Se,t[26]=k.draft,t[27]=k.handleSoulContentChange,t[28]=k.handleSoulTemplateChange,t[29]=k.profileMarkdownLoading,t[30]=k.setAvatarDialogOpen,t[31]=k.toggleSoulPreviewMode,t[32]=k.updateIdentity,t[33]=a,t[34]=f,t[35]=g,t[36]=u,t[37]=m,t[38]=e):e=t[38];let i;t[39]!==n||t[40]!==c||t[41]!==r||t[42]!==V||t[43]!==U||t[44]!==ie||t[45]!==a||t[46]!==H?(i=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(mn,{a:n,chat:r,selected:a,busy:c,modelRows:V,setModelRows:H,onSaveModels:ie,onClearModelsEntry:U})}),t[39]=n,t[40]=c,t[41]=r,t[42]=V,t[43]=U,t[44]=ie,t[45]=a,t[46]=H,t[47]=i):i=t[47];let o;t[48]!==n||t[49]!==M||t[50]!==I||t[51]!==ee||t[52]!==j||t[53]!==A||t[54]!==P||t[55]!==Se||t[56]!==z||t[57]!==R||t[58]!==N||t[59]!==L||t[60]!==F?(o=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(fn,{a:n,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:L,fileSaving:ee,profileFileLoading:R,profileEditorNonce:z,onTryInChat:Se})}),t[48]=n,t[49]=M,t[50]=I,t[51]=ee,t[52]=j,t[53]=A,t[54]=P,t[55]=Se,t[56]=z,t[57]=R,t[58]=N,t[59]=L,t[60]=F,t[61]=o):o=t[61];let s;return t[62]!==e||t[63]!==i||t[64]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[e,i,o]}),t[62]=e,t[63]=i,t[64]=o,t[65]=s):s=t[65],s}if(o===`tools`){let e;return t[66]!==n||t[67]!==c||t[68]!==s||t[69]!==re||t[70]!==ne||t[71]!==a||t[72]!==te||t[73]!==B?(e=(0,Q.jsx)(Nn,{a:n,data:s,selected:a,busy:c,toolEntryDisable:B,setToolEntryDisable:te,onSaveTools:ne,onClearToolsEntry:re}),t[66]=n,t[67]=c,t[68]=s,t[69]=re,t[70]=ne,t[71]=a,t[72]=te,t[73]=B,t[74]=e):e=t[74],e}if(o===`skills`){let e;return t[75]!==n||t[76]!==c||t[77]!==W||t[78]!==q||t[79]!==a||t[80]!==K||t[81]!==se||t[82]!==ae||t[83]!==G||t[84]!==oe?(e=(0,Q.jsx)(Tn,{a:n,selected:a,busy:c,skillsCatalogLoading:ae,catalogForPick:W,skillsInherit:G,setSkillsInherit:K,skillsPick:oe,setSkillsPick:se,onSaveSkills:q}),t[75]=n,t[76]=c,t[77]=W,t[78]=q,t[79]=a,t[80]=K,t[81]=se,t[82]=ae,t[83]=G,t[84]=oe,t[85]=e):e=t[85],e}if(o===`memory`){let e;return t[86]===a.id?e=t[87]:(e=(0,Q.jsx)(Wt,{embedded:!0,agentId:a.id}),t[86]=a.id,t[87]=e),e}if(o===`connections`){let e;return t[88]!==n||t[89]!==ce||t[90]!==le||t[91]!==ue||t[92]!==me||t[93]!==he||t[94]!==J||t[95]!==c||t[96]!==i.lastActiveLabels||t[97]!==i.selectRecipient||t[98]!==fe||t[99]!==ve||t[100]!==ge||t[101]!==xe||t[102]!==Y||t[103]!==be||t[104]!==pe||t[105]!==ye||t[106]!==_e||t[107]!==de?(e=(0,Q.jsx)(dn,{a:n,busy:c,bindingsLoading:J,agentBindings:ce,channelStatuses:le,channelsStatusLoading:ue,useManualChannel:de,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,sessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:_e,newBindCustomPeer:ve,setNewBindCustomPeer:ye,onRefreshSessions:be,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:Y,onAddBinding:xe}),t[88]=n,t[89]=ce,t[90]=le,t[91]=ue,t[92]=me,t[93]=he,t[94]=J,t[95]=c,t[96]=i.lastActiveLabels,t[97]=i.selectRecipient,t[98]=fe,t[99]=ve,t[100]=ge,t[101]=xe,t[102]=Y,t[103]=be,t[104]=pe,t[105]=ye,t[106]=_e,t[107]=de,t[108]=e):e=t[108],e}if(o===`config`){let e;return t[109]!==n||t[110]!==c||t[111]!==T||t[112]!==_||t[113]!==E||t[114]!==v||t[115]!==h||t[116]!==p||t[117]!==O||t[118]!==D||t[119]!==a?(e=(0,Q.jsx)(nn,{a:n,selected:a,busy:c,defaultModel:_,defaultWorkspace:v,agentModel:h,agentWorkspace:p,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O}),t[109]=n,t[110]=c,t[111]=T,t[112]=_,t[113]=E,t[114]=v,t[115]=h,t[116]=p,t[117]=O,t[118]=D,t[119]=a,t[120]=e):e=t[120],e}if(o===`dangerZone`){let e;return t[121]!==n||t[122]!==c||t[123]!==w||t[124]!==a?(e=(0,Q.jsx)(ln,{a:n,selected:a,busy:c,onDelete:w}),t[121]=n,t[122]=c,t[123]=w,t[124]=a,t[125]=e):e=t[125],e}let Ce;return t[126]===n.selectAgentHint?Ce=t[127]:(Ce=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[126]=n.selectAgentHint,t[127]=Ce),Ce}function Ln(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=Re(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=B(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function Rn(e,t){return e.replace(`{{count}}`,String(t))}function zn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Rn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Rn(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function Bn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Rn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Rn(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function Vn(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)(g,{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`,X),t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(oe,{className:`fill-surface-panel`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(x,{children:(0,Q.jsxs)(C,{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)(ne,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(ze,{children:[o,l]})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}function Hn(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:a,tuiDefaultAgentId:o,tuiDefaultInherited:s,searchQuery:c,onOpenAgent:l,onChatWithAgent:u,busy:d}=e,f,p,m,h,g;if(t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==a||t[4]!==u||t[5]!==l||t[6]!==c||t[7]!==o||t[8]!==s){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Ln(r,c,n),_=r.length>0&&e.length===0&&c.trim().length>0;if(r.length===0){let e;t[14]===n.listNoAgentsYet?e=t[15]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listNoAgentsYet}),t[14]=n.listNoAgentsYet,t[15]=e),g=e;break bb0}m=`flex flex-col gap-4`,t[16]!==n||t[17]!==_?(h=_?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listEmpty}):null,t[16]=n,t[17]=_,t[18]=h):h=t[18],f=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let v;t[19]!==n||t[20]!==d||t[21]!==a||t[22]!==u||t[23]!==l||t[24]!==o||t[25]!==s?(v=e=>{let t=Re(e,n),r=e.id,c=B(e,n),f=zn(e,n),p=Bn(e,n),m=e.id===a||e.isDefault,h=e.id===o,g=h&&s,_=h&&!s;return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{role:`button`,tabIndex:d?-1:0,"aria-disabled":d,"aria-label":`${t} ${r}`,onClick:()=>{d||l(e.id)},onKeyDown:t=>{d||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.id))},className:i(`flex min-h-[15.5rem] cursor-pointer flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 shadow-surface`,`transition-[border-color,transform,box-shadow] duration-150 ease-out`,`hover:border-edge-strong`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60`,W.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)(de,{agentId:e.id,avatar:e.avatar,size:48,className:`size-full`})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,title:r,children:r})]})]}),(0,Q.jsxs)(`div`,{className:`flex max-w-[9rem] shrink-0 flex-wrap justify-end gap-1.5`,children:[m?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,_?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultBadge}):null,g?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultInheritedBadge}):null,!m&&!h?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:n.listCustomBadge}):null]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 min-h-[6.25rem] text-left`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base px-3 py-3`,children:(0,Q.jsx)(`p`,{className:i(`line-clamp-2 text-sm leading-5`,c?`text-fg`:`text-fg-muted`),title:c||void 0,children:c||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:f,children:p.map(Un)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(z,{type:`button`,variant:`secondary`,disabled:d,onClick:t=>{t.stopPropagation(),u(e.id)},className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(pt,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=d,t[21]=a,t[22]=u,t[23]=l,t[24]=o,t[25]=s,t[26]=v):v=t[26],p=e.map(v)}t[0]=n,t[1]=r,t[2]=d,t[3]=a,t[4]=u,t[5]=l,t[6]=c,t[7]=o,t[8]=s,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[27]!==f||t[28]!==p?(_=(0,Q.jsx)(`ul`,{className:f,children:p}),t[27]=f,t[28]=p,t[29]=_):_=t[29];let v;return t[30]!==m||t[31]!==h||t[32]!==_?(v=(0,Q.jsxs)(`div`,{className:m,children:[h,_]}),t[30]=m,t[31]=h,t[32]=_,t[33]=v):v=t[33],v}function Un(e){return(0,Q.jsx)(Vn,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Wn(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:E}=e,D;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(T,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,xe)}),t[0]=D):D=t[0];let k;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(k=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`,$e,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=k):k=t[1];let j;t[2]===a.addAgent?j=t[3]:(j=(0,Q.jsx)(M,{className:`text-base font-semibold text-fg`,children:a.addAgent}),t[2]=a.addAgent,t[3]=j);let N;t[4]===a.addAgentHint?N=t[5]:(N=(0,Q.jsx)(le,{className:`mt-0.5 text-xs text-fg-muted`,children:a.addAgentHint}),t[4]=a.addAgentHint,t[5]=N);let F;t[6]!==j||t[7]!==N?(F=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[j,N]}),t[6]=j,t[7]=N,t[8]=F):F=t[8];let I;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(I=i(ct,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=I):I=t[9];let L;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t[10]=L):L=t[10];let ee;t[11]===a.closeDialogAria?ee=t[12]:(ee=(0,Q.jsx)(O,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:I,"aria-label":a.closeDialogAria,children:L})}),t[11]=a.closeDialogAria,t[12]=ee);let R;t[13]!==F||t[14]!==ee?(R=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[F,ee]}),t[13]=F,t[14]=ee,t[15]=R):R=t[15];let B;t[16]!==a||t[17]!==C||t[18]!==w||t[19]!==E?(B=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)(Ne,{className:i(Tt(),`bg-surface-panel`),value:w??``,onChange:e=>E(e.target.value||null),children:[(0,Q.jsx)(qe,{value:``,children:a.copyFromExistingAgentNone}),C.map(e=>(0,Q.jsxs)(qe,{value:e.id,children:[Re(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]=E,t[20]=B):B=t[20];let te;t[21]===c?te=t[22]:(te=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]=te);let ne;t[23]!==a.newAgentLabel||t[24]!==l?(ne=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.newAgentLabel,` (`,l,`)`]}),t[23]=a.newAgentLabel,t[24]=l,t[25]=ne):ne=t[25];let re;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(re=Tt(),t[26]=re):re=t[26];let V;t[27]===d?V=t[28]:(V=e=>d(e.target.value),t[27]=d,t[28]=V);let H;t[29]===S?H=t[30]:(H=()=>S(),t[29]=S,t[30]=H);let ie;t[31]!==u||t[32]!==V||t[33]!==H?(ie=(0,Q.jsx)(`input`,{className:re,value:u,onChange:V,onBlur:H,required:!0,autoComplete:`off`}),t[31]=u,t[32]=V,t[33]=H,t[34]=ie):ie=t[34];let U;t[35]!==ne||t[36]!==ie?(U=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ne,ie]}),t[35]=ne,t[36]=ie,t[37]=U):U=t[37];let ae;t[38]===a.newAgentIdOptional?ae=t[39]:(ae=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newAgentIdOptional}),t[38]=a.newAgentIdOptional,t[39]=ae);let W;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(W=i(Tt(),`font-mono text-xs`),t[40]=W):W=t[40];let G;t[41]===p?G=t[42]:(G=e=>p(e.target.value),t[41]=p,t[42]=G);let K;t[43]===S?K=t[44]:(K=()=>S(),t[43]=S,t[44]=K);let oe;t[45]!==a.newAgentIdPlaceholder||t[46]!==a.newAgentIdRules||t[47]!==f||t[48]!==G||t[49]!==K?(oe=(0,Q.jsx)(`input`,{className:W,value:f,onChange:G,onBlur:K,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]=G,t[49]=K,t[50]=oe):oe=t[50];let q;t[51]===a.newAgentIdRules?q=t[52]:(q=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.newAgentIdRules}),t[51]=a.newAgentIdRules,t[52]=q);let J;t[53]!==ae||t[54]!==oe||t[55]!==q?(J=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ae,oe,q]}),t[53]=ae,t[54]=oe,t[55]=q,t[56]=J):J=t[56];let ce;t[57]!==a.agentDescription||t[58]!==l?(ce=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.agentDescription,` (`,l,`)`]}),t[57]=a.agentDescription,t[58]=l,t[59]=ce):ce=t[59];let ue;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ue=i(Tt(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[60]=ue):ue=t[60];let de;t[61]===g?de=t[62]:(de=e=>g(e.target.value),t[61]=g,t[62]=de);let fe;t[63]!==a.agentDescriptionPlaceholder||t[64]!==h||t[65]!==de?(fe=(0,Q.jsx)(`textarea`,{className:ue,value:h,onChange:de,placeholder:a.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[63]=a.agentDescriptionPlaceholder,t[64]=h,t[65]=de,t[66]=fe):fe=t[66];let pe;t[67]!==ce||t[68]!==fe?(pe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ce,fe]}),t[67]=ce,t[68]=fe,t[69]=pe):pe=t[69];let me;t[70]===a.newWorkspace?me=t[71]:(me=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newWorkspace}),t[70]=a.newWorkspace,t[71]=me);let he;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(he=i(Tt(),`font-mono text-xs`),t[72]=he):he=t[72];let ge;t[73]===v?ge=t[74]:(ge=e=>v(e.target.value),t[73]=v,t[74]=ge);let _e;t[75]!==_||t[76]!==ge?(_e=(0,Q.jsx)(`input`,{className:he,value:_,onChange:ge,required:!0,autoComplete:`off`}),t[75]=_,t[76]=ge,t[77]=_e):_e=t[77];let ve;t[78]!==me||t[79]!==_e?(ve=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[me,_e]}),t[78]=me,t[79]=_e,t[80]=ve):ve=t[80];let ye;t[81]===a.newModelOptional?ye=t[82]:(ye=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newModelOptional}),t[81]=a.newModelOptional,t[82]=ye);let be;t[83]===b?be=t[84]:(be=e=>b(e),t[83]=b,t[84]=be);let Y;t[85]!==s||t[86]!==o.modelNoMatches||t[87]!==o.modelPlaceholder||t[88]!==o.modelSearchPlaceholder||t[89]!==y||t[90]!==be?(Y=(0,Q.jsx)(we,{className:`min-w-0 flex-1`,value:y,disabled:s,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,onChange:be}),t[85]=s,t[86]=o.modelNoMatches,t[87]=o.modelPlaceholder,t[88]=o.modelSearchPlaceholder,t[89]=y,t[90]=be,t[91]=Y):Y=t[91];let Se;t[92]!==a.modelClear||t[93]!==s||t[94]!==y||t[95]!==b?(Se=y.trim()?(0,Q.jsx)(z,{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]=Se):Se=t[96];let Ce;t[97]!==Y||t[98]!==Se?(Ce=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[Y,Se]}),t[97]=Y,t[98]=Se,t[99]=Ce):Ce=t[99];let Te;t[100]!==ye||t[101]!==Ce?(Te=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[ye,Ce]}),t[100]=ye,t[101]=Ce,t[102]=Te):Te=t[102];let Ee;t[103]!==a.createModalCancel||t[104]!==s?(Ee=(0,Q.jsx)(O,{asChild:!0,children:(0,Q.jsx)(z,{type:`button`,variant:`secondary`,disabled:s,children:a.createModalCancel})}),t[103]=a.createModalCancel,t[104]=s,t[105]=Ee):Ee=t[105];let De;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Q.jsx)(A,{className:`mr-1 size-4`,"aria-hidden":!0}),t[106]=De):De=t[106];let Oe;t[107]!==a.create||t[108]!==s?(Oe=(0,Q.jsxs)(z,{type:`submit`,disabled:s,children:[De,a.create]}),t[107]=a.create,t[108]=s,t[109]=Oe):Oe=t[109];let ke;t[110]!==Ee||t[111]!==Oe?(ke=(0,Q.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Ee,Oe]}),t[110]=Ee,t[111]=Oe,t[112]=ke):ke=t[112];let Ae;t[113]!==x||t[114]!==te||t[115]!==U||t[116]!==J||t[117]!==pe||t[118]!==ve||t[119]!==Te||t[120]!==ke||t[121]!==B?(Ae=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:x,children:[B,te,U,J,pe,ve,Te,ke]}),t[113]=x,t[114]=te,t[115]=U,t[116]=J,t[117]=pe,t[118]=ve,t[119]=Te,t[120]=ke,t[121]=B,t[122]=Ae):Ae=t[122];let je;t[123]!==Ae||t[124]!==R?(je=(0,Q.jsxs)(P,{children:[D,(0,Q.jsx)(se,{className:k,onOpenAutoFocus:Gn,children:(0,Q.jsxs)(Ye,{layer:`modal`,children:[R,Ae]})})]}),t[123]=Ae,t[124]=R,t[125]=je):je=t[125];let Me;return t[126]!==r||t[127]!==n||t[128]!==je?(Me=(0,Q.jsx)(Xe,{open:n,onOpenChange:r,children:je}),t[126]=r,t[127]=n,t[128]=je,t[129]=Me):Me=t[129],Me}function Gn(e){return e.preventDefault()}var Kn=`~/.xopc/workspace`;function qn(e){let t=e.trim();return t?`${Kn}/${rt(t)}`:``}function Jn(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)(at,{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)(G,{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)(z,{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 Yn(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function Xn(e){let{agentId:t,enabled:n,saveRef:r}=e,i=J(async()=>{if(!t)return null;let[e,n]=await Promise.all([R(t,`IDENTITY.md`).catch(()=>``),R(t,`SOUL.md`).catch(()=>``)]),r=ut(e);return{identity:r,soulTemplate:Y(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?Yn(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?Yn(a):null);return n?e(n):null})},[a]),g=(0,$.useCallback)(e=>{h(t=>({...t,identity:{...t.identity,...e}}))},[h]),_=(0,$.useCallback)(e=>{h(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=ye.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[h]),v=(0,$.useCallback)(e=>{h(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[h]),y=(0,$.useCallback)(e=>{h(t=>({...t,avatarDialogOpen:e}))},[h]),x=(0,$.useCallback)(()=>{h(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[h]),S=(0,$.useCallback)(async()=>{let e=m.current;!e||!f||(await Promise.all([k(e,`IDENTITY.md`,b(f.identity)),k(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=S,()=>{r.current=null}},[S,r]),{profileMarkdownLoading:o,draft:f,dirty:p,updateIdentity:g,handleSoulTemplateChange:_,handleSoulContentChange:v,setAvatarDialogOpen:y,toggleSoulPreviewMode:x}}var Zn={draft:``,editorNonce:0,loadedKey:``};function Qn(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 $n(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=J(()=>n?V(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`behavior`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,f]=(0,$.useState)(null),[p,m]=(0,$.useReducer)(Qn,Zn),[h,g]=(0,$.useState)(!1),[_,v]=(0,$.useState)(`edit`),y=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==y.current&&(y.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 b=p.draft,x=p.editorNonce,S=(0,$.useRef)(b);S.current=b;let C=(0,$.useRef)(n);C.current=n;let w=(0,$.useRef)(d);w.current=d;let T=(0,$.useRef)(null),E=(0,$.useRef)(``),D=(0,$.useRef)(``),O=(0,$.useRef)(``),A=(0,$.useRef)(()=>{}),j=J(()=>d&&n?R(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),M=j.loading,N=Ie(async()=>{let e=C.current,t=w.current;if(!e||!t||`${e}:${t}`!==E.current)return;let n=S.current;if(n!==D.current){g(!0),o(null);try{await k(e,t,n),D.current=n,l(n=>!n||n.agentId!==e?n:{...n,files:n.files.map(e=>e.name===t?{...e,missing:!1}:e)})}catch(e){o(e instanceof Error?e.message:a)}finally{g(!1)}}},800);A.current=N.flush,(0,$.useEffect)(()=>()=>{A.current()},[]);let P=(0,$.useRef)(t);P.current!==t&&(P.current===`behavior`&&A.current(),P.current=t);let F=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{F!==O.current&&(A.current(),O.current=F)},[F]),(0,$.useEffect)(()=>{if(!F){m({type:`clear`});return}M||(E.current=F,D.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},v(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{A.current(),f(e)},[]),fileDraft:b,setFileDraft:(0,$.useCallback)(e=>{m({type:`setDraft`,value:typeof e==`function`?e(S.current):e}),N()},[N]),fileSaving:h,filesViewMode:_,setFilesViewMode:v,profileFileLoading:M,profileEditorNonce:x,overviewSaveProfileMarkdownRef:T,saveProfileMarkdownDebounced:N}}function er(e){let{panel:t,hasToken:n,bindingsFromConfig:r,gatewayCfgLoading:i,selected:a,saveErrorMessage:o,setBusy:s,setError:c}=e,l=(0,$.useRef)(!1),[u,d]=(0,$.useState)(null),f=(0,$.useRef)(r);t===`connections`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let p=u??r,m=t===`connections`&&n,h=J(()=>bt(),[t,n],{enabled:m,initial:[],errorData:[]}),g=h.data,_=h.loading,v=(0,$.useMemo)(()=>_||g.length===0?``:g[0]?.name??``,[g,_]),[b,x]=(0,$.useState)(``),S=(0,$.useRef)(v);t===`connections`&&!_&&v&&S.current!==v&&(!b||!g.some(e=>e.name===b))&&(S.current=v,x(v)),S.current=v;let C=b.trim(),w=m&&C.length>0,T=J(()=>xt(C),[t,n,C],{enabled:w,initial:[],errorData:[]}),E=T.data,D=T.loading,O=T.setData,[k,A]=(0,$.useState)(null),[j,M]=(0,$.useState)(``),N=(0,$.useRef)(C);N.current!==C&&(N.current=C,A(null));let P=(0,$.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),F=(0,$.useCallback)(()=>{let e=b.trim();e&&xt(e).then(e=>{O(e),A(t=>t!=null&&t<e.length?t:null)}).catch(()=>{O([]),A(null)})},[b,O]),I=!_&&g.length===0,L=t===`connections`&&n&&i,ee=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await y(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,o,s,c]);return{agentBindings:P,allBindings:p,bindChannelStatuses:g,bindChannelsLoading:_,bindSessionChats:E,bindSessionsLoading:D,bindingsLoading:L,newBindChannel:b,setNewBindChannel:x,newBindSessionIdx:k,setNewBindSessionIdx:A,newBindCustomPeer:j,setNewBindCustomPeer:M,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!b.trim())return;let t=Ct(b,j,k,E),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await y(n),l.current=!0,d(n),A(null),M(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,E,b,j,k,o,a,s,c]),onRemoveBinding:ee,refreshBindSessions:F,useManualChannel:I}}function tr(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(ir)};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}=J(rr,s,d),m;n[10]===f?m=n[11]:(m=f.filter(nr),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 nr(e){return e.enabled!==!1}function rr(){return L()}function ir(e){return e+1}function ar(e){return tr(e.panel===`skills`,e.hasToken)}function or(e){return new Set(e.tools.entryDisable)}function sr(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function cr(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(or(n)),n&&t===`skills`){let e=sr(n);u(e.inherit),c(e.pick)}n&&t===`behavior`&&f(Dt(n.typedModels.effective))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:f}}function lr(e,t){let n=e.typedModels.defaultRole;return{defaultRole:n,roles:{[n]:{model:t}}}}function ur(e){let t=Dt(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Dt(e.typedModels.effective)}function dr(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 fr(){let e=o(e=>e.language),t=a(e),n=t.agentsSettings,[r,i]=(0,$.useState)(!1),[s,l]=(0,$.useState)(null),[u,p]=(0,$.useState)(!1),[m,g]=(0,$.useState)(``),_=t.cron,v=t.chat,y=!!c(e=>e.token),[b,x]=dt(),S=ve(),{agentId:C}=st(),w=me(e=>e.setPageHeader),T=me(e=>e.clearPageHeader),{data:E,error:D,isLoading:O,mutate:k}=d(y?`settings-gateway-agents`:null,j,{revalidateOnFocus:!1}),{data:A,mutate:M}=d(y?`settings-capability-presets`:null,Nt,{revalidateOnFocus:!1}),N=ke(y),{data:P}=N,F=(0,$.useMemo)(()=>ft(P?.payload?.config??{}),[P]),I=E??null,L=(0,$.useMemo)(()=>I?I.agents.find(e=>e.id===I.defaultId)??I.agents[0]??null:null,[I]),R=!!(y&&O),[z,B]=(0,$.useState)(null),te=D instanceof Error?D.message:D?n.loadError:null,ne=z??te,[re,V]=(0,$.useState)(null),[H,ie]=(0,$.useState)(`overview`),[U,ae]=(0,$.useState)(``),[W,G]=(0,$.useState)(``),[K,oe]=(0,$.useState)(``),[se,q]=(0,$.useState)(``),[J,le]=(0,$.useState)(``),[de,fe]=(0,$.useState)(null),[pe,he]=(0,$.useState)(!1),ge=(0,$.useRef)(``),[_e,ye]=(0,$.useState)(null),[be,Y]=(0,$.useState)(!1),[xe,Ce]=(0,$.useState)(``),[we,Te]=(0,$.useState)(``),[Ee,De]=(0,$.useState)(``),[Oe,Ae]=(0,$.useState)(``),[je,Me]=(0,$.useState)(``),[Ne,Pe]=(0,$.useState)(``),Fe=(0,$.useRef)(null),[Ie,Le]=(0,$.useState)(!1),ze=(0,$.useRef)({data:null,routeAgentId:void 0});I&&(I!==ze.current.data||C!==ze.current.routeAgentId)&&(ze.current={data:I,routeAgentId:C},C&&I.agents.some(e=>e.id===C)?V(C):V(e=>e&&I.agents.some(t=>t.id===e)?e:I.defaultId)),(0,$.useEffect)(()=>{!I||!C||I.agents.some(e=>e.id===C)||S(tt,{replace:!0})},[I,C,S]),(0,$.useEffect)(()=>{C&&ie(`overview`)},[C]),(0,$.useEffect)(()=>{b.get(`panel`)===`defaults`&&S(C?Ge(C):tt,{replace:!0,state:{[We]:C?Ge(C):tt}})},[b,C,S]),(0,$.useEffect)(()=>{if(b.get(`focus`)!==`avatar`||!C||(ie(`overview`),R||!I?.agents.some(e=>e.id===C)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),x(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[b,C,R,I,x]);let X=(0,$.useMemo)(()=>I?.agents.find(e=>e.id===re)??null,[I,re]),Be=(0,$.useMemo)(()=>{let e=P?.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():``},[P]),Ve=(0,$.useMemo)(()=>!I||Be&&I.agents.some(e=>e.id===Be)?Be:I.defaultId||I.agents[0]?.id||Be,[I,Be]),He=!!(I&&Be&&!I.agents.some(e=>e.id===Be));(0,$.useEffect)(()=>{Te(He?``:Be)},[Be,He]);let Ue=(0,$.useRef)(null),Ke=X?X.id:null;X&&Ue.current!==Ke?(Ue.current=Ke,De(X.workspace),Ae(X.model?.primary??``),Me(Re(X,a(e).agentsSettings)),Pe(X.description??``)):!X&&Ue.current!==null&&(Ue.current=null,De(``),Ae(``),Me(``),Pe(``));let qe=Xn({agentId:X?.id??null,enabled:H===`behavior`&&!!X,saveRef:Fe}),Je=$n({panel:H,selectedId:re,hasToken:y,dataAgentsLength:I?.agents.length,saveErrorMessage:n.saveError,setError:B}),Ye=cr({panel:H,selected:X}),Xe=er({panel:H,hasToken:y,bindingsFromConfig:F,gatewayCfgLoading:P===void 0,selected:X,saveErrorMessage:n.saveError,setBusy:Y,setError:B}),Ze=ar({panel:H,hasToken:y}),Qe=(0,$.useCallback)(()=>{let e=qn(W.trim()||U);q(t=>t===``||t===ge.current?(ge.current=e,e):t)},[W,U]),$e=(0,$.useCallback)(()=>{ge.current=``,ae(``),G(``),oe(``),q(``),le(``),fe(null),ye(null),he(!0)},[]),et=(0,$.useCallback)(e=>{let t=new Set(I?.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,I]),nt=(0,$.useCallback)(e=>{if(ye(e),!e)return;let t=I?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=et(t.id),o=t.description??``;ge.current=``,ae(i),G(a),oe(o),q(t.workspace),le(t.model?.primary??``),fe(null)},[n.duplicateName,I,et]),rt=(0,$.useCallback)(e=>{nt(e),he(!0)},[nt]),it=(0,$.useMemo)(()=>(0,Q.jsx)(Jn,{a:n,busy:be,listSearchQuery:xe,onListSearchQueryChange:Ce,onAddAgent:()=>$e()}),[n,be,xe,$e]);(0,$.useLayoutEffect)(()=>y?(w({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:it}),()=>T()):(T(),()=>T()),[n.title,it,T,y,w]);async function at(t){t.preventDefault();let r=U.trim();if(!r)return;let i=Se(W,r);if(i.ok===!1){fe(i.error);return}let a=se.trim()||qn(W.trim()||r);if(a){Y(!0),fe(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${K.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
|
|
2
|
-
`),{createdAgentId:n,...i}=await h({workspace:a,...W.trim()?{id:W.trim()}:{},...J.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:J.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},..._e?{cloneFrom:_e}:{}});k(i,{revalidate:!1}),ae(``),G(``),oe(``),q(``),le(``),fe(null),he(!1),V(n),S(Ge(n))}catch(e){fe(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function ot(){if(X){Y(!0),B(null);try{k(await ue(X.id,{workspace:Ee.trim()||void 0,...Oe.trim()?{models:lr(X,Oe.trim())}:{}}),{revalidate:!1})}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function ct(e){Y(!0),B(null);try{k(await ue(e.id,{setDefault:!0}),{revalidate:!1}),V(e.id)}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function lt(){let e=we.trim().toLowerCase();if(e&&!I?.agents.some(t=>t.id===e)){B(n.tuiDefaultAgentInvalid);return}Y(!0),B(null);try{await ce(e||null),await N.mutate()}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function ut(e){Y(!0),B(null);try{await ce(e.id),Te(e.id),await N.mutate()}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function pt(){Y(!0),B(null);try{await ce(null),Te(``),await N.mutate()}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function mt(e,t){Y(!0),B(null);try{let n=await ee(e.id,t);k(n,{revalidate:!1}),V(n.defaultId),ie(`overview`),C===e.id&&S(tt,{replace:!0}),i(!1),l(null),g(``)}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}function ht(e,t){e.id!==`main`&&(l(e),p(t),g(``),i(!0))}async function gt(){if(X){Y(!0),B(null);try{k(await ue(X.id,{tools:{builtin:dr(Ye.toolEntryDisable)}}),{revalidate:!1})}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function _t(){if(X){Y(!0),B(null);try{k(await ue(X.id,{tools:null}),{revalidate:!1}),Ye.setToolEntryDisable(new Set)}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function vt(){if(!X)return;let e=Et(Ye.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){B(e);return}Y(!0),B(null);try{k(await ue(X.id,{models:{roles:At(Ye.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function yt(){if(!X)return;let e=ur(X),t=At(e);if(!t?.roles?.[X.typedModels.defaultRole]){B(n.typedModelsInvalidModel);return}Y(!0),B(null);try{k(await ue(X.id,{models:{defaultRole:X.typedModels.defaultRole,roles:t.roles}}),{revalidate:!1}),Ye.setModelRows(e)}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function bt(){if(X){Y(!0),B(null);try{k(await ue(X.id,{skills:Ye.skillsInherit?null:[...Ye.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function xt(e){if(X){Y(!0),B(null);try{k(await ue(X.id,{extends:e}),{revalidate:!1}),M()}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}let St=H!==`behavior`,Ct=(()=>{if(!X||H!==`behavior`)return!1;let e=X.workspace,t=X.model?.primary??``;return Ee.trim()!==e||Oe.trim()!==t})(),wt=(()=>{if(St||!X)return!1;switch(H){case`behavior`:return Ct||qe.dirty;default:return!0}})(),Tt=St||!wt;function Dt(){Le(!0),setTimeout(()=>Le(!1),2e3)}async function Ot(){switch(H){case`behavior`:await Promise.all([ot(),Fe.current?.()??Promise.resolve()]),Dt();break;default:break}}function kt(e){e||S(tt)}let jt=X?je.trim()||Re(X,n):C??``,Mt=X?.id??C??``,Pt=(0,$.useCallback)(async()=>{if(X){await Ot(),Je.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(f,X.id)}catch{}S(`/chat/new`,{state:{agentId:X.id,fromAgentEditor:!0}})}},[X,Ot,Je.saveProfileMarkdownDebounced,S]),Z={a:n,chat:v,cCron:_,selected:X,panel:H,data:I,busy:be,editName:je,setEditName:Me,editDescription:Ne,setEditDescription:Pe,editWorkspace:Ee,setEditWorkspace:De,editModel:Oe,setEditModel:Ae,defaultModel:L?.model?.primary??``,defaultWorkspace:L?.workspace??``,onSetDefault:()=>{X&&ct(X)},onSetTuiDefault:()=>{X&&ut(X)},isTuiDefault:!!(X&&X.id===Ve),isTuiDefaultInherited:!!(X&&X.id===Ve&&(!Be||He)),onSaveAgentEdits:()=>void ot(),onDelete:e=>{X&&ht(X,e)},onTryInChat:()=>void Pt(),capabilityPresets:A?.presets??[],defaultPresetId:A?.defaultPresetId,onUpdateAgentExtends:e=>void xt(e),onOpenCapabilityPreset:e=>{S(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewSaveProfileMarkdownRef:Fe,overviewProfile:qe,filesLoading:Je.filesLoading,files:Je.files,activeFile:Je.activeFile,setActiveFile:Je.setActiveFile,filesViewMode:Je.filesViewMode,setFilesViewMode:Je.setFilesViewMode,fileDraft:Je.fileDraft,setFileDraft:Je.setFileDraft,fileSaving:Je.fileSaving,profileFileLoading:Je.profileFileLoading,profileEditorNonce:Je.profileEditorNonce,toolEntryDisable:Ye.toolEntryDisable,setToolEntryDisable:Ye.setToolEntryDisable,onSaveTools:()=>void gt(),onClearToolsEntry:()=>void _t(),modelRows:Ye.modelRows,setModelRows:Ye.setModelRows,onSaveModels:()=>void vt(),onClearModelsEntry:()=>void yt(),skillsCatalogLoading:Ze.skillsCatalogLoading,catalogForPick:Ze.catalogForPick,skillsInherit:Ye.skillsInherit,setSkillsInherit:Ye.setSkillsInherit,skillsPick:Ye.skillsPick,setSkillsPick:Ye.setSkillsPick,onSaveSkills:()=>void bt(),bindingsLoading:Xe.bindingsLoading,agentBindings:Xe.agentBindings,bindChannelStatuses:Xe.bindChannelStatuses,bindChannelsLoading:Xe.bindChannelsLoading,useManualChannel:Xe.useManualChannel,newBindChannel:Xe.newBindChannel,setNewBindChannel:Xe.setNewBindChannel,bindSessionChats:Xe.bindSessionChats,bindSessionsLoading:Xe.bindSessionsLoading,newBindSessionIdx:Xe.newBindSessionIdx,setNewBindSessionIdx:Xe.setNewBindSessionIdx,newBindCustomPeer:Xe.newBindCustomPeer,setNewBindCustomPeer:Xe.setNewBindCustomPeer,refreshBindSessions:Xe.refreshBindSessions,onRemoveBinding:e=>void Xe.onRemoveBinding(e),onAddBinding:Xe.onAddBinding};return{hasToken:y,a:n,chat:v,language:e,data:I,savedTuiDefaultAgentId:Be,effectiveTuiDefaultAgentId:Ve,tuiDefaultAgentDraft:we,setTuiDefaultAgentDraft:Te,tuiDefaultAgentUnavailable:He,onSaveTuiDefaultAgent:lt,onSetTuiDefaultAgent:ut,onClearTuiDefaultAgent:pt,onSetDefaultAgent:ct,loading:R,displayError:ne,navigate:S,routeAgentId:C,busy:be,listSearchQuery:xe,openAddAgentModal:$e,openDuplicateAgentModal:rt,duplicateSourceId:_e,onSelectDuplicateSource:nt,panel:H,setPanel:ie,modalTitle:jt,modalSubtitle:Mt,footerSaveDisabled:Tt,savedFlash:Ie,handleModalFooterSave:Ot,onAgentModalOpenChange:kt,addAgentModalOpen:pe,setAddAgentModalOpen:he,createWorkspaceSuggestedRef:ge,createModalError:de,setCreateModalError:fe,createDisplayName:U,setCreateDisplayName:ae,createAgentId:W,setCreateAgentId:G,createDescription:K,setCreateDescription:oe,createWorkspace:se,setCreateWorkspace:q,createModel:J,setCreateModel:le,onCreate:at,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:Qe,deleteDialogOpen:r,setDeleteDialogOpen:i,deletePurge:u,deleteTarget:s,setDeleteTarget:l,deleteConfirmText:m,setDeleteConfirmText:g,performDelete:mt,editorPanelProps:Z}}function pr(){let e=fr();return e.hasToken?(0,Q.jsxs)(vt,{gap:`gap-6`,padding:`px-4 py-8`,children:[e.displayError?(0,Q.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:e.displayError}):null,e.loading?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.loading}):e.data?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Q.jsx)(Hn,{a:e.a,agents:e.data.agents,defaultAgentId:e.data.defaultId,tuiDefaultAgentId:e.effectiveTuiDefaultAgentId,tuiDefaultInherited:!e.savedTuiDefaultAgentId||e.tuiDefaultAgentUnavailable,searchQuery:e.listSearchQuery,onOpenAgent:t=>e.navigate(Ge(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(f,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(zt,{open:!!e.routeAgentId,onOpenChange:e.onAgentModalOpenChange,a:e.a,title:e.modalTitle,subtitle:e.modalSubtitle,panel:e.panel,onPanelChange:e.setPanel,onFooterSave:()=>void e.handleModalFooterSave(),footerSaveDisabled:e.footerSaveDisabled,footerSavedFlash:e.savedFlash,showFooter:e.panel===`behavior`,busy:e.busy,children:e.loading||!e.data?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.loading}):(0,Q.jsx)(In,{...e.editorPanelProps})}):null,(0,Q.jsx)(Wn,{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)(Ft,{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)(vt,{gap:`gap-3`,padding:`px-4 py-8`,children:[(0,Q.jsx)(_t,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{pr 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-C6Kc4Jhf.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{c as s,i as c,n as l,t as u}from"./fetch-Cs4ck8zA.js";import{a as d,i as f}from"./vendor-swr-BIWyz7Rc.js";import{Aa as p,Ci as m,Dn as h,Ei as g,Gi as _,Ji as v,Ki as y,Ks as b,Oa as x,Pr as S,Si as C,So as w,Ss as T,Ti as E,Ui as D,Uo as O,Va as k,Wi as A,Yi as j,Zs as M,cc as N,ct as P,jo as F,mc as I,oo as L,qi as R,uo as z,wi as B,yc as V}from"./index-BU1pvxmS.js";var H=e(t(),1),U=n();function W(e){return e===`builtin`||e===`user`?e:`marketplace`}async function G(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ee(e){let t=await u(c(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function K(e){let t=await u(c(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await u(c(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function J(e){let t=await u(c(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Y=r();function X(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function te({className:e}){let t=a(o(e=>e.language)).appsPage,n=s(e=>!!e.token),r=m(),{mutate:u}=d(),[p,g]=(0,H.useReducer)(P,Z),{q:_,debounced:v,detailPkg:y,rowBusy:x,actionError:S,restartHint:C}=p,w=n?`marketplace-${v}`:null;(0,H.useEffect)(()=>{let e=window.setTimeout(()=>g({type:`patch`,patch:{debounced:_.trim()}}),300);return()=>window.clearTimeout(e)},[_]);let{data:T,isLoading:E,error:D}=f(w,async()=>l(v.length>0?c(`/api/marketplace?q=${encodeURIComponent(v)}`):c(`/api/marketplace`)),{revalidateOnFocus:!1}),A=(0,H.useCallback)(()=>{u(`gateway-extensions-list`),h()},[u]),j=(0,H.useCallback)(async(e,n)=>{g({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await K({name:e,overwrite:n});A(),r.requiresGatewayRestart&&g({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw g({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{g({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,A]),M=(0,H.useCallback)(async e=>{g({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await J(e);A(),n.requiresGatewayRestart&&g({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw g({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{g({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,A]),N=T?.extensions??[];return(0,Y.jsxs)(`div`,{className:i(`flex flex-col gap-4`,e),children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(z,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:_,onChange:e=>g({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),D?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:D instanceof Error?D.message:t.marketplaceLoadFailed}):null,S?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:S}):null,C?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C}):null,E&&!T?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):(0,Y.jsx)(`ul`,{className:`flex flex-col gap-3`,children:N.length===0?(0,Y.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):N.map(e=>{let n=X(r,e.id),a=x===e.id;return(0,Y.jsx)(`li`,{className:`list-none`,children:(0,Y.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>g({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),g({type:`patch`,patch:{detailPkg:e.id}}))},className:i(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl border border-edge bg-surface-base p-4 text-left shadow-surface`,`transition-[transform,background-color,border-color,box-shadow] duration-150 ease-out`,`hover:border-edge-subtle hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Y.jsx)(b,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Y.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,Y.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Y.jsx)(F,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Y.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Y.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&M(e.id).catch(()=>{})},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,Y.jsx)(O,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(k,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Y.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{j(e.id,!1).catch(()=>{})},className:i(`inline-flex w-full items-center justify-center rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white`,`shadow-surface transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,Y.jsx)(O,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t.marketplaceInstall]})})]})},e.id)})}),y?(0,Y.jsx)(ne,{packageName:y,copy:t,extensions:r,onClose:()=>g({type:`patch`,patch:{detailPkg:null}}),onInstall:j,onUninstall:M}):null]})}function ne(e){let t=(0,U.c)(61),{packageName:n,copy:r,extensions:a,onClose:o,onInstall:c,onUninstall:l}=e,[u,d]=(0,H.useState)(!1),m=s(oe)?`ext-mp-detail-${n}`:null,h;t[0]===n?h=t[1]:(h=async()=>ee(n),t[0]=n,t[1]=h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[2]=g):g=t[2];let{data:b,error:x,isLoading:C}=f(m,h,g),w;t[3]!==a||t[4]!==n?(w=X(a,n),t[3]=a,t[4]=n,t[5]=w):w=t[5];let T=w,E=T===`user`,A;t[6]!==r.marketplaceNoReadme||t[7]!==b?(A=b?.readme?.trim()||(b?.description?.trim()?`### ${b.name}\n\n${b.description}`:`*${r.marketplaceNoReadme}*`),t[6]=r.marketplaceNoReadme,t[7]=b,t[8]=A):A=t[8];let j=A,M;t[9]===o?M=t[10]:(M=e=>!e&&o(),t[9]=o,t[10]=M);let P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Y.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[11]=P):P=t[11];let F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Y.jsx)(N,{className:`size-5`}),t[12]=F):F=t[12];let L;t[13]!==r.detailBack||t[14]!==o?(L=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:F}),t[13]=r.detailBack,t[14]=o,t[15]=L):L=t[15];let z;t[16]===r.marketplaceDetailTitle?z=t[17]:(z=(0,Y.jsx)(v,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[16]=r.marketplaceDetailTitle,t[17]=z);let B;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Y.jsx)(p,{className:`size-5`}),t[18]=B):B=t[18];let V;t[19]!==r.detailClose||t[20]!==o?(V=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:B}),t[19]=r.detailClose,t[20]=o,t[21]=V):V=t[21];let W;t[22]!==V||t[23]!==L||t[24]!==z?(W=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[L,z,V]}),t[22]=V,t[23]=L,t[24]=z,t[25]=W):W=t[25];let G;t[26]!==r.marketplaceAuthor||t[27]!==r.marketplaceDetailLoadFailed||t[28]!==r.marketplaceDetailReadmeHeading||t[29]!==r.marketplaceDownloads||t[30]!==r.marketplaceVersion||t[31]!==b||t[32]!==x||t[33]!==C||t[34]!==j?(G=C&&!b?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):x?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.marketplaceDetailLoadFailed}):b?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:b.name}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:b.id})}),(0,Y.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Y.jsx)(`dd`,{children:b.author.username})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Y.jsx)(`dd`,{children:b.latestVersion.version})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Y.jsx)(`dd`,{children:b.downloads})]})]}),b.readme?.trim()?(0,Y.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Y.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Y.jsx)(S,{content:j})})]}):null,t[26]=r.marketplaceAuthor,t[27]=r.marketplaceDetailLoadFailed,t[28]=r.marketplaceDetailReadmeHeading,t[29]=r.marketplaceDownloads,t[30]=r.marketplaceVersion,t[31]=b,t[32]=x,t[33]=C,t[34]=j,t[35]=G):G=t[35];let K;t[36]===G?K=t[37]:(K=(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:G}),t[36]=G,t[37]=K);let q;t[38]!==u||t[39]!==r.marketplaceBuiltinGoBuiltin||t[40]!==r.marketplaceBuiltinManageHint||t[41]!==r.marketplaceInstall||t[42]!==r.marketplaceReinstall||t[43]!==r.marketplaceReinstallConfirm||t[44]!==r.marketplaceUninstall||t[45]!==r.marketplaceUninstallConfirm||t[46]!==b||t[47]!==T||t[48]!==o||t[49]!==c||t[50]!==l||t[51]!==n||t[52]!==E?(q=b?(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:T===`bundled`?(0,Y.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Y.jsx)(I,{to:`/apps?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{E&&!window.confirm(r.marketplaceReinstallConfirm)||(d(!0),c(n,E).catch(ie).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[u?(0,Y.jsx)(O,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,E?r.marketplaceReinstall:r.marketplaceInstall]}),E?(0,Y.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(d(!0),l(n).then(()=>o()).catch(re).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,Y.jsx)(k,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[38]=u,t[39]=r.marketplaceBuiltinGoBuiltin,t[40]=r.marketplaceBuiltinManageHint,t[41]=r.marketplaceInstall,t[42]=r.marketplaceReinstall,t[43]=r.marketplaceReinstallConfirm,t[44]=r.marketplaceUninstall,t[45]=r.marketplaceUninstallConfirm,t[46]=b,t[47]=T,t[48]=o,t[49]=c,t[50]=l,t[51]=n,t[52]=E,t[53]=q):q=t[53];let J;t[54]!==W||t[55]!==K||t[56]!==q?(J=(0,Y.jsxs)(y,{children:[P,(0,Y.jsxs)(D,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:ae,children:[W,K,q]})]}),t[54]=W,t[55]=K,t[56]=q,t[57]=J):J=t[57];let Z;return t[58]!==J||t[59]!==M?(Z=(0,Y.jsx)(R,{defaultOpen:!0,onOpenChange:M,children:J}),t[58]=J,t[59]=M,t[60]=Z):Z=t[60],Z}function re(){}function ie(){}function ae(e){return e.preventDefault()}function oe(e){return!!e.token}function se(){let e=o(e=>e.language),t=a(e),n=j(e=>e.setPageHeader),r=j(e=>e.clearPageHeader),s=m(),c=B(),[l,u]=V(),d=W(l.get(`tab`)),f=l.get(`q`)??``,[p,h]=(0,H.useState)(d),[g,_]=(0,H.useState)(f),[v,y]=(0,H.useState)(null),b=l.toString(),x=(0,H.useRef)(b);if(x.current!==b){x.current=b;let e=W(l.get(`tab`)),t=l.get(`q`)??``;h(t=>t===e?t:e),_(e=>e===t?e:t)}(0,H.useEffect)(()=>{u(e=>{let t=new URLSearchParams(e),n=g.trim();return n?t.set(`q`,n):t.delete(`q`),p===`marketplace`?t.delete(`tab`):t.set(`tab`,p),t.toString()===e.toString()?e:t},{replace:!0})},[p,g,u]);let S=(0,H.useMemo)(()=>s.filter(e=>e.source===`bundled`),[s]),C=(0,H.useMemo)(()=>s.filter(e=>e.source!==`bundled`),[s]),w=p===`builtin`?S:C,T=(0,H.useMemo)(()=>{let t=g.trim().toLowerCase(),n=w;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[w,g,e]);if((0,H.useEffect)(()=>{y(e=>{if(!e)return e;let t=s.find(t=>t.id===e.id);return t?Q(e)===Q(t)&&e.active===t.active?e:t:null})},[s]),(0,H.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.appsPage.title})}),end:null}),()=>r()),[r,t.appsPage.title,n]),c&&p!==`marketplace`)return(0,Y.jsx)(pe,{});let E=p!==`marketplace`&&w.length>0;return(0,Y.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[(0,Y.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-x-1 gap-y-1`,role:`tablist`,"aria-label":t.appsPage.appsNavAria,children:[(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`marketplace`,className:i(`relative max-w-full rounded-md px-3 py-2 text-left text-sm font-medium transition-colors sm:text-center`,p===`marketplace`?`text-fg`:`text-fg-muted hover:text-fg`,p===`marketplace`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>h(`marketplace`),children:t.appsPage.tabMarketplace}),(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`builtin`,className:i(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,p===`builtin`?`text-fg`:`text-fg-muted hover:text-fg`,p===`builtin`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>h(`builtin`),children:[t.appsPage.tabBuiltin,(0,Y.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,S.length,`)`]})]}),(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":p===`user`,className:i(`relative rounded-md px-3 py-2 text-sm font-medium transition-colors`,p===`user`?`text-fg`:`text-fg-muted hover:text-fg`,p===`user`&&`after:absolute after:bottom-0 after:left-1/2 after:h-0.5 after:w-9 after:-translate-x-1/2 after:rounded-full after:bg-accent`),onClick:()=>h(`user`),children:[t.appsPage.tabUser,(0,Y.jsxs)(`span`,{className:`ml-1 tabular-nums text-fg-muted`,children:[`(`,C.length,`)`]})]})]}),E?(0,Y.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Y.jsx)(z,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:g,onChange:e=>_(e.target.value),placeholder:t.appsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),p===`marketplace`?(0,Y.jsx)(te,{}):p===`builtin`&&S.length===0?(0,Y.jsx)(he,{message:t.appsPage.emptyBuiltin}):p===`user`&&C.length===0?(0,Y.jsx)(he,{message:t.appsPage.emptyUser}):T.length===0?(0,Y.jsx)(`p`,{className:`rounded-xl border border-dashed border-edge-subtle bg-surface-hover/30 px-4 py-8 text-center text-sm text-fg-muted dark:bg-surface-hover/15`,children:t.appsPage.noSearchResults}):(0,Y.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:T.map(e=>(0,Y.jsx)(de,{extension:e,copy:t.appsPage,showSourceBadge:p===`user`,onOpen:()=>y(e)},e.id))})]}),v?(0,Y.jsx)(fe,{extension:v,copy:t.appsPage,onClose:()=>y(null)},v.id):null]})}function Q(e){return e.activationEligible??e.active}function ce(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function le(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function ue(e,t){let n=Q(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function de(e){let t=(0,U.c)(45),{extension:n,copy:r,showSourceBadge:a,onOpen:o}=e,s;t[0]===n?s=t[1]:(s=Q(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(`group flex w-full flex-col rounded-xl border border-edge bg-surface-base p-4 text-left shadow-sm transition-colors`,`hover:border-edge-subtle hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=u):u=t[2];let d=n.name||n.id,f;t[3]===d?f=t[4]:(f=d.charAt(0).toUpperCase(),t[3]=d,t[4]=f);let p;t[5]===f?p=t[6]:(p=(0,Y.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:f}),t[5]=f,t[6]=p);let m;t[7]===n.name?m=t[8]:(m=(0,Y.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=m);let h;t[9]===n.version?h=t[10]:(h=n.version?(0,Y.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=h);let g;t[11]!==m||t[12]!==h?(g=(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==r.statusEnabled||t[15]!==c?(_=c?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,Y.jsx)(M,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Y.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,Y.jsx)(w,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=_):_=t[16];let v;t[17]!==g||t[18]!==_?(v=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[g,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==r.cardNoDescription||t[21]!==n.description?(y=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=y):y=t[22];let b;t[23]===y?b=t[24]:(b=(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:y}),t[23]=y,t[24]=b);let x=n.hasUi?r.badgeKindUi:r.badgeKindBackend,S;t[25]!==x||t[26]!==l?(S=(0,Y.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:x}),t[25]=x,t[26]=l,t[27]=S):S=t[27];let C;t[28]!==r||t[29]!==n||t[30]!==a?(C=n.source===`bundled`?(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):a?(0,Y.jsx)(`span`,{title:ce(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:le(n,r)}):null,t[28]=r,t[29]=n,t[30]=a,t[31]=C):C=t[31];let T;t[32]!==S||t[33]!==C?(T=(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[S,C]}),t[32]=S,t[33]=C,t[34]=T):T=t[34];let E;t[35]!==v||t[36]!==b||t[37]!==T?(E=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,b,T]}),t[35]=v,t[36]=b,t[37]=T,t[38]=E):E=t[38];let D;t[39]!==E||t[40]!==p?(D=(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[p,E]}),t[39]=E,t[40]=p,t[41]=D):D=t[41];let O;return t[42]!==o||t[43]!==D?(O=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:u,children:D}),t[42]=o,t[43]=D,t[44]=O):O=t[44],O}function fe({extension:e,copy:t,onClose:n}){let{mutate:r}=d(),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(!1),f=e.activationEligible===!0,m=(0,H.useCallback)(async()=>{if(e.source===`bundled`){c(null),u(!1),o(!0);try{let{requiresGatewayRestart:t}=await q({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),h(),u(t)}catch(e){c(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),b=e.ui?.contributions?.pages??[],S=e.ui?.contributions?.settingsPanels??[],w=e.ui?.contributions?.chatWidgets??[],k=e.ui?.contributions?.sidebarPanels??[],j=b.find(e=>e.showInNav)??b[0],M=S[0],P=j?C(e.id,j):null,F=M?`/settings/ext/${e.id}/${M.id}`:e.hasConfigSchema||E(e)?`/settings/ext/${e.id}`:null;return(0,Y.jsx)(R,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Y.jsxs)(y,{children:[(0,Y.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Y.jsxs)(D,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,Y.jsx)(N,{className:`size-5`})}),(0,Y.jsx)(v,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Y.jsxs)(A,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,Y.jsx)(p,{className:`size-5`})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Y.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,ce(e,t)]}),e.version?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Y.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:ue(e,t)}),e.source===`bundled`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,Y.jsxs)(`div`,{className:`mt-3 rounded-lg border border-edge-subtle bg-surface-hover/40 p-3 dark:bg-surface-hover/20`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Y.jsx)(x,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void m(),className:`shrink-0 py-1.5 text-xs`,children:a?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,l?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg border border-edge-subtle bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(b.length>0||S.length>0||w.length>0)?(0,Y.jsxs)(`section`,{className:`mt-8`,children:[(0,Y.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Y.jsx)($,{template:t.badgePages,count:b.length,hidden:b.length===0}),(0,Y.jsx)($,{template:t.badgeSettings,count:S.length,hidden:S.length===0}),(0,Y.jsx)($,{template:t.badgeWidgets,count:w.length,hidden:w.length===0}),(0,Y.jsx)($,{template:t.badgeSidebar,count:k.length,hidden:k.length===0})]})]}):null,g(e)&&(P||F)?(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[P?(0,Y.jsxs)(I,{to:P,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Y.jsx)(T,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,F?(0,Y.jsxs)(I,{to:F,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Y.jsx)(L,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Y.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function $(e){let t=(0,U.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,Y.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function pe(){let e=(0,U.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Y.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Y.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[t,n,r,(0,Y.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(me)})]})}),e[4]=a):a=e[4],a}function me(e){return(0,Y.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge bg-surface-base`},e)}function he(e){let t=(0,U.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Y.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-dashed border-edge-subtle bg-surface-hover/40 px-4 py-12 text-center dark:bg-surface-hover/20`,children:(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{se as AppsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{t as r}from"./messages-C6Kc4Jhf.js";import{n as i}from"./locale-store-Ba72bFmP.js";import{i as a}from"./vendor-swr-BIWyz7Rc.js";import{Gs as o,Oa as s,Zo as c,_c as l,a as u,c as d,eo as f,o as p,s as m}from"./index-BU1pvxmS.js";var h=e(),g=t();function _(e){let t=(0,h.c)(30),{title:d,description:_,prompt:x,coverage:S,className:C}=e,w=i(b),T=r(w).automations.suggestions,E=r(w).automations,D=l(),O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(O={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=O):O=t[0];let{data:k}=a(S?`automation-suggestion-coverage`:null,y,O),A=S?k?.automations.find(e=>m(e,S)):void 0,j=A?u(A,E):[];if(A){let e;t[1]===C?e=t[2]:(e=n(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,C),t[1]=C,t[2]=e);let r;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,g.jsx)(o,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=r):r=t[3];let i;t[4]===D?i=t[5]:(i=()=>D(`/automations`),t[4]=D,t[5]=i);let a;return t[6]!==T||t[7]!==i?(a=(0,g.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,g.jsx)(s,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:i,children:T.manage})}),t[6]=T,t[7]=i,t[8]=a):a=t[8],(0,g.jsxs)(`section`,{className:e,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[r,(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,g.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:T.coveredTitle}),(0,g.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:p(T.coveredDescription,{name:A.name})})]})]}),(0,g.jsxs)(`div`,{className:`mt-2 rounded-md border border-emerald-500/20 bg-surface-base/45 px-2.5 py-2`,children:[(0,g.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:E.explain.whyCovered}),(0,g.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:j.map(v)})]}),a]})}let M;t[9]===C?M=t[10]:(M=n(`rounded-lg border border-edge bg-surface-panel p-3`,C),t[9]=C,t[10]=M);let N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,g.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=N):N=t[11];let P;t[12]===d?P=t[13]:(P=(0,g.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:d}),t[12]=d,t[13]=P);let F;t[14]===_?F=t[15]:(F=(0,g.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:_}),t[14]=_,t[15]=F);let I;t[16]!==P||t[17]!==F?(I=(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[N,(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[P,F]})]}),t[16]=P,t[17]=F,t[18]=I):I=t[18];let L;t[19]!==D||t[20]!==x?(L=()=>{D(`/automations?${new URLSearchParams({draft:x,autogenerate:`1`}).toString()}`)},t[19]=D,t[20]=x,t[21]=L):L=t[21];let R;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,g.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[22]=R):R=t[22];let z;t[23]!==T.create||t[24]!==L?(z=(0,g.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,g.jsxs)(s,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:L,children:[R,T.create]})}),t[23]=T.create,t[24]=L,t[25]=z):z=t[25];let B;return t[26]!==M||t[27]!==I||t[28]!==z?(B=(0,g.jsxs)(`section`,{className:M,children:[I,z]}),t[26]=M,t[27]=I,t[28]=z,t[29]=B):B=t[29],B}function v(e){return(0,g.jsx)(`span`,{className:`rounded-full border border-edge/70 bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function y(){return d.list()}function b(e){return e.language}export{_ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-C6Kc4Jhf.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{r as s}from"./toast-z0toXu32.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{Aa as l,Gi as u,Gs as d,Hi as f,Ji as p,Ki as m,Oa as h,So as g,Ss as _,Ui as v,Va as y,Vr as b,Yi as x,Z as S,c as C,eo as w,go as T,ia as E,ka as D,ko as O,mc as k,oa as A,pc as ee,pi as j,ps as te,qi as M,wo as ne,yc as N}from"./index-BU1pvxmS.js";import{t as P}from"./format-cron-label-arqgGlVV.js";import{i as re,n as F,o as I,r as ie,t as ae}from"./dist-wO9a2_ID.js";import{i as oe,n as L,r as se,t as R}from"./workflow-run-setup-panel-CcQeX6l5.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 ce(e){return e===`zh`?`zh-CN`:`en-US`}function le(e,t,n){return e?new Intl.DateTimeFormat(ce(n),{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e)):t.never}function U(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}`,le(Date.parse(i.at),t,r)):i.kind===`interval`?t.trigger.everyMinutes.replace(`{minutes}`,String(Math.round(i.everyMs/6e4))):P(i.expr,ce(r),n.scheduleBadge,{timezone:i.tz})}function W(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 G(e){return e.safety?.mode??`auto_apply`}function ue(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 de(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 fe(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}function q(e){return K(e)?0:fe(e)?1:e.status===`succeeded`?2:3}function pe(e){return[...e].sort((e,t)=>{let n=q(e)-q(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function me(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 he(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=L(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=x(e=>e.setPageHeader),_=x(e=>e.clearPageHeader),[y,w]=N(),T=y.get(`run`)?.trim()??``,E=y.get(`draft`)?.trim()??``,D=y.get(`action`)?.trim()??``,O=y.get(`autogenerate`)===`1`,k=(0,B.useRef)(``),A=me(`(min-width: 1280px)`),[ee,te]=(0,B.useState)(`activity`),[ne,P]=(0,B.useState)(!1),[oe,L]=(0,B.useState)(`blank`),[R,z]=(0,B.useState)(H),[ce,U]=(0,B.useState)(null),[W,G]=(0,B.useState)(null),[ue,de]=(0,B.useState)(!1),[K,q]=(0,B.useState)(null),[J,_e]=(0,B.useState)(``),[X,Z]=(0,B.useState)(null),[Se,Ce]=(0,B.useState)(!1),[we,Ee]=(0,B.useState)(!1),[De,Q]=(0,B.useState)(null),[$,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(W?`automation-run-events:${W}`:null,()=>C.runEvents(W),{refreshInterval:5e3}),ze=c(`automation-workflow-definitions`,S),Be=c(`automation-chat-agents`,j),Ve=Fe.data?.automations??[],He=(0,B.useMemo)(()=>pe(Ie.data?.runs??[]),[Ie.data?.runs]),Ue=(0,B.useMemo)(()=>He.find(e=>e.id===W)??null,[He,W]),We=(0,B.useMemo)(()=>Ve.find(e=>e.id===K)??null,[Ve,K]),Ge=(0,B.useMemo)(()=>He.filter(e=>e.automationId===K),[He,K]),Ke=Re.data?.events??[],qe=Le.data,Je=(0,B.useMemo)(()=>He.filter(fe),[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===R.workflowId.trim())??null,[R.workflowId,Xe]),$e=R.actionMode===`workflow`&&(!R.workflowId.trim()||Xe.length>0&&!Xe.some(e=>e.id===R.workflowId)),et=R.actionMode===`workflow`&&Qe?!se(Qe,R.workflowInput,R.workflowInputValid).valid:!1,tt=!!R.name.trim()&&(R.actionMode===`workflow`?!$e&&!et:!!R.instruction.trim())&&(R.afterRunMode!==`webhook`||!!R.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=>{L(e),P(!0),e===`blank`&&z(H)},[]),at=(0,B.useCallback)(async()=>{Me(!0),U(null);try{await rt()}catch(e){let t=e instanceof Error?e.message:String(e);U(t),s({type:`error`,title:n.feedback.actionFailed,message:t})}finally{Me(!1)}},[n.feedback.actionFailed,rt]);(0,B.useEffect)(()=>{T&&(te(`activity`),G(T),A||de(!0))},[T,A]),(0,B.useEffect)(()=>{A&&de(!1)},[A]),(0,B.useEffect)(()=>{D===`create`&&(it(`blank`),w(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[D,it,w]),(0,B.useEffect)(()=>{if(!E)return;let t=`${e}:${O?`auto`:`seed`}:${E}`;k.current!==t&&(k.current=t,_e(E),Z(null),Ee(!1),L(`draft`),P(!0),w(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),O&&(U(null),Ce(!0),C.draft({prompt:E,language:e}).then(e=>{Z(e.draft),Ee(!1)}).catch(e=>{U(e instanceof Error?e.message:String(e))}).finally(()=>{Ce(!1)})))},[O,E,e,w]);let ot=(0,B.useCallback)(e=>{G(e),A||de(!0),w(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[w,A]);(0,B.useEffect)(()=>{Q(null),Ae(!1)},[W]);async function st(){if(U(null),tt)try{await C.create(he(R,Qe)),z(H),P(!1),await rt(),s({type:`success`,title:n.dashboard.created})}catch(e){let t=e instanceof Error?e.message:String(e);U(t),s({type:`error`,title:n.feedback.actionFailed,message:t})}}async function ct(e,t,r){U(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 U(t),s({type:`error`,title:n.feedback.actionFailed,message:t}),!1}finally{Pe(null)}}async function lt(){let t=J.trim();if(t){U(null),Ce(!0);try{Z((await C.draft({prompt:t,language:e})).draft),Ee(!1)}catch(e){U(e instanceof Error?e.message:String(e))}finally{Ce(!1)}}}async function ut(){X&&await ct(`draft:publish`,async()=>{await C.create(X.automation),Z(null),_e(``),Ee(!1),P(!1)},n.dashboard.created)}async function dt(t){U(null),Oe(!0),Q(null),Ae(!1);try{Q((await C.repairDraft(t.id,{language:e})).repair)}catch(e){U(e instanceof Error?e.message:String(e))}finally{Oe(!1)}}async function ft(e){De&&await ct(`run:${e.id}:repair`,async()=>{await C.update(e.automationId,De.patch),Q(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)(b,{className:`size-9 shrink-0 p-0`,loading:je,label:n.refresh,onClick:at}),(0,V.jsxs)(re,{children:[(0,V.jsx)(I,{asChild:!0,children:(0,V.jsxs)(h,{variant:`primary`,children:[(0,V.jsx)(g,{className:`size-4`}),n.new]})}),(0,V.jsx)(ie,{children:(0,V.jsxs)(ae,{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}),()=>_()),[_,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&&fe(Ye)?`danger`:`neutral`}),(0,V.jsx)(Y,{label:n.metrics.next,value:qe?.nextRun?le(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`,ee===e.id&&`bg-surface-hover text-fg`),onClick:()=>{te(e.id),e.id!==`activity`&&de(!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,ee===`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)(ye,{runs:He.slice(0,12),labels:n,cronLabels:r,language:e,selectedRunId:W,busyAction:Ne,className:`h-full overflow-y-auto`,onSelectRun:ot,onAction:ct})}),(0,V.jsx)(be,{className:`hidden h-full xl:block`,run:Ue,events:Ke,labels:n,cronLabels:r,language:e,loading:Re.isLoading,repairDraft:De,repairLoading:$,repairApproved:ke,busyAction:Ne,onRepairApprovedChange:Ae,onSuggestRepair:dt,onApplyRepair:ft})]}):(0,V.jsx)(`section`,{children:(0,V.jsx)(ve,{automations:Ve,runs:He,labels:n,cronLabels:r,language:e,busyAction:Ne,onOpenDetails:q,onAction:ct})})]}),(0,V.jsx)(M,{open:ne,onOpenChange:P,children:(0,V.jsxs)(m,{children:[(0,V.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,V.jsxs)(v,{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)(p,{className:`text-base font-semibold text-fg`,children:oe===`draft`?n.draft.title:oe===`template`?n.createMenu.templatesTitle:n.createTitle}),(0,V.jsx)(f,{asChild:!0,children:(0,V.jsx)(h,{variant:`ghost`,"aria-label":n.close,children:(0,V.jsx)(l,{className:`size-4`})})})]}),oe===`draft`?(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,V.jsx)(ge,{labels:n,prompt:J,draft:X,loading:Se,approved:we,publishBusy:Ne===`draft:publish`,onPromptChange:_e,onGenerate:lt,onPublish:ut,onApprovedChange:Ee,onDiscard:()=>{Z(null),Ee(!1)}})}):oe===`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:()=>{z(e.form),L(`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)(Te,{form:R,labels:n,setForm:z,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)(f,{asChild:!0,children:(0,V.jsx)(h,{variant:`ghost`,children:n.cancel})}),(0,V.jsx)(h,{variant:`primary`,onClick:st,disabled:!tt,children:n.create})]})]})]})]})}),(0,V.jsx)(xe,{automation:We,runs:Ge,labels:n,cronLabels:r,language:e,busyAction:Ne,onClose:()=>q(null),onSelectRun:e=>{ot(e),q(null)},onAction:ct}),(0,V.jsx)(M,{open:!A&&ue&&!!Ue,onOpenChange:de,children:(0,V.jsxs)(m,{children:[(0,V.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,V.jsxs)(v,{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)(p,{className:`truncate text-base font-semibold text-fg`,children:Ue?.automationName??n.dashboard.result}),(0,V.jsx)(f,{asChild:!0,children:(0,V.jsx)(h,{variant:`ghost`,"aria-label":n.close,children:(0,V.jsx)(l,{className:`size-4`})})})]}),(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,V.jsx)(be,{className:`h-full rounded-none border-0`,run:Ue,events:Ke,labels:n,cronLabels:r,language:e,loading:Re.isLoading,repairDraft:De,repairLoading:$,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 ge(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)(w,{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)(w,{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)(h,{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 T;t[16]!==y||t[17]!==C?(T=(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]=T):T=t[18];let E;t[19]===c?E=t[20]:(E=e=>c(e.target.value),t[19]=c,t[20]=E);let D;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==E?(D=(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:E,placeholder:n.draft.placeholder}),t[21]=n.draft.placeholder,t[22]=r,t[23]=E,t[24]=D):D=t[24];let O;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?(O=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)(Ce,{label:n.info.when,value:i.simulation.triggerSummary}),(0,V.jsx)(Ce,{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)(_e,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,V.jsx)(_e,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,V.jsx)(_e,{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)(h,{variant:`ghost`,onClick:f,children:n.draft.discard}),(0,V.jsx)(h,{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]=O):O=t[42];let k;return t[43]!==T||t[44]!==D||t[45]!==O?(k=(0,V.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-panel p-4`,children:[T,D,O]}),t[43]=T,t[44]=D,t[45]=O,t[46]=k):k=t[46],k}function _e(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 ve(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)(D,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===a.empty.automations?n=t[2]:(n=(0,V.jsx)(we,{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:U(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:W(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,`: `,le(e.state.lastRunAtMs,a,s)]}),(0,V.jsxs)(`span`,{children:[a.next,`: `,le(e.state.nextRunAtMs,a,s)]}),(0,V.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5`,ue(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)(h,{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)(ne,{className:i(`size-4`,f&&`animate-pulse`)})}),(0,V.jsx)(h,{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)(T,{className:`size-4 animate-spin`}):e.enabled?(0,V.jsx)(O,{className:`size-4`}):(0,V.jsx)(ne,{className:`size-4`})}),(0,V.jsx)(h,{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)(T,{className:`size-4 animate-spin`}):(0,V.jsx)(y,{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 ye(e){let t=(0,z.c)(25),{runs:n,labels:r,cronLabels:a,language:o,selectedRunId:s,busyAction:c,className:l,onSelectRun:u,onAction:d}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(ee,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===r.empty.runs?n=t[2]:(n=(0,V.jsx)(we,{icon:e,title:r.empty.runs}),t[1]=r.empty.runs,t[2]=n),n}let f;t[3]===l?f=t[4]:(f=i(`rounded-lg border border-edge bg-surface-panel`,l),t[3]=l,t[4]=f);let p;if(t[5]!==c||t[6]!==a||t[7]!==r||t[8]!==o||t[9]!==d||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]!==d||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`,ue(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||W(e.actionSnapshot,r)}),(0,V.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[le(e.createdAtMs,r,o),` · `,e.manual?r.trigger.manual:U(e.triggerSnapshot,r,a,o)]})]}),e.status===`running`||e.status===`queued`?(0,V.jsx)(h,{variant:`ghost`,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`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]=d,t[19]=u,t[20]=s,t[21]=e):e=t[21],p=n.map(e),t[5]=c,t[6]=a,t[7]=r,t[8]=o,t[9]=d,t[10]=u,t[11]=n,t[12]=s,t[13]=p}else p=t[13];let m;return t[22]!==f||t[23]!==p?(m=(0,V.jsx)(`div`,{className:f,children:p}),t[22]=f,t[23]=p,t[24]=m):m=t[24],m}function be(e){let t=(0,z.c)(127),{className:n,run:r,events:a,labels:o,cronLabels:s,language:c,loading:l,repairDraft:u,repairLoading:d,repairApproved:f,busyAction:p,onRepairApprovedChange:m,onSuggestRepair:g,onApplyRepair:v}=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)(ee,{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 y;t[8]===n?y=t[9]:(y=i(`min-h-0 overflow-y-auto rounded-lg border border-edge bg-surface-panel`,n),t[8]=n,t[9]=y);let b;t[10]===r.automationName?b=t[11]:(b=(0,V.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=b);let x;t[12]===r.id?x=t[13]:(x=r.id.slice(0,8),t[12]=r.id,t[13]=x);let S;t[14]===x?S=t[15]:(S=(0,V.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:x}),t[14]=x,t[15]=S);let C;t[16]!==b||t[17]!==S?(C=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[b,S]}),t[16]=b,t[17]=S,t[18]=C):C=t[18];let T;t[19]===r.status?T=t[20]:(T=i(`shrink-0 rounded-full px-2 py-0.5 text-xs`,ue(r.status)),t[19]=r.status,t[20]=T);let E=o.status[r.status],D;t[21]!==T||t[22]!==E?(D=(0,V.jsx)(`span`,{className:T,children:E}),t[21]=T,t[22]=E,t[23]=D):D=t[23];let O;t[24]!==C||t[25]!==D?(O=(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[C,D]}),t[24]=C,t[25]=D,t[26]=O):O=t[26];let A=o.details.created,j;t[27]!==o||t[28]!==c||t[29]!==r.createdAtMs?(j=le(r.createdAtMs,o,c),t[27]=o,t[28]=c,t[29]=r.createdAtMs,t[30]=j):j=t[30];let M;t[31]!==o.details.created||t[32]!==j?(M=(0,V.jsx)(Z,{label:A,value:j}),t[31]=o.details.created,t[32]=j,t[33]=M):M=t[33];let ne=o.details.started,N;t[34]!==o||t[35]!==c||t[36]!==r.startedAtMs?(N=le(r.startedAtMs,o,c),t[34]=o,t[35]=c,t[36]=r.startedAtMs,t[37]=N):N=t[37];let P;t[38]!==o.details.started||t[39]!==N?(P=(0,V.jsx)(Z,{label:ne,value:N}),t[38]=o.details.started,t[39]=N,t[40]=P):P=t[40];let re=o.details.duration,F;t[41]!==o||t[42]!==r.durationMs?(F=de(r.durationMs,o),t[41]=o,t[42]=r.durationMs,t[43]=F):F=t[43];let I;t[44]!==o.details.duration||t[45]!==F?(I=(0,V.jsx)(Z,{label:re,value:F}),t[44]=o.details.duration,t[45]=F,t[46]=I):I=t[46];let ie;t[47]!==o.details.model||t[48]!==r.model?(ie=r.model?(0,V.jsx)(Z,{label:o.details.model,value:r.model}):null,t[47]=o.details.model,t[48]=r.model,t[49]=ie):ie=t[49];let ae;t[50]!==M||t[51]!==P||t[52]!==I||t[53]!==ie?(ae=(0,V.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[M,P,I,ie]}),t[50]=M,t[51]=P,t[52]=I,t[53]=ie,t[54]=ae):ae=t[54];let oe;t[55]===o.dashboard.result?oe=t[56]:(oe=(0,V.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.dashboard.result}),t[55]=o.dashboard.result,t[56]=oe);let L;t[57]===r?L=t[58]:(L=fe(r)?`text-red-700 dark:text-red-300`:`text-fg`,t[57]=r,t[58]=L);let se;t[59]===L?se=t[60]:(se=i(`mt-1 break-words text-sm`,L),t[59]=L,t[60]=se);let R;t[61]!==o||t[62]!==r.actionSnapshot||t[63]!==r.error||t[64]!==r.summary?(R=r.error||r.summary||W(r.actionSnapshot,o),t[61]=o,t[62]=r.actionSnapshot,t[63]=r.error,t[64]=r.summary,t[65]=R):R=t[65];let B;t[66]!==se||t[67]!==R?(B=(0,V.jsx)(`p`,{className:se,children:R}),t[66]=se,t[67]=R,t[68]=B):B=t[68];let H;t[69]!==s||t[70]!==o||t[71]!==c||t[72]!==r.manual||t[73]!==r.triggerSnapshot?(H=r.manual?o.trigger.manual:U(r.triggerSnapshot,o,s,c),t[69]=s,t[70]=o,t[71]=c,t[72]=r.manual,t[73]=r.triggerSnapshot,t[74]=H):H=t[74];let ce;t[75]!==o.explain.whyRan||t[76]!==H?(ce=(0,V.jsx)(Z,{label:o.explain.whyRan,value:H}),t[75]=o.explain.whyRan,t[76]=H,t[77]=ce):ce=t[77];let G;t[78]!==o.dashboard.openSession||t[79]!==r.sessionKey?(G=r.sessionKey?(0,V.jsx)(h,{asChild:!0,variant:`secondary`,className:`h-8 justify-start rounded-md px-2 text-xs`,children:(0,V.jsxs)(k,{to:`/chat/${encodeURIComponent(r.sessionKey)}`,children:[(0,V.jsx)(_,{className:`size-3.5`}),o.dashboard.openSession]})}):null,t[78]=o.dashboard.openSession,t[79]=r.sessionKey,t[80]=G):G=t[80];let K;t[81]!==o.feedback||t[82]!==r.workflowRunId?(K=r.workflowRunId?(0,V.jsx)(h,{asChild:!0,variant:`secondary`,className:`h-8 justify-start rounded-md px-2 text-xs`,children:(0,V.jsxs)(k,{to:`/workflows?run=${encodeURIComponent(r.workflowRunId)}`,children:[(0,V.jsx)(te,{className:`size-3.5`}),o.feedback.workflow]})}):null,t[81]=o.feedback,t[82]=r.workflowRunId,t[83]=K):K=t[83];let q;t[84]!==ce||t[85]!==G||t[86]!==K?(q=(0,V.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[ce,G,K]}),t[84]=ce,t[85]=G,t[86]=K,t[87]=q):q=t[87];let pe;t[88]!==oe||t[89]!==B||t[90]!==q?(pe=(0,V.jsxs)(`div`,{className:`mt-3 rounded-md border border-edge/70 bg-surface-base/50 p-3`,children:[oe,B,q]}),t[88]=oe,t[89]=B,t[90]=q,t[91]=pe):pe=t[91];let me;t[92]!==o.repair||t[93]!==g||t[94]!==d||t[95]!==r?(me=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,V.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,V.jsxs)(h,{variant:`secondary`,onClick:()=>g(r),disabled:d,children:[(0,V.jsx)(w,{className:`size-4`}),d?o.repair.generating:o.repair.suggest]})}):null,t[92]=o.repair,t[93]=g,t[94]=d,t[95]=r,t[96]=me):me=t[96];let he;t[97]!==ae||t[98]!==pe||t[99]!==me||t[100]!==O?(he=(0,V.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[O,ae,pe,me]}),t[97]=ae,t[98]=pe,t[99]=me,t[100]=O,t[101]=he):he=t[101];let J;t[102]!==p||t[103]!==o.feedback||t[104]!==o.none||t[105]!==o.repair||t[106]!==v||t[107]!==m||t[108]!==f||t[109]!==u||t[110]!==r?(J=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)(_e,{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:f,onChange:e=>m(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)(h,{variant:`primary`,onClick:()=>v(r),disabled:p===`run:${r.id}:repair`||u.requiresApproval&&!f,children:p===`run:${r.id}:repair`?o.feedback.working:o.repair.apply})})]}):null,t[102]=p,t[103]=o.feedback,t[104]=o.none,t[105]=o.repair,t[106]=v,t[107]=m,t[108]=f,t[109]=u,t[110]=r,t[111]=J):J=t[111];let Y;t[112]===o.timeline?Y=t[113]:(Y=(0,V.jsx)(`div`,{className:`mb-3 text-xs font-semibold uppercase text-fg-muted`,children:o.timeline}),t[112]=o.timeline,t[113]=Y);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`,Se(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:[le(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 X;t[119]!==Y||t[120]!==ge?(X=(0,V.jsxs)(`div`,{className:`px-4 py-3`,children:[Y,ge]}),t[119]=Y,t[120]=ge,t[121]=X):X=t[121];let ve;return t[122]!==y||t[123]!==he||t[124]!==J||t[125]!==X?(ve=(0,V.jsxs)(`aside`,{className:y,children:[he,J,X]}),t[122]=y,t[123]=he,t[124]=J,t[125]=X,t[126]=ve):ve=t[126],ve}function xe(e){let t=(0,z.c)(25),{automation:n,runs:r,labels:a,cronLabels:o,language:s,busyAction:c,onClose:g,onSelectRun:b,onAction:x}=e,S;t[0]===n?S=t[1]:(S=n?G(n):`suggest_only`,t[0]=n,t[1]=S);let w=S,E=n?c===`automation:${n.id}:run`:!1,D=n?c===`automation:${n.id}:toggle`:!1,A=n?c===`automation:${n.id}:delete`:!1,j=!!n,N;t[2]===g?N=t[3]:(N=e=>!e&&g(),t[2]=g,t[3]=N);let P;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,V.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),t[4]=P):P=t[4];let re;t[5]!==n||t[6]!==c||t[7]!==o||t[8]!==A||t[9]!==a||t[10]!==s||t[11]!==w||t[12]!==x||t[13]!==g||t[14]!==b||t[15]!==E||t[16]!==r||t[17]!==D?(re=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)(p,{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)(f,{asChild:!0,children:(0,V.jsx)(h,{variant:`ghost`,"aria-label":a.close,children:(0,V.jsx)(l,{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)(Ce,{label:a.info.when,value:U(n.trigger,a,o,s)}),(0,V.jsx)(Ce,{label:a.info.run,value:W(n.action,a)}),(0,V.jsx)(Ce,{label:a.info.safety,value:a.safety[w]}),(0,V.jsx)(Z,{label:a.last,value:le(n.state.lastRunAtMs,a,s)}),(0,V.jsx)(Z,{label:a.next,value:le(n.state.nextRunAtMs,a,s)}),n.state.consecutiveFailures?(0,V.jsx)(Z,{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)(we,{icon:(0,V.jsx)(ee,{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:()=>b(e.id),children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,V.jsx)(d,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,V.jsx)(ee,{className:`size-4 shrink-0 text-fg-muted`}),(0,V.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:le(e.createdAtMs,a,s)}),(0,V.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs`,ue(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||W(e.actionSnapshot,a)})]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-1`,children:[e.sessionKey?(0,V.jsx)(h,{asChild:!0,variant:`ghost`,className:`h-8 rounded-md px-2 text-xs`,children:(0,V.jsxs)(k,{to:`/chat/${encodeURIComponent(e.sessionKey)}`,children:[(0,V.jsx)(_,{className:`size-3.5`}),a.dashboard.openSession]})}):null,e.workflowRunId?(0,V.jsx)(h,{asChild:!0,variant:`ghost`,className:`h-8 rounded-md px-2 text-xs`,children:(0,V.jsxs)(k,{to:`/workflows?run=${encodeURIComponent(e.workflowRunId)}`,children:[(0,V.jsx)(te,{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)(h,{variant:`ghost`,disabled:c!==null,onClick:()=>void x(`automation:${n.id}:delete`,()=>C.remove(n.id),a.dashboard.deleted).then(e=>{e&&g()}),children:[A?(0,V.jsx)(T,{className:`size-4 animate-spin`}):(0,V.jsx)(y,{className:`size-4`}),a.dashboard.delete]}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsxs)(h,{variant:`secondary`,disabled:c!==null,onClick:()=>void x(`automation:${n.id}:toggle`,()=>n.enabled?C.pause(n.id):C.resume(n.id),n.enabled?a.feedback.paused:a.dashboard.resumed),children:[D?(0,V.jsx)(T,{className:`size-4 animate-spin`}):n.enabled?(0,V.jsx)(O,{className:`size-4`}):(0,V.jsx)(ne,{className:`size-4`}),n.enabled?a.dashboard.pause:a.dashboard.resume]}),(0,V.jsxs)(h,{variant:`primary`,disabled:c!==null,onClick:()=>void x(`automation:${n.id}:run`,()=>C.runNow(n.id),a.feedback.rerunQueued),children:[E?(0,V.jsx)(T,{className:`size-4 animate-spin`}):(0,V.jsx)(ne,{className:`size-4`}),a.dashboard.runNow]})]})]})]}):null,t[5]=n,t[6]=c,t[7]=o,t[8]=A,t[9]=a,t[10]=s,t[11]=w,t[12]=x,t[13]=g,t[14]=b,t[15]=E,t[16]=r,t[17]=D,t[18]=re):re=t[18];let F;t[19]===re?F=t[20]:(F=(0,V.jsxs)(m,{children:[P,(0,V.jsx)(v,{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:re})]}),t[19]=re,t[20]=F);let I;return t[21]!==j||t[22]!==N||t[23]!==F?(I=(0,V.jsx)(M,{open:j,onOpenChange:N,children:F}),t[21]=j,t[22]=N,t[23]=F,t[24]=I):I=t[24],I}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)(`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 Se(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function Ce(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 we(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 Te(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)(Oe,{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)(A,{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)(A,{value:`daily`,children:r.trigger.daily}),t[30]=r.trigger.daily,t[31]=T);let D;t[32]===r.trigger.weekly?D=t[33]:(D=(0,V.jsx)(A,{value:`weekly`,children:r.trigger.weekly}),t[32]=r.trigger.weekly,t[33]=D);let O;t[34]===r.trigger.interval?O=t[35]:(O=(0,V.jsx)(A,{value:`interval`,children:r.trigger.interval}),t[34]=r.trigger.interval,t[35]=O);let k;t[36]===r.trigger.customCron?k=t[37]:(k=(0,V.jsx)(A,{value:`cron`,children:r.trigger.customCron}),t[36]=r.trigger.customCron,t[37]=k);let ee;t[38]===r.trigger.webhook?ee=t[39]:(ee=(0,V.jsx)(A,{value:`webhook`,children:r.trigger.webhook}),t[38]=r.trigger.webhook,t[39]=ee);let j;t[40]===r.trigger.goalBlocked?j=t[41]:(j=(0,V.jsx)(A,{value:`goalBlocked`,children:r.trigger.goalBlocked}),t[40]=r.trigger.goalBlocked,t[41]=j);let te;t[42]===r.trigger.noteCreated?te=t[43]:(te=(0,V.jsx)(A,{value:`noteCreated`,children:r.trigger.noteCreated}),t[42]=r.trigger.noteCreated,t[43]=te);let M;t[44]===r.trigger.workflowFailed?M=t[45]:(M=(0,V.jsx)(A,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[44]=r.trigger.workflowFailed,t[45]=M);let ne;t[46]===r.trigger.sessionUpdated?ne=t[47]:(ne=(0,V.jsx)(A,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[46]=r.trigger.sessionUpdated,t[47]=ne);let N;t[48]!==n.triggerMode||t[49]!==C||t[50]!==w||t[51]!==T||t[52]!==D||t[53]!==O||t[54]!==k||t[55]!==ee||t[56]!==j||t[57]!==te||t[58]!==M||t[59]!==ne?(N=(0,V.jsxs)(E,{className:Q,value:n.triggerMode,onChange:C,children:[w,T,D,O,k,ee,j,te,M,ne]}),t[48]=n.triggerMode,t[49]=C,t[50]=w,t[51]=T,t[52]=D,t[53]=O,t[54]=k,t[55]=ee,t[56]=j,t[57]=te,t[58]=M,t[59]=ne,t[60]=N):N=t[60];let P;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?(P=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)(E,{className:Q,value:n.weekday,onChange:e=>p({weekday:e.target.value}),children:[(0,V.jsx)(A,{value:`1`,children:r.weekdays.monday}),(0,V.jsx)(A,{value:`2`,children:r.weekdays.tuesday}),(0,V.jsx)(A,{value:`3`,children:r.weekdays.wednesday}),(0,V.jsx)(A,{value:`4`,children:r.weekdays.thursday}),(0,V.jsx)(A,{value:`5`,children:r.weekdays.friday}),(0,V.jsx)(A,{value:`6`,children:r.weekdays.saturday}),(0,V.jsx)(A,{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]=P):P=t[68];let re;t[69]!==n.intervalMinutes||t[70]!==n.triggerMode||t[71]!==r.form.everyMinutes||t[72]!==p?(re=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]=re):re=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 I;t[79]!==n.triggerMode||t[80]!==n.webhookSecretId||t[81]!==r.form.secretId||t[82]!==p?(I=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]=I):I=t[83];let ie;t[84]===r.form.action?ie=t[85]:(ie=(0,V.jsx)(Oe,{title:r.form.action}),t[84]=r.form.action,t[85]=ie);let ae;t[86]!==n.workflowId||t[87]!==p||t[88]!==o?(ae=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]=ae):ae=t[89];let L;t[90]===r.action.runAgent?L=t[91]:(L=(0,V.jsx)(A,{value:`agent`,children:r.action.runAgent}),t[90]=r.action.runAgent,t[91]=L);let se;t[92]===r.action.runWorkflow?se=t[93]:(se=(0,V.jsx)(A,{value:`workflow`,children:r.action.runWorkflow}),t[92]=r.action.runWorkflow,t[93]=se);let H;t[94]!==n.actionMode||t[95]!==ae||t[96]!==L||t[97]!==se?(H=(0,V.jsxs)(E,{className:Q,value:n.actionMode,onChange:ae,children:[L,se]}),t[94]=n.actionMode,t[95]=ae,t[96]=L,t[97]=se,t[98]=H):H=t[98];let ce=r.form.agent,le=n.agentId,U;t[99]===p?U=t[100]:(U=e=>p({agentId:e.target.value}),t[99]=p,t[100]=U);let W=u?r.form.loadingAgents:r.form.defaultAgent,G;t[101]===W?G=t[102]:(G=(0,V.jsx)(A,{value:``,children:W}),t[101]=W,t[102]=G);let ue;t[103]===l?ue=t[104]:(ue=l.map(De),t[103]=l,t[104]=ue);let de;t[105]!==n.agentId||t[106]!==U||t[107]!==G||t[108]!==ue?(de=(0,V.jsxs)(E,{className:Q,value:le,onChange:U,children:[G,ue]}),t[105]=n.agentId,t[106]=U,t[107]=G,t[108]=ue,t[109]=de):de=t[109];let K;t[110]!==r.form.agent||t[111]!==de?(K=(0,V.jsx)($,{label:ce,children:de}),t[110]=r.form.agent,t[111]=de,t[112]=K):K=t[112];let fe;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?(fe=n.actionMode===`agent`?(0,V.jsxs)($,{label:r.form.instruction,children:[(0,V.jsx)(`div`,{className:`flex justify-end`,children:(0,V.jsx)(oe,{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)(E,{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)(A,{value:``,children:r.form.loadingWorkflows}):null,!c&&o.length===0?(0,V.jsx)(A,{value:``,children:r.form.noWorkflows}):null,o.map(Ee)]})}),s?(0,V.jsx)(R,{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]=fe):fe=t[131];let q;t[132]===r.form.safety?q=t[133]:(q=(0,V.jsx)(Oe,{title:r.form.safety}),t[132]=r.form.safety,t[133]=q);let pe;t[134]!==n.afterRunMode||t[135]!==p?(pe=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]=pe):pe=t[136];let me;t[137]===r.safety.suggest_only?me=t[138]:(me=(0,V.jsx)(A,{value:`suggest_only`,children:r.safety.suggest_only}),t[137]=r.safety.suggest_only,t[138]=me);let he;t[139]===r.safety.ask_before_apply?he=t[140]:(he=(0,V.jsx)(A,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),t[139]=r.safety.ask_before_apply,t[140]=he);let J;t[141]===r.safety.auto_apply?J=t[142]:(J=(0,V.jsx)(A,{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]!==pe||t[145]!==me||t[146]!==he||t[147]!==J?(Y=(0,V.jsxs)(E,{className:Q,value:n.safetyMode,onChange:pe,children:[me,he,J]}),t[143]=n.safetyMode,t[144]=pe,t[145]=me,t[146]=he,t[147]=J,t[148]=Y):Y=t[148];let ge=n.safetyMode===`suggest_only`?r.safety.suggestOnlyDescription:n.safetyMode===`ask_before_apply`?r.safety.askBeforeApplyDescription:r.safety.autoApplyDescription,_e;t[149]===ge?_e=t[150]:(_e=(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:ge}),t[149]=ge,t[150]=_e);let X;t[151]!==r.form.safety||t[152]!==Y||t[153]!==_e?(X=(0,V.jsxs)($,{label:r.form.safety,children:[Y,_e]}),t[151]=r.form.safety,t[152]=Y,t[153]=_e,t[154]=X):X=t[154];let ve;t[155]===r.form.afterRun?ve=t[156]:(ve=(0,V.jsx)(Oe,{title:r.form.afterRun}),t[155]=r.form.afterRun,t[156]=ve);let ye;t[157]===p?ye=t[158]:(ye=e=>p({afterRunMode:e.target.value}),t[157]=p,t[158]=ye);let be;t[159]===r.afterRun.none?be=t[160]:(be=(0,V.jsx)(A,{value:`none`,children:r.afterRun.none}),t[159]=r.afterRun.none,t[160]=be);let xe;t[161]===r.afterRun.saveToSession?xe=t[162]:(xe=(0,V.jsx)(A,{value:`saveToSession`,children:r.afterRun.saveToSession}),t[161]=r.afterRun.saveToSession,t[162]=xe);let Z=n.safetyMode!==`auto_apply`,Se;t[163]!==r.afterRun.webhook||t[164]!==Z?(Se=(0,V.jsx)(A,{value:`webhook`,disabled:Z,children:r.afterRun.webhook}),t[163]=r.afterRun.webhook,t[164]=Z,t[165]=Se):Se=t[165];let Ce;t[166]!==n.afterRunMode||t[167]!==ye||t[168]!==be||t[169]!==xe||t[170]!==Se?(Ce=(0,V.jsxs)(E,{className:Q,value:n.afterRunMode,onChange:ye,children:[be,xe,Se]}),t[166]=n.afterRunMode,t[167]=ye,t[168]=be,t[169]=xe,t[170]=Se,t[171]=Ce):Ce=t[171];let we;t[172]!==n.afterRunMode||t[173]!==n.webhookUrl||t[174]!==r.form.webhookUrl||t[175]!==p?(we=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]=we):we=t[176];let Te;t[177]===r.form.reliability?Te=t[178]:(Te=(0,V.jsx)(Oe,{title:r.form.reliability}),t[177]=r.form.reliability,t[178]=Te);let ke;t[179]===p?ke=t[180]:(ke=e=>p({timeoutSeconds:e.target.value}),t[179]=p,t[180]=ke);let Ae;t[181]!==n.timeoutSeconds||t[182]!==ke?(Ae=(0,V.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:ke}),t[181]=n.timeoutSeconds,t[182]=ke,t[183]=Ae):Ae=t[183];let je;t[184]!==r.form.timeoutSeconds||t[185]!==Ae?(je=(0,V.jsx)($,{label:r.form.timeoutSeconds,children:Ae}),t[184]=r.form.timeoutSeconds,t[185]=Ae,t[186]=je):je=t[186];let Me;t[187]===p?Me=t[188]:(Me=e=>p({disableAfterFailures:e.target.value}),t[187]=p,t[188]=Me);let Ne;t[189]!==n.disableAfterFailures||t[190]!==Me?(Ne=(0,V.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:Me}),t[189]=n.disableAfterFailures,t[190]=Me,t[191]=Ne):Ne=t[191];let Pe;t[192]!==r.form.disableAfterFailures||t[193]!==Ne?(Pe=(0,V.jsx)($,{label:r.form.disableAfterFailures,children:Ne}),t[192]=r.form.disableAfterFailures,t[193]=Ne,t[194]=Pe):Pe=t[194];let Fe;t[195]!==je||t[196]!==Pe?(Fe=(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[je,Pe]}),t[195]=je,t[196]=Pe,t[197]=Fe):Fe=t[197];let Ie;return t[198]!==S||t[199]!==N||t[200]!==P||t[201]!==re||t[202]!==F||t[203]!==I||t[204]!==ie||t[205]!==H||t[206]!==K||t[207]!==fe||t[208]!==q||t[209]!==X||t[210]!==ve||t[211]!==Ce||t[212]!==we||t[213]!==Te||t[214]!==v||t[215]!==Fe||t[216]!==x?(Ie=(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,P,re,F,I,ie,H,K,fe,q,X,ve,Ce,we,Te,Fe]})}),t[198]=S,t[199]=N,t[200]=P,t[201]=re,t[202]=F,t[203]=I,t[204]=ie,t[205]=H,t[206]=K,t[207]=fe,t[208]=q,t[209]=X,t[210]=ve,t[211]=Ce,t[212]=we,t[213]=Te,t[214]=v,t[215]=Fe,t[216]=x,t[217]=Ie):Ie=t[217],Ie}function Ee(e){return(0,V.jsx)(A,{value:e.id,children:e.title||e.name},e.id)}function De(e){return(0,V.jsx)(A,{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 Oe(e){let t=(0,z.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,V.jsx)(te,{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};
|